(function(){var Zt='',Mt='';document.addEventListener("nav",()=>{let Vt=document.getElementsByTagName("pre");for(let Gt=0;Gt{$t.blur(),$t.innerHTML=Mt,setTimeout(()=>{$t.innerHTML=Zt,$t.style.borderColor=""},2e3)},ni=>console.error(ni))};var Rt=y;let Br=(Ft.dataset.clipboard?JSON.parse(Ft.dataset.clipboard):Ft.innerText).replace(/\n\n/g,` `),$t=document.createElement("button");$t.className="clipboard-button",$t.type="button",$t.innerHTML=Zt,$t.ariaLabel="Copy source",$t.addEventListener("click",y),window.addCleanup(()=>$t.removeEventListener("click",y)),Vt[Gt].prepend($t)}}})})(),(function(){var Zt=Object.create,Mt=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,Rt=Object.getOwnPropertyNames,Gt=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty,y=(h,d)=>()=>(d||h((d={exports:{}}).exports,d),d.exports),Br=(h,d,p,v)=>{if(d&&typeof d=="object"||typeof d=="function")for(let m of Rt(d))!Ft.call(h,m)&&m!==p&&Mt(h,m,{get:()=>d[m],enumerable:!(v=Vt(d,m))||v.enumerable});return h},$t=(h,d,p)=>(p=h!=null?Zt(Gt(h)):{},Br(d||!h||!h.__esModule?Mt(p,"default",{value:h,enumerable:!0}):p,h)),ni=y(()=>{}),Sr=y((h,d)=>{"use strict";d.exports=v;function p(w){return w instanceof Buffer?Buffer.from(w):new w.constructor(w.buffer.slice(),w.byteOffset,w.length)}function v(w){if(w=w||{},w.circles)return m(w);let E=new Map;if(E.set(Date,F=>new Date(F)),E.set(Map,(F,Y)=>new Map(R(Array.from(F),Y))),E.set(Set,(F,Y)=>new Set(R(Array.from(F),Y))),w.constructorHandlers)for(let F of w.constructorHandlers)E.set(F[0],F[1]);let C=null;return w.proto?U:G;function R(F,Y){let I=Object.keys(F),z=new Array(I.length);for(let N=0;Nnew Date(I)),R.set(Map,(I,z)=>new Map(U(Array.from(I),z))),R.set(Set,(I,z)=>new Set(U(Array.from(I),z))),w.constructorHandlers)for(let I of w.constructorHandlers)R.set(I[0],I[1]);let G=null;return w.proto?Y:F;function U(I,z){let N=Object.keys(I),L=new Array(N.length);for(let ue=0;ue"u"?d:h}function Se(){return Object.create(null)}function Z(h){return typeof h=="string"}function mr(h){return typeof h=="object"}function Er(h,d){if(Z(d))h=h[d];else for(let p=0;h&&p1?this.addMatcher(h,d):(this.mapper||(this.mapper=new Map),this.mapper.set(h,d),this.cache&&fr(this),this)},k.addMatcher=function(h,d){return typeof h=="object"?this.addReplacer(h,d):h.length<2&&(this.dedupe||this.mapper)?this.addMapper(h,d):(this.matcher||(this.matcher=new Map),this.matcher.set(h,d),this.h+=(this.h?"|":"")+h,this.J=null,this.cache&&fr(this),this)},k.addReplacer=function(h,d){return typeof h=="string"?this.addMatcher(h,d):(this.replacer||(this.replacer=[]),this.replacer.push(h,d),this.cache&&fr(this),this)},k.encode=function(h,d){if(this.cache&&h.length<=this.H)if(this.F){if(this.B.has(h))return this.B.get(h)}else this.F=setTimeout(fr,50,this);this.normalize&&(typeof this.normalize=="function"?h=this.normalize(h):h=Nt?h.normalize("NFKD").replace(Nt,"").toLowerCase():h.toLowerCase()),this.prepare&&(h=this.prepare(h)),this.numeric&&h.length>3&&(h=h.replace(si,"$1 $2").replace(Qt,"$1 $2").replace(Xt,"$1 "));let p=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer),v=[],m=Se(),w,E,C=this.split||this.split===""?h.split(this.split):[h];for(let G=0,U,F;Gthis.maxlength)){if(d){if(m[U])continue;m[U]=1}else{if(w===U)continue;w=U}if(p)v.push(U);else if(!this.filter||(typeof this.filter=="function"?this.filter(U):!this.filter.has(U))){if(this.cache&&U.length<=this.I)if(this.F){var R=this.D.get(U);if(R||R===""){R&&v.push(R);continue}}else this.F=setTimeout(fr,50,this);if(this.stemmer){this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));let Y;for(;Y!==U&&U.length>2;)Y=U,U=U.replace(this.K,I=>this.stemmer.get(I))}if(U&&(this.mapper||this.dedupe&&U.length>1)){R="";for(let Y=0,I="",z,N;Y1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),U=U.replace(this.J,Y=>this.matcher.get(Y))),U&&this.replacer)for(R=0;U&&Rthis.L&&(this.D.clear(),this.I=this.I/1.1|0)),U){if(U!==F)if(d){if(m[U])continue;m[U]=1}else{if(E===U)continue;E=U}v.push(U)}}}return this.finalize&&(v=this.finalize(v)||v),this.cache&&h.length<=this.H&&(this.B.set(h,v),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),v};function fr(h){h.F=null,h.B.clear(),h.D.clear()}function Qr(h,d,p){p||(d||typeof h!="object"?typeof d=="object"&&(p=d,d=0):p=h),p&&(h=p.query||h,d=p.limit||d);let v=""+(d||0);p&&(v+=(p.offset||0)+!!p.context+!!p.suggest+(p.resolve!==!1)+(p.resolution||this.resolution)+(p.boost||0)),h=(""+h).toLowerCase(),this.cache||(this.cache=new _r);let m=this.cache.get(h+v);if(!m){let w=p&&p.cache;w&&(p.cache=!1),m=this.search(h,d,p),w&&(p.cache=w),this.cache.set(h+v,m)}return m}function _r(h){this.limit=h&&h!==!0?h:1e3,this.cache=new Map,this.h=""}_r.prototype.set=function(h,d){this.cache.set(this.h=h,d),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)},_r.prototype.get=function(h){let d=this.cache.get(h);return d&&this.h!==h&&(this.cache.delete(h),this.cache.set(this.h=h,d)),d},_r.prototype.remove=function(h){for(let d of this.cache){let p=d[0];d[1].includes(h)&&this.cache.delete(p)}},_r.prototype.clear=function(){this.cache.clear(),this.h=""};var ai={normalize:!1,numeric:!1,dedupe:!1},de={},J=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),pe=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Je=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],st={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,\u00DF:2,d:3,t:3,l:4,m:5,n:5,r:6},pt={Exact:ai,Default:de,Normalize:de,LatinBalance:{mapper:J},LatinAdvanced:{mapper:J,matcher:pe,replacer:Je},LatinExtra:{mapper:J,replacer:Je.concat([/(?!^)[aeo]/g,""]),matcher:pe},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(h){for(let p=0;p=E.length)d-=E.length;else{d=E[v?"splice":"slice"](d,p);let C=d.length;if(C&&(m=m.length?m.concat(d):d,p-=C,v&&(h.length-=C),!p))break;d=0}return m}function _t(h){if(!this||this.constructor!==_t)return new _t(h);this.index=h?[h]:[],this.length=h?h.length:0;let d=this;return new Proxy([],{get(p,v){if(v==="length")return d.length;if(v==="push")return function(m){d.index[d.index.length-1].push(m),d.length++};if(v==="pop")return function(){if(d.length)return d.length--,d.index[d.index.length-1].pop()};if(v==="indexOf")return function(m){let w=0;for(let E=0,C,R;E=0)return w+R;w+=C.length}return-1};if(v==="includes")return function(m){for(let w=0;w32?(this.B=Fe,this.A=BigInt(h)):(this.B=kt,this.A=h)}ct.prototype.get=function(h){let d=this.index[this.B(h)];return d&&d.get(h)},ct.prototype.set=function(h,d){var p=this.B(h);let v=this.index[p];v?(p=v.size,v.set(h,d),(p-=v.size)&&this.size++):(this.index[p]=v=new Map([[h,d]]),this.h.push(v),this.size++)};function ut(h=8){if(!this||this.constructor!==ut)return new ut(h);this.index=Se(),this.h=[],this.size=0,h>32?(this.B=Fe,this.A=BigInt(h)):(this.B=kt,this.A=h)}ut.prototype.add=function(h){var d=this.B(h);let p=this.index[d];p?(d=p.size,p.add(h),(d-=p.size)&&this.size++):(this.index[d]=p=new Set([h]),this.h.push(p),this.size++)},k=ct.prototype,k.has=ut.prototype.has=function(h){let d=this.index[this.B(h)];return d&&d.has(h)},k.delete=ut.prototype.delete=function(h){let d=this.index[this.B(h)];d&&d.delete(h)&&this.size--},k.clear=ut.prototype.clear=function(){this.index=Se(),this.h=[],this.size=0},k.values=ut.prototype.values=function*(){for(let h=0;h=this.priority*this.priority*3):(Pe=setTimeout(H,0),ft=Date.now()),Ut){let w=this;return new Promise(E=>{setTimeout(function(){E(w[h+"Async"].apply(w,d))},0)})}let m=this[h].apply(this,d);return p=m.then?m:new Promise(w=>w(m)),v&&p.then(v),p}}var fe=0;function De(h={},d){function p(C){function R(G){G=G.data||G;let U=G.id,F=U&&w.h[U];F&&(F(G.msg),delete w.h[U])}if(this.worker=C,this.h=Se(),this.worker)return m?this.worker.on("message",R):this.worker.onmessage=R,h.config?new Promise(function(G){fe>1e9&&(fe=0),w.h[++fe]=function(){G(w)},w.worker.postMessage({id:fe,task:"init",factory:v,options:h})}):(this.priority=h.priority||4,this.encoder=d||null,this.worker.postMessage({task:"init",factory:v,options:h}),this)}if(!this||this.constructor!==De)return new De(h);let v=typeof self<"u"?self._factory:typeof window<"u"?window._factory:null;v&&(v=v.toString());let m=typeof window>"u",w=this,E=Me(v,m,h.worker);return E.then?E.then(function(C){return p.call(w,C)}):p.call(this,E)}Ge("add"),Ge("append"),Ge("search"),Ge("update"),Ge("remove"),Ge("clear"),Ge("export"),Ge("import"),De.prototype.searchCache=Qr,mt(De.prototype);function Ge(h){De.prototype[h]=function(){let d=this,p=[].slice.call(arguments);var v=p[p.length-1];let m;return typeof v=="function"&&(m=v,p.pop()),v=new Promise(function(w){h==="export"&&typeof p[0]=="function"&&(p[0]=null),fe>1e9&&(fe=0),d.h[++fe]=w,d.worker.postMessage({task:h,id:fe,args:p})}),m?(v.then(m),this):v}}function Me(h,d,p){return d?typeof module<"u"?new(ni()).Worker(__dirname+"/worker/node.js"):Promise.resolve().then(()=>$t(ni())).then(function(v){return new v.Worker(import.meta.dirname+"/node/node.mjs")}):h?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ke.toString()],{type:"text/javascript"}))):new window.Worker(typeof p=="string"?p:import.meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js"),{type:"module"})}Fr.prototype.add=function(h,d,p){if(mr(h)&&(d=h,h=Er(d,this.key)),d&&(h||h===0)){if(!p&&this.reg.has(h))return this.update(h,d);for(let C=0,R;Cd?h.slice(p,p+d):h,v?dt.call(this,h):h;let m=[];for(let w=0,E,C;w=C){p-=C;continue}E=E.slice(p,p+d),C=E.length,p=0}if(C>d&&(E=E.slice(0,d),C=d),!m.length&&C>=d)return v?dt.call(this,E):E;if(m.push(E),d-=C,!d)break}return m=m.length>1?[].concat.apply([],m):m[0],v?dt.call(this,m):m}function Jt(h,d,p,v){var m=v[0];if(m[0]&&m[0].query)return h[d].apply(h,m);if(!(d!=="and"&&d!=="not"||h.result.length||h.await||m.suggest))return v.length>1&&(m=v[v.length-1]),(v=m.resolve)?h.await||h.result:h;let w=[],E=0,C=0,R,G,U,F,Y;for(d=0;d1&&(p=p[d].apply(p,h.slice(1))),p}we.prototype.or=function(){return Jt(this,"or",rt,arguments)};function rt(h,d,p,v,m,w,E){return h.length&&(this.result.length&&h.push(this.result),h.length<2?this.result=h[0]:(this.result=yr(h,d,p,!1,this.h),p=0)),m&&(this.await=null),m?this.resolve(d,p,v,E):this}we.prototype.and=function(){return Jt(this,"and",St,arguments)};function St(h,d,p,v,m,w,E){if(!w&&!this.result.length)return m?this.result:this;let C;if(h.length)if(this.result.length&&h.unshift(this.result),h.length<2)this.result=h[0];else{let R=0;for(let G=0,U,F;G1?Ie.join(" "):Ie[0];let Xe;if(Ie&&at){for(var nt=at.length,_e=(zt.split?at.replace(zt.split,""):at).length-Ie.length,xe="",qe=0,Ze=0;Ze-1&&(xe=(lt?at.substring(0,lt):"")+E+at.substring(lt,lt+vt)+C+(lt+vt=R)break}if(ot=Ct.length*(w.length-2),I||z||R&&L.length-ot>R)if(ot=R+ot-Y*2,Ye=Ne-Re,I>0&&(Ye+=I),z>0&&(Ye+=z),Ye<=ot)ue=I?Re-(I>0?I:0):Re-((ot-Ye)/2|0),oe=z?Ne+(z>0?z:0):ue+ot,G||(ue>0&&L.charAt(ue)!==" "&&L.charAt(ue-1)!==" "&&(ue=L.indexOf(" ",ue),ue<0&&(ue=0)),oe=oe.length-1){if(tr>=oe.length){Ye[Xe+1]=1,tr>=ue.length&&(ot[Xe+1]=1);continue}nt-=Y}if(L=oe[tr].text,vt=z&&Ie[Xe])if(vt>0){if(L.length>vt)if(Ye[Xe+1]=1,G)L=L.substring(0,vt);else continue;(vt-=L.length)||(vt=-1),Ie[Xe]=vt}else{Ye[Xe+1]=1;continue}if(nt+L.length+1<=R)L=" "+L,Ne[Xe]+=L;else if(G)Yt=R-nt-1,Yt>0&&(L=" "+L.substring(0,Yt),Ne[Xe]+=L),Ye[Xe+1]=1;else{Ye[Xe+1]=1;continue}}else{if(Ye[Xe])continue;if(tr-=_e,Re[tr]){nt-=Y,Ye[Xe]=1,ot[Xe]=1;continue}if(tr<=0){if(tr<0){Ye[Xe]=1,ot[Xe]=1;continue}nt-=Y}if(L=oe[tr].text,vt=I&&at[Xe])if(vt>0){if(L.length>vt)if(Ye[Xe]=1,G)L=L.substring(L.length-vt);else continue;(vt-=L.length)||(vt=-1),at[Xe]=vt}else{Ye[Xe]=1;continue}if(nt+L.length+1<=R)L+=" ",Ne[Xe]=L+Ne[Xe];else if(G)Yt=L.length+1-(R-nt),Yt>=0&&Yt=ue.length-1||tr1?yr(R,p,v,E,w):(R=R[0])&&p&&R.length>p||v?R.slice(v,p+v):R;else{if(hp||v)&&(R=R.slice(v,p+v));else{m=[];for(let F=0,Y;Fv)v-=Y.length;else if((p&&Y.length>p||v)&&(Y=Y.slice(v,p+v),p-=Y.length,v&&(v-=Y.length)),m.push(Y),!p)break}R=m}}return R}function yr(h,d,p,v,m){let w=[],E=Se(),C;var R=h.length;let G;if(v){for(m=R-1;m>=0;m--)if(G=(v=h[m])&&v.length){for(R=0;R=0;U--){F=h[U];for(let I=0;I1?vr(m,1,0,0,R,G):m[0],at)})}return I?m:new we(m.length>1?vr(m,1,0,0,R,G):m[0],this)}}I||E||!(F=F||this.field)||(Z(F)?E=F:(F.constructor===Array&&F.length===1&&(F=F[0]),E=F.field||F.index)),F&&F.constructor!==Array&&(F=[F])}F||(F=this.field);let ot;oe=(this.worker||this.db)&&!v&&[];for(let at=0,Ie,nt,_e;at"u"&&(this.db?oe.push(N=this.index.get(this.field[0]).db.enrich(N)):N=dt.call(this,N)),E)return I?z?Et(h,N,this.index,E,z):N:new we(N,this);m[ue]={field:w[ue],result:N}}if(L&&this.db&&oe.length){let at=this;return Promise.all(oe).then(function(Ie){for(let nt=0;nt0&&((p&&d>p||v)&&(h=h.slice(v,v+p)),m&&(h=dt.call(this,h))),h):[]):[]}function dt(h){if(!this||!this.store)return h;if(this.db)return this.index.get(this.field[0]).db.enrich(h);let d=Array(h.length);for(let p=0,v;p1?p:p[0]}k.append=function(h,d){return this.add(h,d,!0)},k.update=function(h,d){return this.remove(h).add(h,d)},k.remove=function(h){mr(h)&&(h=Er(h,this.key));for(var d of this.index.values())d.remove(h,!0);if(this.reg.has(h)){if(this.tag&&!this.fastupdate)for(let p of this.tag.values())for(let v of p){d=v[0];let m=v[1],w=m.indexOf(h);w>-1&&(m.length>1?m.splice(w,1):p.delete(d))}this.store&&this.store.delete(h),this.reg.delete(h)}return this.cache&&this.cache.remove(h),this},k.clear=function(){let h=[];for(let d of this.index.values()){let p=d.clear();p.then&&h.push(p)}if(this.tag)for(let d of this.tag.values())d.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),h.length?Promise.all(h):this},k.contain=function(h){return this.db?this.index.get(this.field[0]).db.has(h):this.reg.has(h)},k.cleanup=function(){for(let h of this.index.values())h.cleanup();return this},k.get=function(h){return this.db?this.index.get(this.field[0]).db.enrich(h).then(function(d){return d[0]&&d[0].doc||null}):this.store.get(h)||null},k.set=function(h,d){return typeof h=="object"&&(d=h,h=Er(d,this.key)),this.store.set(h,d),this},k.searchCache=Qr,k.export=Si,k.import=It,mt(Fr.prototype);function gt(h,d=0){let p=[],v=[];d&&(d=25e4/d*5e3|0);for(let m of h.entries())v.push(m),v.length===d&&(p.push(v),v=[]);return v.length&&p.push(v),p}function Vi(h,d){d||(d=new Map);for(let p=0,v;p2?p[0]:"";if(p=p.length>2?p[2]:p[1],this.worker&&v)return this.index.get(v).import(h);if(d){if(typeof d=="string"&&(d=JSON.parse(d)),v)return this.index.get(v).import(p,d);switch(p){case"reg":this.fastupdate=!1,this.reg=it(d,this.reg);for(let m=0,w;m=0&&m.splice(E,1)}}else zr(this.map,h),this.depth&&zr(this.ctx,h);d||this.reg.delete(h)}return this.db&&(this.commit_task.push({del:h}),this.M&&xn(this)),this.cache&&this.cache.remove(h),this};function zr(h,d){let p=0;var v=typeof d>"u";if(h.constructor===Array){for(let m=0,w,E,C;m=0){if(w.length>1)return w.splice(E,1),1;if(delete h[m],p)return 1;C=1}else{if(C)return 1;p++}}}else for(let m of h.entries())v=m[0],zr(m[1],d)?p++:h.delete(v);return p}var Wn={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};Or.prototype.add=function(h,d,p,v){if(d&&(h||h===0)){if(!v&&!p&&this.reg.has(h))return this.update(h,d);v=this.depth,d=this.encoder.encode(d,!v);let G=d.length;if(G){let U=Se(),F=Se(),Y=this.resolution;for(let I=0;I2){for(let N=1,L,ue,oe,Re;N2){for(let N=0,L;NN;w--){E=z.substring(N,w),L=this.rtl?m-1-N:N;var C=this.score?this.score(d,z,I,E,L):$i(Y,G,I,m,L);Hr(this,F,E,C,h,p)}break}case"bidirectional":case"reverse":if(m>1){for(C=m-1;C>0;C--){E=z[this.rtl?m-1-C:C]+E;var R=this.score?this.score(d,z,I,E,C):$i(Y,G,I,m,C);Hr(this,F,E,R,h,p)}E=""}case"forward":if(m>1){for(C=0;C1&&IE;let N=this.score?this.score(d,E,I,z,C-1):$i(m+(G/2>m?0:1),G,I,w-1,C-1);Hr(this,U,R?E:z,N,h,p,R?z:E)}}}}this.fastupdate||this.reg.add(h)}}return this.db&&(this.commit_task.push(p?{ins:h}:{del:h}),this.M&&xn(this)),this};function Hr(h,d,p,v,m,w,E){let C,R;if(!(C=d[p])||E&&!C[E]){if(E?(d=C||(d[p]=Se()),d[E]=1,R=h.ctx,(C=R.get(E))?R=C:R.set(E,R=h.keystore?new ct(h.keystore):new Map)):(R=h.map,d[p]=1),(C=R.get(p))?R=C:R.set(p,R=C=[]),w){for(let G=0,U;G1?d+(v||0)<=h?p+(m||0):(h-1)/(d+(v||0))*(p+(m||0))+1|0:0}Or.prototype.search=function(h,d,p){if(p||(d||typeof h!="object"?typeof d=="object"&&(p=d,d=0):(p=h,h="")),p&&p.cache)return p.cache=!1,h=this.searchCache(h,d,p),p.cache=!0,h;let v=[],m,w,E,C=0,R,G,U,F,Y;p&&(h=p.query||h,d=p.limit||d,C=p.offset||0,w=p.context,E=p.suggest,Y=(R=p.resolve)&&p.enrich,U=p.boost,F=p.resolution,G=this.db&&p.tag),typeof R>"u"&&(R=this.resolve),w=this.depth&&w!==!1;let I=this.encoder.encode(h,!w);if(m=I.length,d=d||(R?100:0),m===1)return jr.call(this,I[0],"",d,C,R,Y,G);if(m===2&&w&&!E)return jr.call(this,I[1],I[0],d,C,R,Y,G);let z=Se(),N=0,L;if(w&&(L=I[0],N=1),F||F===0||(F=L?this.N:this.resolution),this.db){if(this.db.search&&(p=this.db.search(this,I,d,C,E,R,Y,G),p!==!1))return p;let ue=this;return(async function(){for(let oe,Re;N1)R=vr(h,d,p,v,m,w,E);else if(C===1)return E?xt.call(null,h[0],p,v):new we(h[0],this);return E?R:new we(R,this)}function jr(h,d,p,v,m,w,E){return h=nn(this,h,d,p,v,m,w,E),this.db?h.then(function(C){return m?C||[]:new we(C,this)}):h&&h.length?m?xt.call(this,h,p,v):new we(h,this):m?[]:new we([],this)}function rn(h,d,p,v){let m=[];if(h&&h.length){if(h.length<=v){d.push(h);return}for(let w=0,E;wp)&&(R=p,p=d,d=R),h.db?h.db.get(d,p,v,m,w,E,C):(h=p?(h=h.ctx.get(p))&&h.get(d):h.map.get(d),h)}function Or(h,d){if(!this||this.constructor!==Or)return new Or(h);if(h){var p=Z(h)?h:h.preset;p&&(h=Object.assign({},Wn[p],h))}else h={};p=h.context;let v=p===!0?{depth:1}:p||{},m=Z(h.encoder)?pt[h.encoder]:h.encode||h.encoder||{};this.encoder=m.encode?m:typeof m=="object"?new yt(m):{encode:m},this.resolution=h.resolution||9,this.tokenize=p=(p=h.tokenize)&&p!=="default"&&p!=="exact"&&p||"strict",this.depth=p==="strict"&&v.depth||0,this.bidirectional=v.bidirectional!==!1,this.fastupdate=!!h.fastupdate,this.score=h.score||null,(p=h.keystore||0)&&(this.keystore=p),this.map=p?new ct(p):new Map,this.ctx=p?new ct(p):new Map,this.reg=d||(this.fastupdate?p?new ct(p):new Map:p?new ut(p):new Set),this.N=v.resolution||3,this.rtl=m.rtl||h.rtl||!1,this.cache=(p=h.cache||null)&&new _r(p),this.resolve=h.resolve!==!1,(p=h.db)&&(this.db=this.mount(p)),this.M=h.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=h.priority||4}k=Or.prototype,k.mount=function(h){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),h.mount(this)},k.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)},k.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};function xn(h){h.commit_timer||(h.commit_timer=setTimeout(function(){h.commit_timer=null,h.db.commit(h)},1))}k.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this},k.append=function(h,d){return this.add(h,d,!0)},k.contain=function(h){return this.db?this.db.has(h):this.reg.has(h)},k.update=function(h,d){let p=this,v=this.remove(h);return v&&v.then?v.then(()=>p.add(h,d)):this.add(h,d)},k.cleanup=function(){return this.fastupdate?(zr(this.map),this.depth&&zr(this.ctx),this):this},k.searchCache=Qr,k.export=function(h,d,p=0,v=0){let m,w;switch(v){case 0:m="reg",w=Ot(this.reg);break;case 1:m="cfg",w=null;break;case 2:m="map",w=gt(this.map,this.reg.size);break;case 3:m="ctx",w=Cr(this.ctx,this.reg.size);break;default:return}return Dr.call(this,h,d,m,w,p,v)},k.import=function(h,d){if(d)switch(typeof d=="string"&&(d=JSON.parse(d)),h=h.split("."),h[h.length-1]==="json"&&h.pop(),h.length===3&&h.shift(),h=h.length>1?h[1]:h[0],h){case"reg":this.fastupdate=!1,this.reg=it(d,this.reg);break;case"map":this.map=Vi(d,this.map);break;case"ctx":this.ctx=$e(d,this.ctx)}},k.serialize=function(h=!0){let d="",p="",v="";if(this.reg.size){let w;for(var m of this.reg.keys())w||(w=typeof m),d+=(d?",":"")+(w==="string"?'"'+m+'"':m);d="index.reg=new Set(["+d+"]);",p=li(this.map,w),p="index.map=new Map(["+p+"]);";for(let E of this.ctx.entries()){m=E[0];let C=li(E[1],w);C="new Map(["+C+"])",C='["'+m+'",'+C+"]",v+=(v?",":"")+C}v="index.ctx=new Map(["+v+"]);"}return h?"function inject(index){"+d+p+v+"}":d+p+v},mt(Or.prototype);var bn=typeof window<"u"&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),sn=["map","ctx","tag","reg","cfg"],Wr=Se();function Xi(h,d={}){if(!this||this.constructor!==Xi)return new Xi(h,d);typeof h=="object"&&(d=h,h=h.name),h||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(h?":"+h.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=d.field?d.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=d.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}k=Xi.prototype,k.mount=function(h){return h.index?h.mount(this):(h.db=this,this.open())},k.open=function(){if(this.db)return this.db;let h=this;navigator.storage&&navigator.storage.persist(),Wr[h.id]||(Wr[h.id]=[]),Wr[h.id].push(h.field);let d=bn.open(h.id,1);return d.onupgradeneeded=function(){let p=h.db=this.result;for(let v=0,m;v=U.length){v-=U.length;continue}let F=p?v+Math.min(U.length-v,p):U.length;for(let Y=v;Y=w.length?[]:!d&&!p?w:(w=w.slice(p,p+d),v?m.enrich(w):w)})},k.enrich=function(h){typeof h!="object"&&(h=[h]);let d=this.db.transaction("reg","readonly").objectStore("reg"),p=[];for(let v=0;v=0)if(m=1,C.length>1)C.splice(G,1);else{v[E]=[];break}w+=C.length}if(p)break}w?m&&h.update(v):h.delete(),h.continue()}k.remove=function(h){return typeof h!="object"&&(h=[h]),Promise.all([this.transaction("map","readwrite",function(d){d.openCursor().onsuccess=function(){let p=this.result;p&&hi(p,h)}}),this.transaction("ctx","readwrite",function(d){d.openCursor().onsuccess=function(){let p=this.result;p&&hi(p,h)}}),this.transaction("tag","readwrite",function(d){d.openCursor().onsuccess=function(){let p=this.result;p&&hi(p,h,!0)}}),this.transaction("reg","readwrite",function(d){for(let p=0;p{h.onsuccess=h.oncomplete=function(){d&&d(this.result),d=null,p(this.result)},h.onerror=h.onblocked=v,h=null})}var Vn={Index:Or,Charset:pt,Encoder:yt,Document:Fr,Worker:De,Resolver:we,IndexedDB:Xi,Language:{}};function an(h,d){if(!h)return;function p(m){m.target===this&&(m.preventDefault(),m.stopPropagation(),d())}function v(m){m.key.startsWith("Esc")&&(m.preventDefault(),d())}h?.addEventListener("click",p),window.addCleanup(()=>h?.removeEventListener("click",p)),document.addEventListener("keydown",v),window.addCleanup(()=>document.removeEventListener("keydown",v))}function on(h){for(;h.firstChild;)h.removeChild(h.firstChild)}var ws=Object.hasOwnProperty,Ts=$t(Sr(),1),Ss=(0,Ts.default)();function Ma(h){let d=Pr(cr(h,"index"),!0);return d.length===0?"/":d}var Ei=(h,d,p)=>{let v=new URL(h.getAttribute(d),p);h.setAttribute(d,v.pathname+v.hash)};function Wt(h,d){h.querySelectorAll('[href=""], [href^="./"], [href^="../"]').forEach(p=>Ei(p,"href",d)),h.querySelectorAll('[src=""], [src^="./"], [src^="../"]').forEach(p=>Ei(p,"src",d))}function nr(h){let d=h.split("/").filter(p=>p!=="").slice(0,-1).map(p=>"..").join("/");return d.length===0&&(d="."),d}function wn(h,d){return pr(nr(h),Ma(d))}function pr(...h){if(h.length===0)return"";let d=h.filter(p=>p!==""&&p!=="/").map(p=>Pr(p)).join("/");return h[0].startsWith("/")&&(d="/"+d),h[h.length-1].endsWith("/")&&(d=d+"/"),d}function Ar(h,d){return h===d||h.endsWith("/"+d)}function cr(h,d){return Ar(h,d)&&(h=h.slice(0,-d.length)),h}function Pr(h,d){return h.startsWith("/")&&(h=h.substring(1)),!d&&h.endsWith("/")&&(h=h.slice(0,-1)),h}var xr="basic",dr="",M=h=>{let d=[],p=-1,v=-1,m=h.toLowerCase(),w=0;for(let E of m){let C=E.codePointAt(0);C>=12352&&C<=12447||C>=12448&&C<=12543||C>=19968&&C<=40959||C>=44032&&C<=55215||C>=131072&&C<=173791?(p!==-1&&(d.push(m.slice(p,v)),p=-1),d.push(E)):C===32||C===9||C===10||C===13?p!==-1&&(d.push(m.slice(p,v)),p=-1):(p===-1&&(p=w),v=w+E.length),w+=E.length}return p!==-1&&d.push(m.slice(p)),d},O=new Vn.Document({encode:M,document:{id:"id",tag:"tags",index:[{field:"title",tokenize:"forward"},{field:"content",tokenize:"forward"},{field:"tags",tokenize:"forward"}]}}),j=new DOMParser,V=new Map,Q=30,K=8,ne=5,le=h=>{let d=h.split(/\s+/).filter(v=>v.trim()!==""),p=d.length;if(p>1)for(let v=1;vm.length-v.length)};function Te(h,d,p){let v=le(h),m=d.split(/\s+/).filter(R=>R!==""),w=0,E=m.length-1;if(p){let R=Y=>v.some(I=>Y.toLowerCase().startsWith(I.toLowerCase())),G=m.map(R),U=0,F=0;for(let Y=0;Yz+(N?1:0),0);I>=U&&(U=I,F=Y)}w=Math.max(F-Q,0),E=Math.min(w+2*Q,m.length-1),m=m.slice(w,E)}let C=m.map(R=>{for(let G of v)if(R.toLowerCase().includes(G.toLowerCase())){let U=new RegExp(G.toLowerCase(),"gi");return R.replace(U,'$&')}return R}).join(" ");return`${w===0?"":"..."}${C}${E===m.length-1?"":"..."}`}function Ae(h,d){let p=new DOMParser,v=le(h),m=p.parseFromString(d.innerHTML,"text/html"),w=C=>{let R=document.createElement("span");return R.className="highlight",R.textContent=C,R},E=(C,R)=>{if(C.nodeType===Node.TEXT_NODE){let G=C.nodeValue??"",U=new RegExp(R.toLowerCase(),"gi"),F=G.match(U);if(!F||F.length===0)return;let Y=document.createElement("span"),I=0;for(let z of F){let N=G.indexOf(z,I);Y.appendChild(document.createTextNode(G.slice(I,N))),Y.appendChild(w(z)),I=N+z.length}Y.appendChild(document.createTextNode(G.slice(I))),C.parentNode?.replaceChild(Y,C)}else if(C.nodeType===Node.ELEMENT_NODE){if(C.classList.contains("highlight"))return;Array.from(C.childNodes).forEach(G=>E(G,R))}};for(let C of v)E(m.body,C);return m.body}async function Ue(h,d,p){let v=h.querySelector(".search-container");if(!v)return;let m=v.closest(".sidebar"),w=h.querySelector(".search-button");if(!w)return;let E=h.querySelector(".search-bar");if(!E)return;let C=h.querySelector(".search-layout");if(!C)return;let R=Object.keys(p),G=_e=>{C.appendChild(_e)},U=C.dataset.preview==="true",F,Y,I=document.createElement("div");I.className="results-container",G(I),U&&(F=document.createElement("div"),F.className="preview-container",G(F));function z(){v.classList.remove("active"),E.value="",m&&(m.style.zIndex=""),on(I),F&&on(F),C.classList.remove("display-results"),xr="basic",w.focus()}function N(_e){xr=_e,m&&(m.style.zIndex="1"),v.classList.add("active"),E.focus()}let L=null;async function ue(_e){if(_e.key==="k"&&(_e.ctrlKey||_e.metaKey)&&!_e.shiftKey){_e.preventDefault(),v.classList.contains("active")?z():N("basic");return}else if(_e.shiftKey&&(_e.ctrlKey||_e.metaKey)&&_e.key.toLowerCase()==="k"){_e.preventDefault(),v.classList.contains("active")?z():N("tags"),E.value="#";return}if(L&&L.classList.remove("focus"),!!v.classList.contains("active")){if(_e.key==="Enter"&&!_e.isComposing)if(I.contains(document.activeElement)){let xe=document.activeElement;if(xe.classList.contains("no-match"))return;await Ie(xe),xe.click()}else{let xe=document.getElementsByClassName("result-card")[0];if(!xe||xe.classList.contains("no-match"))return;await Ie(xe),xe.click()}else if(_e.key==="ArrowUp"||_e.shiftKey&&_e.key==="Tab"){if(_e.preventDefault(),I.contains(document.activeElement)){let xe=L||document.activeElement,qe=xe?.previousElementSibling;xe?.classList.remove("focus"),qe?.focus(),qe&&(L=qe),await Ie(qe)}}else if((_e.key==="ArrowDown"||_e.key==="Tab")&&(_e.preventDefault(),document.activeElement===E||L!==null)){let xe=L||document.getElementsByClassName("result-card")[0],qe=xe?.nextElementSibling;xe?.classList.remove("focus"),qe?.focus(),qe&&(L=qe),await Ie(qe)}}}let oe=(_e,xe)=>{let qe=R[xe];return{id:xe,slug:qe,title:xr==="tags"?p[qe].title:Te(_e,p[qe].title??""),content:Te(_e,p[qe].content??"",!0),tags:Re(_e.substring(1),p[qe].tags)}};function Re(_e,xe){return!xe||xr!=="tags"?[]:xe.map(qe=>qe.toLowerCase().includes(_e.toLowerCase())?`
  • #${qe}

  • `:`
  • #${qe}

  • `).slice(0,ne)}function Ne(_e){return new URL(wn(d,_e),location.toString())}let ot=({slug:_e,title:xe,content:qe,tags:Ze})=>{let lt=Ze.length>0?`
      ${Ze.join("")}
    `:"",vt=document.createElement("a");vt.classList.add("result-card"),vt.id=_e,vt.href=Ne(_e).toString(),vt.innerHTML=`

    ${xe}

    ${lt}

    ${qe}

    `,vt.addEventListener("click",zt=>{zt.altKey||zt.ctrlKey||zt.metaKey||zt.shiftKey||z()});let Yt=zt=>{zt.altKey||zt.ctrlKey||zt.metaKey||zt.shiftKey||z()};async function br(zt){if(!zt.target)return;let Jr=zt.target;await Ie(Jr)}return vt.addEventListener("mouseenter",br),window.addCleanup(()=>vt.removeEventListener("mouseenter",br)),vt.addEventListener("click",Yt),window.addCleanup(()=>vt.removeEventListener("click",Yt)),vt};async function Ye(_e){if(on(I),_e.length===0?I.innerHTML=`

    No results.

    Try another search term?

    `:I.append(..._e.map(ot)),_e.length===0&&F)on(F);else{let xe=I.firstElementChild;xe.classList.add("focus"),L=xe,await Ie(xe)}}async function at(_e){if(V.has(_e))return V.get(_e);let xe=Ne(_e).toString(),qe=await fetch(xe).then(Ze=>Ze.text()).then(Ze=>{if(Ze===void 0)throw new Error(`Could not fetch ${xe}`);let lt=j.parseFromString(Ze??"","text/html");return Wt(lt,xe),[...lt.getElementsByClassName("popover-hint")]});return V.set(_e,qe),qe}async function Ie(_e){if(!C||!U||!_e||!F)return;let xe=_e.id,qe=await at(xe).then(Ze=>Ze.flatMap(lt=>[...Ae(dr,lt).children]));Y=document.createElement("div"),Y.classList.add("preview-inner"),Y.append(...qe),F.replaceChildren(Y),[...F.getElementsByClassName("highlight")].sort((Ze,lt)=>lt.innerHTML.length-Ze.innerHTML.length)[0]?.scrollIntoView({block:"start"})}async function nt(_e){if(!C||!O)return;dr=_e.target.value,C.classList.toggle("display-results",dr!==""),xr=dr.startsWith("#")?"tags":"basic";let xe;if(xr==="tags"){dr=dr.substring(1).trim();let lt=dr.indexOf(" ");if(lt!=-1){let vt=dr.substring(0,lt),Yt=dr.substring(lt+1).trim();xe=await O.searchAsync({query:Yt,limit:Math.max(K,1e4),index:["title","content"],tag:{tags:vt}});for(let br of xe)br.result=br.result.slice(0,K);xr="basic",dr=Yt}else xe=await O.searchAsync({query:dr,limit:K,index:["tags"]})}else xr==="basic"&&(xe=await O.searchAsync({query:dr,limit:K,index:["title","content"]}));let qe=lt=>{let vt=xe.filter(Yt=>Yt.field===lt);return vt.length===0?[]:[...vt[0].result]},Ze=[...new Set([...qe("title"),...qe("content"),...qe("tags")])].map(lt=>oe(dr,lt));await Ye(Ze)}document.addEventListener("keydown",ue),window.addCleanup(()=>document.removeEventListener("keydown",ue)),w.addEventListener("click",()=>N("basic")),window.addCleanup(()=>w.removeEventListener("click",()=>N("basic"))),E.addEventListener("input",nt),window.addCleanup(()=>E.removeEventListener("input",nt)),an(v,z),await Oe(p)}var se=!1;async function Oe(h){if(se)return;let d=0,p=[];for(let[v,m]of Object.entries(h))p.push(O.addAsync(d++,{id:d,slug:v,title:m.title,content:m.content,tags:m.tags}));await Promise.all(p),se=!0}document.addEventListener("nav",async h=>{let d=h.detail.url,p=await fetchData,v=document.getElementsByClassName("search");for(let m of v)await Ue(m,d,p)})})(),(function(){var Zt=Object.create,Mt=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,Rt=Object.getOwnPropertyNames,Gt=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty,y=(de,J)=>()=>(J||de((J={exports:{}}).exports,J),J.exports),Br=(de,J,pe,Je)=>{if(J&&typeof J=="object"||typeof J=="function")for(let st of Rt(J))!Ft.call(de,st)&&st!==pe&&Mt(de,st,{get:()=>J[st],enumerable:!(Je=Vt(J,st))||Je.enumerable});return de},$t=(de,J,pe)=>(pe=de!=null?Zt(Gt(de)):{},Br(J||!de||!de.__esModule?Mt(pe,"default",{value:de,enumerable:!0}):pe,de)),ni=y((de,J)=>{"use strict";J.exports=Je;function pe(pt){return pt instanceof Buffer?Buffer.from(pt):new pt.constructor(pt.buffer.slice(),pt.byteOffset,pt.length)}function Je(pt){if(pt=pt||{},pt.circles)return st(pt);let tt=new Map;if(tt.set(Date,Fe=>new Date(Fe)),tt.set(Map,(Fe,We)=>new Map(ct(Array.from(Fe),We))),tt.set(Set,(Fe,We)=>new Set(ct(Array.from(Fe),We))),pt.constructorHandlers)for(let Fe of pt.constructorHandlers)tt.set(Fe[0],Fe[1]);let _t=null;return pt.proto?kt:ut;function ct(Fe,We){let be=Object.keys(Fe),ke=new Array(be.length);for(let mt=0;mtnew Date(be)),ct.set(Map,(be,ke)=>new Map(kt(Array.from(be),ke))),ct.set(Set,(be,ke)=>new Set(kt(Array.from(be),ke))),pt.constructorHandlers)for(let be of pt.constructorHandlers)ct.set(be[0],be[1]);let ut=null;return pt.proto?We:Fe;function kt(be,ke){let mt=Object.keys(be),Pe=new Array(mt.length);for(let ft=0;ftpe!=="").slice(0,-1).map(pe=>"..").join("/");return J.length===0&&(J="."),J}function Z(de,J){return mr(Se(de),jt(J))}function mr(...de){if(de.length===0)return"";let J=de.filter(pe=>pe!==""&&pe!=="/").map(pe=>Xt(pe)).join("/");return de[0].startsWith("/")&&(J="/"+J),de[de.length-1].endsWith("/")&&(J=J+"/"),J}function Er(de,J){return de===J||de.endsWith("/"+J)}function Tt(de,J){return Er(de,J)&&(de=de.slice(0,-J.length)),de}function Xt(de,J){return de.startsWith("/")&&(de=de.substring(1)),!J&&de.endsWith("/")&&(de=de.slice(0,-1)),de}var si=class bd{isFolder;children;slugSegments;fileSegmentHint;displayNameOverride;data;constructor(J,pe){this.children=[],this.slugSegments=J,this.data=pe??null,this.isFolder=!1,this.displayNameOverride=void 0}get displayName(){let J=this.data?.title==="index"?void 0:this.data?.title;return this.displayNameOverride??J??this.fileSegmentHint??this.slugSegment??""}set displayName(J){this.displayNameOverride=J}get slug(){let J=mr(...this.slugSegments);return this.isFolder?mr(J,"index"):J}get slugSegment(){return this.slugSegments[this.slugSegments.length-1]}makeChild(J,pe){let Je=[...this.slugSegments,J[0]],st=new bd(Je,pe);return this.children.push(st),st}insert(J,pe){if(J.length===0)throw new Error("path is empty");this.isFolder=!0;let Je=J[0];if(J.length===1)Je==="index"?this.data??=pe:this.makeChild(J,pe);else if(J.length>1){let st=this.children.find(tt=>tt.slugSegment===Je)??this.makeChild(J,void 0),pt=pe.filePath.split("/");st.fileSegmentHint=pt.at(-J.length),st.insert(J.slice(1),pe)}}add(J){this.insert(J.slug.split("/"),J)}findNode(J){return J.length===0||J.length===1&&J[0]==="index"?this:this.children.find(pe=>pe.slugSegment===J[0])?.findNode(J.slice(1))}ancestryChain(J){if(J.length===0||J.length===1&&J[0]==="index")return[this];let pe=this.children.find(st=>st.slugSegment===J[0]);if(!pe)return;let Je=pe.ancestryChain(J.slice(1));if(Je)return[this,...Je]}filter(J){this.children=this.children.filter(J),this.children.forEach(pe=>pe.filter(J))}map(J){J(this),this.children.forEach(pe=>pe.map(J))}sort(J){this.children=this.children.sort(J),this.children.forEach(pe=>pe.sort(J))}static fromEntries(J){let pe=new bd([]);return J.forEach(([,Je])=>pe.add(Je)),pe}entries(){let J=pe=>[[pe.slug,pe]].concat(...pe.children.map(J));return J(this)}getFolderPaths(){return this.entries().filter(([J,pe])=>pe.isFolder).map(([J,pe])=>J)}},Qt;function Nt(){let de=this.closest(".explorer");if(!de)return;let J=de.classList.toggle("collapsed");de.setAttribute("aria-expanded",de.getAttribute("aria-expanded")==="true"?"false":"true"),J?document.documentElement.classList.remove("mobile-no-scroll"):document.documentElement.classList.add("mobile-no-scroll")}function yt(de){de.stopPropagation();let J=de.target;if(!J)return;let pe=J.nodeName==="svg"?J.parentElement:J.parentElement?.parentElement;if(!pe)return;let Je=pe.nextElementSibling;if(!Je)return;Je.classList.toggle("open");let st=!Je.classList.contains("open");ai(Je,st);let pt=Qt.find(_t=>_t.path===pe.dataset.folderpath);pt?pt.collapsed=st:Qt.push({path:pe.dataset.folderpath,collapsed:st});let tt=JSON.stringify(Qt);localStorage.setItem("fileTree",tt)}function fr(de,J){let pe=document.getElementById("template-file").content.cloneNode(!0).querySelector("li"),Je=pe.querySelector("a");return Je.href=Z(de,J.slug),Je.dataset.for=J.slug,Je.textContent=J.displayName,de===J.slug&&Je.classList.add("active"),pe}function Qr(de,J,pe){let Je=document.getElementById("template-folder").content.cloneNode(!0).querySelector("li"),st=Je.querySelector(".folder-container"),pt=st.querySelector("div"),tt=Je.querySelector(".folder-outer"),_t=tt.querySelector("ul"),ct=J.slug;if(st.dataset.folderpath=ct,de===ct&&st.classList.add("active"),pe.folderClickBehavior==="link"){let We=pt.querySelector(".folder-button"),be=document.createElement("a");be.href=Z(de,ct),be.dataset.for=ct,be.className="folder-title",be.textContent=J.displayName,We.replaceWith(be)}else{let We=pt.querySelector(".folder-title");We.textContent=J.displayName}let ut=Qt.find(We=>We.path===ct)?.collapsed??pe.folderDefaultState==="collapsed",kt=jt(ct),Fe=kt===de.slice(0,kt.length);(!ut||Fe)&&tt.classList.add("open");for(let We of J.children){let be=We.isFolder?Qr(de,We,pe):fr(de,We);_t.appendChild(be)}return Je}async function _r(de){let J=document.querySelectorAll("div.explorer");for(let pe of J){let Je=JSON.parse(pe.dataset.dataFns||"{}"),st={folderClickBehavior:pe.dataset.behavior||"collapse",folderDefaultState:pe.dataset.collapsed||"collapsed",useSavedState:pe.dataset.savestate==="true",order:Je.order||["filter","map","sort"],sortFn:new Function("return "+(Je.sortFn||"undefined"))(),filterFn:new Function("return "+(Je.filterFn||"undefined"))(),mapFn:new Function("return "+(Je.mapFn||"undefined"))()},pt=localStorage.getItem("fileTree"),tt=pt&&st.useSavedState?JSON.parse(pt):[],_t=new Map(tt.map(Pe=>[Pe.path,Pe.collapsed])),ct=await fetchData,ut=[...Object.entries(ct)],kt=si.fromEntries(ut);for(let Pe of st.order)switch(Pe){case"filter":st.filterFn&&kt.filter(st.filterFn);break;case"map":st.mapFn&&kt.map(st.mapFn);break;case"sort":st.sortFn&&kt.sort(st.sortFn);break}Qt=kt.getFolderPaths().map(Pe=>{let ft=_t.get(Pe);return{path:Pe,collapsed:ft===void 0?st.folderDefaultState==="collapsed":ft}});let Fe=pe.querySelector(".explorer-ul");if(!Fe)continue;let We=document.createDocumentFragment();for(let Pe of kt.children){let ft=Pe.isFolder?Qr(de,Pe,st):fr(de,Pe);We.appendChild(ft)}Fe.insertBefore(We,Fe.firstChild);let be=sessionStorage.getItem("explorerScrollTop");if(be)Fe.scrollTop=parseInt(be);else{let Pe=Fe.querySelector(".active");Pe&&Pe.scrollIntoView({behavior:"smooth"})}let ke=pe.getElementsByClassName("explorer-toggle");for(let Pe of ke)Pe.addEventListener("click",Nt),window.addCleanup(()=>Pe.removeEventListener("click",Nt));if(st.folderClickBehavior==="collapse"){let Pe=pe.getElementsByClassName("folder-button");for(let ft of Pe)ft.addEventListener("click",yt),window.addCleanup(()=>ft.removeEventListener("click",yt))}let mt=pe.getElementsByClassName("folder-icon");for(let Pe of mt)Pe.addEventListener("click",yt),window.addCleanup(()=>Pe.removeEventListener("click",yt))}}document.addEventListener("prenav",async()=>{let de=document.querySelector(".explorer-ul");de&&sessionStorage.setItem("explorerScrollTop",de.scrollTop.toString())}),document.addEventListener("nav",async de=>{let J=de.detail.url;await _r(J);for(let pe of document.getElementsByClassName("explorer")){let Je=pe.querySelector(".mobile-explorer");if(!Je)return;Je.checkVisibility()&&(pe.classList.add("collapsed"),pe.setAttribute("aria-expanded","false"),document.documentElement.classList.remove("mobile-no-scroll")),Je.classList.remove("hide-until-loaded")}}),window.addEventListener("resize",function(){let de=document.querySelector(".explorer");if(de&&!de.classList.contains("collapsed")){document.documentElement.classList.add("mobile-no-scroll");return}});function ai(de,J){return J?de.classList.remove("open"):de.classList.add("open")}})(),(function(){document.addEventListener("nav",Zt=>{const Mt=new IntersectionObserver(Gt=>{for(const Ft of Gt){const y=Ft.target.parentElement;if(!y)return;Ft.isIntersecting?y.classList.remove("gradient-active"):y.classList.add("gradient-active")}}),Vt=document.getElementById("list-0");if(!Vt)return;const Rt=Vt.querySelector(".overflow-end");Rt&&(Mt.observe(Rt),window.addCleanup(()=>Mt.disconnect()))})})(),(function(){var Zt=Object.create,Mt=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,Rt=Object.getOwnPropertyNames,Gt=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty,y=(t,e)=>()=>(t&&(e=t(t=0)),e),Br=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),$t=(t,e)=>{for(var r in e)Mt(t,r,{get:e[r],enumerable:!0})},ni=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Rt(e))!Ft.call(t,n)&&n!==r&&Mt(t,n,{get:()=>e[n],enumerable:!(i=Vt(e,n))||i.enumerable});return t},Sr=(t,e,r)=>(r=t!=null?Zt(Gt(t)):{},ni(e||!t||!t.__esModule?Mt(r,"default",{value:t,enumerable:!0}):r,t)),k,Dt,jt,Se,Z=y(()=>{"use strict";k=(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))(k||{}),Dt=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},jt=(t,e)=>Dt(t).priority??e,Se={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Dt).forEach(e=>{e.type.forEach(r=>this._removeHandlers[r]?.(e))}),this},add(...t){return t.map(Dt).forEach(e=>{e.type.forEach(r=>{let i=this._addHandlers,n=this._queue;i[r]?i[r]?.(e):(n[r]=n[r]||[],n[r]?.push(e))})}),this},handle(t,e,r){let i=this._addHandlers,n=this._removeHandlers;if(i[t]||n[t])throw new Error(`Extension type ${t} already has a handler`);i[t]=e,n[t]=r;let s=this._queue;return s[t]&&(s[t]?.forEach(a=>e(a)),delete s[t]),this},handleByMap(t,e){return this.handle(t,r=>{r.name&&(e[r.name]=r.ref)},r=>{r.name&&delete e[r.name]})},handleByNamedList(t,e,r=-1){return this.handle(t,i=>{e.findIndex(n=>n.name===i.name)>=0||(e.push({name:i.name,value:i.ref}),e.sort((n,s)=>jt(s.value,r)-jt(n.value,r)))},i=>{let n=e.findIndex(s=>s.name===i.name);n!==-1&&e.splice(n,1)})},handleByList(t,e,r=-1){return this.handle(t,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((n,s)=>jt(s,r)-jt(n,r)))},i=>{let n=e.indexOf(i.ref);n!==-1&&e.splice(n,1)})},mixin(t,...e){for(let r of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(r))}}}),mr=Br((t,e)=>{"use strict";var r=Object.prototype.hasOwnProperty,i="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(i=!1));function s(u,c,f){this.fn=u,this.context=c,this.once=f||!1}function a(u,c,f,_,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var b=new s(f,_||u,g),T=i?i+c:c;return u._events[T]?u._events[T].fn?u._events[T]=[u._events[T],b]:u._events[T].push(b):(u._events[T]=b,u._eventsCount++),u}function o(u,c){--u._eventsCount===0?u._events=new n:delete u._events[c]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],c,f;if(this._eventsCount===0)return u;for(f in c=this._events)r.call(c,f)&&u.push(i?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},l.prototype.listeners=function(u){var c=i?i+u:u,f=this._events[c];if(!f)return[];if(f.fn)return[f.fn];for(var _=0,g=f.length,b=new Array(g);_{Er=Sr(mr(),1),Tt=Er.default}),si,Qt,Nt,yt,fr,Qr,_r,ai,de,J,pe,Je,st,pt,tt,_t,ct,ut,kt,Fe,We,be,ke,mt,Pe,ft,Ut,H,ee,fe=y(()=>{si={grad:.9,turn:360,rad:360/(2*Math.PI)},Qt=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},Nt=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},yt=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},fr=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Qr=function(t){return{r:yt(t.r,0,255),g:yt(t.g,0,255),b:yt(t.b,0,255),a:yt(t.a)}},_r=function(t){return{r:Nt(t.r),g:Nt(t.g),b:Nt(t.b),a:Nt(t.a,3)}},ai=/^#([0-9a-f]{3,8})$/i,de=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},J=function(t){var e=t.r,r=t.g,i=t.b,n=t.a,s=Math.max(e,r,i),a=s-Math.min(e,r,i),o=a?s===e?(r-i)/a:s===r?2+(i-e)/a:4+(e-r)/a:0;return{h:60*(o<0?o+6:o),s:s?a/s*100:0,v:s/255*100,a:n}},pe=function(t){var e=t.h,r=t.s,i=t.v,n=t.a;e=e/360*6,r/=100,i/=100;var s=Math.floor(e),a=i*(1-r),o=i*(1-(e-s)*r),l=i*(1-(1-e+s)*r),u=s%6;return{r:255*[i,o,a,a,l,i][u],g:255*[l,i,i,o,a,a][u],b:255*[a,a,l,i,i,o][u],a:n}},Je=function(t){return{h:fr(t.h),s:yt(t.s,0,100),l:yt(t.l,0,100),a:yt(t.a)}},st=function(t){return{h:Nt(t.h),s:Nt(t.s),l:Nt(t.l),a:Nt(t.a,3)}},pt=function(t){return pe((r=(e=t).s,{h:e.h,s:(r*=((i=e.l)<50?i:100-i)/100)>0?2*r/(i+r)*100:0,v:i+r,a:e.a}));var e,r,i},tt=function(t){return{h:(e=J(t)).h,s:(n=(200-(r=e.s))*(i=e.v)/100)>0&&n<200?r*i/100/(n<=100?n:200-n)*100:0,l:n/2,a:e.a};var e,r,i,n},_t=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ct=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ut=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,kt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Fe={string:[[function(t){var e=ai.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?Nt(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?Nt(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=ut.exec(t)||kt.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Qr({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=_t.exec(t)||ct.exec(t);if(!e)return null;var r,i,n=Je({h:(r=e[1],i=e[2],i===void 0&&(i="deg"),Number(r)*(si[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return pt(n)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,i=t.b,n=t.a,s=n===void 0?1:n;return Qt(e)&&Qt(r)&&Qt(i)?Qr({r:Number(e),g:Number(r),b:Number(i),a:Number(s)}):null},"rgb"],[function(t){var e=t.h,r=t.s,i=t.l,n=t.a,s=n===void 0?1:n;if(!Qt(e)||!Qt(r)||!Qt(i))return null;var a=Je({h:Number(e),s:Number(r),l:Number(i),a:Number(s)});return pt(a)},"hsl"],[function(t){var e=t.h,r=t.s,i=t.v,n=t.a,s=n===void 0?1:n;if(!Qt(e)||!Qt(r)||!Qt(i))return null;var a=(function(o){return{h:fr(o.h),s:yt(o.s,0,100),v:yt(o.v,0,100),a:yt(o.a)}})({h:Number(e),s:Number(r),v:Number(i),a:Number(s)});return pe(a)},"hsv"]]},We=function(t,e){for(var r=0;r=.5},t.prototype.toHex=function(){return e=_r(this.rgba),r=e.r,i=e.g,n=e.b,a=(s=e.a)<1?de(Nt(255*s)):"","#"+de(r)+de(i)+de(n)+a;var e,r,i,n,s,a},t.prototype.toRgb=function(){return _r(this.rgba)},t.prototype.toRgbString=function(){return e=_r(this.rgba),r=e.r,i=e.g,n=e.b,(s=e.a)<1?"rgba("+r+", "+i+", "+n+", "+s+")":"rgb("+r+", "+i+", "+n+")";var e,r,i,n,s},t.prototype.toHsl=function(){return st(tt(this.rgba))},t.prototype.toHslString=function(){return e=st(tt(this.rgba)),r=e.h,i=e.s,n=e.l,(s=e.a)<1?"hsla("+r+", "+i+"%, "+n+"%, "+s+")":"hsl("+r+", "+i+"%, "+n+"%)";var e,r,i,n,s},t.prototype.toHsv=function(){return e=J(this.rgba),{h:Nt(e.h),s:Nt(e.s),v:Nt(e.v),a:Nt(e.a,3)};var e},t.prototype.invert=function(){return Ut({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),Ut(ke(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),Ut(ke(this.rgba,-e))},t.prototype.grayscale=function(){return Ut(ke(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),Ut(Pe(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),Ut(Pe(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"?Ut({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):Nt(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=tt(this.rgba);return typeof e=="number"?Ut({h:e,s:r.s,l:r.l,a:r.a}):Nt(r.h)},t.prototype.isEqual=function(e){return this.toHex()===Ut(e).toHex()},t})(),Ut=function(t){return t instanceof ft?t:new ft(t)},H=[],ee=function(t){t.forEach(function(e){H.indexOf(e)<0&&(e(ft,Fe),H.push(e))})}});function De(t,e){var r={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"},i={};for(var n in r)i[r[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,u=i[this.toHex()];if(u)return u;if(a?.closest){var c=this.toRgb(),f=1/0,_="black";if(!s.length)for(var g in r)s[g]=new t(r[g]).toRgb();for(var b in r){var T=(o=c,l=s[b],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));T{}),Me,ge,Ke=y(()=>{fe(),Ge(),ee([De]),Me=class Aa{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 Aa)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,r){let i=typeof e;if(i!==typeof r)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===r;if(Array.isArray(e)&&Array.isArray(r)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(r))return e.length!==r.length?!1:e.every((n,s)=>n===r[s]);if(e!==null&&r!==null){let n=Object.keys(e),s=Object.keys(r);return n.length!==s.length?!1:n.every(a=>e[a]===r[a])}return e===r}toRgba(){let[e,r,i,n]=this._components;return{r:e,g:r,b:i,a:n}}toRgb(){let[e,r,i]=this._components;return{r:e,g:r,b:i}}toRgbaString(){let[e,r,i]=this.toUint8RgbArray();return`rgba(${e},${r},${i},${this.alpha})`}toUint8RgbArray(e){let[r,i,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(r*255),e[1]=Math.round(i*255),e[2]=Math.round(n*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);let[r,i,n,s]=this._components;return e[0]=r,e[1]=i,e[2]=n,e[3]=s,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);let[r,i,n]=this._components;return e[0]=r,e[1]=i,e[2]=n,e}toNumber(){return this._int}toBgrNumber(){let[e,r,i]=this.toUint8RgbArray();return(i<<16)+(r<<8)+e}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[r,i,n,s]=Aa._temp.setValue(e)._components;return this._components[0]*=r,this._components[1]*=i,this._components[2]*=n,this._components[3]*=s,this._refreshInt(),this._value=null,this}premultiply(e,r=!0){return r&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,r=!0){if(e===1)return(255<<24)+this._int;if(e===0)return r?0:this._int;let i=this._int>>16&255,n=this._int>>8&255,s=this._int&255;return r&&(i=i*e+.5|0,n=n*e+.5|0,s=s*e+.5|0),(e*255<<24)+(i<<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 r,i,n,s;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let a=e;r=(a>>16&255)/255,i=(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),[r,i,n,s=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[r,i,n,s=255]=e,r/=255,i/=255,n/=255,s/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let o=Aa.HEX_PATTERN.exec(e);o&&(e=`#${o[2]}`)}let a=Ut(e);a.isValid()&&({r,g:i,b:n,a:s}=a.rgba,r/=255,i/=255,n/=255)}if(r!==void 0)this._components[0]=r,this._components[1]=i,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,r,i]=this._components;this._int=(e*255<<16)+(r*255<<8)+(i*255|0)}_clamp(e,r=0,i=1){return typeof e=="number"?Math.min(Math.max(e,r),i):(e.forEach((n,s)=>{e[s]=Math.min(Math.max(n,r),i)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof Aa||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}},Me.shared=new Me,Me._temp=new Me,Me.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i,ge=Me}),xt,Jt=y(()=>{"use strict";xt={cullArea:null,cullable:!1,cullableChildren:!0}}),ur,rt,St,Le=y(()=>{"use strict";ur=Math.PI*2,rt=180/Math.PI,St=Math.PI/180}),ye,Et,we=y(()=>{"use strict";ye=class Dy{constructor(e=0,r=0){this.x=0,this.y=0,this.x=e,this.y=r}clone(){return new Dy(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,r=e){return this.x=e,this.y=r,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Et.x=0,Et.y=0,Et}},Et=new ye}),me,vr,yr,et=y(()=>{Le(),we(),me=class Uy{constructor(e=1,r=0,i=0,n=1,s=0,a=0){this.array=null,this.a=e,this.b=r,this.c=i,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,r,i,n,s,a){return this.a=e,this.b=r,this.c=i,this.d=n,this.tx=s,this.ty=a,this}toArray(e,r){this.array||(this.array=new Float32Array(9));let i=r||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(e,r){r=r||new ye;let i=e.x,n=e.y;return r.x=this.a*i+this.c*n+this.tx,r.y=this.b*i+this.d*n+this.ty,r}applyInverse(e,r){r=r||new ye;let i=this.a,n=this.b,s=this.c,a=this.d,o=this.tx,l=this.ty,u=1/(i*a+s*-n),c=e.x,f=e.y;return r.x=a*u*c+-s*u*f+(l*s-o*a)*u,r.y=i*u*f+-n*u*c+(-l*i+o*n)*u,r}translate(e,r){return this.tx+=e,this.ty+=r,this}scale(e,r){return this.a*=e,this.d*=r,this.c*=e,this.b*=r,this.tx*=e,this.ty*=r,this}rotate(e){let r=Math.cos(e),i=Math.sin(e),n=this.a,s=this.c,a=this.tx;return this.a=n*r-this.b*i,this.b=n*i+this.b*r,this.c=s*r-this.d*i,this.d=s*i+this.d*r,this.tx=a*r-this.ty*i,this.ty=a*i+this.ty*r,this}append(e){let r=this.a,i=this.b,n=this.c,s=this.d;return this.a=e.a*r+e.b*n,this.b=e.a*i+e.b*s,this.c=e.c*r+e.d*n,this.d=e.c*i+e.d*s,this.tx=e.tx*r+e.ty*n+this.tx,this.ty=e.tx*i+e.ty*s+this.ty,this}appendFrom(e,r){let i=e.a,n=e.b,s=e.c,a=e.d,o=e.tx,l=e.ty,u=r.a,c=r.b,f=r.c,_=r.d;return this.a=i*u+n*f,this.b=i*c+n*_,this.c=s*u+a*f,this.d=s*c+a*_,this.tx=o*u+l*f+r.tx,this.ty=o*c+l*_+r.ty,this}setTransform(e,r,i,n,s,a,o,l,u){return this.a=Math.cos(o+u)*s,this.b=Math.sin(o+u)*s,this.c=-Math.sin(o-l)*a,this.d=Math.cos(o-l)*a,this.tx=e-(i*this.a+n*this.c),this.ty=r-(i*this.b+n*this.d),this}prepend(e){let r=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let i=this.a,n=this.c;this.a=i*e.a+this.b*e.c,this.b=i*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=r*e.a+this.ty*e.c+e.tx,this.ty=r*e.b+this.ty*e.d+e.ty,this}decompose(e){let r=this.a,i=this.b,n=this.c,s=this.d,a=e.pivot,o=-Math.atan2(-n,s),l=Math.atan2(i,r),u=Math.abs(o+l);return u<1e-5||Math.abs(ur-u)<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(r*r+i*i),e.scale.y=Math.sqrt(n*n+s*s),e.position.x=this.tx+(a.x*r+a.y*n),e.position.y=this.ty+(a.x*i+a.y*s),e}invert(){let e=this.a,r=this.b,i=this.c,n=this.d,s=this.tx,a=e*n-r*i;return this.a=n/a,this.b=-r/a,this.c=-i/a,this.d=e/a,this.tx=(i*this.ty-n*s)/a,this.ty=-(e*this.ty-r*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 Uy;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 yr.identity()}static get shared(){return vr.identity()}},vr=new me,yr=new me}),Bt,Ti=y(()=>{"use strict";Bt=class Ly{constructor(e,r,i){this._x=r||0,this._y=i||0,this._observer=e}clone(e){return new Ly(e??this._observer,this._x,this._y)}set(e=0,r=e){return(this._x!==e||this._y!==r)&&(this._x=e,this._y=r,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=${this._x} y=${this._y} 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 dt(t="default"){return Fr[t]===void 0&&(Fr[t]=-1),++Fr[t]}var Fr,er=y(()=>{"use strict";Fr={default:-1}}),oi,gt,Vi,Cr,$e,Ot=y(()=>{"use strict";oi=new Set,gt="8.0.0",Vi="8.3.4",Cr={quiet:!1,noColor:!1},$e=(t,e,r=3)=>{if(Cr.quiet||oi.has(e))return;let i=new Error().stack,n=`${e} Deprecated since v${t}`,s=typeof console.groupCollapsed=="function"&&!Cr.noColor;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",n):(i=i.split(` `).splice(r).join(` `),s?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",n),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",n),console.warn(i))),oi.add(e)},Object.defineProperties($e,{quiet:{get:()=>Cr.quiet,set:t=>{Cr.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>Cr.noColor,set:t=>{Cr.noColor=t},enumerable:!0,configurable:!1}})});function it(...t){Dr!==Si&&(Dr++,Dr===Si?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}var Dr,Si,It=y(()=>{"use strict";Dr=0,Si=500}),li,zr=y(()=>{"use strict";li={_registeredResources:new Set,register(t){this._registeredResources.add(t)},unregister(t){this._registeredResources.delete(t)},release(){this._registeredResources.forEach(t=>t.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(t){return this._registeredResources.has(t)},reset(){this._registeredResources.clear()}}}),Wn,Hr=y(()=>{"use strict";Wn=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;e0?e=this._pool[--this._index]:(e=new this._classType,this._count++),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(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t{zr(),Hr(),$i=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 Wn(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}},qt=new $i,li.register(qt)}),rn,nn=y(()=>{Ot(),rn={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(t){typeof t=="boolean"&&t===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(t===!0?{}:t))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){$e("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}}});function Or(t,e,r){let i=t.length,n;if(e>=i||r===0)return;r=e+r>i?i-e:r;let s=i-r;for(n=e;n{"use strict"}),bn,sn=y(()=>{xn(),Ot(),bn={allowChildren:!0,removeChildren(t=0,e){let r=e??this.children.length,i=r-t,n=[];if(i>0&&i<=r){for(let a=r-1;a>=t;a--){let o=this.children[a];o&&(n.push(o),o.parent=null)}Or(this.children,t,r);let s=this.renderGroup||this.parentRenderGroup;s&&s.removeChildren(n);for(let a=0;a0&&this._didViewChangeTick++,n}else if(i===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||$e(gt,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:r}=this;if(e<0||e>r.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${r.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===r.length?r.push(t):r.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.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 r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=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 r=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);let i=this.worldTransform.clone();return i.invert(),r.prepend(i),t.setFromMatrix(r),t},replaceChild(t,e){t.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(t)),e.setFromMatrix(t.localTransform),e.updateLocalTransform(),this.removeChild(t)}}}),Wr,Xi=y(()=>{"use strict";Wr={collectRenderables(t,e,r){this.parentRenderLayer&&this.parentRenderLayer!==r||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,r):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,r))},collectRenderablesSimple(t,e,r){let i=this.children,n=i.length;for(let s=0;s=0;n--){let s=this.effects[n];i[s.pipe].pop(s,this,t)}}}}),hi,Vr=y(()=>{"use strict";hi=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t{Z(),jr(),Vn=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{Vr(),on(),ws={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){this.effects.indexOf(t)===-1&&(this.effects.push(t),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){let e=this.effects.indexOf(t);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){let e=this._maskEffect;e?.mask!==t&&(e&&(this.removeEffect(e),an.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=an.getMaskEffect(t),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},set filters(t){!Array.isArray(t)&&t&&(t=[t]);let e=this._filterEffect||(this._filterEffect=new hi);t=t;let r=t?.length>0,i=e.filters?.length>0,n=r!==i;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),n&&(r?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){return this._filterEffect?.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new hi),this._filterEffect.filterArea=t},get filterArea(){return this._filterEffect?.filterArea}}}),Ss,Ma=y(()=>{Ot(),Ss={label:null,get name(){return $e(gt,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){$e(gt,"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 r=this.children;for(let i=0;i{we(),Ei=[new ye,new ye,new ye,new ye],Wt=class El{constructor(e=0,r=0,i=0,n=0){this.type="rectangle",this.x=Number(e),this.y=Number(r),this.width=Number(i),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 El(0,0,0,0)}clone(){return new El(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,r){return this.width<=0||this.height<=0?!1:e>=this.x&&e=this.y&&r=f&&e<=_&&r>=g&&r<=b&&!(e>T&&eS&&re.right?e.right:this.right)<=ae)return!1;let ce=this.ye.bottom?e.bottom:this.bottom)>ce}let i=this.left,n=this.right,s=this.top,a=this.bottom;if(n<=i||a<=s)return!1;let o=Ei[0].set(e.left,e.top),l=Ei[1].set(e.left,e.bottom),u=Ei[2].set(e.right,e.top),c=Ei[3].set(e.right,e.bottom);if(u.x<=o.x||l.y<=o.y)return!1;let f=Math.sign(r.a*r.d-r.b*r.c);if(f===0||(r.apply(o,o),r.apply(l,l),r.apply(u,u),r.apply(c,c),Math.max(o.x,l.x,u.x,c.x)<=i||Math.min(o.x,l.x,u.x,c.x)>=n||Math.max(o.y,l.y,u.y,c.y)<=s||Math.min(o.y,l.y,u.y,c.y)>=a))return!1;let _=f*(l.y-o.y),g=f*(o.x-l.x),b=_*i+g*s,T=_*n+g*s,x=_*i+g*a,S=_*n+g*a;if(Math.max(b,T,x,S)<=_*o.x+g*o.y||Math.min(b,T,x,S)>=_*c.x+g*c.y)return!1;let P=f*(o.y-u.y),B=f*(u.x-o.x),A=P*i+B*s,X=P*n+B*s,W=P*i+B*a,q=P*n+B*a;return!(Math.max(A,X,W,q)<=P*o.x+B*o.y||Math.min(A,X,W,q)>=P*c.x+B*c.y)}pad(e=0,r=e){return this.x-=e,this.y-=r,this.width+=e*2,this.height+=r*2,this}fit(e){let r=Math.max(this.x,e.x),i=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=r,this.width=Math.max(i-r,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(e=1,r=.001){let i=Math.ceil((this.x+this.width-r)*e)/e,n=Math.ceil((this.y+this.height-r)*e)/e;return this.x=Math.floor((this.x+r)*e)/e,this.y=Math.floor((this.y+r)*e)/e,this.width=i-this.x,this.height=n-this.y,this}scale(e,r=e){return this.x*=e,this.y*=r,this.width*=e,this.height*=r,this}enlarge(e){let r=Math.min(this.x,e.x),i=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=r,this.width=i-r,this.y=n,this.height=s-n,this}getBounds(e){return e||(e=new El),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;let r=e.x,i=e.y,n=e.x+e.width,s=e.y+e.height;return r>=this.x&&r=this.y&&i=this.x&&n=this.y&&s{et(),nr(),wn=new me,pr=class Ny{constructor(e=1/0,r=1/0,i=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=wn,this.minX=e,this.minY=r,this.maxX=i,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Wt);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=wn,this}set(e,r,i,n){this.minX=e,this.minY=r,this.maxX=i,this.maxY=n}addFrame(e,r,i,n,s){s||(s=this.matrix);let a=s.a,o=s.b,l=s.c,u=s.d,c=s.tx,f=s.ty,_=this.minX,g=this.minY,b=this.maxX,T=this.maxY,x=a*e+l*r+c,S=o*e+u*r+f;x<_&&(_=x),Sb&&(b=x),S>T&&(T=S),x=a*i+l*r+c,S=o*i+u*r+f,x<_&&(_=x),Sb&&(b=x),S>T&&(T=S),x=a*e+l*n+c,S=o*e+u*n+f,x<_&&(_=x),Sb&&(b=x),S>T&&(T=S),x=a*i+l*n+c,S=o*i+u*n+f,x<_&&(_=x),Sb&&(b=x),S>T&&(T=S),this.minX=_,this.minY=g,this.maxX=b,this.maxY=T}addRect(e,r){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,r)}addBounds(e,r){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,r)}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.maxXthis.maxX?_:this.maxX,this.maxY=g>this.maxY?g:this.maxY,_=a*r+l*s+c,g=o*r+u*s+f,this.minX=_this.maxX?_:this.maxX,this.maxY=g>this.maxY?g:this.maxY,_=a*n+l*s+c,g=o*n+u*s+f,this.minX=_this.maxX?_:this.maxX,this.maxY=g>this.maxY?g:this.maxY}fit(e){return this.minXe.right&&(this.maxX=e.right),this.minYe.bottom&&(this.maxY=e.bottom),this}fitBounds(e,r,i,n){return this.minXr&&(this.maxX=r),this.minYn&&(this.maxY=n),this}pad(e,r=e){return this.minX-=e,this.maxX+=e,this.minY-=r,this.maxY+=r,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 Ny(this.minX,this.minY,this.maxX,this.maxY)}scale(e,r=e){return this.minX*=e,this.minY*=r,this.maxX*=e,this.maxY*=r,this}get x(){return this.minX}set x(e){let r=this.maxX-this.minX;this.minX=e,this.maxX=e+r}get y(){return this.minY}set y(e){let r=this.maxY-this.minY;this.minY=e,this.maxY=e+r}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,r,i,n){let s=this.minX,a=this.minY,o=this.maxX,l=this.maxY;n||(n=this.matrix);let u=n.a,c=n.b,f=n.c,_=n.d,g=n.tx,b=n.ty;for(let T=r;To?P:o,l=B>l?B:l}this.minX=s,this.minY=a,this.maxX=o,this.maxY=l}containsPoint(e,r){return this.minX<=e&&this.minY<=r&&this.maxX>=e&&this.maxY>=r}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}}),cr,Pr,xr=y(()=>{et(),jr(),Ar(),cr=qt.getPool(me),Pr=qt.getPool(pr)}),dr,M,O=y(()=>{et(),Ar(),xr(),dr=new me,M={getFastGlobalBounds(t,e){e||(e=new pr),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);let r=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(r.worldTransform),e},_getGlobalBoundsRecursive(t,e,r){let i=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==r||this.localDisplayStatus!==7||!this.measurable)return;let n=!!this.effects.length;if((this.renderGroup||n)&&(i=Pr.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let a=this.bounds;i.addFrame(a.minX,a.minY,a.maxX,a.maxY,this.groupTransform)}let s=this.children;for(let a=0;a{et(),xr()});function ne(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;let r=t>>16&255,i=t>>8&255,n=t&255,s=e>>16&255,a=e>>8&255,o=e&255,l=r*s/255|0,u=i*a/255|0,c=n*o/255|0;return(l<<16)+(u<<8)+c}var le=y(()=>{"use strict"});function Te(t,e){return t===Ae?e:e===Ae?t:ne(t,e)}var Ae,Ue=y(()=>{le(),Ae=16777215});function se(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}var Oe,h=y(()=>{et(),K(),xr(),Ue(),Oe={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,r=this.parent;for(;r;)e*=r.alpha,r=r.parent;return e},getGlobalTransform(t=new me,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();let r=Q(this,cr.get().identity());return t.appendFrom(this.localTransform,r),cr.return(r),t},getGlobalTint(t){if(t)return this.renderGroup?se(this.renderGroup.worldColor):this.parentRenderGroup?se(Te(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,r=this.parent;for(;r;)e=Te(e,r.localColor),r=r.parent;return se(e)}}});function d(t,e,r){return e.clear(),r||(r=me.IDENTITY),p(t,e,r,t,!0),e.isValid||e.set(0,0,0,0),e}function p(t,e,r,i,n){let s;if(n)s=cr.get(),s=r.copyTo(s);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();let l=t.localTransform;s=cr.get(),s.appendFrom(l,r)}let a=e,o=!!t.effects.length;if(o&&(e=Pr.get().clear()),t.boundsArea)e.addRect(t.boundsArea,s);else{t.renderPipeId&&(e.matrix=s,e.addBounds(t.bounds));let l=t.children;for(let u=0;u{et(),xr()});function m(t,e){let r=t.children;for(let i=0;i{"use strict"}),E,C,R=y(()=>{et(),Ar(),K(),v(),w(),E=new me,C={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){let r=Math.sign(this.scale.x)||1;e!==0?this.scale.x=t/e*r:this.scale.x=r},_setHeight(t,e){let r=Math.sign(this.scale.y)||1;e!==0?this.scale.y=t/e*r:this.scale.y=r},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new pr});let t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),m(this,t),t.didChange&&d(this,t.localBounds,E),t.localBounds},getBounds(t,e){return j(this,t,e||new pr)}}}),G,U=y(()=>{"use strict";G={_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 F(t,e){return t._zIndex-e._zIndex}var Y,I=y(()=>{"use strict";Y={_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(F))}}}),z,N=y(()=>{we(),xr(),z={getGlobalPosition(t=new ye,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,r=!1){let i=this.getGlobalTransform(cr.get(),r);return e=i.apply(t,e),cr.return(i),e},toLocal(t,e,r,i){e&&(t=e.toGlobal(t,r,i));let n=this.getGlobalTransform(cr.get(),i);return r=n.applyInverse(t,r),cr.return(n),r}}}),L,ue=y(()=>{er(),L=class{constructor(){this.uid=dt("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function oe(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 Re(t){return!(t&t-1)&&!!t}var Ne=y(()=>{"use strict"});function ot(t){let e={};for(let r in t)t[r]!==void 0&&(e[r]=t[r]);return e}var Ye=y(()=>{"use strict"});function at(t){let e=Ie[t];return e===void 0&&(Ie[t]=dt("resource")),e}var Ie,nt,_e,xe=y(()=>{Xt(),er(),Ot(),Ie=Object.create(null),nt=class zy extends Tt{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...zy.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){$e(gt,"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._sharedResourceId=null,this.emit("change",this)}_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=at(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}},nt.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"},_e=nt}),qe,Ze,lt=y(()=>{Xt(),Ne(),Ye(),er(),xe(),qe=class Hy extends Tt{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=dt("textureSource"),this._resourceType="textureSource",this._resourceId=dt("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={...Hy.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 _e(ot(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())}set maxAnisotropy(e){this._style.maxAnisotropy=e}get maxAnisotropy(){return this._style.maxAnisotropy}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.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=dt("resource"),this.emit("change",this),this.emit("unload",this);for(let e in this._gpuData)this._gpuData[e]?.destroy?.();this._gpuData=Object.create(null)}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,r,i){i||(i=this._resolution),e||(e=this.width),r||(r=this.height);let n=Math.round(e*i),s=Math.round(r*i);return this.width=n/i,this.height=s/i,this._resolution=i,this.pixelWidth===n&&this.pixelHeight===s?!1:(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=s,this.emit("resize",this),this._resourceId=dt("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=Re(this.pixelWidth)&&Re(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}},qe.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1},Ze=qe});function vt(){for(let t=0;t<16;t++){let e=[];Ci.push(e);for(let r=0;r<16;r++){let i=Ai(Yt[t]*Yt[r]+zt[t]*br[r]),n=Ai(br[t]*Yt[r]+Jr[t]*br[r]),s=Ai(Yt[t]*zt[r]+zt[t]*Jr[r]),a=Ai(br[t]*zt[r]+Jr[t]*Jr[r]);for(let o=0;o<16;o++)if(Yt[o]===i&&br[o]===n&&zt[o]===s&&Jr[o]===a){e.push(o);break}}}for(let t=0;t<16;t++){let e=new me;e.set(Yt[t],br[t],zt[t],Jr[t],0,0),Yi.push(e)}}var Yt,br,zt,Jr,Ci,Yi,Ai,Ct,Xe=y(()=>{et(),Yt=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],br=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],zt=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Jr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ci=[],Yi=[],Ai=Math.sign,vt(),Ct={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=>Yt[t],uY:t=>br[t],vX:t=>zt[t],vY:t=>Jr[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Ci[t][e],sub:(t,e)=>Ci[t][Ct.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?Ct.S:Ct.N:Math.abs(e)*2<=Math.abs(t)?t>0?Ct.E:Ct.W:e>0?t>0?Ct.SE:Ct.SW:t>0?Ct.NE:Ct.NW,matrixAppendRotationInv:(t,e,r=0,i=0)=>{let n=Yi[Ct.inv(e)];n.tx=r,n.ty=i,t.append(n)},transformRectCoords:(t,e,r,i)=>{let{x:n,y:s,width:a,height:o}=t,{x:l,y:u,width:c,height:f}=e;return r===Ct.E?(i.set(n+l,s+u,a,o),i):r===Ct.S?i.set(c-s-o+l,n+u,o,a):r===Ct.W?i.set(c-n-a+l,f-s-o+u,a,o):r===Ct.N?i.set(s+l,f-n-a+u,o,a):i.set(n+l,s+u,a,o)}}}),tr,Ra=y(()=>{"use strict";tr=()=>{}}),ka,kd=y(()=>{Z(),lt(),ka=class extends Ze{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),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}},ka.extension=k.TextureSource}),Al,Pl,Bd=y(()=>{et(),Al=new me,Pl=class{constructor(t,e){this.mapCoord=new me,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 r=this.mapCoord;for(let i=0;i{Xt(),Xe(),nr(),er(),Ot(),Ra(),kd(),lt(),Bd(),He=class extends Tt{constructor({source:t,label:e,frame:r,orig:i,trim:n,defaultAnchor:s,defaultBorders:a,rotate:o,dynamic:l}={}){if(super(),this.uid=dt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Wt,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new Ze,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:u,height:c}=this._source;this.frame.width=u,this.frame.height=c}this.orig=i||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 Pl(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:i}=this._source,n=e.x/r,s=e.y/i,a=e.width/r,o=e.height/i,l=this.rotate;if(l){let u=a/2,c=o/2,f=n+u,_=s+c;l=Ct.add(l,Ct.NW),t.x0=f+u*Ct.uX(l),t.y0=_+c*Ct.uY(l),l=Ct.add(l,2),t.x1=f+u*Ct.uX(l),t.y1=_+c*Ct.uY(l),l=Ct.add(l,2),t.x2=f+u*Ct.uX(l),t.y2=_+c*Ct.uY(l),l=Ct.add(l,2),t.x3=f+u*Ct.uX(l),t.y3=_+c*Ct.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&&(this._source.off("resize",this.update,this),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 $e(gt,"Texture.baseTexture is now Texture.source"),this._source}},He.EMPTY=new He({label:"EMPTY",source:new Ze({label:"EMPTY"})}),He.EMPTY.destroy=tr,He.WHITE=new He({source:new ka({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),He.WHITE.destroy=tr}),Od,Id,wr,Tn=y(()=>{Ne(),zr(),lt(),Kt(),xe(),Od=0,Id=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new _e(this.textureOptions)}createTexture(t,e,r){let i=new Ze({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new He({source:i,label:`texturePool_${Od++}`})}getOptimalTexture(t,e,r=1,i){let n=Math.ceil(t*r-1e-6),s=Math.ceil(e*r-1e-6);n=oe(n),s=oe(s);let a=(n<<17)+(s<<1)+(i?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let o=this._texturePool[a].pop();return o||(o=this.createTexture(n,s,i)),o.source._resolution=r,o.source.width=n/r,o.source.height=s/r,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 r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t,e=!1){let r=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[r].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let i=0;i{et(),ue(),Tn(),Ba=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new me,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new L,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let r=0;r-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 r=0;r0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e{"use strict"}),Oa,Es,Ia,Cs,As,Ga,$n,Ir,Pi=y(()=>{Xt(),Ke(),Jt(),Z(),et(),Le(),Ti(),er(),Ot(),It(),jr(),nn(),sn(),Xi(),Ts(),Ma(),O(),h(),R(),U(),I(),N(),Gd(),xx(),Oa=new Bt(null),Es=new Bt(null),Ia=new Bt(null,1,1),Cs=new Bt(null),As=1,Ga=2,$n=4,Ir=class jy extends Tt{constructor(e={}){super(),this.uid=dt("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.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new me,this.relativeGroupTransform=new me,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Bt(this,0,0),this._scale=Ia,this._pivot=Es,this._origin=Cs,this._skew=Oa,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=[],yx(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(r=>this.addChild(r)),e.parent?.addChild(this)}static mixin(e){$e("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),Se.mixin(jy,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||$e(gt,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let n=0;n1){for(let n=0;n-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(r):this.parentRenderGroup&&this.parentRenderGroup.removeChild(r),r.parentRenderLayer&&r.parentRenderLayer.detach(r),r.parent=null,this.emit("childRemoved",r,this,i),r.emit("removed",this)),r}_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=qt.get(Ba,this),this.groupTransform=me.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),qt.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 me),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*rt}set angle(e){this.rotation=e*St}get pivot(){return this._pivot===Es&&(this._pivot=new Bt(this,0,0)),this._pivot}set pivot(e){this._pivot===Es&&(this._pivot=new Bt(this,0,0),this._origin!==Cs&&it("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===Oa&&(this._skew=new Bt(this,0,0)),this._skew}set skew(e){this._skew===Oa&&(this._skew=new Bt(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Ia&&(this._scale=new Bt(this,1,1)),this._scale}set scale(e){this._scale===Ia&&(this._scale=new Bt(this,0,0)),typeof e=="string"&&(e=parseFloat(e)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get origin(){return this._origin===Cs&&(this._origin=new Bt(this,0,0)),this._origin}set origin(e){this._origin===Cs&&(this._origin=new Bt(this,0,0),this._pivot!==Es&&it("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._origin.set(e):this._origin.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let r=this.getLocalBounds().width;this._setWidth(e,r)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let r=this.getLocalBounds().height;this._setHeight(e,r)}getSize(e){e||(e={});let r=this.getLocalBounds();return e.width=Math.abs(this.scale.x*r.width),e.height=Math.abs(this.scale.y*r.height),e}setSize(e,r){let i=this.getLocalBounds();typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,i.width),r!==void 0&&this._setHeight(r,i.height)}_updateSkew(){let e=this._rotation,r=this._skew;this._cx=Math.cos(e+r._y),this._sx=Math.sin(e+r._y),this._cy=-Math.sin(e-r._x),this._sy=Math.cos(e-r._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.origin.set(typeof e.originX=="number"?e.originX:this.origin.x,typeof e.originY=="number"?e.originY:this.origin.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;let r=this.localTransform,i=this._scale,n=this._pivot,s=this._origin,a=this._position,o=i._x,l=i._y,u=n._x,c=n._y,f=-s._x,_=-s._y;r.a=this._cx*o,r.b=this._sx*o,r.c=this._cy*l,r.d=this._sy*l,r.tx=a._x-(u*r.a+c*r.c)+(f*r.a+_*r.c)-f,r.ty=a._y-(u*r.b+c*r.d)+(f*r.b+_*r.d)-_}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=As,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let r=ge.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=As,this._onUpdate())}get tint(){return se(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Ga,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let r=e?2:0;(this.localDisplayStatus&2)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=$n,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let r=e?0:4;(this.localDisplayStatus&4)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=$n,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let r=e?1:0;(this.localDisplayStatus&1)!==r&&(this._updateFlags|=$n,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 r;if(this.children.length&&(r=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof e=="boolean"?e:e?.children)&&r)for(let i=0;i{"use strict";Sn=(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))(Sn||{})}),Da,bx=y(()=>{"use strict";Da=class{constructor(t,e=null,r=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=i}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}}}),Ml,ei,Ps=y(()=>{Fa(),bx(),Ml=class ii{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 Da(null,null,1/0),this.deltaMS=1/ii.targetFPMS,this.elapsedMS=1/ii.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,r,i=Sn.NORMAL){return this._addListener(new Da(e,r,i))}addOnce(e,r,i=Sn.NORMAL){return this._addListener(new Da(e,r,i,!0))}_addListener(e){let r=this._head.next,i=this._head;if(!r)e.connect(i);else{for(;r;){if(e.priority>r.priority){e.connect(i);break}i=r,r=r.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,r){let i=this._head.next;for(;i;)i.match(e,r)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,r=this._head;for(;r=r.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 r;if(e>this.lastTime){if(r=this.elapsedMS=e-this.lastTime,r>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){let s=e-this._lastFrame|0;if(s{Fa(),Ps(),Rl=class{constructor(t){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;let e=this._canvas.getBoundingClientRect(),r=this._canvas.width,i=this._canvas.height,n=e.width/r*this._renderer.resolution,s=e.height/i*this._renderer.resolution,a=e.left,o=e.top,l=`translate(${a}px, ${o}px) scale(${n}, ${s})`;l!==this._lastTransform&&(this._domElement.style.transform=l,this._lastTransform=l)},this._domElement=t.domElement,this._renderer=t.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(t=>{for(let e of t){if(e.target!==this._canvas)continue;let r=this.canvas.width,i=this.canvas.height,n=e.contentRect.width/r*this._renderer.resolution,s=e.contentRect.height/i*this._renderer.resolution;(this._lastScaleX!==n||this._lastScaleY!==s)&&(this.updateTranslation(),this._lastScaleX=n,this._lastScaleY=s)}}),this._observer.observe(this._canvas)):this._tickerAttached||ei.shared.add(this.updateTranslation,this,Sn.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&ei.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}}),Ua,kl=y(()=>{we(),Ua=class Wy{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Wy.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ye,this.page=new ye,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,r,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,r,i,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 wx(t){return function(e){return e.test(t)}}function Dd(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 r=e.userAgent,i=r.split("[FBAN");typeof i[1]<"u"&&(r=i[0]),i=r.split("Twitter"),typeof i[1]<"u"&&(r=i[0]);var n=wx(r),s={apple:{phone:n(La)&&!n(Mi),ipod:n(Bl),tablet:!n(La)&&(n(Ol)||Hl(e))&&!n(Mi),universal:n(Il),device:(n(La)||n(Bl)||n(Ol)||n(Il)||Hl(e))&&!n(Mi)},amazon:{phone:n(En),tablet:!n(En)&&n(Ms),device:n(En)||n(Ms)},android:{phone:!n(Mi)&&n(En)||!n(Mi)&&n(Na),tablet:!n(Mi)&&!n(En)&&!n(Na)&&(n(Ms)||n(Gl)),device:!n(Mi)&&(n(En)||n(Ms)||n(Na)||n(Gl))||n(/\bokhttp\b/i)},windows:{phone:n(Mi),tablet:n(Fl),device:n(Mi)||n(Fl)},other:{blackberry:n(Dl),blackberry10:n(Ul),opera:n(Ll),firefox:n(zl),chrome:n(Nl),device:n(Dl)||n(Ul)||n(Ll)||n(zl)||n(Nl)},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 La,Bl,Ol,Il,Na,Gl,En,Ms,Mi,Fl,Dl,Ul,Ll,Nl,zl,Hl,Ud=y(()=>{La=/iPhone/i,Bl=/iPod/i,Ol=/iPad/i,Il=/\biOS-universal(?:.+)Mac\b/i,Na=/\bAndroid(?:.+)Mobile\b/i,Gl=/Android/i,En=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ms=/Silk/i,Mi=/Windows Phone/i,Fl=/\bWindows(?:.+)ARM\b/i,Dl=/BlackBerry/i,Ul=/BB10/i,Ll=/Opera Mini/i,Nl=/\b(CriOS|Chrome)(?:.+)Mobile/i,zl=/Mobile(?:.+)Firefox\b/i,Hl=function(t){return typeof t<"u"&&t.platform==="MacIntel"&&typeof t.maxTouchPoints=="number"&&t.maxTouchPoints>1&&typeof MSStream>"u"}}),Tx=y(()=>{Ud(),Ud()}),Ld,Nd,Sx=y(()=>{Tx(),Ld=Dd.default??Dd,Nd=Ld(globalThis.navigator)}),zd,jl,Hd,jd,Wl,Vl,Wd,Vd,$d,za,Xd,Ex=y(()=>{Fd(),kl(),Z(),Sx(),xn(),zd=9,jl=100,Hd=0,jd=0,Wl=2,Vl=1,Wd=-1e3,Vd=-1e3,$d=2,za=class Vy{constructor(e,r=Nd){this._mobileInfo=r,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(r.tablet||r.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){let e=document.createElement("button");e.style.width=`${Vl}px`,e.style.height=`${Vl}px`,e.style.position="absolute",e.style.top=`${Wd}px`,e.style.left=`${Vd}px`,e.style.zIndex=$d.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${Hd}px`,this._div.style.left=`${jd}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=Wl.toString(),this._canvasObserver=new Rl({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);let e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{let r=new MutationObserver(()=>{e.parentNode&&(r.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});r.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(let e in this._pools)this._pools[e].forEach(r=>{r.parentNode&&r.parentNode.removeChild(r)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let r=e.children;if(r)for(let i=0;i=0;i--){let n=this._children[i];r.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,Or(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i title : ${e.title}
    tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:r,height:i}=this._renderer;e.x+e.width>r&&(e.width=r-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let r=this._getPool(e.accessibleType).pop();r?(r.innerHTML="",r.removeAttribute("title"),r.removeAttribute("aria-label"),r.tabIndex=0):(e.accessibleType==="button"?r=document.createElement("button"):(r=document.createElement(e.accessibleType),r.style.cssText=` color: transparent; pointer-events: none; padding: 0; margin: 0; border: 0; outline: 0; background: transparent; box-sizing: border-box; user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; `,e.accessibleText&&(r.innerText=e.accessibleText)),r.style.width=`${jl}px`,r.style.height=`${jl}px`,r.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",r.style.position="absolute",r.style.zIndex=Wl.toString(),r.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?r.setAttribute("aria-live","off"):r.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?r.setAttribute("aria-relevant","additions"):r.setAttribute("aria-relevant","text"),r.addEventListener("click",this._onClick.bind(this)),r.addEventListener("focus",this._onFocus.bind(this)),r.addEventListener("focusout",this._onFocusOut.bind(this))),r.style.pointerEvents=e.accessiblePointerEvents,r.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?r.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(r.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&r.setAttribute("aria-label",e.accessibleHint),e.interactive?r.tabIndex=e.tabIndex:r.tabIndex=0,this.debug&&this._updateDebugHTML(r),e._accessibleActive=!0,e._accessibleDiv=r,r.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv)}_dispatchEvent(e,r){let{container:i}=e.target,n=this._renderer.events.rootBoundary,s=Object.assign(new Ua(n),{target:i});n.rootTarget=this._renderer.lastObjectRendered,r.forEach(a=>n.dispatchEvent(s,a))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode!==zd||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._canvasObserver?.destroy(),this._canvasObserver=null,this._div=null,this._pools=null,this._children=null,this._renderer=null,this._hookDiv=null,globalThis.removeEventListener("keydown",this._boundOnKeyDown),this._boundOnKeyDown=null,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._boundOnMouseMove=null}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}_getPool(e){return this._pools[e]||(this._pools[e]=[]),this._pools[e]}},za.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"accessibility"},za.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0},Xd=za}),Yd,Cx=y(()=>{"use strict";Yd={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1}}),Ax=y(()=>{Z(),Pi(),Ex(),Cx(),Se.add(Xd),Se.mixin(Ir,Yd)}),$l,Px=y(()=>{Z(),$l=class{static init(t){Object.defineProperty(this,"resizeTo",{configurable:!0,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,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:i,clientHeight:n}=this._resizeTo;e=i,r=n}this.renderer.resize(e,r),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}},$l.extension=k.Application}),Xl,Mx=y(()=>{Z(),Fa(),Ps(),Xl=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{configurable:!0,set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Sn.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ei.shared:new ei,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}},Xl.extension=k.Application}),qd=y(()=>{Z(),Px(),Mx(),Se.add($l),Se.add(Xl)}),Kd,Ri,Zd=y(()=>{Fa(),Ps(),Kd=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||(ei.system.add(this._tickerUpdate,this,Sn.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(ei.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(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}):new MouseEvent("mousemove",{clientX:t.clientX,clientY:t.clientY}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime{we(),kl(),Rs=class extends Ua{constructor(){super(...arguments),this.client=new ye,this.movement=new ye,this.offset=new ye,this.global=new ye,this.screen=new ye}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,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,i,n,s,a,o,l,u,c,f,_,g,b){throw new Error("Method not implemented.")}}}),ui,Qd=y(()=>{Yl(),ui=class extends Rs{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!")}}}),Cn,Jd=y(()=>{Yl(),Cn=class extends Rs{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}},Cn.DOM_DELTA_PIXEL=0,Cn.DOM_DELTA_LINE=1,Cn.DOM_DELTA_PAGE=2}),ef,tf,Xn,rf,Rx=y(()=>{Xt(),we(),It(),Zd(),Yl(),Qd(),Jd(),ef=2048,tf=new ye,Xn=new ye,rf=class{constructor(t){this.dispatch=new Tt,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((r,i)=>r.priority-i.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 r=0,i=e.length;r=0;i--)if(t.currentTarget=r[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let i=Array.isArray(e)?e:[e];for(let n=r.length-1;n>=0;n--)i.forEach(s=>{t.currentTarget=r[n],this.notifyTarget(t,s)})}propagationPath(t){let e=[t];for(let r=0;r=0;c--){let f=u[c],_=this.hitTestMoveRecursive(f,this._isInteractive(e)?e:f.eventMode,r,i,n,s||n(t,r));if(_){if(_.length>0&&!_[_.length-1].parent)continue;let g=t.isInteractive();(_.length>0||g)&&(g&&this._allInteractiveElements.push(t),_.push(t)),this._hitElements.length===0&&(this._hitElements=_),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,r)&&i(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,i,n){if(this._interactivePrune(t)||n(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ri.pauseUpdate=!1),t.interactiveChildren&&t.children){let o=t.children,l=r;for(let u=o.length-1;u>=0;u--){let c=o[u],f=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,l,i,n);if(f){if(f.length>0&&!f[f.length-1].parent)continue;let _=t.isInteractive();return(f.length>0||_)&&f.push(t),f}}}let s=this._isInteractive(e),a=t.isInteractive();return s&&i(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,Xn),!t.hitArea.contains(Xn.x,Xn.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r0&&n!==e.target){let o=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,o,n);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(n)){let u=this.createPointerEvent(t,"pointerleave",n);for(u.eventPhase=u.AT_TARGET;u.target&&!e.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),r&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(l)}if(n!==e.target){let o=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,o);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let u=n?.parent;for(;u&&u!==this.rootTarget.parent&&u!==e.target;)u=u.parent;if(!u||u===this.rootTarget.parent){let c=this.clonePointerEvent(e,"pointerenter");for(c.eventPhase=c.AT_TARGET;c.target&&c.target!==n&&c.target!==this.rootTarget.parent;)c.currentTarget=c.target,this.notifyTarget(c),r&&this.notifyTarget(c,"mouseenter"),c.target=c.target.parent;this.freeEvent(c)}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")),r&&(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,i.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof ui)){it("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),i=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),i&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let n=this.clonePointerEvent(r,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof ui)){it("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",i=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(n),r&&this.dispatchEvent(n,"mouseout");let s=this.createPointerEvent(t,"pointerleave",i);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),r&&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 ui)){it("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=n;if(n&&!r.composedPath().includes(n)){let a=n;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let o=r.button===2;this.notifyTarget(r,o?"rightupoutside":"mouseupoutside")}a=a.parent}delete i.pressTargetsByButton[t.button],s=a}if(s){let a=this.clonePointerEvent(r,"click");a.target=s,a.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let o=i.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(r)}mapPointerUpOutside(t){if(!(t instanceof ui)){it("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),i=this.createPointerEvent(t);if(r){let n=r;for(;n;)i.currentTarget=n,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch"?this.notifyTarget(i,"touchendoutside"):(i.pointerType==="mouse"||i.pointerType==="pen")&&this.notifyTarget(i,i.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof Cn)){it("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 r=1;r{Z(),Rx(),Zd(),Qd(),Jd(),nf=1,sf={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ha=class wd{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new rf(null),Ri.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new ui(null),this._rootWheelEvent=new Cn(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...wd.defaultEventFeatures},{set:(r,i,n)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),r[i]=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:r,resolution:i}=this.renderer;this.setTargetElement(r),this.resolution=i,wd._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){Ri.destroy(),this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||(e="default");let r=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(r=!1),this._currentCursor===e)return;this._currentCursor=e;let i=this.cursorStyles[e];if(i)switch(typeof i){case"string":r&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":r&&Object.assign(this.domElement.style,i);break}else r&&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 r=this._normalizeToPointerData(e);this.autoPreventDefault&&r[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,n=r.length;i0&&(r=e.composedPath()[0]);let i=r!==this.domElement?"outside":"",n=this._normalizeToPointerData(e);for(let s=0,a=n.length;s"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,r.push(s)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){let i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=nf),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,r.push(i)}else r.push(e);return r}normalizeWheelEvent(e){let r=this._rootWheelEvent;return this._transferMouseData(r,e),r.deltaX=e.deltaX,r.deltaY=e.deltaY,r.deltaZ=e.deltaZ,r.deltaMode=e.deltaMode,this.mapPositionToPoint(r.screen,e.clientX,e.clientY),r.global.copyFrom(r.screen),r.offset.copyFrom(r.screen),r.nativeEvent=e,r.type=e.type,r}_bootstrapEvent(e,r){return e.originalEvent=null,e.nativeEvent=r,e.pointerId=r.pointerId,e.width=r.width,e.height=r.height,e.isPrimary=r.isPrimary,e.pointerType=r.pointerType,e.pressure=r.pressure,e.tangentialPressure=r.tangentialPressure,e.tiltX=r.tiltX,e.tiltY=r.tiltY,e.twist=r.twist,this._transferMouseData(e,r),this.mapPositionToPoint(e.screen,r.clientX,r.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=r.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=sf[e.type]||e.type),e}_transferMouseData(e,r){e.isTrusted=r.isTrusted,e.srcElement=r.srcElement,e.timeStamp=performance.now(),e.type=r.type,e.altKey=r.altKey,e.button=r.button,e.buttons=r.buttons,e.client.x=r.clientX,e.client.y=r.clientY,e.ctrlKey=r.ctrlKey,e.metaKey=r.metaKey,e.movement.x=r.movementX,e.movement.y=r.movementY,e.page.x=r.pageX,e.page.y=r.pageY,e.relatedTarget=null,e.shiftKey=r.shiftKey}},Ha.extension={name:"events",type:[k.WebGLSystem,k.CanvasSystem,k.WebGPUSystem],priority:-1},Ha.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},ql=Ha}),of,kx=y(()=>{af(),kl(),of={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??ql.defaultEventMode},set eventMode(t){this._internalEventMode=t},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(t,e,r){let i=typeof r=="boolean"&&r||typeof r=="object"&&r.capture,n=typeof r=="object"?r.signal:void 0,s=typeof r=="object"?r.once===!0:!1,a=typeof e=="function"?void 0:e;t=i?`${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,r){let i=typeof r=="boolean"&&r||typeof r=="object"&&r.capture,n=typeof e=="function"?void 0:e;t=i?`${t}capture`:t,e=typeof e=="function"?e:e.handleEvent,this.off(t,e,n)},dispatchEvent(t){if(!(t instanceof Ua))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}}}),Bx=y(()=>{Z(),Pi(),af(),kx(),Se.add(ql),Se.mixin(Ir,of)}),Kl,Ox=y(()=>{Z(),Fd(),Kl=class{constructor(t){this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._renderer.runners.init.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}init(){this._canvasObserver=new Rl({domElement:this._domElement,renderer:this._renderer})}addRenderable(t,e){this._attachedDomElements.includes(t)||this._attachedDomElements.push(t)}updateRenderable(t){}validateRenderable(t){return!0}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}this._canvasObserver.ensureAttached();for(let e=0;e{Ar(),Pi(),ja=class extends Ir{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new pr(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=t.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:r,y:i}=t;return r>=e.minX&&r<=e.maxX&&i>=e.minY&&i<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}unload(){this.emit("unload",this);for(let t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){let{renderPipes:i}=e;i.blendMode.pushBlendMode(this,this.groupBlendMode,t),i[this.renderPipeId].addRenderable(this,t),this.didViewUpdate=!1;let n=this.children,s=n.length;for(let a=0;a{Z(),Ox(),Se.add(Kl)}),Ql,Gx=y(()=>{"use strict";Ql=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(Ql||{})}),lf,Fx=y(()=>{"use strict";lf={createCanvas:(t,e)=>{let r=document.createElement("canvas");return r.width=t,r.height=e,r},createImage:()=>new Image,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")}}),Jl,Ht,rr=y(()=>{Fx(),Jl=lf,Ht={get(){return Jl},set(t){Jl=t}}});function mi(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function ks(t){return t.split("?")[0].split("#")[0]}function Dx(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ux(t,e,r){return t.replace(new RegExp(Dx(e),"g"),r)}function Lx(t,e){let r="",i=0,n=-1,s=0,a=-1;for(let o=0;o<=t.length;++o){if(o2){let l=r.lastIndexOf("/");if(l!==r.length-1){l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}}else if(r.length===2||r.length===1){r="",i=0,n=o,s=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+=`/${t.slice(n+1,o)}`:r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a===46&&s!==-1?++s:s=-1}return r}var Yn,hf=y(()=>{rr(),Yn={toPosix(t){return Ux(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 r=/^[^/:]+:\/{0,2}/.exec(t);return r?r[0]:""},toAbsolute(t,e,r){if(mi(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;let i=ks(this.toPosix(e??Ht.get().getBaseUrl())),n=ks(this.toPosix(r??this.rootname(i)));return t=this.toPosix(t),t.startsWith("/")?Yn.join(n,t.slice(1)):this.isAbsolute(t)?t:this.join(i,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="",r=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));let i=t.endsWith("/");return t=Lx(t,!1),t.length>0&&i&&(t+="/"),r?`/${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 r=0;r0)if(e===void 0)e=i;else{let n=t[r-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}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),r=e===47,i=-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){i=o;break}}else n=!1;return i===-1?r?"/":this.isUrl(a)?s+t:s:r&&i===1?"//":s+t.slice(0,i)},rootname(t){mi(t),t=this.toPosix(t);let e="";if(t.startsWith("/")?e="/":e=this.getProtocol(t),this.isUrl(t)){let r=t.indexOf("/",e.length);r!==-1?e=t.slice(0,r):e=t,e.endsWith("/")||(e+="/")}return e},basename(t,e){mi(t),e&&mi(e),t=ks(this.toPosix(t));let r=0,i=-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){r=s+1;break}}else o===-1&&(n=!1,o=s+1),a>=0&&(l===e.charCodeAt(a)?--a===-1&&(i=s):(a=-1,i=o))}return r===i?i=o:i===-1&&(i=t.length),t.slice(r,i)}for(s=t.length-1;s>=0;--s)if(t.charCodeAt(s)===47){if(!n){r=s+1;break}}else i===-1&&(n=!1,i=s+1);return i===-1?"":t.slice(r,i)},extname(t){mi(t),t=ks(this.toPosix(t));let e=-1,r=0,i=-1,n=!0,s=0;for(let a=t.length-1;a>=0;--a){let o=t.charCodeAt(a);if(o===47){if(!n){r=a+1;break}continue}i===-1&&(n=!1,i=a+1),o===46?e===-1?e=a:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||i===-1||s===0||s===1&&e===i-1&&e===r+1?"":t.slice(e,i)},parse(t){mi(t);let e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=ks(this.toPosix(t));let r=t.charCodeAt(0),i=this.isAbsolute(t),n,s="";e.root=this.rootname(t),i||this.hasProtocol(t)?n=1:n=0;let a=-1,o=0,l=-1,u=!0,c=t.length-1,f=0;for(;c>=n;--c){if(r=t.charCodeAt(c),r===47){if(!u){o=c+1;break}continue}l===-1&&(u=!1,l=c+1),r===46?a===-1?a=c:f!==1&&(f=1):a!==-1&&(f=-1)}return a===-1||l===-1||f===0||f===1&&a===l-1&&a===o+1?l!==-1&&(o===0&&i?e.base=e.name=t.slice(1,l):e.base=e.name=t.slice(o,l)):(o===0&&i?(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"]}}),An,uf=y(()=>{"use strict";An=(t,e,r=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(i=>typeof i=="string"||r?e(i):i):t)});function cf(t,e,r,i,n){let s=e[r];for(let a=0;a{let a=s.substring(1,s.length-1).split(",");n.push(a)}),cf(t,n,0,r,i)}else i.push(t);return i}var zx=y(()=>{"use strict"}),eh,Hx=y(()=>{"use strict";eh=t=>!Array.isArray(t)});function jx(t){return t.split(".").pop().split("?").shift().split("#").shift()}var th,Wx=y(()=>{It(),hf(),uf(),zx(),Hx(),th=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(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return An(e||r,i=>typeof i=="string"?i:Array.isArray(i)?i.map(n=>n?.src??n):i?.src?i.src:i,!0)}addManifest(t){this._manifest&&it("[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 r=[],i=e;Array.isArray(e)||(i=Object.entries(e).map(([n,s])=>typeof s=="string"||Array.isArray(s)?{alias:n,src:s}:{alias:n,...s})),i.forEach(n=>{let s=n.src,a=n.alias,o;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),o=[a,l]}else{let l=a.map(u=>this._createBundleAssetId(t,u));r.push(...l),o=[...a,...l]}this.add({...n,alias:o,src:s})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=i=>{this.hasKey(i)&&it(`[Resolver] already has key: ${i} overwriting`)},An(e).forEach(i=>{let{src:n}=i,{data:s,format:a,loadParser:o,parser:l}=i,u=An(n).map(g=>typeof g=="string"?Nx(g):Array.isArray(g)?g:[g]),c=this.getAlias(i);Array.isArray(c)?c.forEach(r):r(c);let f=[],_=g=>({...this._parsers.find(b=>b.test(g))?.parse(g),src:g});u.forEach(g=>{g.forEach(b=>{let T={};if(typeof b!="object"?T=_(b):(s=b.data??s,a=b.format??a,(b.loadParser||b.parser)&&(o=b.loadParser??o,l=b.parser??l),T={..._(b.src),...b}),!c)throw new Error(`[Resolver] alias is undefined for this asset: ${T.src}`);T=this._buildResolvedAsset(T,{aliases:c,data:s,format:a,loadParser:o,parser:l,progressSize:i.progressSize}),f.push(T)})}),c.forEach(g=>{this._assetMap[g]=f})})}resolveBundle(t){let e=eh(t);t=An(t);let r={};return t.forEach(i=>{let n=this._bundles[i];if(n){let s=this.resolve(n),a={};for(let o in s){let l=s[o];a[this._extractAssetIdFromBundle(i,o)]=l}r[i]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let i in e)r[i]=e[i].src;return r}return e.src}resolve(t){let e=eh(t);t=An(t);let r={};return t.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let n=this._assetMap[i],s=this._getPreferredOrder(n);s?.priority.forEach(a=>{s.params[a].forEach(o=>{let l=n.filter(u=>u[a]?u[a]===o:!1);l.length&&(n=l)})}),this._resolverHash[i]=n[0]}else this._resolverHash[i]=this._buildResolvedAsset({alias:[i],src:i},{});r[i]=this._resolverHash[i]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(r.format));if(i)return i}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:r,data:i,loadParser:n,parser:s,format:a,progressSize:o}=e;return(this._basePath||this._rootPath)&&(t.src=Yn.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...i||{},...t.data},t.loadParser=n??t.loadParser,t.parser=s??t.parser,t.format=a??t.format??jx(t.src),o!==void 0&&(t.progressSize=o),t}},th.RETINA_PREFIX=/@([0-9\.]+)x/}),rh,Vx=y(()=>{"use strict";rh=(t,e)=>{let r=e.split("?")[1];return r&&(t+=`?${r}`),t}}),ih,nh,$x=y(()=>{nr(),lt(),Kt(),ih=class Pa{constructor(e,r){this.linkedSheets=[];let i=e;e?.source instanceof Ze&&(i={texture:e,data:r});let{texture:n,data:s,cachePrefix:a=""}=i;this.cachePrefix=a,this._texture=n instanceof He?n:null,this.textureSource=n.source,this.textures={},this.animations={},this.data=s;let o=parseFloat(s.meta.scale);o?(this.resolution=o,n.source.resolution=this.resolution):this.resolution=n.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<=Pa.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let r=e,i=Pa.BATCH_SIZE;for(;r-e{this._batchIndex*Pa.BATCH_SIZE{i[n]=e}),Object.keys(e.textures).forEach(n=>{i[`${e.cachePrefix}${n}`]=e.textures[n]}),!r){let n=Yn.dirname(t[0]);e.linkedSheets.forEach((s,a)=>{let o=df([`${n}/${e.data.meta.related_multi_packs[a]}`],s,!0);Object.assign(i,o)})}return i}var ff,pf,Xx=y(()=>{Gx(),Wx(),Vx(),Z(),Kt(),hf(),$x(),ff=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"],pf={extension:k.Asset,cache:{test:t=>t instanceof nh,getCacheableAssets:(t,e)=>df(t,e,!1)},resolver:{extension:{type:k.ResolveParser,name:"resolveSpritesheet"},test:t=>{let e=t.split("?")[0].split("."),r=e.pop(),i=e.pop();return r==="json"&&ff.includes(i)},parse:t=>{let e=t.split(".");return{resolution:parseFloat(th.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:k.LoadParser,priority:Ql.Normal,name:"spritesheetLoader"},async testParse(t,e){return Yn.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,r){let{texture:i,imageFilename:n,textureOptions:s,cachePrefix:a}=e?.data??{},o=Yn.dirname(e.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let l;if(i instanceof He)l=i;else{let f=rh(o+(n??t.meta.image),e.src);l=(await r.load([{src:f,data:s}]))[f]}let u=new nh({texture:l.source,data:t,cachePrefix:a});await u.parse();let c=t?.meta?.related_multi_packs;if(Array.isArray(c)){let f=[];for(let g of c){if(typeof g!="string")continue;let b=o+g;e.data?.ignoreMultiPack||(b=rh(b,e.src),f.push(r.load({src:b,data:{textureOptions:s,ignoreMultiPack:!0}})))}let _=await Promise.all(f);u.linkedSheets=_,_.forEach(g=>{g.linkedSheets=[u].concat(u.linkedSheets.filter(b=>b!==g))})}return u},async unload(t,e,r){await r.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}}}),sh=y(()=>{Z(),Xx(),Se.add(pf)});function gf(t,e,r){let{width:i,height:n}=r.orig,s=r.trim;if(s){let a=s.width,o=s.height;t.minX=s.x-e._x*i,t.maxX=t.minX+a,t.minY=s.y-e._y*n,t.maxY=t.minY+o}else t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}var mf=y(()=>{"use strict"}),Wa,_f=y(()=>{Ti(),Kt(),mf(),Ot(),Zl(),Wa=class Td extends ja{constructor(e=He.EMPTY){e instanceof He&&(e={texture:e});let{texture:r=He.EMPTY,anchor:i,roundPixels:n,width:s,height:a,...o}=e;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Bt({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:r.defaultAnchor&&(this.anchor=r.defaultAnchor),this.texture=r,this.allowChildren=!1,this.roundPixels=n??!1,s!==void 0&&(this.width=s),a!==void 0&&(this.height=a)}static from(e,r=!1){return e instanceof He?new Td(e):new Td(He.from(e,r))}set texture(e){e||(e=He.EMPTY);let r=this._texture;r!==e&&(r&&r.dynamic&&r.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 visualBounds(){return gf(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return $e("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let e=this._anchor,r=this._texture,i=this._bounds,{width:n,height:s}=r.orig;i.minX=-e._x*n,i.maxX=i.minX+n,i.minY=-e._y*s,i.maxY=i.minY+s}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e?.texture){let r=typeof e=="boolean"?e:e?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=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,r){typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),r!==void 0&&this._setHeight(r,this._texture.orig.height)}}});function vf(t,e,r){let i=yf;t.measurable=!0,j(t,r,i),e.addBoundsMask(i),t.measurable=!1}var yf,xf=y(()=>{Ar(),K(),yf=new pr});function bf(t,e,r){let i=Pr.get();t.measurable=!0;let n=cr.get().identity(),s=wf(t,r,n);d(t,i,s),t.measurable=!1,e.addBoundsMask(i),cr.return(n),Pr.return(i)}function wf(t,e,r){return t?(t!==e&&(wf(t.parent,e,r),t.updateLocalTransform(),r.append(t.localTransform)),r):(it("Mask bounds, renderable is not inside the root container"),r)}var Tf=y(()=>{v(),xr(),It()}),ah,Yx=y(()=>{Z(),_f(),xf(),Tf(),ah=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Wa),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,e){this.inverse||vf(this.mask,t,e)}addLocalBounds(t,e){bf(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Wa}},ah.extension=k.MaskEffect}),oh,qx=y(()=>{Z(),oh=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"}},oh.extension=k.MaskEffect}),lh,Kx=y(()=>{Z(),Pi(),xf(),Tf(),lh=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!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,e){vf(this.mask,t,e)}addLocalBounds(t,e){bf(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Ir}},lh.extension=k.MaskEffect}),ki,Bs=y(()=>{rr(),Z(),lt(),ki=class extends Ze{constructor(t){t.resource||(t.resource=Ht.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,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(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,r=this._resolution){let i=super.resize(t,e,r);return i&&this.resizeCanvas(),i}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"))}},ki.extension=k.TextureSource}),qn,hh=y(()=>{Z(),lt(),qn=class extends Ze{constructor(t){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}},qn.extension=k.TextureSource});async function Zx(){return uh??(uh=(async()=>{let t=Ht.get().createCanvas(1,1).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 r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,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(i),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),uh}var uh,Qx=y(()=>{rr()}),Os,Sf,Jx=y(()=>{Z(),Ps(),Qx(),lt(),Os=class $y extends Ze{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...$y.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=ei.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,r=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():(r.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.alphaMode=await Zx(),this._load=new Promise((i,n)=>{this.isValid?i(this):(this._resolve=i,this._reject=n,r.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${r.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&&(ei.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||(ei.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ei.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}},Os.extension=k.TextureSource,Os.defaultOptions={...Ze.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},Os.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},Sf=Os}),Ef,Mr,Va=y(()=>{It(),uf(),Ef=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||it(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=An(t),i;for(let o=0;o{n.set(o,e)});let s=[...n.keys()],a={cacheKeys:s,keys:r};r.forEach(o=>{this._cacheMap.set(o,a)}),s.forEach(o=>{let l=i?i[o]:e;this._cache.has(o)&&this._cache.get(o)!==l&&it("[Cache] already has key:",o),this._cache.set(o,n.get(o))})}remove(t){if(!this._cacheMap.has(t)){it(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(r=>{this._cache.delete(r)}),e.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}},Mr=new Ef});function Cf(t={}){let e=t&&t.resource,r=e?t.resource:t,i=e?t:{resource:t};for(let n=0;n<$a.length;n++){let s=$a[n];if(s.test(r))return new s(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function e0(t={},e=!1){let r=t&&t.resource,i=r?t.resource:t,n=r?t:{resource:t};if(!e&&Mr.has(i))return Mr.get(i);let s=new He({source:Cf(n)});return s.on("destroy",()=>{Mr.has(i)&&Mr.remove(i)}),e||Mr.set(i,s),s}function t0(t,e=!1){return typeof t=="string"?Mr.get(t):t instanceof Ze?new He({source:t}):e0(t,e)}var $a,Af=y(()=>{Va(),Z(),lt(),Kt(),$a=[],Se.handleByList(k.TextureSource,$a),He.from=t0,Ze.from=Cf}),ch=y(()=>{Z(),Yx(),qx(),Kx(),kd(),Bs(),hh(),Jx(),Af(),Se.add(ah,oh,lh,Sf,qn,ki,ka)}),Bi,Pn=y(()=>{"use strict";Bi=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let i=t[r];this.setResource(i,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&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,e){let r=this.resources;for(let i in r)r[i]._gcLastUsed=t,r[i]._touched=e}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 r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function dh(t,e,r){let i=2166136261;for(let n=0;n>>=0;return fh[i]||r0(t,e,i,r)}function r0(t,e,r,i){let n={},s=0;for(let o=0;o{Pn(),Kt(),fh={}}),Mn,Pf=y(()=>{"use strict";Mn=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.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=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 gh(t,e){let r=t.byteLength/8|0,i=new Float64Array(t,0,r);new Float64Array(e,0,r).set(i);let n=t.byteLength-r*8;if(n>0){let s=new Uint8Array(t,r*8,n);new Uint8Array(e,r*8,n).set(s)}}var Mf=y(()=>{"use strict"}),Rf,sr,Kn=y(()=>{"use strict";Rf={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},sr=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",t[t.NONE=5]="NONE",t))(sr||{})});function Is(t,e){return e.alphaMode==="no-premultiply-alpha"&&Rf[t]||t}var Xa=y(()=>{Kn()});function kf(){return(!Ya||Ya?.isContextLost())&&(Ya=Ht.get().createCanvas().getContext("webgl",{})),Ya}var Ya,Bf=y(()=>{rr()});function i0(t){let e="";for(let r=0;r0&&(e+=` else `),r{"use strict";If=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` `)});function n0(){if(Rn)return Rn;let t=kf();return Rn=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Rn=Of(Rn,t),t.getExtension("WEBGL_lose_context")?.loseContext(),Rn}var Rn,s0=y(()=>{Bf(),Gf(),Rn=null}),Ff,a0=y(()=>{"use strict";Ff=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t0?Zn[--Gs]:new Lf}function Uf(t){Zn[Gs++]=t}var Lf,Zn,Gs,Qn,mh,Nf,o0=y(()=>{er(),Pf(),Ot(),zr(),Mf(),Xa(),s0(),a0(),Lf=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ff,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Zn=[],Gs=0,li.register({clear:()=>{if(Zn.length>0)for(let t of Zn)t&&t.destroy();Zn.length=0,Gs=0}}),Qn=0,mh=class Xy{constructor(e){this.uid=dt("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...Xy.defaultOptions,...e},e.maxTextures||($e("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=n0());let{maxTextures:r,attributesInitialSize:i,indicesInitialSize:n}=e;this.attributeBuffer=new Mn(i*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=r}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;ethis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,u=this.attributeBuffer.uint32View,c=this.indexBuffer,f=this._batchIndexSize,_=this._batchIndexStart,g="startBatch",b=this.maxTextures;for(let T=this.elementStart;T=b||B)&&(this._finishBatch(i,_,f-_,n,a,o,e,g),g="renderBatch",_=f,a=P,o=x.topology,i=Df(),n=i.textures,n.clear(),++Qn),x._textureId=S._textureBindLocation=n.count,n.ids[S.uid]=n.count,n.textures[n.count++]=S,x._batch=i,f+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,u,x._attributeStart,x._textureId),this.packQuadIndex(c,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,u,x._attributeStart,x._textureId),this.packIndex(x,c,x._indexStart,x._attributeStart/this.vertexSize))}n.count>0&&(this._finishBatch(i,_,f-_,n,a,o,e,g),_=f,++Qn),this.elementStart=this.elementSize,this._batchIndexStart=_,this._batchIndexSize=f}_finishBatch(e,r,i,n,s,a,o,l){e.gpuBindGroup=null,e.bindGroup=null,e.action=l,e.batcher=this,e.textures=n,e.blendMode=s,e.topology=a,e.start=r,e.size=i,++Qn,this.batches[this.batchIndex++]=e,o.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 r=Math.max(e,this.attributeBuffer.size*2),i=new Mn(r);gh(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(e){let r=this.indexBuffer,i=Math.max(e,r.length*1.5);i+=i%2;let n=i>65535?new Uint32Array(i):new Uint16Array(i);if(n.BYTES_PER_ELEMENT!==r.BYTES_PER_ELEMENT)for(let s=0;s{"use strict";bt=(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))(bt||{})}),$r,kn=y(()=>{Xt(),er(),ln(),$r=class extends Tt{constructor(t){let{data:e,size:r}=t,{usage:i,label:n,shrinkToFit:s}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=dt("buffer"),this._resourceType="buffer",this._resourceId=dt("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:i,mappedAtCreation:a,label:n},this.shrinkToFit=s??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&bt.STATIC)}set static(t){t?this.descriptor.usage|=bt.STATIC:this.descriptor.usage&=~bt.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let i=this._data;if(this._data=t,this._dataInt32=null,!i||i.length!==t.length){!this.shrinkToFit&&i&&t.byteLength{kn(),ln()});function h0(t,e,r){let i=t.getAttribute(e);if(!i)return r.minX=0,r.minY=0,r.maxX=0,r.maxY=0,r;let n=i.buffer.data,s=1/0,a=1/0,o=-1/0,l=-1/0,u=n.BYTES_PER_ELEMENT,c=(i.offset||0)/u,f=(i.stride||8)/u;for(let _=c;_o&&(o=g),b>l&&(l=b),g{"use strict"});function c0(t){return(t instanceof $r||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=zf(t.buffer,!1),t}var Jn,Fs=y(()=>{Xt(),Ar(),er(),kn(),l0(),u0(),Jn=class extends Tt{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=dt("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new pr,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:i}=t;if(this.buffers=[],this.attributes={},e)for(let n in e)this.addAttribute(n,e[n]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=i||"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}addAttribute(t,e){let r=c0(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=zf(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,h0(this,"aPosition",this._bounds)):this._bounds}unload(){this.emit("unload",this);for(let t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.unload(),this.indexBuffer?.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}}),Hf,jf,Wf,d0=y(()=>{kn(),ln(),Fs(),Hf=new Float32Array(1),jf=new Uint32Array(1),Wf=class extends Jn{constructor(){let t=new $r({data:Hf,label:"attribute-batch-buffer",usage:bt.VERTEX|bt.COPY_DST,shrinkToFit:!1}),e=new $r({data:jf,label:"index-batch-buffer",usage:bt.INDEX|bt.COPY_DST,shrinkToFit:!1}),r=24;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:r,offset:0},aUV:{buffer:t,format:"float32x2",stride:r,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:r,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:r,offset:20}},indexBuffer:e})}}});function Ds(t,e){let r=_h[t];return r===void 0&&(qa[e]===void 0&&(qa[e]=1),_h[t]=r=qa[e]++),r}var qa,_h,Ka=y(()=>{"use strict";qa=Object.create(null),_h=Object.create(null)});function f0(){if(!Za){Za="mediump";let t=kf();t&&t.getShaderPrecisionFormat&&(Za=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return Za}var Za,p0=y(()=>{Bf()});function g0(t,e,r){return e?t:r?(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 m0=y(()=>{"use strict"});function _0(t,e,r){let i=r?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(t.substring(0,9)!=="precision"){let n=r?e.requestedFragmentPrecision:e.requestedVertexPrecision;return n==="highp"&&i!=="highp"&&(n="mediump"),`precision ${n} float; ${t}`}else if(i!=="highp"&&t.substring(0,15)==="precision highp")return t.replace("precision highp","precision mediump");return t}var v0=y(()=>{"use strict"});function y0(t,e){return e?`#version 300 es ${t}`:t}var x0=y(()=>{"use strict"});function b0(t,{name:e="pixi-program"},r=!0){e=e.replace(/\s+/g,"-"),e+=r?"-fragment":"-vertex";let i=r?Vf:$f;return i[e]?(i[e]++,e+=`-${i[e]}`):i[e]=1,t.indexOf("#define SHADER_NAME")!==-1?t:`${`#define SHADER_NAME ${e}`} ${t}`}var Vf,$f,w0=y(()=>{"use strict";Vf={},$f={}});function T0(t,e){return e?t.replace("#version 300 es",""):t}var S0=y(()=>{"use strict"}),Qa,es,vh,hn,Bn=y(()=>{Ka(),p0(),m0(),v0(),x0(),w0(),S0(),Qa={stripVersion:T0,ensurePrecision:_0,addProgramDefines:g0,setProgramName:b0,insertVersion:y0},es=Object.create(null),vh=class Sd{constructor(e){e={...Sd.defaultOptions,...e};let r=e.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:r,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:f0()},setProgramName:{name:e.name},addProgramDefines:r,insertVersion:r},n=e.fragment,s=e.vertex;Object.keys(Qa).forEach(a=>{let o=i[a];n=Qa[a](n,o,!0),s=Qa[a](s,o,!1)}),this.fragment=n,this.vertex=s,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=Ds(`${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,es[this._cacheKey]=null}static from(e){let r=`${e.vertex}:${e.fragment}`;return es[r]||(es[r]=new Sd(e),es[r]._cacheKey=r),es[r]}},vh.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"},hn=vh});function un(t){return yh[t]??yh.float32}var yh,ts=y(()=>{"use strict";yh={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 E0({source:t,entryPoint:e}){let r={},i=t.indexOf(`fn ${e}`);if(i!==-1){let n=t.indexOf("->",i);if(n!==-1){let s=t.substring(i,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=Xf[o[3]]??"float32";r[o[2]]={location:parseInt(o[1],10),format:l,stride:un(l).stride,offset:0,instance:!1,start:0}}}}return r}var Xf,C0=y(()=>{ts(),Xf={f32:"float32","vec2":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4"}});function xh(t){let e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,r=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,n=/var(<[^>]+>)? (\w+)/,s=/:\s*(\w+)/,a=/struct\s+(\w+)\s*{([^}]+)}/g,o=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,u=t.match(e)?.map(f=>({group:parseInt(f.match(r)[1],10),binding:parseInt(f.match(i)[1],10),name:f.match(n)[2],isUniform:f.match(n)[1]==="",type:f.match(s)[1]}));if(!u)return{groups:[],structs:[]};let c=t.match(a)?.map(f=>{let _=f.match(l)[1],g=f.match(o).reduce((b,T)=>{let[x,S]=T.split(":");return b[x.trim()]=S.trim(),b},{});return g?{name:_,members:g}:null}).filter(({name:f})=>u.some(_=>_.type===f))??[];return{groups:u,structs:c}}var A0=y(()=>{"use strict"}),rs,P0=y(()=>{"use strict";rs=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(rs||{})});function M0({groups:t}){let e=[];for(let r=0;r{P0()});function k0({groups:t}){let e=[];for(let r=0;r{"use strict"});function O0(t,e){let r=new Set,i=new Set,n=[...t.structs,...e.structs].filter(a=>r.has(a.name)?!1:(r.add(a.name),!0)),s=[...t.groups,...e.groups].filter(a=>{let o=`${a.name}-${a.binding}`;return i.has(o)?!1:(i.add(o),!0)});return{structs:n,groups:s}}var I0=y(()=>{"use strict"}),is,On,ns=y(()=>{Ka(),C0(),A0(),R0(),B0(),I0(),is=Object.create(null),On=class Yy{constructor(e){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:r,vertex:i,layout:n,gpuLayout:s,name:a}=e;if(this.name=a,this.fragment=r,this.vertex=i,r.source===i.source){let o=xh(r.source);this.structsAndGroups=o}else{let o=xh(i.source),l=xh(r.source);this.structsAndGroups=O0(o,l)}this.layout=n??k0(this.structsAndGroups),this.gpuLayout=s??M0(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:r}=this,i=e.source+r.source+e.entryPoint+r.entryPoint;this._layoutKey=Ds(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=E0(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,is[this._cacheKey]=null}static from(e){let r=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return is[r]||(is[r]=new Yy(e),is[r]._cacheKey=r),is[r]}}});function Yf(t,e,r){if(t)for(let i in t){let n=i.toLocaleLowerCase(),s=e[n];if(s){let a=t[i];i==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),r&&s.push(`//----${r}----//`),s.push(a)}else it(`${i} placement hook does not exist in shader`)}}var G0=y(()=>{It()});function qf(t){let e={};return(t.match(Kf)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{e[r]=[]}),e}var Kf,F0=y(()=>{"use strict";Kf=/\{\{(.*?)\}\}/g});function Zf(t,e){let r,i=/@in\s+([^;]+);/g;for(;(r=i.exec(t))!==null;)e.push(r[1])}function Qf(t,e,r=!1){let i=[];Zf(e,i),t.forEach(o=>{o.header&&Zf(o.header,i)});let n=i;r&&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 D0=y(()=>{"use strict"});function Jf(t,e){let r,i=/@out\s+([^;]+);/g;for(;(r=i.exec(t))!==null;)e.push(r[1])}function U0(t){let e=/\b(\w+)\s*:/g.exec(t);return e?e[1]:""}function L0(t){let e=/@.*?\s+/g;return t.replace(e,"")}function N0(t,e){let r=[];Jf(e,r),t.forEach(l=>{l.header&&Jf(l.header,r)});let i=0,n=r.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`, `),s=r.sort().map(l=>` var ${L0(l)};`).join(` `),a=`return VSOutput( ${r.sort().map(l=>` ${U0(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 z0=y(()=>{"use strict"});function ep(t,e){let r=t;for(let i in e){let n=e[i];n.join(` `).length?r=r.replace(`{{${i}}}`,`//-----${i} START-----// ${n.join(` `)} //----${i} FINISH----//`):r=r.replace(`{{${i}}}`,"")}return r}var H0=y(()=>{"use strict"});function j0({template:t,bits:e}){let r=tp(t,e);if(cn[r])return cn[r];let{vertex:i,fragment:n}=V0(t,e);return cn[r]=rp(i,n,e),cn[r]}function W0({template:t,bits:e}){let r=tp(t,e);return cn[r]||(cn[r]=rp(t.vertex,t.fragment,e)),cn[r]}function V0(t,e){let r=e.map(a=>a.vertex).filter(a=>!!a),i=e.map(a=>a.fragment).filter(a=>!!a),n=Qf(r,t.vertex,!0);n=N0(r,n);let s=Qf(i,t.fragment,!0);return{vertex:n,fragment:s}}function tp(t,e){return e.map(r=>(Ja.has(r)||Ja.set(r,ip++),Ja.get(r))).sort((r,i)=>r-i).join("-")+t.vertex+t.fragment}function rp(t,e,r){let i=qf(t),n=qf(e);return r.forEach(s=>{Yf(s.vertex,i,s.name),Yf(s.fragment,n,s.name)}),{vertex:ep(t,i),fragment:ep(e,n)}}var cn,Ja,ip,$0=y(()=>{G0(),F0(),D0(),z0(),H0(),cn=Object.create(null),Ja=new Map,ip=0}),np,sp,ap,op,X0=y(()=>{"use strict";np=` @in aPosition: vec2; @in aUV: vec2; @out @builtin(position) vPosition: vec4; @out vUV : vec2; @out vColor : vec4; {{header}} struct VSOutput { {{struct}} }; @vertex fn main( {{in}} ) -> VSOutput { var worldTransformMatrix = globalUniforms.uWorldTransformMatrix; var modelMatrix = mat3x3( 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(1., 1., 1., 1.); {{main}} vUV = uv; var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix; vPosition = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); vColor *= globalUniforms.uWorldColorAlpha; {{end}} {{return}} }; `,sp=` @in vUV : vec2; @in vColor : vec4; {{header}} @fragment fn main( {{in}} ) -> @location(0) vec4 { {{start}} var outColor:vec4; {{main}} var finalColor:vec4 = outColor * vColor; {{end}} return finalColor; }; `,ap=` 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}} } `,op=` in vec4 vColor; in vec2 vUV; out vec4 finalColor; {{header}} void main(void) { {{start}} vec4 outColor; {{main}} finalColor = outColor * vColor; {{end}} } `}),lp,hp,Y0=y(()=>{"use strict";lp={name:"global-uniforms-bit",vertex:{header:` struct GlobalUniforms { uProjectionMatrix:mat3x3, uWorldTransformMatrix:mat3x3, uWorldColorAlpha: vec4, uResolution: vec2, } @group(0) @binding(0) var globalUniforms : GlobalUniforms; `}},hp={name:"global-uniforms-bit",vertex:{header:` uniform mat3 uProjectionMatrix; uniform mat3 uWorldTransformMatrix; uniform vec4 uWorldColorAlpha; uniform vec2 uResolution; `}}});function Us({bits:t,name:e}){let r=j0({template:{fragment:sp,vertex:np},bits:[lp,...t]});return On.from({name:e,vertex:{source:r.vertex,entryPoint:"main"},fragment:{source:r.fragment,entryPoint:"main"}})}function Ls({bits:t,name:e}){return new hn({name:e,...W0({template:{vertex:ap,fragment:op},bits:[hp,...t]})})}var In=y(()=>{Bn(),ns(),$0(),X0(),Y0()}),eo,to,ro=y(()=>{"use strict";eo={name:"color-bit",vertex:{header:` @in aColor: vec4; `,main:` vColor *= vec4(aColor.rgb * aColor.a, aColor.a); `}},to={name:"color-bit",vertex:{header:` in vec4 aColor; `,main:` vColor *= vec4(aColor.rgb * aColor.a, aColor.a); `}}});function q0(t){let e=[];if(t===1)e.push("@group(1) @binding(0) var textureSource1: texture_2d;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let r=0;for(let i=0;i;`),e.push(`@group(1) @binding(${r++}) var textureSampler${i+1}: sampler;`)}return e.join(` `)}function K0(t){let e=[];if(t===1)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let r=0;r; @out @interpolate(flat) vTextureId : u32; `,main:` vTextureId = aTextureIdAndRound.y; `,end:` if(aTextureIdAndRound.x == 1) { vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); } `},fragment:{header:` @in @interpolate(flat) vTextureId: u32; ${q0(t)} `,main:` var uvDx = dpdx(vUV); var uvDy = dpdy(vUV); ${K0(t)} `}}),io[t]}function Z0(t){let e=[];for(let r=0;r0&&e.push("else"),r{"use strict";io={},no={}}),ss,as,Gn=y(()=>{"use strict";ss={name:"round-pixels-bit",vertex:{header:` fn roundPixels(position: vec2, targetSize: vec2) -> vec2 { return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; } `}},as={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; } `}}}),Th,up,Q0=y(()=>{"use strict";Th=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4","vec2","vec3","vec4"],up=Th.reduce((t,e)=>(t[e]=!0,t),{})});function J0(t,e){switch(t){case"f32":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var eb=y(()=>{"use strict"}),Sh,Gr,Xr=y(()=>{er(),Ka(),Q0(),eb(),Sh=class qy{constructor(e,r){this._touched=0,this.uid=dt("uniform"),this._resourceType="uniformGroup",this._resourceId=dt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,r={...qy.defaultOptions,...r},this.uniformStructures=e;let i={};for(let n in e){let s=e[n];if(s.name=n,s.size=s.size??1,!up[s.type]){let a=s.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(a){let[,o,l]=a;throw new Error(`Uniform type ${s.type} is not supported. Use type: '${o}', size: ${l} instead.`)}throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${Th.join(", ")}`)}s.value??(s.value=J0(s.type,s.size)),i[n]=s.value}this.uniforms=i,this._dirtyId=1,this.ubo=r.ubo,this.isStatic=r.isStatic,this._signature=Ds(Object.keys(i).map(n=>`${n}-${e[n].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}},Sh.defaultOptions={ubo:!1,isStatic:!1},Gr=Sh});function Eh(t){let e=Ch[t];if(e)return e;let r=new Int32Array(t);for(let i=0;i{Xr(),Ch={}}),ci,qi=y(()=>{"use strict";ci=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.BOTH=3]="BOTH",t))(ci||{})}),_i,Oi=y(()=>{Xt(),er(),Bn(),Pn(),ns(),qi(),Xr(),_i=class Ky extends Tt{constructor(e){super(),this.uid=dt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:r,glProgram:i,groups:n,resources:s,compatibleRenderers:a,groupMap:o}=e;this.gpuProgram=r,this.glProgram=i,a===void 0&&(a=0,r&&(a|=ci.WEBGPU),i&&(a|=ci.WEBGL)),this.compatibleRenderers=a;let l={};if(!s&&!n&&(s={}),s&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!r&&n&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!r&&n&&o)for(let u in o)for(let c in o[u]){let f=o[u][c];l[f]={group:u,binding:c,name:f}}else if(r&&n&&!o){let u=r.structsAndGroups.groups;o={},u.forEach(c=>{o[c.group]=o[c.group]||{},o[c.group][c.binding]=c.name,l[c.name]=c})}else if(s){n={},o={},r&&r.structsAndGroups.groups.forEach(c=>{o[c.group]=o[c.group]||{},o[c.group][c.binding]=c.name,l[c.name]=c});let u=0;for(let c in s)l[c]||(n[99]||(n[99]=new Bi,this._ownedBindGroups.push(n[99])),l[c]={group:99,binding:u,name:c},o[99]=o[99]||{},o[99][u]=c,u++);for(let c in s){let f=c,_=s[c];!_.source&&!_._resourceType&&(_=new Gr(_));let g=l[f];g&&(n[g.group]||(n[g.group]=new Bi,this._ownedBindGroups.push(n[g.group])),n[g.group].setResource(_,g.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,l)}addResource(e,r,i){var n,s;(n=this._uniformBindMap)[r]||(n[r]={}),(s=this._uniformBindMap[r])[i]||(s[i]=e),this.groups[r]||(this.groups[r]=new Bi,this._ownedBindGroups.push(this.groups[r]))}_buildResourceAccessor(e,r){let i={};for(let n in r){let s=r[n];Object.defineProperty(i,s.name,{get(){return e[s.group].getResource(s.binding)},set(a){e[s.group].setResource(a,s.binding)}})}return i}destroy(e=!1){this._destroyed||(this._destroyed=!0,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(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(e){let{gpu:r,gl:i,...n}=e,s,a;return r&&(s=On.from(r)),i&&(a=hn.from(i)),new Ky({gpuProgram:s,glProgram:a,...n})}}}),Ph,tb=y(()=>{In(),ro(),so(),Gn(),Ah(),Oi(),Ph=class extends _i{constructor(t){let e=Ls({name:"batch",bits:[to,wh(t),as]}),r=Us({name:"batch",bits:[eo,bh(t),ss]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:Eh(t)}}),this.maxTextures=t}}}),os,Mh,ao,cp=y(()=>{Z(),o0(),d0(),tb(),os=null,Mh=class Zy extends Nf{constructor(e){super(e),this.geometry=new Wf,this.name=Zy.extension.name,this.vertexSize=6,os??(os=new Ph(e.maxTextures)),this.shader=os}packAttributes(e,r,i,n,s){let a=s<<16|e.roundPixels&65535,o=e.transform,l=o.a,u=o.b,c=o.c,f=o.d,_=o.tx,g=o.ty,{positions:b,uvs:T}=e,x=e.color,S=e.attributeOffset,P=S+e.attributeSize;for(let B=S;B{"use strict";Yr=class{constructor(t){this.items=Object.create(null);let{renderer:e,type:r,onUnload:i,priority:n,name:s}=t;this._renderer=e,e.gc.addResourceHash(this,"items",r,n??0),this._onUnload=i,this.name=s}add(t){return this.items[t.uid]?!1:(this.items[t.uid]=t,t.once("unload",this.remove,this),t._gcLastUsed=this._renderer.gc.now,!0)}remove(t,...e){if(!this.items[t.uid])return;let r=t._gpuData[this._renderer.uid];r&&(this._onUnload?.(t,...e),r.destroy(),t._gpuData[this._renderer.uid]=null,this.items[t.uid]=null)}removeAll(...t){Object.values(this.items).forEach(e=>e&&this.remove(e,...t))}destroy(...t){this.removeAll(...t),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}});function rb(t,e,r,i,n,s,a,o=null){let l=0;r*=e,n*=s;let u=o.a,c=o.b,f=o.c,_=o.d,g=o.tx,b=o.ty;for(;l{"use strict"});function dp(t,e,r,i,n){let s=e.a,a=e.b,o=e.c,l=e.d,u=e.tx,c=e.ty;r||(r=0),i||(i=2),n||(n=t.length/i-r);let f=r*i;for(let _=0;_{"use strict"}),fp,oo,pp=y(()=>{et(),le(),fp=new me,oo=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",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.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?ne(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||fp}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,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}}),ls,gp,mp,ab=y(()=>{Z(),ls={extension:{type:k.ShapeBuilder,name:"circle"},build(t,e){let r,i,n,s,a,o;if(t.type==="circle"){let A=t;if(a=o=A.radius,a<=0)return!1;r=A.x,i=A.y,n=s=0}else if(t.type==="ellipse"){let A=t;if(a=A.halfWidth,o=A.halfHeight,a<=0||o<=0)return!1;r=A.x,i=A.y,n=s=0}else{let A=t,X=A.width/2,W=A.height/2;r=A.x+X,i=A.y+W,a=o=Math.max(0,Math.min(A.radius,Math.min(X,W))),n=X-a,s=W-o}if(n<0||s<0)return!1;let l=Math.ceil(2.3*Math.sqrt(a+o)),u=l*8+(n?4:0)+(s?4:0);if(u===0)return!1;if(l===0)return e[0]=e[6]=r+n,e[1]=e[3]=i+s,e[2]=e[4]=r-n,e[5]=e[7]=i-s,!0;let c=0,f=l*4+(n?2:0)+2,_=f,g=u,b=n+a,T=s,x=r+b,S=r-b,P=i+T;if(e[c++]=x,e[c++]=P,e[--f]=P,e[--f]=S,s){let A=i-T;e[_++]=S,e[_++]=A,e[--g]=A,e[--g]=x}for(let A=1;A0&&(n[s++]=l,n[s++]=u,n[s++]=l-1),l++;n[s++]=u+1,n[s++]=u,n[s++]=l-1}},gp={...ls,extension:{...ls.extension,name:"ellipse"}},mp={...ls,extension:{...ls.extension,name:"roundedRectangle"}}});function ob(t){let e=t.length;if(e<6)return 1;let r=0;for(let i=0,n=t[e-2],s=t[e-1];i{"use strict"});function _p(t,e,r,i,n,s,a,o){let l=t-r*n,u=e-i*n,c=t+r*s,f=e+i*s,_,g;a?(_=i,g=-r):(_=-i,g=r);let b=l+_,T=u+g,x=c+_,S=f+g;return o.push(b,T),o.push(x,S),2}function Fn(t,e,r,i,n,s,a,o){let l=r-t,u=i-e,c=Math.atan2(l,u),f=Math.atan2(n-t,s-e);o&&cf&&(f+=Math.PI*2);let _=c,g=f-c,b=Math.abs(g),T=Math.sqrt(l*l+u*u),x=(15*b*Math.sqrt(T)/Math.PI>>0)+1,S=g/x;if(_+=S,o){a.push(t,e),a.push(r,i);for(let P=1,B=_;P=0&&(o.join==="round"?T+=Fn(W,q,W-ie*$,q-he*$,W-Be*$,q-Ve*$,g,!1)+4:T+=2,g.push(W-Be*re,q-Ve*re),g.push(W+Be*$,q+Ve*$));continue}let kr=(-ie+A)*(-he+q)-(-ie+W)*(-he+X),hr=(-Be+ae)*(-Ve+q)-(-Be+W)*(-Ve+ce),Zr=(je*hr-Lt*kr)/Tr,yn=(lr*kr-wt*hr)/Tr,xs=(Zr-W)*(Zr-W)+(yn-q)*(yn-q),zi=W+(Zr-W)*$,wi=q+(yn-q)*$,Hi=W-(Zr-W)*re,ji=q-(yn-q)*re,te=Math.min(je*je+wt*wt,Lt*Lt+lr*lr),ve=Rr?$:re,ht=te+ve*ve*P;xs<=ht?o.join==="bevel"||xs/P>B?(Rr?(g.push(zi,wi),g.push(W+ie*re,q+he*re),g.push(zi,wi),g.push(W+Be*re,q+Ve*re)):(g.push(W-ie*$,q-he*$),g.push(Hi,ji),g.push(W-Be*$,q-Ve*$),g.push(Hi,ji)),T+=2):o.join==="round"?Rr?(g.push(zi,wi),g.push(W+ie*re,q+he*re),T+=Fn(W,q,W+ie*re,q+he*re,W+Be*re,q+Ve*re,g,!0)+4,g.push(zi,wi),g.push(W+Be*re,q+Ve*re)):(g.push(W-ie*$,q-he*$),g.push(Hi,ji),T+=Fn(W,q,W-ie*$,q-he*$,W-Be*$,q-Ve*$,g,!1)+4,g.push(W-Be*$,q-Ve*$),g.push(Hi,ji)):(g.push(zi,wi),g.push(Hi,ji)):(g.push(W-ie*$,q-he*$),g.push(W+ie*re,q+he*re),o.join==="round"?Rr?T+=Fn(W,q,W+ie*re,q+he*re,W+Be*re,q+Ve*re,g,!0)+2:T+=Fn(W,q,W-ie*$,q-he*$,W-Be*$,q-Ve*$,g,!1)+2:o.join==="miter"&&xs/P<=B&&(Rr?(g.push(Hi,ji),g.push(Hi,ji)):(g.push(zi,wi),g.push(zi,wi)),T+=2),g.push(W-Be*$,q-Ve*$),g.push(W+Be*re,q+Ve*re),T+=2)}A=t[(b-2)*2],X=t[(b-2)*2+1],W=t[(b-1)*2],q=t[(b-1)*2+1],ie=-(X-q),he=A-W,D=Math.sqrt(ie*ie+he*he),ie/=D,he/=D,ie*=S,he*=S,g.push(W-ie*$,q-he*$),g.push(W+ie*re,q+he*re),f||(o.cap==="round"?T+=Fn(W-ie*($-re)*.5,q-he*($-re)*.5,W-ie*$,q-he*$,W+ie*re,q+he*re,g,!1)+2:o.cap==="square"&&(T+=_p(W,q,ie,he,$,re,!1,g)));let Qe=1e-4*1e-4;for(let Ce=x;Ce{we(),lb()});function cb(t,e,r,i){let n=1e-4;if(t.length===0)return;let s=t[0],a=t[1],o=t[t.length-2],l=t[t.length-1],u=e||Math.abs(s-o){});function vp(t,e,r=2){let i=e&&e.length,n=i?e[0]*r:t.length,s=yp(t,0,n,r,!0),a=[];if(!s||s.next===s.prev)return a;let o,l,u;if(i&&(s=_b(t,e,s,r)),t.length>80*r){o=t[0],l=t[1];let c=o,f=l;for(let _=r;_c&&(c=g),b>f&&(f=b)}u=Math.max(c-o,f-l),u=u!==0?32767/u:0}return Ns(s,a,r,o,l,u,0),a}function yp(t,e,r,i,n){let s;if(n===Pb(t,e,r,i)>0)for(let a=e;a=e;a-=i)s=Tp(a/i|0,t[a],t[a+1],s);return s&&hs(s,s.next)&&(js(s),s=s.next),s}function Dn(t,e){if(!t)return t;e||(e=t);let r=t,i;do if(i=!1,!r.steiner&&(hs(r,r.next)||ir(r.prev,r,r.next)===0)){if(js(r),r=e=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function Ns(t,e,r,i,n,s,a){if(!t)return;!a&&s&&wb(t,i,n,s);let o=t;for(;t.prev!==t.next;){let l=t.prev,u=t.next;if(s?pb(t,i,n,s):fb(t)){e.push(l.i,t.i,u.i),js(t),t=u.next,o=u.next;continue}if(t=u,t===o){a?a===1?(t=gb(Dn(t),e),Ns(t,e,r,i,n,s,2)):a===2&&mb(t,e,r,i,n,s):Ns(Dn(t),e,r,i,n,s,1);break}}}function fb(t){let e=t.prev,r=t,i=t.next;if(ir(e,r,i)>=0)return!1;let n=e.x,s=r.x,a=i.x,o=e.y,l=r.y,u=i.y,c=Math.min(n,s,a),f=Math.min(o,l,u),_=Math.max(n,s,a),g=Math.max(o,l,u),b=i.next;for(;b!==e;){if(b.x>=c&&b.x<=_&&b.y>=f&&b.y<=g&&zs(n,o,s,l,a,u,b.x,b.y)&&ir(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function pb(t,e,r,i){let n=t.prev,s=t,a=t.next;if(ir(n,s,a)>=0)return!1;let o=n.x,l=s.x,u=a.x,c=n.y,f=s.y,_=a.y,g=Math.min(o,l,u),b=Math.min(c,f,_),T=Math.max(o,l,u),x=Math.max(c,f,_),S=Rh(g,b,e,r,i),P=Rh(T,x,e,r,i),B=t.prevZ,A=t.nextZ;for(;B&&B.z>=S&&A&&A.z<=P;){if(B.x>=g&&B.x<=T&&B.y>=b&&B.y<=x&&B!==n&&B!==a&&zs(o,c,l,f,u,_,B.x,B.y)&&ir(B.prev,B,B.next)>=0||(B=B.prevZ,A.x>=g&&A.x<=T&&A.y>=b&&A.y<=x&&A!==n&&A!==a&&zs(o,c,l,f,u,_,A.x,A.y)&&ir(A.prev,A,A.next)>=0))return!1;A=A.nextZ}for(;B&&B.z>=S;){if(B.x>=g&&B.x<=T&&B.y>=b&&B.y<=x&&B!==n&&B!==a&&zs(o,c,l,f,u,_,B.x,B.y)&&ir(B.prev,B,B.next)>=0)return!1;B=B.prevZ}for(;A&&A.z<=P;){if(A.x>=g&&A.x<=T&&A.y>=b&&A.y<=x&&A!==n&&A!==a&&zs(o,c,l,f,u,_,A.x,A.y)&&ir(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function gb(t,e){let r=t;do{let i=r.prev,n=r.next.next;!hs(i,n)&&bp(i,r,r.next,n)&&Hs(i,n)&&Hs(n,i)&&(e.push(i.i,r.i,n.i),js(r),js(r.next),r=t=n),r=r.next}while(r!==t);return Dn(r)}function mb(t,e,r,i,n,s){let a=t;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Eb(a,o)){let l=wp(a,o);a=Dn(a,a.next),l=Dn(l,l.next),Ns(a,e,r,i,n,s,0),Ns(l,e,r,i,n,s,0);return}o=o.next}a=a.next}while(a!==t)}function _b(t,e,r,i){let n=[];for(let s=0,a=e.length;s=r.next.y&&r.next.y!==r.y){let f=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(f<=i&&f>s&&(s=f,a=r.x=r.x&&r.x>=l&&i!==r.x&&xp(na.x||r.x===a.x&&bb(a,r)))&&(a=r,c=f)}r=r.next}while(r!==o);return a}function bb(t,e){return ir(t.prev,t,e.prev)<0&&ir(e.next,t,t.next)<0}function wb(t,e,r,i){let n=t;do n.z===0&&(n.z=Rh(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,Tb(n)}function Tb(t){let e,r=1;do{let i=t,n;t=null;let s=null;for(e=0;i;){e++;let a=i,o=0;for(let u=0;u0||l>0&&a;)o!==0&&(l===0||!a||i.z<=a.z)?(n=i,i=i.nextZ,o--):(n=a,a=a.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=a}s.nextZ=null,r*=2}while(e>1);return t}function Rh(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Sb(t){let e=t,r=t;do(e.x=(t-a)*(s-o)&&(t-a)*(i-o)>=(r-a)*(e-o)&&(r-a)*(s-o)>=(n-a)*(i-o)}function zs(t,e,r,i,n,s,a,o){return!(t===a&&e===o)&&xp(t,e,r,i,n,s,a,o)}function Eb(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Cb(t,e)&&(Hs(t,e)&&Hs(e,t)&&Ab(t,e)&&(ir(t.prev,t,e.prev)||ir(t,e.prev,e))||hs(t,e)&&ir(t.prev,t,t.next)>0&&ir(e.prev,e,e.next)>0)}function ir(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function hs(t,e){return t.x===e.x&&t.y===e.y}function bp(t,e,r,i){let n=ho(ir(t,e,r)),s=ho(ir(t,e,i)),a=ho(ir(r,i,t)),o=ho(ir(r,i,e));return!!(n!==s&&a!==o||n===0&&lo(t,r,e)||s===0&&lo(t,i,e)||a===0&&lo(r,t,i)||o===0&&lo(r,e,i))}function lo(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ho(t){return t>0?1:t<0?-1:0}function Cb(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&bp(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Hs(t,e){return ir(t.prev,t,t.next)<0?ir(t,e,t.next)>=0&&ir(t,t.prev,e)>=0:ir(t,e,t.prev)<0||ir(t,t.next,e)<0}function Ab(t,e){let r=t,i=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}function wp(t,e){let r=kh(t.i,t.x,t.y),i=kh(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function Tp(t,e,r,i){let n=kh(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function js(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function kh(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Pb(t,e,r,i){let n=0;for(let s=e,a=r-i;s{}),Sp,Rb=y(()=>{Mb(),Xt(),Sp=vp.default||vp});function Ep(t,e,r,i,n,s,a){let o=Sp(t,e,2);if(!o)return;for(let u=0;u{Rb()}),Ap,Pp,kb=y(()=>{Z(),Cp(),Ap=[],Pp={extension:{type:k.ShapeBuilder,name:"polygon"},build(t,e){for(let r=0;r{Z(),Mp={extension:{type:k.ShapeBuilder,name:"rectangle"},build(t,e){let r=t,i=r.x,n=r.y,s=r.width,a=r.height;return s>0&&a>0?(e[0]=i,e[1]=n,e[2]=i+s,e[3]=n,e[4]=i+s,e[5]=n+a,e[6]=i,e[7]=n+a,!0):!1},triangulate(t,e,r,i,n,s){let a=0;i*=r,e[i+a]=t[0],e[i+a+1]=t[1],a+=r,e[i+a]=t[2],e[i+a+1]=t[3],a+=r,e[i+a]=t[6],e[i+a+1]=t[7],a+=r,e[i+a]=t[4],e[i+a+1]=t[5],a+=r;let o=i/r;n[s++]=o,n[s++]=o+1,n[s++]=o+2,n[s++]=o+1,n[s++]=o+3,n[s++]=o+2}}}),Rp,Ob=y(()=>{Z(),Rp={extension:{type:k.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,!0},triangulate(t,e,r,i,n,s){let a=0;i*=r,e[i+a]=t[0],e[i+a+1]=t[1],a+=r,e[i+a]=t[2],e[i+a+1]=t[3],a+=r,e[i+a]=t[4],e[i+a+1]=t[5];let o=i/r;n[s++]=o,n[s++]=o+1,n[s++]=o+2}}});function kp(t,e){for(let r=0;r{Ke(),rr(),et(),hh(),Kt(),er(),Ot(),Ye(),Bh=[{offset:0,color:"white"},{offset:1,color:"black"}],uo=class Ed{constructor(...e){this.uid=dt("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let r=Ib(e);r={...r.type==="radial"?Ed.defaultRadialOptions:Ed.defaultLinearOptions,...ot(r)},this._textureSize=r.textureSize,this._wrapMode=r.wrapMode,r.type==="radial"?(this.center=r.center,this.outerCenter=r.outerCenter??this.center,this.innerRadius=r.innerRadius,this.outerRadius=r.outerRadius,this.scale=r.scale,this.rotation=r.rotation):(this.start=r.start,this.end=r.end),this.textureSpace=r.textureSpace,this.type=r.type,r.colorStops.forEach(i=>{this.addColorStop(i.offset,i.color)})}addColorStop(e,r){return this.colorStops.push({offset:e,color:ge.shared.setValue(r).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:r}=this.start,{x:i,y:n}=this.end,s=i-e,a=n-r,o=s<0||a<0;if(this._wrapMode==="clamp-to-edge"){if(s<0){let x=e;e=i,i=x,s*=-1}if(a<0){let x=r;r=n,n=x,a*=-1}}let l=this.colorStops.length?this.colorStops:Bh,u=this._textureSize,{canvas:c,context:f}=Bp(u,1),_=o?f.createLinearGradient(this._textureSize,0,0,0):f.createLinearGradient(0,0,this._textureSize,0);kp(_,l),f.fillStyle=_,f.fillRect(0,0,u,1),this.texture=new He({source:new qn({resource:c,addressMode:this._wrapMode})});let g=Math.sqrt(s*s+a*a),b=Math.atan2(a,s),T=new me;T.scale(g/u,1),T.rotate(b),T.translate(e,r),this.textureSpace==="local"&&T.scale(u,u),this.transform=T}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:Bh,r=this._textureSize,{canvas:i,context:n}=Bp(r,r),{x:s,y:a}=this.center,{x:o,y:l}=this.outerCenter,u=this.innerRadius,c=this.outerRadius,f=o-c,_=l-c,g=r/(c*2),b=(s-f)*g,T=(a-_)*g,x=n.createRadialGradient(b,T,u*g,(o-f)*g,(l-_)*g,c*g);kp(x,e),n.fillStyle=e[e.length-1].color,n.fillRect(0,0,r,r),n.fillStyle=x,n.translate(b,T),n.rotate(this.rotation),n.scale(1,this.scale),n.translate(-b,-T),n.fillRect(0,0,r,r),this.texture=new He({source:new qn({resource:i,addressMode:this._wrapMode})});let S=new me;S.scale(1/g,1/g),S.translate(f,_),this.textureSpace==="local"&&S.scale(r,r),this.transform=S}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}},uo.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"},uo.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"},Ii=uo});function Gb(t,e,r,i){let n=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){let a=r.getBounds(Ip);e.width&&a.pad(e.width);let{x:o,y:l}=a,u=1/a.width,c=1/a.height,f=-o*u,_=-l*c,g=n.a,b=n.b,T=n.c,x=n.d;n.a*=u,n.b*=u,n.c*=c,n.d*=c,n.tx=f*g+_*T+n.tx,n.ty=f*b+_*x+n.ty}else n.translate(e.texture.frame.x,e.texture.frame.y),n.scale(1/e.texture.source.width,1/e.texture.source.height);let s=e.texture.source.style;return!(e.fill instanceof Ii)&&s.addressMode==="clamp-to-edge"&&(s.addressMode="repeat",s.update()),i&&n.append(Op.copyFrom(i).invert()),n}var Op,Ip,Fb=y(()=>{et(),nr(),Ws(),Op=new me,Ip=new Wt});function Db(t,e){let{geometryData:r,batches:i}=e;i.length=0,r.indices.length=0,r.vertices.length=0,r.uvs.length=0;for(let n=0;n{let f=[],_=Vs[l.type];if(!_.build(l,f))return;let g=o.length,b=s.length/2,T="triangle-list";if(u&&dp(f,u),r){let B=l.closePath??!0,A=e;A.pixelLine?(cb(f,B,s,o),T="line-list"):hb(f,A,!1,B,s,o)}else if(c){let B=[],A=f.slice();Lb(c).forEach(X=>{B.push(A.length/2),A.push(...X)}),Ep(A,B,s,2,b,o,g)}else _.triangulate(f,s,2,b,o,g);let x=a.length/2,S=e.texture;if(S!==He.WHITE){let B=Gb(Dp,e,l,u);rb(s,2,b,a,x,2,s.length/2-b,B)}else ib(a,x,2,s.length/2-b);let P=qt.get(oo);P.indexOffset=g,P.indexSize=o.length-g,P.attributeOffset=b,P.attributeSize=s.length/2-b,P.baseColor=e.color,P.alpha=e.alpha,P.texture=S,P.geometryData=n,P.topology=T,i.push(P)})}function Lb(t){let e=[];for(let r=0;r{Z(),et(),nr(),nb(),sb(),Kt(),jr(),pp(),ab(),ub(),db(),kb(),Bb(),Ob(),Fb(),Cp(),Vs={},Se.handleByMap(k.ShapeBuilder,Vs),Se.add(Mp,Pp,Rp,ls,gp,mp),Fp=new Wt,Dp=new me}),Up,Lp,co,fo,Oh=y(()=>{Z(),ph(),cp(),ue(),ti(),Ot(),jr(),Nb(),Up=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(t=>{qt.return(t)}),this.graphicsData&&qt.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}},Lp=class{constructor(){this.instructions=new L}init(t){let e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new ao({maxTextures:e}),this.instructions.reset()}get geometry(){return $e(Vi,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}},co=class Cd{constructor(e){this._renderer=e,this._managedContexts=new Yr({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Cd.defaultOptions.bezierSmoothness=e?.bezierSmoothness??Cd.defaultOptions.bezierSmoothness}getContextRenderData(e){return e._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(e)}updateGpuContext(e){let r=!!e._gpuData[this._renderer.uid],i=e._gpuData[this._renderer.uid]||this._initContext(e);if(e.dirty||!r){r&&i.reset(),Db(e,i);let n=e.batchMode;e.customShader||n==="no-batch"?i.isBatchable=!1:n==="auto"?i.isBatchable=i.geometryData.vertices.length<400:i.isBatchable=!0,e.dirty=!1}return i}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){let r=qt.get(Lp,{maxTextures:this._renderer.limits.maxBatchableTextures}),i=e._gpuData[this._renderer.uid],{batches:n,geometryData:s}=i;i.graphicsData=r;let a=s.vertices.length,o=s.indices.length;for(let f=0;f{"use strict";Np={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},po=0,go=1,mo=2,_o=3,vo=4,yo=5,xo=class Qy{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<>24&255)/255;e[r++]=(t&255)/255*i,e[r++]=(t>>8&255)/255*i,e[r++]=(t>>16&255)/255*i,e[r++]=i}var Xs=y(()=>{"use strict"}),zp,Ih,zb=y(()=>{Z(),Gi(),ti(),jr(),Xs(),pp(),zp=class{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{qt.return(t)}),this.batches.length=0}},Ih=class{constructor(t,e){this.state=di.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Yr({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){let e=t.context,r=!!t._gpuData,i=this.renderer.graphicsContext.updateGpuContext(e);return!!(i.isBatchable||r!==i.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._getGpuDataForRenderable(t).batches;for(let r=0;r{let a=qt.get(oo);return s.copyTo(a),a.renderable=t,a.roundPixels=n,a})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}},Ih.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"graphics"}}),Hp=y(()=>{Z(),Oh(),zb(),Se.add(Ih),Se.add(fo)}),bo,Gh=y(()=>{"use strict";bo=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let t=this.geometry.getBuffer("aUV"),e=t.data,r=e,i=this.texture.textureMatrix;return i.isSimple||(r=this._transformedUvs,(this._textureMatrixUpdateId!==i._updateID||this._uvUpdateId!==t._updateID)&&((!r||r.length{Z(),et(),Pn(),Xr(),Xa(),Xs(),Gh(),Fh=class{destroy(){}},Dh=class{constructor(t,e){this.localUniforms=new Gr({uTransformMatrix:{value:new me,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Bi({0:this.localUniforms}),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,i=t.batched;if(e.batched=i,r!==i)return!0;if(i){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);return s.texture.uid!==t._texture.uid&&(s._textureMatrixUpdateId=-1),!s._batcher.checkAndUpdateTexture(s,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,i=this._getMeshData(t);if(t.didViewUpdate&&(i.indexSize=t._geometry.indices?.length,i.vertexSize=t._geometry.positions?.length),i.batched){let n=this._getBatchableMesh(t);n.setTexture(t._texture),n.geometry=t._geometry,r.addToBatch(n,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._getBatchableMesh(t);e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}execute(t){if(!t.isRenderable)return;t.state.blendMode=Is(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),$s(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){var e,r;return(e=t._gpuData)[r=this.renderer.uid]||(e[r]=new Fh),t._gpuData[this.renderer.uid].meshData||this._initMeshData(t)}_initMeshData(t){return t._gpuData[this.renderer.uid].meshData={batched:t.batched,indexSize:0,vertexSize:0},t._gpuData[this.renderer.uid].meshData}_getBatchableMesh(t){var e,r;return(e=t._gpuData)[r=this.renderer.uid]||(e[r]=new Fh),t._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=new bo;return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,t._gpuData[this.renderer.uid].batchableMesh=e,e}destroy(){this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}},Dh.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"mesh"}}),jp=y(()=>{Z(),Hb(),Se.add(Dh)}),Wp,jb=y(()=>{"use strict";Wp=class{execute(t,e){let r=t.state,i=t.renderer,n=e.shader||t.defaultShader;n.resources.uTexture=e.texture._source,n.resources.uniforms=t.localUniforms;let s=i.gl,a=t.getBuffers(e);i.shader.bind(n),i.state.set(r),i.geometry.bind(a.geometry,n.glProgram);let o=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;s.drawElements(s.TRIANGLES,e.particleChildren.length*6,o,0)}}});function Vp(t,e=null){let r=t*6;if(r>65535?e||(e=new Uint32Array(r)):e||(e=new Uint16Array(r)),e.length!==r)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${r}`);for(let i=0,n=0;i{"use strict"});function Vb(t){return{dynamicUpdate:$p(t,!0),staticUpdate:$p(t,!1)}}function $p(t,e){let r=[];r.push(` var index = 0; for (let i = 0; i < ps.length; ++i) { const p = ps[i]; `);let i=0;for(let s in t){let a=t[s];if(e!==a.dynamic)continue;r.push(`offset = index + ${i}`),r.push(a.code);let o=un(a.format);i+=o.stride/4}r.push(` index += stride * 4; } `),r.unshift(` var stride = ${i}; `);let n=r.join(` `);return new Function("ps","f32v","u32v",n)}var $b=y(()=>{ts()});function Xb(t){let e=[];for(let r in t){let i=t[r];e.push(r,i.code,i.dynamic?"d":"s")}return e.join("_")}var Xp,Yb=y(()=>{kn(),ln(),Fs(),ts(),Pf(),Wb(),$b(),Xp=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,i=0,n=0;for(let u in r){let c=r[u],f=un(c.format);c.dynamic?n+=f.stride:i+=f.stride}this._dynamicStride=n/4,this._staticStride=i/4,this.staticAttributeBuffer=new Mn(e*4*i),this.dynamicAttributeBuffer=new Mn(e*4*n),this.indexBuffer=Vp(e);let s=new Jn,a=0,o=0;this._staticBuffer=new $r({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:bt.VERTEX|bt.COPY_DST}),this._dynamicBuffer=new $r({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:bt.VERTEX|bt.COPY_DST});for(let u in r){let c=r[u],f=un(c.format);c.dynamic?(s.addAttribute(c.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:c.format}),a+=f.size):(s.addAttribute(c.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:o*4,format:c.format}),o+=f.size)}s.addIndex(this.indexBuffer);let l=this.getParticleUpdate(r);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=s}getParticleUpdate(t){let e=Xb(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return Vb(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Mn(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Mn(this._size*this._dynamicStride*4*4),this.indexBuffer=Vp(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let i=this.staticAttributeBuffer;this._staticUpload(t,i.float32View,i.uint32View),this._staticBuffer.setDataWithSize(i.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}}),Yp,qb=y(()=>{Yp=`varying vec2 vUV; varying vec4 vColor; uniform sampler2D uTexture; void main(void){ vec4 color = texture2D(uTexture, vUV) * vColor; gl_FragColor = color; }`}),qp,Kb=y(()=>{qp=`attribute vec2 aVertex; attribute vec2 aUV; attribute vec4 aColor; attribute vec2 aPosition; attribute float aRotation; uniform mat3 uTranslationMatrix; uniform float uRound; uniform vec2 uResolution; uniform vec4 uColor; varying vec2 vUV; varying vec4 vColor; vec2 roundPixels(vec2 position, vec2 targetSize) { return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; } void main(void){ float cosRotation = cos(aRotation); float sinRotation = sin(aRotation); float x = aVertex.x * cosRotation - aVertex.y * sinRotation; float y = aVertex.x * sinRotation + aVertex.y * cosRotation; vec2 v = vec2(x, y); v = v + aPosition; gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0); if(uRound == 1.0) { gl_Position.xy = roundPixels(gl_Position.xy, uResolution); } vUV = aUV; vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor; } `}),Uh,Zb=y(()=>{Uh=` struct ParticleUniforms { uTranslationMatrix:mat3x3, uColor:vec4, uRound:f32, uResolution:vec2, }; fn roundPixels(position: vec2, targetSize: vec2) -> vec2 { return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; } @group(0) @binding(0) var uniforms: ParticleUniforms; @group(1) @binding(0) var uTexture: texture_2d; @group(1) @binding(1) var uSampler : sampler; struct VSOutput { @builtin(position) position: vec4, @location(0) uv : vec2, @location(1) color : vec4, }; @vertex fn mainVertex( @location(0) aVertex: vec2, @location(1) aPosition: vec2, @location(2) aUV: vec2, @location(3) aColor: vec4, @location(4) aRotation: f32, ) -> VSOutput { let v = vec2( aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation), aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation) ) + aPosition; var position = vec4((uniforms.uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0); if(uniforms.uRound == 1.0) { position = vec4(roundPixels(position.xy, uniforms.uResolution), position.zw); } let vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uniforms.uColor; return VSOutput( position, aUV, vColor, ); } @fragment fn mainFragment( @location(0) uv: vec2, @location(1) color: vec4, @builtin(position) position: vec4, ) -> @location(0) vec4 { var sample = textureSample(uTexture, uSampler, uv) * color; return sample; }`}),Kp,Qb=y(()=>{Ke(),et(),Bn(),ns(),Oi(),Kt(),xe(),qb(),Kb(),Zb(),Kp=class extends _i{constructor(){let t=hn.from({vertex:qp,fragment:Yp}),e=On.from({fragment:{source:Uh,entryPoint:"mainFragment"},vertex:{source:Uh,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:He.WHITE.source,uSampler:new _e({}),uniforms:{uTranslationMatrix:{value:new me,type:"mat3x3"},uColor:{value:new ge(16777215),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}}})}}}),Lh,Zp=y(()=>{et(),Xr(),Xa(),Gi(),ti(),Xs(),Yb(),Qb(),Lh=class{constructor(t,e){this.state=di.for2d(),this.localUniforms=new Gr({uTranslationMatrix:{value:new me,type:"mat3x3"},uColor:{value:new Float32Array(4),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Kp,this.state=di.for2d(),this._managedContainers=new Yr({renderer:t,type:"renderable",name:"particleContainer"})}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return t._gpuData[this.renderer.uid]||this._initBuffer(t)}_initBuffer(t){return t._gpuData[this.renderer.uid]=new Xp({size:t.particleChildren.length,properties:t._properties}),this._managedContainers.add(t),t._gpuData[this.renderer.uid]}updateRenderable(t){}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,i=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let n=this.state;i.update(e,t._childrenDirty),t._childrenDirty=!1,n.blendMode=Is(t.blendMode,t.texture._source);let s=this.localUniforms.uniforms,a=s.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),s.uResolution=r.globalUniforms.globalUniformData.resolution,s.uRound=r._roundPixels|t._roundPixels,$s(t.groupColorAlpha,s.uColor,0),this.adaptor.execute(this,t)}destroy(){this._managedContainers.destroy(),this.renderer=null,this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}}),Nh,Jb=y(()=>{Z(),jb(),Zp(),Nh=class extends Lh{constructor(t){super(t,new Wp)}},Nh.extension={type:[k.WebGLPipes],name:"particle"}}),Qp,e1=y(()=>{"use strict";Qp=class{execute(t,e){let r=t.renderer,i=e.shader||t.defaultShader;i.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),i.groups[1]=r.texture.getTextureBindGroup(e.texture);let n=t.state,s=t.getBuffers(e);r.encoder.draw({geometry:s.geometry,shader:e.shader||t.defaultShader,state:n,size:e.particleChildren.length*6})}}}),zh,t1=y(()=>{Z(),e1(),Zp(),zh=class extends Lh{constructor(t){super(t,new Qp)}},zh.extension={type:[k.WebGPUPipes],name:"particle"}}),Jp=y(()=>{Z(),Jb(),t1(),Se.add(Nh),Se.add(zh)});function Hh(t,e){let{texture:r,bounds:i}=t,n=e._style._getFinalPadding();gf(i,e._anchor,r);let s=e._anchor._x*n*2,a=e._anchor._y*n*2;i.minX-=n-s,i.minY-=n-a,i.maxX-=n-s,i.maxY-=n-a}var eg=y(()=>{mf()}),Ys,wo=y(()=>{"use strict";Ys=class{constructor(){this.batcherName="default",this.topology="triangle-list",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}destroy(){this.reset()}}}),tg,r1=y(()=>{wo(),tg=class extends Ys{}}),jh,i1=y(()=>{Z(),ti(),eg(),r1(),jh=class{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Yr({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(let t in this._managedTexts.items){let e=this._managedTexts.items[t];e?._autoResolution&&e.onViewUpdate()}}validateRenderable(t){let e=this._getGpuText(t),r=t.styleKey;return e.currentKey!==r?!0:t._didTextUpdate}addRenderable(t,e){let r=this._getGpuText(t);if(t._didTextUpdate){let i=t._autoResolution?this._renderer.resolution:t.resolution;(r.currentKey!==t.styleKey||t.resolution!==i)&&this._updateGpuText(t),t._didTextUpdate=!1,Hh(r,t)}this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){let e=this._getGpuText(t);e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t.styleKey}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new tg;return e.currentKey="--",e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,this._managedTexts.add(t),e}onTextUnload(t){let e=t._gpuData[this._renderer.uid];if(!e)return;let{canvasText:r}=this._renderer;r.getReferenceCount(e.currentKey)>0?r.decreaseReferenceCount(e.currentKey):e.texture&&r.returnTexture(e.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}},jh.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"text"}}),Wh,qs,Vh=y(()=>{et(),er(),Wh={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"}},qs=class{constructor(t,e){this.uid=dt("fillPattern"),this._tick=0,this.transform=new me,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Wh[e].addressModeU,t.source.style.addressModeV=Wh[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._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}}),n1=Br((t,e)=>{e.exports=n;var r={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(o){var l=[];return o.replace(i,function(u,c,f){var _=c.toLowerCase();for(f=a(f),_=="m"&&f.length>2&&(l.push([c].concat(f.splice(0,2))),_="l",c=c=="m"?"l":"L");;){if(f.length==r[_])return f.unshift(c),l.push(f);if(f.length0&&(n=i.pop(),n?(s=n.startX,a=n.startY):(s=0,a=0)),n=null;break;default:it(`Unknown SVG path command: ${u}`)}u!=="Z"&&u!=="z"&&n===null&&(n={startX:s,startY:a},i.push(n))}return e}var rg,a1=y(()=>{rg=Sr(n1(),1),It()}),$h,ig=y(()=>{nr(),$h=class Jy{constructor(e=0,r=0,i=0){this.type="circle",this.x=e,this.y=r,this.radius=i}clone(){return new Jy(this.x,this.y,this.radius)}contains(e,r){if(this.radius<=0)return!1;let i=this.radius*this.radius,n=this.x-e,s=this.y-r;return n*=n,s*=s,n+s<=i}strokeContains(e,r,i,n=.5){if(this.radius===0)return!1;let s=this.x-e,a=this.y-r,o=this.radius,l=(1-n)*i,u=Math.sqrt(s*s+a*a);return u<=o+l&&u>o-(i-l)}getBounds(e){return e||(e=new Wt),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}]`}}}),ng,o1=y(()=>{nr(),ng=class ex{constructor(e=0,r=0,i=0,n=0){this.type="ellipse",this.x=e,this.y=r,this.halfWidth=i,this.halfHeight=n}clone(){return new ex(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,r){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(e-this.x)/this.halfWidth,n=(r-this.y)/this.halfHeight;return i*=i,n*=n,i+n<=1}strokeContains(e,r,i,n=.5){let{halfWidth:s,halfHeight:a}=this;if(s<=0||a<=0)return!1;let o=i*(1-n),l=i-o,u=s-l,c=a-l,f=s+o,_=a+o,g=e-this.x,b=r-this.y,T=g*g/(u*u)+b*b/(c*c),x=g*g/(f*f)+b*b/(_*_);return T>1&&x<=1}getBounds(e){return e||(e=new Wt),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 l1(t,e,r,i,n,s){let a=t-r,o=e-i,l=n-r,u=s-i,c=a*l+o*u,f=l*l+u*u,_=-1;f!==0&&(_=c/f);let g,b;_<0?(g=r,b=i):_>1?(g=n,b=s):(g=r+_*l,b=i+_*u);let T=t-g,x=e-b;return T*T+x*x}var h1=y(()=>{"use strict"}),u1,c1,To,d1=y(()=>{Ot(),h1(),nr(),To=class tx{constructor(...e){this.type="polygon";let r=Array.isArray(e[0])?e[0]:e;if(typeof r[0]!="number"){let i=[];for(let n=0,s=r.length;nr!=c>r&&e<(u-o)*((r-l)/(c-l))+o&&(i=!i)}return i}strokeContains(e,r,i,n=.5){let s=i*i,a=s*(1-n),o=s-a,{points:l}=this,u=l.length-(this.closePath?0:2);for(let c=0;cn?u:n,s=ca?c:a}return e.x=i,e.width=n-i,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,r)=>`${e}, ${r}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return $e("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return $e("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}}),Ks,sg,f1=y(()=>{nr(),Ks=(t,e,r,i,n,s,a)=>{let o=t-r,l=e-i,u=Math.sqrt(o*o+l*l);return u>=n-s&&u<=n+a},sg=class rx{constructor(e=0,r=0,i=0,n=0,s=20){this.type="roundedRectangle",this.x=e,this.y=r,this.width=i,this.height=n,this.radius=s}getBounds(e){return e||(e=new Wt),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new rx(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,r){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&r>=this.y&&r<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(r>=this.y+i&&r<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let n=e-(this.x+i),s=r-(this.y+i),a=i*i;if(n*n+s*s<=a||(n=e-(this.x+this.width-i),n*n+s*s<=a)||(s=r-(this.y+this.height-i),n*n+s*s<=a)||(n=e-(this.x+i),n*n+s*s<=a))return!0}return!1}strokeContains(e,r,i,n=.5){let{x:s,y:a,width:o,height:l,radius:u}=this,c=i*(1-n),f=i-c,_=s+u,g=a+u,b=o-u*2,T=l-u*2,x=s+o,S=a+l;return(e>=s-c&&e<=s+f||e>=x-f&&e<=x+c)&&r>=g&&r<=g+T||(r>=a-c&&r<=a+f||r>=S-f&&r<=S+c)&&e>=_&&e<=_+b?!0:e<_&&rx-u&&rx-u&&r>S-u&&Ks(e,r,x-u,S-u,u,f,c)||e<_&&r>S-u&&Ks(e,r,_,S-u,u,f,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function ag(t,e,r,i,n,s,a,o,l,u){let c=Math.min(.99,Math.max(0,u??fo.defaultOptions.bezierSmoothness)),f=(lg-c)/1;return f*=f,p1(e,r,i,n,s,a,o,l,t,f),t}function p1(t,e,r,i,n,s,a,o,l,u){Xh(t,e,r,i,n,s,a,o,l,u,0),l.push(a,o)}function Xh(t,e,r,i,n,s,a,o,l,u,c){if(c>og)return;let f=Math.PI,_=(t+r)/2,g=(e+i)/2,b=(r+n)/2,T=(i+s)/2,x=(n+a)/2,S=(s+o)/2,P=(_+b)/2,B=(g+T)/2,A=(b+x)/2,X=(T+S)/2,W=(P+A)/2,q=(B+X)/2;if(c>0){let ae=a-t,ce=o-e,ie=Math.abs((r-a)*ce-(i-o)*ae),he=Math.abs((n-a)*ce-(s-o)*ae),Be,Ve;if(ie>Zs&&he>Zs){if((ie+he)*(ie+he)<=u*(ae*ae+ce*ce)){if(Un=f&&(Be=2*f-Be),Ve>=f&&(Ve=2*f-Ve),Be+Vedn){l.push(r,i);return}if(Ve>dn){l.push(n,s);return}}}}else if(ie>Zs){if(ie*ie<=u*(ae*ae+ce*ce)){if(Un=f&&(Be=2*f-Be),Bedn){l.push(r,i);return}}}else if(he>Zs){if(he*he<=u*(ae*ae+ce*ce)){if(Un=f&&(Be=2*f-Be),Bedn){l.push(n,s);return}}}else if(ae=W-(t+a)/2,ce=q-(e+o)/2,ae*ae+ce*ce<=u){l.push(W,q);return}}Xh(t,e,_,g,P,B,W,q,l,u,c+1),Xh(W,q,A,X,x,S,a,o,l,u,c+1)}var og,Zs,lg,So,Un,dn,hg=y(()=>{Oh(),og=8,Zs=11920929e-14,lg=1,So=.01,Un=0,dn=0});function g1(t,e,r,i,n,s,a,o){let l=Math.min(.99,Math.max(0,o??fo.defaultOptions.bezierSmoothness)),u=(dg-l)/1;return u*=u,m1(e,r,i,n,s,a,t,u),t}function m1(t,e,r,i,n,s,a,o){Yh(a,t,e,r,i,n,s,o,0),a.push(n,s)}function Yh(t,e,r,i,n,s,a,o,l){if(l>ug)return;let u=Math.PI,c=(e+i)/2,f=(r+n)/2,_=(i+s)/2,g=(n+a)/2,b=(c+_)/2,T=(f+g)/2,x=s-e,S=a-r,P=Math.abs((i-s)*S-(n-a)*x);if(P>cg){if(P*P<=o*(x*x+S*S)){if(qh=u&&(B=2*u-B),B{Oh(),ug=8,cg=11920929e-14,dg=1,fg=.01,qh=0});function pg(t,e,r,i,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(i,1/3)*(l/Math.PI)))),o=Math.max(o,3);let u=l/o,c=n;u*=a?-1:1;for(let f=0;f{"use strict"});function v1(t,e,r,i,n,s){let a=t[t.length-2],o=t[t.length-1]-r,l=a-e,u=n-r,c=i-e,f=Math.abs(o*c-l*u);if(f<1e-8||s===0){(t[t.length-2]!==e||t[t.length-1]!==r)&&t.push(e,r);return}let _=o*o+l*l,g=u*u+c*c,b=o*u+l*c,T=s*Math.sqrt(_)/f,x=s*Math.sqrt(g)/f,S=T*b/_,P=x*b/g,B=T*c+x*l,A=T*u+x*o,X=l*(x+S),W=o*(x+S),q=c*(T+P),ae=u*(T+P),ce=Math.atan2(W-A,X-B),ie=Math.atan2(ae-A,q-B);pg(t,B+e,A+r,s,ce,ie,l*u>c*o)}var y1=y(()=>{gg()});function x1(t,e){let r=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=e===1.5707963267948966?.551915024494:r,n=Math.cos(t),s=Math.sin(t),a=Math.cos(t+e),o=Math.sin(t+e);return[{x:n-s*i,y:s+n*i},{x:a+o*i,y:o-a*i},{x:a,y:o}]}function b1(t,e,r,i,n,s,a,o=0,l=0,u=0){if(s===0||a===0)return;let c=Math.sin(o*us/360),f=Math.cos(o*us/360),_=f*(e-i)/2+c*(r-n)/2,g=-c*(e-i)/2+f*(r-n)/2;if(_===0&&g===0)return;s=Math.abs(s),a=Math.abs(a);let b=Math.pow(_,2)/Math.pow(s,2)+Math.pow(g,2)/Math.pow(a,2);b>1&&(s*=Math.sqrt(b),a*=Math.sqrt(b)),mg(e,r,i,n,s,a,l,u,c,f,_,g,Eo);let{ang1:T,ang2:x}=Eo,{centerX:S,centerY:P}=Eo,B=Math.abs(x)/(us/4);Math.abs(1-B)<1e-7&&(B=1);let A=Math.max(Math.ceil(B),1);x/=A;let X=t[t.length-2],W=t[t.length-1],q={x:0,y:0};for(let ae=0;ae{hg(),us=Math.PI*2,Eo={centerX:0,centerY:0,ang1:0,ang2:0},Co=({x:t,y:e},r,i,n,s,a,o,l)=>{t*=r,e*=i;let u=n*t-s*e,c=s*t+n*e;return l.x=u+a,l.y=c+o,l},Kh=(t,e,r,i)=>{let n=t*i-e*r<0?-1:1,s=t*r+e*i;return s>1&&(s=1),s<-1&&(s=-1),n*Math.acos(s)},mg=(t,e,r,i,n,s,a,o,l,u,c,f,_)=>{let g=Math.pow(n,2),b=Math.pow(s,2),T=Math.pow(c,2),x=Math.pow(f,2),S=g*b-g*x-b*T;S<0&&(S=0),S/=g*x+b*T,S=Math.sqrt(S)*(a===o?-1:1);let P=S*n/s*f,B=S*-s/n*c,A=u*P-l*B+(t+r)/2,X=l*P+u*B+(e+i)/2,W=(c-P)/n,q=(f-B)/s,ae=(-c-P)/n,ce=(-f-B)/s,ie=Kh(1,0,W,q),he=Kh(W,q,ae,ce);o===0&&he>0&&(he-=us),o===1&&he<0&&(he+=us),_.centerX=A,_.centerY=X,_.ang1=ie,_.ang2=he}});function T1(t,e,r){let i=(a,o)=>{let l=o.x-a.x,u=o.y-a.y,c=Math.sqrt(l*l+u*u),f=l/c,_=u/c;return{len:c,nx:f,ny:_}},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;a0&&(g=-1,b=!0);let T=_/2,x,S=Math.abs(Math.cos(T)*l/Math.sin(T));S>Math.min(c.len/2,f.len/2)?(S=Math.min(c.len/2,f.len/2),x=Math.abs(S*Math.sin(T)/Math.cos(T))):x=l;let P=o.x+f.nx*S+-f.ny*x*g,B=o.y+f.ny*S+f.nx*x*g,A=Math.atan2(c.ny,c.nx)+Math.PI/2*g,X=Math.atan2(f.ny,f.nx)-Math.PI/2*g;a===0&&t.moveTo(P+Math.cos(A)*x,B+Math.sin(A)*x),t.arc(P,B,x,A,X,b),s=o}}function S1(t,e,r,i){let n=(o,l)=>Math.sqrt((o.x-l.x)**2+(o.y-l.y)**2),s=(o,l,u)=>({x:o.x+(l.x-o.x)*u,y:o.y+(l.y-o.y)*u}),a=e.length;for(let o=0;o{"use strict"}),_g,vg,C1=y(()=>{ig(),o1(),d1(),nr(),f1(),Ar(),hg(),_1(),gg(),y1(),w1(),E1(),_g=new Wt,vg=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new pr,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,i=r[r.length-2],n=r[r.length-1];return(i!==t||n!==e)&&r.push(t,e),this}arc(t,e,r,i,n,s){this._ensurePoly(!1);let a=this._currentPoly.points;return pg(a,t,e,r,i,n,s),this}arcTo(t,e,r,i,n){this._ensurePoly();let s=this._currentPoly.points;return v1(s,t,e,r,i,n),this}arcToSvg(t,e,r,i,n,s,a){let o=this._currentPoly.points;return b1(o,this._currentPoly.lastX,this._currentPoly.lastY,s,a,t,e,r,i,n),this}bezierCurveTo(t,e,r,i,n,s,a){this._ensurePoly();let o=this._currentPoly;return ag(this._currentPoly.points,o.lastX,o.lastY,t,e,r,i,n,s,a),this}quadraticCurveTo(t,e,r,i,n){this._ensurePoly();let s=this._currentPoly;return g1(this._currentPoly.points,s.lastX,s.lastY,t,e,r,i,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let r=this.shapePrimitives,i=r.length;for(let n=0;n1){let n=null;for(let s=i;s=2;c-=2)u[c]===u[c-2]&&u[c-1]===u[c-3]&&u.splice(c-1,2);return this.poly(u,!0,s)}ellipse(t,e,r,i,n){return this.drawShape(new ng(t,e,r,i),n),this}roundRect(t,e,r,i,n,s){return this.drawShape(new sg(t,e,r,i,n),s),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new To,r.points.push(t,e),this._currentPoly=r,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 To,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,i=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let n=e.transform,s=r;r=n.a*r+n.c*i+n.tx,i=n.b*s+n.d*i+n.ty}this._currentPoly.points.push(r,i)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e{we(),er(),It(),a1(),C1(),fn=class ix{constructor(e,r=!1){this.instructions=[],this.uid=dt("graphicsPath"),this._dirty=!0,this.checkForHoles=r,typeof e=="string"?s1(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new vg(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,r){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,r]}),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,r,i,n,s){let a=this.instructions[this.instructions.length-1],o=this.getLastPoint(ye.shared),l=0,u=0;if(!a||a.action!=="bezierCurveTo")l=o.x,u=o.y;else{l=a.data[2],u=a.data[3];let c=o.x,f=o.y;l=c+(c-l),u=f+(f-u)}return this.instructions.push({action:"bezierCurveTo",data:[l,u,e,r,i,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,r,i){let n=this.instructions[this.instructions.length-1],s=this.getLastPoint(ye.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,u=s.y;a=l+(l-a),o=u+(u-o)}return this.instructions.push({action:"quadraticCurveTo",data:[a,o,e,r,i]}),this._dirty=!0,this}rect(e,r,i,n,s){return this.instructions.push({action:"rect",data:[e,r,i,n,s]}),this._dirty=!0,this}circle(e,r,i,n){return this.instructions.push({action:"circle",data:[e,r,i,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,r,i,n,s,a,o){s||(s=n/2);let l=-1*Math.PI/2+a,u=i*2,c=Math.PI*2/u,f=[];for(let _=0;_{"use strict"});function A1(t,e){let r=t.querySelectorAll("defs");for(let i=0;i{Ke(),It(),Ws(),yg()});function xg(t){let e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var k1=y(()=>{"use strict"});function bg(t,e){let r=t.getAttribute("style"),i={},n={},s={strokeStyle:i,fillStyle:n,useFill:!1,useStroke:!1};for(let a in Qh){let o=t.getAttribute(a);o&&wg(e,s,a,o.trim())}if(r){let a=r.split(";");for(let o=0;o{Ke(),k1(),Qh={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function O1(t){if(t.length<=2)return!0;let e=t.map(o=>o.area).sort((o,l)=>l-o),[r,i]=e,n=e[e.length-1],s=r/i,a=i/n;return!(s>3&&a<2)}var I1=y(()=>{"use strict"});function G1(t){return t.split(/(?=[Mm])/).filter(e=>e.trim().length>0)}function F1(t){let e=t.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!e||e.length<4)return 0;let r=e.map(Number),i=[],n=[];for(let u=0;u{Zh()});function U1(t,e){if(typeof t=="string"){let a=document.createElement("div");a.innerHTML=t.trim(),t=a.querySelector("svg")}let r={context:e,defs:{},path:new fn};A1(t,r);let i=t.children,{fillStyle:n,strokeStyle:s}=bg(t,r);for(let a=0;a1;if(he&&Be){let Ve=ie.map(D=>({path:D,area:F1(D)}));if(Ve.sort((D,Ee)=>Ee.area-D.area),ie.length>3||!O1(Ve))for(let D=0;DparseInt(ce,10)),e.context.poly(B,!0),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"polyline":A=t.getAttribute("points"),B=A.match(/-?\d+/g).map(ce=>parseInt(ce,10)),e.context.poly(B,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{it(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}o&&(r=null);for(let ce=0;ce{It(),Zh(),R1(),yg(),B1(),I1(),D1()});function N1(t){return ge.isColorLike(t)}function Eg(t){return t instanceof qs}function Cg(t){return t instanceof Ii}function z1(t){return t instanceof He}function H1(t,e,r){let i=ge.shared.setValue(e??0);return t.color=i.toNumber(),t.alpha=i.alpha===1?r.alpha:i.alpha,t.texture=He.WHITE,{...r,...t}}function j1(t,e,r){return t.texture=e,{...r,...t}}function Ag(t,e,r){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...r,...t}}function Pg(t,e,r){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...r,...t}}function W1(t,e){let r={...e,...t},i=ge.shared.setValue(r.color);return r.alpha*=i.alpha,r.color=i.toNumber(),r}function Ln(t,e){if(t==null)return null;let r={},i=t;return N1(t)?H1(r,t,e):z1(t)?j1(r,t,e):Eg(t)?Ag(r,t,e):Cg(t)?Pg(r,t,e):i.fill&&Eg(i.fill)?Ag(i,i.fill,e):i.fill&&Cg(i.fill)?Pg(i,i.fill,e):W1(i,e)}function Ao(t,e){let{width:r,alignment:i,miterLimit:n,cap:s,join:a,pixelLine:o,...l}=e,u=Ln(t,l);return u?{width:r,alignment:i,miterLimit:n,cap:s,join:a,pixelLine:o,...u}:null}var Mg=y(()=>{Ke(),Kt(),Ws(),Vh()}),Rg,Jh,Po,fi,kg=y(()=>{Xt(),Ke(),et(),we(),Kt(),er(),Ot(),Ar(),Zh(),L1(),Mg(),Rg=new ye,Jh=new me,Po=class Wi extends Tt{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=dt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new fn,this._transform=new me,this._fillStyle={...Wi.defaultFillStyle},this._strokeStyle={...Wi.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new pr,this._boundsDirty=!0}clone(){let e=new Wi;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=Ln(e,Wi.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Ao(e,Wi.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=Ln(e,Wi.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=Ln(e,Wi.defaultStrokeStyle),this}texture(e,r,i,n,s,a){return this.instructions.push({action:"texture",data:{image:e,dx:i||0,dy:n||0,dw:s||e.frame.width,dh:a||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:r?ge.shared.setValue(r).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new fn,this}fill(e,r){let i,n=this.instructions[this.instructions.length-1];return this._tick===0&&n?.action==="stroke"?i=n.data.path:i=this._activePath.clone(),i?(e!=null&&(r!==void 0&&typeof e=="number"&&($e(gt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:r}),this._fillStyle=Ln(e,Wi.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:r}=this._activePath.getLastPoint(ye.shared);this._activePath.clear(),this._activePath.moveTo(e,r)}stroke(e){let r,i=this.instructions[this.instructions.length-1];return this._tick===0&&i?.action==="fill"?r=i.data.path:r=this._activePath.clone(),r?(e!=null&&(this._strokeStyle=Ao(e,Wi.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let r=this.instructions[this.instructions.length-1-e],i=this._activePath.clone();if(r&&(r.action==="stroke"||r.action==="fill"))if(r.data.hole)r.data.hole.addPath(i);else{r.data.hole=i;break}}return this._initNextPathLocation(),this}arc(e,r,i,n,s,a){this._tick++;let o=this._transform;return this._activePath.arc(o.a*e+o.c*r+o.tx,o.b*e+o.d*r+o.ty,i,n,s,a),this}arcTo(e,r,i,n,s){this._tick++;let a=this._transform;return this._activePath.arcTo(a.a*e+a.c*r+a.tx,a.b*e+a.d*r+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,s),this}arcToSvg(e,r,i,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,r,i,n,s,l.a*a+l.c*o+l.tx,l.b*a+l.d*o+l.ty),this}bezierCurveTo(e,r,i,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*r+l.tx,l.b*e+l.d*r+l.ty,l.a*i+l.c*n+l.tx,l.b*i+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,r,i,n){return this._tick++,this._activePath.ellipse(e,r,i,n,this._transform.clone()),this}circle(e,r,i){return this._tick++,this._activePath.circle(e,r,i,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,r){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*e+i.c*r+i.tx,i.b*e+i.d*r+i.ty),this}moveTo(e,r){this._tick++;let i=this._transform,n=this._activePath.instructions,s=i.a*e+i.c*r+i.tx,a=i.b*e+i.d*r+i.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,r,i,n,s){this._tick++;let a=this._transform;return this._activePath.quadraticCurveTo(a.a*e+a.c*r+a.tx,a.b*e+a.d*r+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,s),this}rect(e,r,i,n){return this._tick++,this._activePath.rect(e,r,i,n,this._transform.clone()),this}roundRect(e,r,i,n,s){return this._tick++,this._activePath.roundRect(e,r,i,n,s,this._transform.clone()),this}poly(e,r){return this._tick++,this._activePath.poly(e,r,this._transform.clone()),this}regularPoly(e,r,i,n,s=0,a){return this._tick++,this._activePath.regularPoly(e,r,i,n,s,a),this}roundPoly(e,r,i,n,s,a){return this._tick++,this._activePath.roundPoly(e,r,i,n,s,a),this}roundShape(e,r,i,n){return this._tick++,this._activePath.roundShape(e,r,i,n),this}filletRect(e,r,i,n,s){return this._tick++,this._activePath.filletRect(e,r,i,n,s),this}chamferRect(e,r,i,n,s,a){return this._tick++,this._activePath.chamferRect(e,r,i,n,s,a),this}star(e,r,i,n,s=0,a=0){return this._tick++,this._activePath.star(e,r,i,n,s,a,this._transform.clone()),this}svg(e){return this._tick++,U1(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,r=e){return this._transform.scale(e,r),this}setTransform(e,r,i,n,s,a){return e instanceof me?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,r,i,n,s,a),this)}transform(e,r,i,n,s,a){return e instanceof me?(this._transform.append(e),this):(Jh.set(e,r,i,n,s,a),this._transform.append(Jh),this)}translate(e,r=e){return this._transform.translate(e,r),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,!this.dirty&&(this.emit("update",this,16),this.dirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;let e=this._bounds;e.clear();for(let r=0;rge.shared.setValue(s).toNumber());i.forEach((s,a)=>{r.addColorStop(s,n[a])}),t.fill={fill:r}}}var Mo,pn,Ro=y(()=>{Xt(),Ke(),er(),Ot(),It(),Ws(),Vh(),kg(),Mg(),Mo=class bs extends Tt{constructor(e={}){super(),this.uid=dt("textStyle"),this._tick=0,V1(e);let r={...bs.defaultTextStyle,...e};for(let i in r){let n=i;this[n]=r[i]}this.update(),this._tick=0}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.update())}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords!==e&&(this._breakWords=e,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(e!==null&&typeof e=="object"?this._dropShadow=this._createProxy({...bs.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...bs.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.update())}get fontSize(){return this._fontSize}set fontSize(e){this._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._fontStyle=e.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant!==e&&(this._fontVariant=e,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.update())}get leading(){return this._leading}set leading(e){this._leading!==e&&(this._leading=e,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.update())}get padding(){return this._padding}set padding(e){this._padding!==e&&(this._padding=e,this.update())}get filters(){return this._filters}set filters(e){this._filters!==e&&(this._filters=Object.freeze(e),this.update())}get trim(){return this._trim}set trim(e){this._trim!==e&&(this._trim=e,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline!==e&&(this._textBaseline=e,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap!==e&&(this._wordWrap=e,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._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({...fi.defaultFillStyle,...e},()=>{this._fill=Ln({...this._originalFill},fi.defaultFillStyle)})),this._fill=Ln(e===0?"black":e,fi.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...fi.defaultStrokeStyle,...e},()=>{this._stroke=Ao({...this._originalStroke},fi.defaultStrokeStyle)})),this._stroke=Ao(e,fi.defaultStrokeStyle),this.update())}update(){this._tick++,this.emit("update",this)}reset(){let e=bs.defaultTextStyle;for(let r in e)this[r]=e[r]}get styleKey(){return`${this.uid}-${this._tick}`}clone(){return new bs({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,filters:this._filters?[...this._filters]:void 0})}_getFinalPadding(){let e=0;if(this._filters)for(let r=0;r(i[n]===s||(i[n]=s,r?.(n,s),this.update()),!0)})}_isFillStyle(e){return(e??null)!==null&&!(ge.isColorLike(e)||e instanceof Ii||e instanceof qs)}},Mo.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},Mo.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},pn=Mo});function Bg(t,e,r,i){let n=Og;n.minX=0,n.minY=0,n.maxX=t.width/i|0,n.maxY=t.height/i|0;let s=wr.getOptimalTexture(n.width,n.height,i,!1);return s.source.uploadMethodId="image",s.source.resource=t,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=e/i,s.frame.height=r/i,s.source.emit("update",s.source),s.updateUvs(),s}var Og,Ig=y(()=>{Tn(),Ar(),Og=new pr}),Gg,Fi,Js=y(()=>{rr(),Ne(),zr(),Gg=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=Ht.get().createCanvas();r.width=t,r.height=e;let i=r.getContext("2d");return{canvas:r,context:i}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=oe(t),e=oe(e);let i=(t<<17)+(e<<1);this._canvasPool[i]||(this._canvasPool[i]=[]);let n=this._canvasPool[i].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:i}=e,n=(r<<17)+(i<<1);t.context.resetTransform(),t.context.clearRect(0,0,r,i),this._canvasPool[n].push(t)}clear(){this._canvasPool={}}},Fi=new Gg,li.register(Fi)});function $1(t,e){gn||(gn=Ht.get().createCanvas(256,128),Di=gn.getContext("2d",{willReadFrequently:!0}),Di.globalCompositeOperation="copy",Di.globalAlpha=1),(gn.width{rr(),Ne(),nr(),gn=null,Di=null});function Ug(t=1e3,e=0,r=!1){if(isNaN(t)||t<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if(typeof r!="boolean")throw new TypeError("Invalid resetTtl value");return new Lg(t,e,r)}var Lg,Ng=y(()=>{Lg=class{constructor(t=0,e=0,r=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=r,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){let e=this.items[t];delete this.items[t],this.size--,e.prev!==null&&(e.prev.next=e.next),e.next!==null&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){return t.map(e=>[e,this.get(e)])}evict(t=!1){if(t||this.size>0){let e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){let e=this.items[t];if(e!==void 0){if(this.ttl>0&&e.expiry<=Date.now()){this.delete(t);return}return this.moveToEnd(e),e.value}}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(t.prev!==null&&(t.prev.next=t.next),t.next!==null&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,this.last!==null&&(this.last.next=t),this.last=t,this.first===null&&(this.first=t))}keys(){let t=[],e=this.first;for(;e!==null;)t.push(e.key),e=e.next;return t}setWithEvicted(t,e,r=this.resetTtl){let i=null;if(this.has(t))this.set(t,e,!0,r);else{this.max>0&&this.size===this.max&&(i={...this.first},this.evict(!0));let n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};++this.size===1?this.first=n:this.last.next=n,this.last=n}return i}set(t,e,r=!1,i=this.resetTtl){let n=this.items[t];return r||n!==void 0?(n.value=e,r===!1&&i&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(n)):(this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},++this.size===1?this.first=n:this.last.next=n,this.last=n),this}values(t=this.keys()){return t.map(e=>this.get(e))}}});function ko(t){let e=typeof t.fontSize=="number"?`${t.fontSize}px`:t.fontSize,r=t.fontFamily;Array.isArray(t.fontFamily)||(r=t.fontFamily.split(","));for(let i=r.length-1;i>=0;i--){let n=r[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!zg.includes(n)&&(n=`"${n}"`),r[i]=n}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${r.join(",")}`}var zg,eu=y(()=>{"use strict";zg=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]}),Bo,pi,gi,ea=y(()=>{Ng(),rr(),eu(),Bo={willReadFrequently:!0},pi=class ze{static get experimentalLetterSpacingSupported(){let e=ze._experimentalLetterSpacingSupported;if(e===void 0){let r=Ht.get().getCanvasRenderingContext2D().prototype;e=ze._experimentalLetterSpacingSupported="letterSpacing"in r||"textLetterSpacing"in r}return e}constructor(e,r,i,n,s,a,o,l,u){this.text=e,this.style=r,this.width=i,this.height=n,this.lines=s,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=l,this.fontProperties=u}static measureText(e=" ",r,i=ze._canvas,n=r.wordWrap){let s=`${e}-${r.styleKey}-wordWrap-${n}`;if(ze._measurementCache.has(s))return ze._measurementCache.get(s);let a=ko(r),o=ze.measureFont(a);o.fontSize===0&&(o.fontSize=r.fontSize,o.ascent=r.fontSize);let l=ze.__context;l.font=a;let u=(n?ze._wordWrap(e,r,i):e).split(/(?:\r\n|\r|\n)/),c=new Array(u.length),f=0;for(let S=0;S0)if(n)a-=r,l-=r;else{let u=(ze.graphemeSegmenter(e).length-1)*r;a+=u,l+=u}return Math.max(a,l)}static _wordWrap(e,r,i=ze._canvas){let n=i.getContext("2d",Bo),s=0,a="",o="",l=Object.create(null),{letterSpacing:u,whiteSpace:c}=r,f=ze._collapseSpaces(c),_=ze._collapseNewlines(c),g=!f,b=r.wordWrapWidth+u,T=ze._tokenize(e);for(let x=0;xb)if(a!==""&&(o+=ze._addLine(a),a="",s=0),ze.canBreakWords(S,r.breakWords)){let B=ze.wordWrapSplit(S);for(let A=0;Ab&&(o+=ze._addLine(a),g=!1,a="",s=0),a+=X,s+=ae}}else{a.length>0&&(o+=ze._addLine(a),a="",s=0);let B=x===T.length-1;o+=ze._addLine(S,!B),g=!1,a="",s=0}else P+s>b&&(g=!1,o+=ze._addLine(a),a="",s=0),(a.length>0||!ze.isBreakingSpace(S)||g)&&(a+=S,s+=P)}return o+=ze._addLine(a,!1),o}static _addLine(e,r=!0){return e=ze._trimRight(e),e=r?`${e} `:e,e}static _getFromCache(e,r,i,n){let s=i[e];return typeof s!="number"&&(s=ze._measureText(e,r,n)+r,i[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 r=e.length-1;r>=0;r--){let i=e[r];if(!ze.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static _isNewline(e){return typeof e!="string"?!1:ze._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,r){return typeof e!="string"?!1:ze._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){let r=[],i="";if(typeof e!="string")return r;for(let n=0;n{if(typeof Intl?.Segmenter=="function"){let t=new Intl.Segmenter;return e=>{let r=t.segment(e),i=[],n=0;for(let s of r)i[n++]=s.segment;return i}}return t=>[...t]})(),pi.experimentalLetterSpacing=!1,pi._fonts={},pi._newlines=[10,13],pi._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],pi._measurementCache=Ug(1e3),gi=pi});function Oo(t,e,r,i=0){if(t.texture===He.WHITE&&!t.fill)return ge.shared.setValue(t.color).setAlpha(t.alpha??1).toHexa();if(t.fill){if(t.fill instanceof qs){let n=t.fill,s=e.createPattern(n.texture.source.resource,"repeat"),a=n.transform.copyTo(me.shared);return a.scale(n.texture.frame.width,n.texture.frame.height),s.setTransform(a),s}else if(t.fill instanceof Ii){let n=t.fill,s=n.type==="linear",a=n.textureSpace==="local",o=1,l=1;a&&r&&(o=r.width+i,l=r.height+i);let u,c=!1;if(s){let{start:f,end:_}=n;u=e.createLinearGradient(f.x*o,f.y*l,_.x*o,_.y*l),c=Math.abs(_.x-f.x){let T=g+b.offset*f;u.addColorStop(Math.floor(T*tu)/tu,ge.shared.setValue(b.color).toHex())})}}else n.colorStops.forEach(f=>{u.addColorStop(f.offset,ge.shared.setValue(f.color).toHex())});return u}}else{let n=e.createPattern(t.texture.source.resource,"repeat"),s=t.matrix.copyTo(me.shared);return s.scale(t.texture.frame.width,t.texture.frame.height),n.setTransform(s),n}return it("FillStyle not recognised",t),"red"}var tu,Hg=y(()=>{Ke(),et(),Kt(),It(),Ws(),Vh(),tu=1e5}),ru,jg,cs,Wg=y(()=>{Ke(),nr(),Js(),Y1(),ea(),eu(),Hg(),ru=new Wt,jg=class{getCanvasAndContext(t){let{text:e,style:r,resolution:i=1}=t,n=r._getFinalPadding(),s=gi.measureText(e||" ",r),a=Math.ceil(Math.ceil(Math.max(1,s.width)+n*2)*i),o=Math.ceil(Math.ceil(Math.max(1,s.height)+n*2)*i),l=Fi.getOptimalCanvasAndContext(a,o);this._renderTextToCanvas(e,r,n,i,l);let u=r.trim?X1({canvas:l.canvas,width:a,height:o,resolution:1,output:ru}):ru.set(0,0,a,o);return{canvasAndContext:l,frame:u}}returnCanvasAndContext(t){Fi.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,r,i,n){let{canvas:s,context:a}=n,o=ko(e),l=gi.measureText(t||" ",e),u=l.lines,c=l.lineHeight,f=l.lineWidths,_=l.maxLineWidth,g=l.fontProperties,b=s.height;if(a.resetTransform(),a.scale(i,i),a.textBaseline=e.textBaseline,e._stroke?.width){let P=e._stroke;a.lineWidth=P.width,a.miterLimit=P.miterLimit,a.lineJoin=P.join,a.lineCap=P.cap}a.font=o;let T,x,S=e.dropShadow?2:1;for(let P=0;P{Z(),Tn(),xe(),Ot(),Ro(),Ig(),Wg(),iu=class{constructor(t){this._activeTextures={},this._renderer=t}getTexture(t,e,r,i){typeof t=="string"&&($e("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof pn||(t.style=new pn(t.style)),t.textureStyle instanceof _e||(t.textureStyle=new _e(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());let{text:n,style:s,textureStyle:a}=t,o=t.resolution??this._renderer.resolution,{frame:l,canvasAndContext:u}=cs.getCanvasAndContext({text:n,style:s,resolution:o}),c=Bg(u.canvas,l.width,l.height,o);if(a&&(c.source.style=a),s.trim&&(l.pad(s.padding),c.frame.copyFrom(l),c.frame.scale(1/o),c.updateUvs()),s.filters){let f=this._applyFilters(c,s.filters);return this.returnTexture(c),cs.returnCanvasAndContext(u),f}return this._renderer.texture.initSource(c._source),cs.returnCanvasAndContext(u),c}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",wr.returnTexture(t,!0)}renderTextToCanvas(){$e("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let r=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle});return this._activeTextures[e]={texture:r,usageCount:1},r}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t]?.usageCount??0}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}_applyFilters(t,e){let r=this._renderer.renderTarget.renderTarget,i=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(r,!1),i}destroy(){this._renderer=null;for(let t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}},iu.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"canvasText"}}),Vg=y(()=>{Z(),i1(),q1(),Se.add(iu),Se.add(jh)}),Io,$g=y(()=>{Ot(),Zl(),kg(),Io=class Ad extends ja{constructor(e){e instanceof fi&&(e={context:e});let{context:r,roundPixels:i,...n}=e||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",r?this.context=r:(this.context=this._ownedContext=new fi,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=i??!1}set context(e){e!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=e,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(e){return this._context.containsPoint(e)}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)}_onTouch(e){this._gcLastUsed=e,this._context._gcLastUsed=e}_callContextMethod(e,r){return this.context[e](...r),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 Ad(this._context.clone()):(this._ownedContext=null,new Ad(this._context))}lineStyle(e,r,i){$e(gt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let n={};return e&&(n.width=e),r&&(n.color=r),i&&(n.alpha=i),this.context.strokeStyle=n,this}beginFill(e,r){$e(gt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return e!==void 0&&(i.color=e),r!==void 0&&(i.alpha=r),this.context.fillStyle=i,this}endFill(){$e(gt,"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!==fi.defaultStrokeStyle.width||e.color!==fi.defaultStrokeStyle.color||e.alpha!==fi.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return $e(gt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return $e(gt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return $e(gt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return $e(gt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return $e(gt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return $e(gt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}}),Xg,Yg,K1=y(()=>{"use strict";Xg={name:"local-uniform-msdf-bit",vertex:{header:` struct LocalUniforms { uColor:vec4, uTransformMatrix:mat3x3, uDistance: f32, uRound:f32, } @group(2) @binding(0) var 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, uTransformMatrix:mat3x3, uDistance: f32 } @group(2) @binding(0) var localUniforms : LocalUniforms; `,main:` outColor = vec4(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance)); `}},Yg={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)); `}}}),qg,Kg,Z1=y(()=>{"use strict";qg={name:"msdf-bit",fragment:{header:` fn calculateMSDFAlpha(msdfColor:vec4, shapeColor:vec4, 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(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; } `}},Kg={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; } `}}}),nu,su,Zg,Q1=y(()=>{et(),In(),ro(),so(),Gn(),Ah(),Oi(),Xr(),K1(),Z1(),Zg=class extends _i{constructor(t){let e=new Gr({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new me,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}});nu??(nu=Us({name:"sdf-shader",bits:[eo,bh(t),Xg,qg,ss]})),su??(su=Ls({name:"sdf-shader",bits:[to,wh(t),Yg,Kg,as]})),super({glProgram:su,gpuProgram:nu,resources:{localUniforms:e,batchSamplers:Eh(t)}})}}}),Qg,J1=y(()=>{Xt(),Ot(),Qg=class extends Tt{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 $e(gt,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return $e(gt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return $e(gt,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return $e(gt,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return $e(gt,"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)}}}),au,ou,ew=y(()=>{Ke(),nr(),Js(),hh(),Kt(),xe(),Ot(),ea(),eu(),Hg(),Ro(),J1(),au=class nx extends Qg{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._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=!1;let r={...nx.defaultOptions,...e};this._textureSize=r.textureSize,this._mipmap=r.mipmap;let i=r.style.clone();r.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=He.WHITE,i._fill.fill=null),this.applyFillAsTint=r.overrideFill;let n=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let s=ko(i);r.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/n):i.fontSize=this.baseRenderedFontSize=n,this._style=i,this._skipKerning=r.skipKerning??!1,this.resolution=r.resolution??1,this._padding=r.padding??4,r.textureStyle&&(this._textureStyle=r.textureStyle instanceof _e?r.textureStyle:new _e(r.textureStyle)),this.fontMetrics=gi.measureFont(s),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(e){let r=gi.graphemeSegmenter(e).filter(x=>!this._currentChars.includes(x)).filter((x,S,P)=>P.indexOf(x)===S);if(!r.length)return;this._currentChars=[...this._currentChars,...r];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:n,context:s}=i.canvasAndContext,a=i.texture.source,o=this._style,l=this._currentX,u=this._currentY,c=this._currentMaxCharHeight,f=this.baseRenderedFontSize/this.baseMeasurementFontSize,_=this._padding*f,g=!1,b=n.width/this.resolution,T=n.height/this.resolution;for(let x=0;xb&&(u+=c,c=q,l=0,u+c>T)){a.update();let ce=this._nextPage();n=ce.canvasAndContext.canvas,s=ce.canvasAndContext.context,a=ce.texture.source,l=0,u=0,c=0}let ae=B/f-(o.dropShadow?.distance??0)-(o._stroke?.width??0);if(this.chars[S]={id:S.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:ae,kerning:{}},g){this._drawGlyph(s,P,l+_,u+_,f,o);let ce=a.width*f,ie=a.height*f,he=new Wt(l/ce*a.width,u/ie*a.height,W/ce*a.width,q/ie*a.height);this.chars[S].texture=new He({source:a,frame:he}),l+=Math.ceil(W)}}a.update(),this._currentX=l,this._currentY=u,this._currentMaxCharHeight=c,this._skipKerning&&this._applyKerning(r,s)}get pageTextures(){return $e(gt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,r){let i=this._measureCache;for(let n=0;n{let P=s.width;for(let B=0;B{let S=s.chars.length-1;if(i){let P=s.chars[S];for(;P===" ";)s.width-=r.chars[P].xAdvance,P=s.chars[--S]}n.width=Math.max(n.width,s.width),s={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},o=!0,n.lines.push(s),n.height+=_},x=S=>S-c>f;for(let S=0;S{"use strict"});function nw(t){if(t==="")return[];typeof t=="string"&&(t=[t]);let e=[];for(let r=0,i=t.length;r{"use strict"}),ta,tm,rm,aw=y(()=>{Ng(),Va(),Ot(),It(),ea(),Ro(),ew(),em(),sw(),ta=0,tm=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,textureStyle:null},this.measureCache=Ug(1e3)}getFont(t,e){let r=`${e.fontFamily}-bitmap`,i=!0;if(e._fill.fill&&!e._stroke?(r+=e._fill.fill.styleKey,i=!1):(e._stroke||e.dropShadow)&&(r=`${e.styleKey}-bitmap`,i=!1),!Mr.has(r)){let s=Object.create(e);s.lineHeight=0;let a=new ou({style:s,overrideFill:i,overrideSize:!0,...this.defaultOptions});ta++,ta>50&&it("BitmapText",`You have dynamically created ${ta} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),a.once("destroy",()=>{ta--,Mr.remove(r)}),Mr.set(r,a)}let n=Mr.get(r);return n.ensureCharacters?.(t),n}getLayout(t,e,r=!0){let i=this.getFont(t,e),n=`${t}-${e.styleKey}-${r}`;if(this.measureCache.has(n))return this.measureCache.get(n);let s=gi.graphemeSegmenter(t),a=Jg(s,e,i,r);return this.measureCache.set(n,a),a}measureText(t,e,r=!0){return this.getLayout(t,e,r)}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},$e(gt,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let i=e.style,n=i instanceof pn?i:new pn(i),s=e.dynamicFill??this._canUseTintForStyle(n),a=new ou({style:n,overrideFill:s,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1,textureStyle:e.textureStyle}),o=nw(e.chars);return a.ensureCharacters(o.join("")),Mr.set(`${r}-bitmap`,a),a.once("destroy",()=>Mr.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=Mr.get(e);r&&r.destroy()}_canUseTintForStyle(t){return!t._stroke&&(!t.dropShadow||t.dropShadow.color===0)&&!t._fill.fill&&t._fill.color===16777215}},rm=new tm});function im(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 nm,lu,ow=y(()=>{Va(),Z(),ti(),$g(),ea(),Q1(),aw(),em(),nm=class extends Io{destroy(){this.context.customShader&&this.context.customShader.destroy(),super.destroy()}},lu=class{constructor(t){this._renderer=t,this._managedBitmapTexts=new Yr({renderer:t,type:"renderable",priority:-2,name:"bitmapText"})}validateRenderable(t){let e=this._getGpuBitmapText(t);return this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);im(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}updateRenderable(t){let e=this._getGpuBitmapText(t);im(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,i=rm.getFont(t.text,t._style);r.clear(),i.distanceField.type!=="none"&&(r.customShader||(r.customShader=new Zg(this._renderer.limits.maxBatchableTextures)));let n=gi.graphemeSegmenter(t.text),s=t._style,a=i.baseLineOffset,o=Jg(n,s,i,!0),l=s.padding,u=o.scale,c=o.width,f=o.height+o.offsetY;s._stroke&&(c+=s._stroke.width/u,f+=s._stroke.width/u),r.translate(-t._anchor._x*c-l,-t._anchor._y*f-l).scale(u,u);let _=i.applyFillAsTint?s._fill.color:16777215,g=i.fontMetrics.fontSize,b=i.lineHeight;s.lineHeight&&(g=s.fontSize/u,b=s.lineHeight/u);let T=(b-g)/2;T-i.baseLineOffset<0&&(T=0);for(let x=0;x{Z(),ow(),Se.add(lu)}),am,lw=y(()=>{wo(),am=class extends Ys{constructor(){super(...arguments),this.generatingTexture=!1,this.currentKey="--"}destroy(){this.texturePromise=null,this.generatingTexture=!1,this.currentKey="--",super.destroy()}}}),hu,hw=y(()=>{Z(),Kt(),ti(),eg(),lw(),hu=class{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Yr({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"htmlText"})}resolutionChange(){for(let t in this._managedTexts.items){let e=this._managedTexts.items[t];e?._autoResolution&&e.onViewUpdate()}}validateRenderable(t){let e=this._getGpuText(t),r=t.styleKey;return e.currentKey!==r}addRenderable(t,e){let r=this._getGpuText(t);if(t._didTextUpdate){let i=t._autoResolution?this._renderer.resolution:t.resolution;(r.currentKey!==t.styleKey||t.resolution!==i)&&this._updateGpuText(t).catch(n=>{console.error(n)}),t._didTextUpdate=!1,Hh(r,t)}this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=e.texturePromise;e.texturePromise=null,e.generatingTexture=!0,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let i=this._renderer.htmlText.getTexturePromise(t);r&&(i=i.finally(()=>{this._renderer.htmlText.decreaseReferenceCount(e.currentKey),this._renderer.htmlText.returnTexturePromise(r)})),e.texturePromise=i,e.currentKey=t.styleKey,e.texture=await i;let n=t.renderGroup||t.parentRenderGroup;n&&(n.structureDidChange=!0),e.generatingTexture=!1,Hh(e,t)}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new am;return e.renderable=t,e.transform=t.groupTransform,e.texture=He.EMPTY,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,t._gpuData[this._renderer.uid]=e,this._managedTexts.add(t),e}onTextUnload(t){let e=t._gpuData[this._renderer.uid];if(!e)return;let{htmlText:r}=this._renderer;r.getReferenceCount(e.currentKey)===null?r.returnTexturePromise(e.texturePromise):r.decreaseReferenceCount(e.currentKey)}destroy(){this._managedTexts.destroy(),this._renderer=null}},hu.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"htmlText"}});function uw(){let{userAgent:t}=Ht.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}var cw=y(()=>{rr()}),uu,cu,du,om=y(()=>{rr(),uu="http://www.w3.org/2000/svg",cu="http://www.w3.org/1999/xhtml",du=class{constructor(){this.svgRoot=document.createElementNS(uu,"svg"),this.foreignObject=document.createElementNS(uu,"foreignObject"),this.domElement=document.createElementNS(cu,"div"),this.styleElement=document.createElementNS(cu,"style");let{foreignObject:t,svgRoot:e,styleElement:r,domElement:i}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(i),this.image=Ht.get().createImage()}destroy(){this.svgRoot.remove(),this.foreignObject.remove(),this.styleElement.remove(),this.domElement.remove(),this.image.src="",this.image.remove(),this.svgRoot=null,this.foreignObject=null,this.styleElement=null,this.domElement=null,this.image=null,this.canvasAndContext=null}}});function dw(t,e){let r=e.fontFamily,i=[],n={},s=/font-family:([^;"\s]+)/g,a=t.match(s);function o(l){n[l]||(i.push(l),n[l]=!0)}if(Array.isArray(r))for(let l=0;l{let u=l.split(":")[1].trim();o(u)});for(let l in e.tagStyles){let u=e.tagStyles[l].fontFamily;o(u)}return i}var fw=y(()=>{"use strict"});async function pw(t){let e=await(await Ht.get().fetch(t)).blob(),r=new FileReader;return await new Promise((i,n)=>{r.onloadend=()=>i(r.result),r.onerror=n,r.readAsDataURL(e)})}var gw=y(()=>{rr()});async function mw(t,e){let r=await pw(e);return`@font-face { font-family: "${t.fontFamily}"; font-weight: ${t.fontWeight}; font-style: ${t.fontStyle}; src: url('${r}'); }`}var _w=y(()=>{gw()});async function vw(t){let e=t.filter(r=>Mr.has(`${r}-and-url`)).map(r=>{if(!Go.has(r)){let{entries:i}=Mr.get(`${r}-and-url`),n=[];i.forEach(s=>{let a=s.url,o=s.faces.map(l=>({weight:l.weight,style:l.style}));n.push(...o.map(l=>mw({fontWeight:l.weight,fontStyle:l.style,fontFamily:r},a)))}),Go.set(r,Promise.all(n).then(s=>s.join(` `)))}return Go.get(r)});return(await Promise.all(e)).join(` `)}var Go,yw=y(()=>{Va(),_w(),Go=new Map});function xw(t,e,r,i,n){let{domElement:s,styleElement:a,svgRoot:o}=n;s.innerHTML=`
    ${t}
    `,s.setAttribute("style",`transform: scale(${r});transform-origin: top left; display: inline-block`),a.textContent=i;let{width:l,height:u}=n.image;return o.setAttribute("width",l.toString()),o.setAttribute("height",u.toString()),new XMLSerializer().serializeToString(o)}var bw=y(()=>{"use strict"});function ww(t,e){let r=Fi.getOptimalCanvasAndContext(t.width,t.height,e),{context:i}=r;return i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),r}var Tw=y(()=>{Js()});function Sw(t,e,r){return new Promise(async i=>{r&&await new Promise(n=>setTimeout(n,100)),t.onload=()=>{i()},t.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(e)}`,t.crossOrigin="anonymous"})}var Ew=y(()=>{"use strict"});function Cw(t,e,r,i){i||(i=lm||(lm=new du));let{domElement:n,styleElement:s,svgRoot:a}=i;n.innerHTML=`
    ${t}
    `,n.setAttribute("style","transform-origin: top left; display: inline-block"),r&&(s.textContent=r),document.body.appendChild(a);let o=n.getBoundingClientRect();a.remove();let l=e.padding*2;return{width:o.width-l,height:o.height-l}}var lm,Aw=y(()=>{om()}),fu,Pw=y(()=>{Z(),Js(),Tn(),qi(),cw(),It(),jr(),Ig(),om(),fw(),yw(),bw(),Tw(),Ew(),Aw(),fu=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===ci.WEBGPU}getTexture(t){return this.getTexturePromise(t)}getManagedTexture(t){let e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].promise;let r=this._buildTexturePromise(t).then(i=>(this._activeTextures[e].texture=i,i));return this._activeTextures[e]={texture:null,promise:r,usageCount:1},r}getReferenceCount(t){return this._activeTextures[t]?.usageCount??null}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e.texture):e.promise.then(r=>{e.texture=r,this._cleanUp(e.texture)}).catch(()=>{it("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}getTexturePromise(t){return this._buildTexturePromise(t)}async _buildTexturePromise(t){let{text:e,style:r,resolution:i,textureStyle:n}=t,s=qt.get(du),a=dw(e,r),o=await vw(a),l=Cw(e,r,o,s),u=Math.ceil(Math.ceil(Math.max(1,l.width)+r.padding*2)*i),c=Math.ceil(Math.ceil(Math.max(1,l.height)+r.padding*2)*i),f=s.image,_=2;f.width=(u|0)+_,f.height=(c|0)+_;let g=xw(e,r,i,o,s);await Sw(f,g,uw()&&a.length>0);let b=f,T;this._createCanvas&&(T=ww(f,i));let x=Bg(T?T.canvas:b,f.width-_,f.height-_,i);return n&&(x.source.style=n),this._createCanvas&&(this._renderer.texture.initSource(x.source),Fi.returnCanvasAndContext(T)),qt.return(s),x}returnTexturePromise(t){t.then(e=>{this._cleanUp(e)}).catch(()=>{it("HTMLTextSystem: Failed to clean texture")})}_cleanUp(t){wr.returnTexture(t,!0),t.source.resource=null,t.source.uploadMethodId="unknown"}destroy(){this._renderer=null;for(let t in this._activeTextures)this._activeTextures[t]&&this.returnTexturePromise(this._activeTextures[t].promise);this._activeTextures=null}},fu.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"htmlText"}}),hm=y(()=>{Z(),hw(),Pw(),Se.add(fu),Se.add(hu)}),pu,Fo,gu=y(()=>{kn(),ln(),Fs(),Ot(),pu=class sx extends Jn{constructor(...e){let r=e[0]??{};r instanceof Float32Array&&($e(gt,"use new MeshGeometry({ positions, uvs, indices }) instead"),r={positions:r,uvs:e[1],indices:e[2]}),r={...sx.defaultOptions,...r};let i=r.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=r.uvs;n||(r.positions?n=new Float32Array(i.length):n=new Float32Array([0,0,1,0,1,1,0,1]));let s=r.indices||new Uint32Array([0,1,2,0,2,3]),a=r.shrinkBuffersToFit,o=new $r({data:i,label:"attribute-mesh-positions",shrinkToFit:a,usage:bt.VERTEX|bt.COPY_DST}),l=new $r({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:bt.VERTEX|bt.COPY_DST}),u=new $r({data:s,label:"index-mesh-buffer",shrinkToFit:a,usage:bt.INDEX|bt.COPY_DST});super({attributes:{aPosition:{buffer:o,format:"float32x2",stride:8,offset:0},aUV:{buffer:l,format:"float32x2",stride:8,offset:0}},indexBuffer:u,topology:r.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}},pu.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1},Fo=pu}),ds,um,Do,ra=y(()=>{"use strict";ds={name:"local-uniform-bit",vertex:{header:` struct LocalUniforms { uTransformMatrix:mat3x3, uColor:vec4, uRound:f32, } @group(1) @binding(0) var localUniforms : LocalUniforms; `,main:` vColor *= localUniforms.uColor; modelMatrix *= localUniforms.uTransformMatrix; `,end:` if(localUniforms.uRound == 1) { vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); } `}},um={...ds,vertex:{...ds.vertex,header:ds.vertex.header.replace("group(1)","group(2)")}},Do={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); } `}}}),cm,dm,Mw=y(()=>{"use strict";cm={name:"tiling-bit",vertex:{header:` struct TilingUniforms { uMapCoord:mat3x3, uClampFrame:vec4, uClampOffset:vec2, uTextureTransform:mat3x3, uSizeAnchor:vec4 }; @group(2) @binding(0) var tilingUniforms: TilingUniforms; @group(2) @binding(1) var uTexture: texture_2d; @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, uClampFrame:vec4, uClampOffset:vec2, uTextureTransform:mat3x3, uSizeAnchor:vec4 }; @group(2) @binding(0) var tilingUniforms: TilingUniforms; @group(2) @binding(1) var uTexture: texture_2d; @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); `}},dm={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 `}}}),mu,_u,fm,Rw=y(()=>{et(),In(),ra(),Gn(),Oi(),Xr(),Kt(),Mw(),fm=class extends _i{constructor(){mu??(mu=Us({name:"tiling-sprite-shader",bits:[ds,cm,ss]})),_u??(_u=Ls({name:"tiling-sprite-shader",bits:[Do,dm,as]}));let t=new Gr({uMapCoord:{value:new me,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new me,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:_u,gpuProgram:mu,resources:{localUniforms:new Gr({uTransformMatrix:{value:new me,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:He.EMPTY.source,uSampler:He.EMPTY.source.style}})}updateUniforms(t,e,r,i,n,s){let a=this.resources.tilingUniforms,o=s.width,l=s.height,u=s.textureMatrix,c=a.uniforms.uTextureTransform;c.set(r.a*o/t,r.b*o/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=i,a.uniforms.uSizeAnchor[3]=n,s&&(this.resources.uTexture=s.source,this.resources.uSampler=s.source.style)}}}),pm,kw=y(()=>{gu(),pm=class extends Fo{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 Bw(t,e){let r=t.anchor.x,i=t.anchor.y;e[0]=-r*t.width,e[1]=-i*t.height,e[2]=(1-r)*t.width,e[3]=-i*t.height,e[4]=(1-r)*t.width,e[5]=(1-i)*t.height,e[6]=-r*t.width,e[7]=(1-i)*t.height}var Ow=y(()=>{"use strict"});function Iw(t,e,r,i){let n=0,s=t.length/(e||2),a=i.a,o=i.b,l=i.c,u=i.d,c=i.tx,f=i.ty;for(r*=e;n{"use strict"});function Fw(t,e){let r=t.texture,i=r.frame.width,n=r.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=me.shared;o.copyFrom(t._tileTransform.matrix),o.tx/=t.width,o.ty/=t.height,o.invert(),o.scale(t.width/i,t.height/n),Iw(e,2,0,o)}var Dw=y(()=>{et(),Gw()}),ia,gm,vu,Uw=y(()=>{Z(),Xa(),Gi(),qi(),ti(),Xs(),Gh(),gu(),Rw(),kw(),Ow(),Dw(),ia=new pm,gm=class{constructor(){this.canBatch=!0,this.geometry=new Fo({indices:ia.indices.slice(),positions:ia.positions.slice(),uvs:ia.uvs.slice()})}destroy(){this.geometry.destroy(),this.shader?.destroy()}},vu=class{constructor(t){this._state=di.default2d,this._renderer=t,this._managedTilingSprites=new Yr({renderer:t,type:"renderable",name:"tilingSprite"})}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let i=e.canBatch;if(i&&i===r){let{batchableMesh:n}=e;return!n._batcher.checkAndUpdateTexture(n,t.texture)}return r!==i}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let i=this._getTilingSpriteData(t),{geometry:n,canBatch:s}=i;if(s){i.batchableMesh||(i.batchableMesh=new bo);let a=i.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=n,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),i.shader||(i.shader=new fm),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._getTilingSpriteData(t);e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,$s(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Is(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:ia,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:i}=e;t.didViewUpdate&&this._updateBatchableMesh(t),i._batcher.updateElement(i)}else if(t.didViewUpdate){let{shader:i}=e;i.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}_getTilingSpriteData(t){return t._gpuData[this._renderer.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new gm;return e.renderable=t,t._gpuData[this._renderer.uid]=e,this._managedTilingSprites.add(t),e}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,i=t.texture.source.style;i.addressMode!=="repeat"&&(i.addressMode="repeat",i.update()),Fw(t,r.uvs),Bw(t,r.positions)}destroy(){this._managedTilingSprites.destroy(),this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,i=!0;return this._renderer.type===ci.WEBGL&&(i=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(i||r.source.isPowerOfTwo),e.canBatch}},vu.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"tilingSprite"}}),mm=y(()=>{Z(),Uw(),Se.add(vu)}),yu,_m,Lw=y(()=>{Ot(),gu(),yu=class ax extends Fo{constructor(...e){super({});let r=e[0]??{};typeof r=="number"&&($e(gt,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),r={width:r,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(r)}build(e){e={...ax.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 r=this.verticesX*this.verticesY,i=[],n=[],s=[],a=this.verticesX-1,o=this.verticesY-1,l=this.width/a,u=this.height/o;for(let f=0;f{Lw(),xu=class ox extends _m{constructor(e={}){e={...ox.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._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let e=this.positions,{width:r,height:i,_leftWidth:n,_rightWidth:s,_topHeight:a,_bottomHeight:o,_anchorX:l,_anchorY:u}=this,c=n+s,f=r>c?1:r/c,_=a+o,g=i>_?1:i/_,b=Math.min(f,g),T=l*r,x=u*i;e[0]=e[8]=e[16]=e[24]=-T,e[2]=e[10]=e[18]=e[26]=n*b-T,e[4]=e[12]=e[20]=e[28]=r-s*b-T,e[6]=e[14]=e[22]=e[30]=r-T,e[1]=e[3]=e[5]=e[7]=-x,e[9]=e[11]=e[13]=e[15]=a*b-x,e[17]=e[19]=e[21]=e[23]=i-o*b-x,e[25]=e[27]=e[29]=e[31]=i-x,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 r=1/this._originalWidth,i=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}},xu.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100},vm=xu}),ym,bu,zw=y(()=>{Z(),ti(),Gh(),Nw(),ym=class extends bo{constructor(){super(),this.geometry=new vm}destroy(){this.geometry.destroy()}},bu=class{constructor(t){this._renderer=t,this._managedSprites=new Yr({renderer:t,type:"renderable",name:"nineSliceSprite"})}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=t._gpuData[this._renderer.uid]=new ym,r=e;return r.renderable=t,r.transform=t.groupTransform,r.texture=t._texture,r.roundPixels=this._renderer._roundPixels|t._roundPixels,this._managedSprites.add(t),t.didViewUpdate||this._updateBatchableSprite(t,r),e}destroy(){this._managedSprites.destroy(),this._renderer=null}},bu.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"nineSliceSprite"}}),xm=y(()=>{Z(),zw(),Se.add(bu)}),wu,Hw=y(()=>{Z(),wu=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.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}},wu.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"filter"}}),Tu,Su,bm=y(()=>{Bn(),ns(),Oi(),Gi(),Tu=class Pd extends _i{constructor(e){e={...Pd.defaultOptions,...e},super(e),this.enabled=!0,this._state=di.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.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1),e.blendRequired&&this.addResource("uBackTexture",0,3)}apply(e,r,i,n){e.applyFilter(this,r,i,n)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:r,gl:i,...n}=e,s,a;return r&&(s=On.from(r)),i&&(a=hn.from(i)),new Pd({gpuProgram:s,glProgram:a,...n})}},Tu.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0},Su=Tu}),wm,jw=y(()=>{wm=`in vec2 aPosition; out vec2 vTextureCoord; uniform vec4 uInputSize; uniform vec4 uOutputFrame; uniform vec4 uOutputTexture; vec4 filterVertexPosition( void ) { 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( void ) { return aPosition * (uOutputFrame.zw * uInputSize.zw); } void main(void) { gl_Position = filterVertexPosition(); vTextureCoord = filterTextureCoord(); } `}),Tm,Ww=y(()=>{Tm=`in vec2 vTextureCoord; out vec4 finalColor; uniform sampler2D uTexture; void main() { finalColor = texture(uTexture, vTextureCoord); } `}),Eu,Vw=y(()=>{Eu=`struct GlobalFilterUniforms { uInputSize: vec4, uInputPixel: vec4, uInputClamp: vec4, uOutputFrame: vec4, uGlobalFrame: vec4, uOutputTexture: vec4, }; @group(0) @binding(0) var gfu: GlobalFilterUniforms; @group(0) @binding(1) var uTexture: texture_2d; @group(0) @binding(2) var uSampler: sampler; struct VSOutput { @builtin(position) position: vec4, @location(0) uv: vec2 }; fn filterVertexPosition(aPosition: vec2) -> vec4 { 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) -> vec2 { return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); } @vertex fn mainVertex( @location(0) aPosition: vec2, ) -> VSOutput { return VSOutput( filterVertexPosition(aPosition), filterTextureCoord(aPosition) ); } @fragment fn mainFragment( @location(0) uv: vec2, ) -> @location(0) vec4 { return textureSample(uTexture, uSampler, uv); } `}),Sm,$w=y(()=>{Bn(),ns(),bm(),jw(),Ww(),Vw(),Sm=class extends Su{constructor(){let t=On.from({vertex:{source:Eu,entryPoint:"mainVertex"},fragment:{source:Eu,entryPoint:"mainFragment"},name:"passthrough-filter"}),e=hn.from({vertex:wm,fragment:Tm,name:"passthrough-filter"});super({gpuProgram:t,glProgram:e})}}});function Xw(t,e){e.clear();let r=e.matrix;for(let i=0;i{et(),Cu=new me}),Em,Cm,Au,qw=y(()=>{Z(),$w(),et(),Pn(),Fs(),Xr(),Kt(),Tn(),qi(),Ar(),Yw(),It(),Em=new Jn({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Cm=class{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new pr,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0},this.firstEnabledIndex=-1,this.lastEnabledIndex=-1}},Au=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Gr({uInputSize:{value:new Float32Array(4),type:"vec4"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new Bi({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters,i=this._pushFilterData();i.skip=!1,i.filters=r,i.container=t.container,i.outputRenderSurface=e.renderTarget.renderSurface;let n=e.renderTarget.renderTarget.colorTexture.source,s=n.resolution,a=n.antialias;if(r.every(_=>!_.enabled)){i.skip=!0;return}let o=i.bounds;if(this._calculateFilterArea(t,o),this._calculateFilterBounds(i,e.renderTarget.rootViewPort,a,s,1),i.skip)return;let l=this._getPreviousFilterData(),u=this._findFilterResolution(s),c=0,f=0;l&&(c=l.bounds.minX,f=l.bounds.minY),this._calculateGlobalFrame(i,c,f,u,n.width,n.height),this._setupFilterTextures(i,o,e,l)}generateFilteredTexture({texture:t,filters:e}){let r=this._pushFilterData();this._activeFilterData=r,r.skip=!1,r.filters=e;let i=t.source,n=i.resolution,s=i.antialias;if(e.every(u=>!u.enabled))return r.skip=!0,t;let a=r.bounds;if(a.addRect(t.frame),this._calculateFilterBounds(r,a.rectangle,s,n,0),r.skip)return t;let o=n;this._calculateGlobalFrame(r,0,0,o,i.width,i.height),r.outputRenderSurface=wr.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=He.EMPTY,r.inputTexture=t,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,!0);let l=r.outputRenderSurface;return l.source.alphaMode="premultiplied-alpha",l}pop(){let t=this.renderer,e=this._popFilterData();e.skip||(t.globalUniforms.pop(),t.renderTarget.finishRenderPass(),this._activeFilterData=e,this._applyFiltersToTexture(e,!1),e.blendRequired&&wr.returnTexture(e.backTexture),wr.returnTexture(e.inputTexture))}getBackTexture(t,e,r){let i=t.colorTexture.source._resolution,n=wr.getOptimalTexture(e.width,e.height,i,!1),s=e.minX,a=e.minY;r&&(s-=r.minX,a-=r.minY),s=Math.floor(s*i),a=Math.floor(a*i);let o=Math.ceil(e.width*i),l=Math.ceil(e.height*i);return this.renderer.renderTarget.copyToTexture(t,n,{x:s,y:a},{width:o,height:l},{x:0,y:0}),n}applyFilter(t,e,r,i){let n=this.renderer,s=this._activeFilterData,a=s.outputRenderSurface===r,o=n.renderTarget.rootRenderTarget.colorTexture.source._resolution,l=this._findFilterResolution(o),u=0,c=0;if(a){let _=this._findPreviousFilterOffset();u=_.x,c=_.y}this._updateFilterUniforms(e,r,s,u,c,l,a,i);let f=t.enabled?t:this._getPassthroughFilter();this._setupBindGroupsAndRender(f,e,n)}calculateSpriteMatrix(t,e){let r=this._activeFilterData,i=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),n=e.worldTransform.copyTo(me.shared),s=e.renderGroup||e.parentRenderGroup;return s&&s.cacheToLocalTransform&&n.prepend(s.cacheToLocalTransform),n.invert(),i.prepend(n),i.scale(1/e.texture.orig.width,1/e.texture.orig.height),i.translate(e.anchor.x,e.anchor.y),i}destroy(){this._passthroughFilter?.destroy(!0),this._passthroughFilter=null}_getPassthroughFilter(){return this._passthroughFilter??(this._passthroughFilter=new Sm),this._passthroughFilter}_setupBindGroupsAndRender(t,e,r){if(r.renderPipes.uniformBatch){let i=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(i,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:Em,shader:t,state:t._state,topology:"triangle-list"}),r.type===ci.WEBGL&&r.renderTarget.finishRenderPass()}_setupFilterTextures(t,e,r,i){if(t.backTexture=He.EMPTY,t.inputTexture=wr.getOptimalTexture(e.width,e.height,t.resolution,t.antialias),t.blendRequired){r.renderTarget.finishRenderPass();let n=r.renderTarget.getRenderTarget(t.outputRenderSurface);t.backTexture=this.getBackTexture(n,e,i?.bounds)}r.renderTarget.bind(t.inputTexture,!0),r.globalUniforms.push({offset:e})}_calculateGlobalFrame(t,e,r,i,n,s){let a=t.globalFrame;a.x=e*i,a.y=r*i,a.width=n*i,a.height=s*i}_updateFilterUniforms(t,e,r,i,n,s,a,o){let l=this._filterGlobalUniforms.uniforms,u=l.uOutputFrame,c=l.uInputSize,f=l.uInputPixel,_=l.uInputClamp,g=l.uGlobalFrame,b=l.uOutputTexture;a?(u[0]=r.bounds.minX-i,u[1]=r.bounds.minY-n):(u[0]=0,u[1]=0),u[2]=t.frame.width,u[3]=t.frame.height,c[0]=t.source.width,c[1]=t.source.height,c[2]=1/c[0],c[3]=1/c[1],f[0]=t.source.pixelWidth,f[1]=t.source.pixelHeight,f[2]=1/f[0],f[3]=1/f[1],_[0]=.5*f[2],_[1]=.5*f[3],_[2]=t.frame.width*c[2]-.5*f[2],_[3]=t.frame.height*c[3]-.5*f[3];let T=this.renderer.renderTarget.rootRenderTarget.colorTexture;g[0]=i*s,g[1]=n*s,g[2]=T.source.width*s,g[3]=T.source.height*s,e instanceof He&&(e.source.resource=null);let x=this.renderer.renderTarget.getRenderTarget(e);this.renderer.renderTarget.bind(e,!!o),e instanceof He?(b[0]=e.frame.width,b[1]=e.frame.height):(b[0]=x.width,b[1]=x.height),b[2]=x.isRoot?-1:1,this._filterGlobalUniforms.update()}_findFilterResolution(t){let e=this._filterStackIndex-1;for(;e>0&&this._filterStack[e].skip;)--e;return e>0&&this._filterStack[e].inputTexture?this._filterStack[e].inputTexture.source._resolution:t}_findPreviousFilterOffset(){let t=0,e=0,r=this._filterStackIndex;for(;r>0;){r--;let i=this._filterStack[r];if(!i.skip){t=i.bounds.minX,e=i.bounds.minY;break}}return{x:t,y:e}}_calculateFilterArea(t,e){if(t.renderables?Xw(t.renderables,e):t.filterEffect.filterArea?(e.clear(),e.addRect(t.filterEffect.filterArea),e.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,e),t.container){let r=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;r&&e.applyMatrix(r)}}_applyFiltersToTexture(t,e){let r=t.inputTexture,i=t.bounds,n=t.filters,s=t.firstEnabledIndex,a=t.lastEnabledIndex;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(t.backTexture.source,3),s===a)n[s].apply(this,r,t.outputRenderSurface,e);else{let o=t.inputTexture,l=wr.getOptimalTexture(i.width,i.height,o.source._resolution,!1),u=l;for(let c=s;c0&&(e--,t=this._filterStack[e],!!t.skip););return t}_pushFilterData(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new Cm),this._filterStackIndex++,t}},Au.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"filter"}}),Am=y(()=>{Z(),Hw(),qw(),Se.add(Au),Se.add(wu)}),Kw={},Zw=y(()=>{Ax(),qd(),Bx(),Ix(),sh(),ch(),Hp(),jp(),Jp(),Vg(),sm(),hm(),mm(),xm(),Am()}),Qw={},Jw=y(()=>{qd(),sh(),ch(),Hp(),jp(),Jp(),Vg(),sm(),hm(),mm(),xm(),Am()});async function eT(t){if(!t)for(let e=0;e{Z(),Uo=[],Se.handleByNamedList(k.Environment,Uo)});function Pm(){if(typeof na=="boolean")return na;try{na=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{na=!1}return na}var na,Mm=y(()=>{"use strict"}),qr,sa=y(()=>{"use strict";qr=(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))(qr||{})}),Pu,Rm=y(()=>{"use strict";Pu=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,i,n,s,a,o){let{name:l,items:u}=this;for(let c=0,f=u.length;c{Ke(),tT(),Pi(),Mm(),er(),Ot(),zr(),sa(),Rm(),Xt(),km=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],Mu=class lx extends Tt{constructor(e){super(),this.tick=0,this.uid=dt("renderer"),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 r=[...km,...this.config.runners??[]];this._addRunners(...r),this._unsafeEvalCheck()}async init(e={}){let r=e.skipExtensionImports===!0?!0:e.manageImports===!1;await eT(r),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)e={...this._systemsHash[i].constructor.defaultOptions,...e};e={...lx.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let i=0;i{this.runners[r]=new Pu(r)})}_addSystems(e){let r;for(r in e){let i=e[r];this._addSystem(i.value,i.name)}}_addSystem(e,r){let i=new e(this);if(this[r])throw new Error(`Whoops! The name "${r}" is already in use`);this[r]=i,this._systemsHash[r]=i;for(let n in this.runners)this.runners[n].add(i);return this}_addPipes(e,r){let i=r.reduce((n,s)=>(n[s.name]=s.value,n),{});e.forEach(n=>{let s=n.value,a=n.name,o=i[a];this.renderPipes[a]=new s(this,o?new o:null),this.runners.destroy.add(this.renderPipes[a])})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),(e===!0||typeof e=="object"&&e.releaseGlobalResources)&&li.release(),Object.values(this.runners).forEach(r=>{r.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Pm())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}},Mu.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1},aa=Mu}),Ru,rT=y(()=>{Z(),et(),ph(),In(),ro(),so(),ra(),Gn(),Oi(),Xr(),Ru=class{constructor(){this._maxTextures=0}contextChange(t){let e=new Gr({uTransformMatrix:{value:new me,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}});this._maxTextures=t.limits.maxBatchableTextures;let r=Us({name:"graphics",bits:[eo,bh(this._maxTextures),um,ss]});this.shader=new _i({gpuProgram:r,resources:{localUniforms:e}})}execute(t,e){let r=e.context,i=r.customShader||this.shader,n=t.renderer,s=n.graphicsContext,{batcher:a,instructions:o}=s.getContextRenderData(r),l=n.encoder;l.setGeometry(a.geometry,i.gpuProgram);let u=n.globalUniforms.bindGroup;l.setBindGroup(0,u,i.gpuProgram);let c=n.renderPipes.uniformBatch.getUniformBindGroup(i.resources.localUniforms,!0);l.setBindGroup(2,c,i.gpuProgram);let f=o.instructions,_=null;for(let g=0;g{"use strict";Bm={name:"texture-bit",vertex:{header:` struct TextureUniforms { uTextureMatrix:mat3x3, } @group(2) @binding(2) var textureUniforms : TextureUniforms; `,main:` uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy; `},fragment:{header:` @group(2) @binding(0) var uTexture: texture_2d; @group(2) @binding(1) var uSampler: sampler; `,main:` outColor = textureSample(uTexture, uSampler, vUV); `}},Om={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); `}}}),ku,iT=y(()=>{Z(),et(),In(),ra(),Gn(),Im(),Oi(),Kt(),It(),ku=class{init(){let t=Us({name:"mesh",bits:[ds,Bm,ss]});this._shader=new _i({gpuProgram:t,resources:{uTexture:He.EMPTY._source,uSampler:He.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new me}}}})}execute(t,e){let r=t.renderer,i=e._shader;if(!i)i=this._shader,i.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!i.gpuProgram){it("Mesh shader has no gpuProgram",e.shader);return}let n=i.gpuProgram;if(n.autoAssignGlobalUniforms&&(i.groups[0]=r.globalUniforms.bindGroup),n.autoAssignLocalUniforms){let s=t.localUniforms;i.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(s,!0)}r.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}},ku.extension={type:[k.WebGPUPipesAdaptor],name:"mesh"}}),oa,Bu,nT=y(()=>{Z(),Gi(),ph(),oa=di.for2d(),Bu=class{start(t,e,r){let i=t.renderer,n=i.encoder,s=r.gpuProgram;this._shader=r,this._geometry=e,n.setGeometry(e,s),oa.blendMode="normal",i.pipeline.getPipeline(e,s,oa);let a=i.globalUniforms.bindGroup;n.resetBindGroup(1),n.setBindGroup(0,a,s)}execute(t,e){let r=this._shader.gpuProgram,i=t.renderer,n=i.encoder;if(!e.bindGroup){let o=e.textures;e.bindGroup=dh(o.textures,o.count,i.limits.maxBatchableTextures)}oa.blendMode=e.blendMode;let s=i.bindGroup.getBindGroup(e.bindGroup,r,1),a=i.pipeline.getPipeline(this._geometry,r,oa,e.topology);e.bindGroup._touch(i.gc.now,i.tick),n.setPipeline(a),n.renderPassEncoder.setBindGroup(1,s),n.renderPassEncoder.drawIndexed(e.size,1,e.start)}},Bu.extension={type:[k.WebGPUPipesAdaptor],name:"batch"}}),Ou,sT=y(()=>{Z(),Ou=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}},Ou.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"customRender"}});function Iu(t,e){let r=t.instructionSet,i=r.instructions;for(let n=0;n{"use strict"}),Fm,Gu,aT=y(()=>{Z(),et(),jr(),wo(),Gm(),Fm=new me,Gu=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(qt.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=qt.get(Ys));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.blendMode.pushBlendMode(t,t.root.groupBlendMode,e),this._renderer.renderPipes.batch.addToBatch(r,e),this._renderer.renderPipes.blendMode.popBlendMode(e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=Fm.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295,offset:{x:0,y:0}}),Iu(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),Iu(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}},Gu.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"renderGroup"}});function Fu(t,e){e||(e=0);for(let r=e;r{"use strict"});function Um(t,e=!1){oT(t);let r=t.childrenToUpdate,i=t.updateTick++;for(let n in r){let s=Number(n),a=r[n],o=a.list,l=a.index;for(let u=0;u1?1:r,t.worldAlpha=r,t.worldColorAlpha=t.worldColor+((r*255|0)<<24)}function Lm(t,e,r){if(e===t.updateTick)return;t.updateTick=e,t.didChange=!1;let i=t.localTransform;t.updateLocalTransform();let n=t.parent;if(n&&!n.renderGroup?(r|=t._updateFlags,t.relativeGroupTransform.appendFrom(i,n.relativeGroupTransform),r&Du&&Nm(t,n,r)):(r=t._updateFlags,t.relativeGroupTransform.copyFrom(i),r&Du&&Nm(t,zm,r)),!t.renderGroup){let s=t.children,a=s.length;for(let u=0;u1?1:i,t.groupAlpha=i,t.groupColorAlpha=t.groupColor+((i*255|0)<<24)}r&Ga&&(t.groupBlendMode=t.localBlendMode==="inherit"?e.groupBlendMode:t.localBlendMode),r&$n&&(t.globalDisplayStatus=t.localDisplayStatus&e.globalDisplayStatus),t._updateFlags=0}var zm,Du,lT=y(()=>{Pi(),Dm(),Ue(),zm=new Ir,Du=$n|As|Ga});function hT(t,e){let{list:r}=t.childrenRenderablesToUpdate,i=!1;for(let n=0;n{"use strict"}),Hm,Uu,cT=y(()=>{Z(),et(),Tn(),xe(),Ar(),Dm(),Gm(),lT(),uT(),Hm=new me,Uu=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,i=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let n=this._renderer,s=Hm;e&&(s.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=n.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Iu(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(s),t.parent=r,t.renderGroup.renderGroupParent=i}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t._parentCacheAsTextureRenderGroup=e,t.isCachedAsTexture){if(!t.textureNeedsUpdate)return;e=t}for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let i=t.texture;t.texture&&wr.returnTexture(t.texture,!0);let n=this._renderer,s=t.textureOptions.resolution||n.view.resolution,a=t.textureOptions.antialias??n.view.antialias,o=t.textureOptions.scaleMode??"linear",l=wr.getOptimalTexture(r.width,r.height,s,a);l._source.style=new _e({scaleMode:o}),t.texture=l,t._textureBounds||(t._textureBounds=new pr),t._textureBounds.copyFrom(r),i!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(wr.returnTexture(t.texture,!0),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?Fu(t.childrenRenderablesToUpdate.list,0):hT(t,r),Um(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let i=0;i{Z(),wo(),Lu=class{constructor(t){this._renderer=t}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=new Ys;return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null}},Lu.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"sprite"}}),la,jm=y(()=>{Xt(),la="8.15.0"}),Nu,zu,Wm=y(()=>{Z(),jm(),Nu=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,la)}static destroy(){}},Nu.extension=k.Application,zu=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,la)}destroy(){this._renderer=null}},zu.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"initHook",priority:-10}}),No,Hu,fT=y(()=>{Z(),Gi(),cp(),No=class hx{constructor(e,r){this.state=di.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=r,this._adaptor.init?.(this)}static getBatcher(e){return new this._availableBatchers[e]}buildStart(e){let r=this._batchersByInstructionSet[e.uid];r||(r=this._batchersByInstructionSet[e.uid]=Object.create(null),r.default||(r.default=new ao({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=r,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(e,r){if(this._activeBatch.name!==e.batcherName){this._activeBatch.break(r);let i=this._activeBatches[e.batcherName];i||(i=this._activeBatches[e.batcherName]=hx.getBatcher(e.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);let r=this._activeBatches;for(let i in r){let n=r[i],s=n.geometry;s.indexBuffer.setDataWithSize(n.indexBuffer,n.indexSize,!0),s.buffers[0].setDataWithSize(n.attributeBuffer.float32View,n.attributeSize,!1)}}upload(e){let r=this._batchersByInstructionSet[e.uid];for(let i in r){let n=r[i],s=n.geometry;n.dirty&&(n.dirty=!1,s.buffers[0].update(n.attributeSize*4))}}execute(e){if(e.action==="startBatch"){let r=e.batcher,i=r.geometry,n=r.shader;this._adaptor.start(this,i,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}},No.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"batch"},No._availableBatchers=Object.create(null),Hu=No,Se.handleByMap(k.Batcher,Hu._availableBatchers),Se.add(ao)}),Vm,pT=y(()=>{Vm=`in vec2 vMaskCoord; in vec2 vTextureCoord; uniform sampler2D uTexture; uniform sampler2D uMaskTexture; uniform float uAlpha; uniform vec4 uMaskClamp; uniform float uInverse; 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); float a = alphaMul * masky.r * npmAlpha * clip; if (uInverse == 1.0) { a = 1.0 - a; } finalColor = original * a; } `}),$m,gT=y(()=>{$m=`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); } `}),ju,mT=y(()=>{ju=`struct GlobalFilterUniforms { uInputSize:vec4, uInputPixel:vec4, uInputClamp:vec4, uOutputFrame:vec4, uGlobalFrame:vec4, uOutputTexture:vec4, }; struct MaskUniforms { uFilterMatrix:mat3x3, uMaskClamp:vec4, uAlpha:f32, uInverse:f32, }; @group(0) @binding(0) var gfu: GlobalFilterUniforms; @group(0) @binding(1) var uTexture: texture_2d; @group(0) @binding(2) var uSampler : sampler; @group(1) @binding(0) var filterUniforms : MaskUniforms; @group(1) @binding(1) var uMaskTexture: texture_2d; struct VSOutput { @builtin(position) position: vec4, @location(0) uv : vec2, @location(1) filterUv : vec2, }; fn filterVertexPosition(aPosition:vec2) -> vec4 { 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 ) -> vec2 { return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); } fn globalTextureCoord( aPosition:vec2 ) -> vec2 { return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); } fn getFilterCoord(aPosition:vec2 ) -> vec2 { return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; } fn getSize() -> vec2 { return gfu.uGlobalFrame.zw; } @vertex fn mainVertex( @location(0) aPosition : vec2, ) -> VSOutput { return VSOutput( filterVertexPosition(aPosition), filterTextureCoord(aPosition), getFilterCoord(aPosition) ); } @fragment fn mainFragment( @location(0) uv: vec2, @location(1) filterUv: vec2, @builtin(position) position: vec4 ) -> @location(0) vec4 { var maskClamp = filterUniforms.uMaskClamp; var uAlpha = filterUniforms.uAlpha; 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 alphaMul = 1.0 - uAlpha * (1.0 - mask.a); var a: f32 = alphaMul * mask.r * uAlpha * clip; if (filterUniforms.uInverse == 1.0) { a = 1.0 - a; } return source * a; } `}),Xm,_T=y(()=>{et(),Bn(),ns(),Xr(),Bd(),bm(),pT(),gT(),mT(),Xm=class extends Su{constructor(t){let{sprite:e,...r}=t,i=new Pl(e.texture),n=new Gr({uFilterMatrix:{value:new me,type:"mat3x3"},uMaskClamp:{value:i.uClampFrame,type:"vec4"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),s=On.from({vertex:{source:ju,entryPoint:"mainVertex"},fragment:{source:ju,entryPoint:"mainFragment"}}),a=hn.from({vertex:$m,fragment:Vm,name:"mask-filter"});super({...r,gpuProgram:s,glProgram:a,clipToViewport:!1,resources:{filterUniforms:n,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=i}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,i){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,r,i)}}}),Ym,qm,Wu,vT=y(()=>{Z(),Vr(),_T(),Ar(),K(),_f(),jr(),Kt(),Tn(),qi(),Ym=new pr,qm=class extends hi{constructor(){super(),this.filters=[new Xm({sprite:new Wa(He.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},Wu=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let i=this._renderer;if(i.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let n=t.mask;n.includeInBuild=!0,n.collectRenderables(r,i,null),n.includeInBuild=!1}i.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let i=qt.get(qm);if(i.inverse=t.inverse,r){t.mask.mask.measurable=!0;let n=j(t.mask.mask,!0,Ym);t.mask.mask.measurable=!1,n.ceil();let s=e.renderTarget.renderTarget.colorTexture.source,a=wr.getOptimalTexture(n.width,n.height,s._resolution,s.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:n,worldColor:4294967295});let o=i.sprite;o.texture=a,o.worldTransform.tx=n.minX,o.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:i,maskedContainer:t.maskedContainer,filterTexture:a})}else i.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:i,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let i=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===ci.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:i.maskedContainer,filterEffect:i.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let i=this._activeMaskStage.pop();r&&wr.returnTexture(i.filterTexture),qt.return(i.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}},Wu.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"alphaMask"}}),Vu,yT=y(()=>{Z(),Vu=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,r){this._renderer.renderPipes.batch.break(r);let i=this._colorStack;i[this._colorStackIndex]=i[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let i=this._colorStack;this._colorStackIndex--;let n=i[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._renderer=null,this._colorStack=null}},Vu.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"colorMask"}}),$u,xT=y(()=>{Z(),sa(),Kn(),$u=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var i;let n=t,s=this._renderer;s.renderPipes.batch.break(r),s.renderPipes.blendMode.setBlendMode(n.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,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=r.instructionSize,a.collectRenderables(r,s,null),a.includeInBuild=!1,s.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-o.instructionsStart-1;o.instructionsLength=l;let u=s.renderTarget.renderTarget.uid;(i=this._maskStackHash)[u]??(i[u]=0)}pop(t,e,r){let i=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(i.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let s=this._maskHash.get(t);for(let a=0;a{Ke(),Z(),It(),zo=class ux{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ge(0),this.color=this._backgroundColor,this.alpha=1}init(e){e={...ux.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){ge.shared.setValue(e).alpha<1&&this._backgroundColor.alpha===1&&it("Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."),this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}},zo.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"background",priority:0},zo.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Km=zo}),fs,Xu,wT=y(()=>{Z(),Vr(),Gd(),It(),fs={},Se.handle(k.BlendMode,t=>{if(!t.name)throw new Error("BlendMode extension must have a name property");fs[t.name]=t.ref},t=>{delete fs[t.name]}),Xu=class{constructor(t){this._blendModeStack=[],this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}pushBlendMode(t,e,r){this._blendModeStack.push(e),this.setBlendMode(t,e,r)}popBlendMode(t){this._blendModeStack.pop();let e=this._blendModeStack[this._activeBlendMode.length-1]??"normal";this.setBlendMode(null,e,t)}setBlendMode(t,e,r){let i=t instanceof Ba;if(this._activeBlendMode===e){this._isAdvanced&&t&&!i&&this._renderableList?.push(t);return}this._isAdvanced&&this._endAdvancedBlendMode(r),this._activeBlendMode=e,t&&(this._isAdvanced=!!fs[e],this._isAdvanced&&this._beginAdvancedBlendMode(t,r))}_beginAdvancedBlendMode(t,e){this._renderer.renderPipes.batch.break(e);let r=this._activeBlendMode;if(!fs[r]){it(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._ensureFilterEffect(r),n=t instanceof Ba,s={renderPipeId:"filter",action:"pushFilter",filterEffect:i,renderables:n?null:[t],container:n?t.root:null,canBundle:!1};this._renderableList=s.renderables,e.add(s)}_ensureFilterEffect(t){let e=this._filterHash[t];return e||(e=this._filterHash[t]=new hi,e.filters=[new fs[t]]),e}_endAdvancedBlendMode(t){this._isAdvanced=!1,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}},Xu.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"blendMode"}}),Ho,jo,Zm,TT=y(()=>{rr(),Z(),Pi(),Kt(),Ho={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},jo=class cx{constructor(e){this._renderer=e}_normalizeOptions(e,r={}){return e instanceof Ir||e instanceof He?{target:e,...r}:{...r,...e}}async image(e){let r=Ht.get().createImage();return r.src=await this.base64(e),r}async base64(e){e=this._normalizeOptions(e,cx.defaultImageOptions);let{format:r,quality:i}=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)},Ho[r],i)});if(n.toDataURL!==void 0)return n.toDataURL(Ho[r],i);if(n.convertToBlob!==void 0){let s=await n.convertToBlob({type:Ho[r],quality:i});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 r=e.target,i=this._renderer;if(r instanceof He)return i.texture.generateCanvas(r);let n=i.textureGenerator.generateTexture(e),s=i.texture.generateCanvas(n);return n.destroy(!0),s}pixels(e){e=this._normalizeOptions(e);let r=e.target,i=this._renderer,n=r instanceof He?r:i.textureGenerator.generateTexture(e),s=i.texture.getPixels(n);return r instanceof Ir&&n.destroy(!0),s}texture(e){return e=this._normalizeOptions(e),e.target instanceof He?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);let r=this.canvas(e),i=document.createElement("a");i.download=e.filename??"image.png",i.href=r.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(e){let r=e.width??200;e=this._normalizeOptions(e);let i=this.canvas(e),n=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let s=["font-size: 1px;",`padding: ${r}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}destroy(){this._renderer=null}},jo.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"extract"},jo.defaultImageOptions={format:"png",quality:1},Zm=jo}),Qm,ST=y(()=>{lt(),Kt(),Qm=class dx extends He{static create(e){let{dynamic:r,...i}=e;return new dx({source:new Ze(i),dynamic:r??!1})}resize(e,r,i){return this.source.resize(e,r,i),this}}}),Jm,e_,t_,Yu,ET=y(()=>{Ke(),Z(),et(),nr(),Ar(),v(),Pi(),ST(),Jm=new Wt,e_=new pr,t_=[0,0,0,0],Yu=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof Ir&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,r=t.antialias||this._renderer.view.antialias,i=t.target,n=t.clearColor;n?n=Array.isArray(n)&&n.length===4?n:ge.shared.setValue(n).toArray():n=t_;let s=t.frame?.copyTo(Jm)||d(i,e_).rectangle;s.width=Math.max(s.width,1/e)|0,s.height=Math.max(s.height,1/e)|0;let a=Qm.create({...t.textureSourceOptions,width:s.width,height:s.height,resolution:e,antialias:r}),o=me.shared.translate(-s.x,-s.y);return this._renderer.render({container:i,transform:o,target:a,clearColor:n}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}},Yu.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"textureGenerator"}}),Wo,r_,CT=y(()=>{Z(),Wo=class fx{constructor(e){this._managedResources=[],this._managedResourceHashes=[],this._ready=!1,this._renderer=e}init(e){e={...fx.defaultOptions,...e},this.maxUnusedTime=e.gcMaxUnusedTime,this._frequency=e.gcFrequency,this.enabled=e.gcActive,this.now=performance.now()}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?this._handler=this._renderer.scheduler.repeat(()=>{this._ready=!0},this._frequency,!1):(this._renderer.scheduler.cancel(this._handler),this._handler=0))}prerender({container:e}){this.now=performance.now(),e.renderGroup.gcTick=this._renderer.tick++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}postrender(){!this._ready||!this.enabled||(this.run(),this._ready=!1)}_updateInstructionGCTick(e,r){e.instructionSet.gcTick=r;for(let i of e.renderGroupChildren)this._updateInstructionGCTick(i,r)}addResource(e,r){if(e._gcLastUsed!==-1){e._gcLastUsed=this.now,e._onTouch?.(this.now);return}let i=this._managedResources.length;e._gcData={index:i,type:r},e._gcLastUsed=this.now,e._onTouch?.(this.now),e.once("unload",this.removeResource,this),this._managedResources.push(e)}removeResource(e){let r=e._gcData;if(!r)return;let i=r.index,n=this._managedResources.length-1;if(i!==n){let s=this._managedResources[n];this._managedResources[i]=s,s._gcData.index=i}this._managedResources.length--,e._gcData=null,e._gcLastUsed=-1}addResourceHash(e,r,i,n=0){this._managedResourceHashes.push({context:e,hash:r,type:i,priority:n}),this._managedResourceHashes.sort((s,a)=>s.priority-a.priority)}run(){let e=performance.now(),r=this._managedResourceHashes;for(let n of r)this.runOnHash(n,e);let i=0;for(let n=0;n{e.off("unload",this.removeResource,this)}),this._managedResources.length=0,this._managedResourceHashes.length=0,this._renderer=null}},Wo.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"gc",priority:0},Wo.defaultOptions={gcActive:!0,gcMaxUnusedTime:6e4,gcFrequency:3e4},r_=Wo}),qu,AT=y(()=>{Z(),et(),we(),Xs(),Pn(),qi(),Xr(),qu=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"},uWorldTransformMatrix:{value:new me,type:"mat3x3"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4"},uResolution:{value:[0,0],type:"vec2"}},{isStatic:!0})}destroy(){this._renderer=null,this._globalUniformDataStack.length=0,this._uniformsPool.length=0,this._activeUniforms.length=0,this._bindGroupPool.length=0,this._activeBindGroups.length=0,this._currentGlobalUniformData=null}},qu.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"globalUniforms"}}),i_,Ku,PT=y(()=>{Z(),Ps(),i_=1,Ku=class{constructor(){this._tasks=[],this._offset=0}init(){ei.system.add(this._update,this)}repeat(t,e,r=!0){let i=i_++,n=0;return r&&(this._offset+=1e3,n=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:n,last:performance.now(),repeat:!0,id:i}),i}cancel(t){for(let e=0;e=r.duration){let i=t-r.start;r.func(i),r.last=t}}}destroy(){ei.system.remove(this._update,this),this._tasks.length=0}},Ku.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"scheduler",priority:0}});function MT(t){if(!Zu){if(Ht.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let e=[`%c %c %c %c %c PixiJS %c v${la} (${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 ${la} - ${t} - http://www.pixijs.com/`);Zu=!0}}var Zu,RT=y(()=>{rr(),jm(),Zu=!1}),Vo,kT=y(()=>{Z(),RT(),qi(),Vo=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===ci.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),MT(e)}}},Vo.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"hello",priority:-2},Vo.defaultOptions={hello:!1}});function BT(t){let e=!1;for(let i in t)if(t[i]==null){e=!0;break}if(!e)return t;let r=Object.create(null);for(let i in t){let n=t[i];n&&(r[i]=n)}return r}function OT(t){let e=0;for(let r=0;r{"use strict"}),n_,$o,s_,GT=y(()=>{Z(),IT(),n_=0,$o=class px{constructor(e){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=e}init(e){e={...px.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,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let r of this._managedHashes)r.context[r.hash]=BT(r.context[r.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let r of this._managedArrays)OT(r.context[r.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(e,r){this._managedHashes.push({context:e,hash:r})}addManagedArray(e,r){this._managedArrays.push({context:e,hash:r})}prerender({container:e}){this._now=performance.now(),e.renderGroup.gcTick=n_++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}addRenderable(e){this.enabled&&(e._lastUsed===-1&&(this._managedRenderables.push(e),e.once("destroyed",this._removeRenderable,this)),e._lastUsed=this._now)}run(){let e=this._now,r=this._managedRenderables,i=this._renderer.renderPipes,n=0;for(let s=0;sthis.maxUnusedTime){if(!a.destroyed){let u=i;o&&(o.structureDidChange=!0),u[a.renderPipeId].destroyRenderable(a)}a._lastUsed=-1,n++,a.off("destroyed",this._removeRenderable,this)}else r[s-n]=a}r.length-=n}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(e){let r=this._managedRenderables.indexOf(e);r>=0&&(e.off("destroyed",this._removeRenderable,this),this._managedRenderables[r]=null)}_updateInstructionGCTick(e,r){e.instructionSet.gcTick=r;for(let i of e.renderGroupChildren)this._updateInstructionGCTick(i,r)}},$o.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"renderableGC",priority:0},$o.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4},s_=$o}),Xo,a_,FT=y(()=>{Z(),Ot(),Xo=class Cl{get count(){return this._renderer.tick}get checkCount(){return this._checkCount}set checkCount(e){$e("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._checkCount=e}get maxIdle(){return this._renderer.gc.maxUnusedTime/1e3*60}set maxIdle(e){$e("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.maxUnusedTime=e/60*1e3}get checkCountMax(){return Math.floor(this._renderer.gc._frequency/1e3)}set checkCountMax(e){$e("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead.")}get active(){return this._renderer.gc.enabled}set active(e){$e("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.enabled=e}constructor(e){this._renderer=e,this._checkCount=0}init(e){e.textureGCActive!==Cl.defaultOptions.textureGCActive&&(this.active=e.textureGCActive),e.textureGCMaxIdle!==Cl.defaultOptions.textureGCMaxIdle&&(this.maxIdle=e.textureGCMaxIdle),e.textureGCCheckCountMax!==Cl.defaultOptions.textureGCCheckCountMax&&(this.checkCountMax=e.textureGCCheckCountMax)}run(){$e("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}},Xo.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"textureGC"},Xo.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600},a_=Xo}),Qu,Yo,o_=y(()=>{er(),lt(),Kt(),Qu=class gx{constructor(e={}){if(this.uid=dt("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,e={...gx.defaultOptions,...e},this.stencil=e.stencil,this.depth=e.depth,this.isRoot=e.isRoot,typeof e.colorTextures=="number"){this._managedColorTextures=!0;for(let r=0;ri.source)];let r=this.colorTexture.source;this.resize(r.width,r.height,r._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(e.depthStencilTexture||this.stencil)&&(e.depthStencilTexture instanceof He||e.depthStencilTexture instanceof Ze?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 Ze({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(e,r,i=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach((s,a)=>{n&&a===0||s.source.resize(e,r,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(e,r,i)}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)}},Qu.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1},Yo=Qu});function l_(t,e){if(!Nn.has(t)){let r=new He({source:new ki({resource:t,...e})}),i=()=>{Nn.get(t)===r&&Nn.delete(t)};r.once("destroy",i),r.source.once("destroy",i),Nn.set(t,r)}return Nn.get(t)}var Nn,h_=y(()=>{zr(),Bs(),Kt(),Nn=new Map,li.register(Nn)}),qo,u_,DT=y(()=>{rr(),Z(),nr(),Ot(),o_(),h_(),qo=class mx{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={...mx.defaultOptions,...e},e.view&&($e(gt,"ViewSystem.view has been renamed to ViewSystem.canvas"),e.canvas=e.view),this.screen=new Wt(0,0,e.width,e.height),this.canvas=e.canvas||Ht.get().createCanvas(),this.antialias=!!e.antialias,this.texture=l_(this.canvas,e),this.renderTarget=new Yo({colorTextures:[this.texture],depth:!!e.depth,isRoot:!0}),this.texture.source.transparent=e.backgroundAlpha<1,this.resolution=e.resolution}resize(e,r,i){this.texture.source.resize(e,r,i),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),this.texture.destroy()}},qo.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"view",priority:0},qo.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1},u_=qo}),Ju,ec,c_=y(()=>{sT(),aT(),cT(),dT(),Wm(),fT(),vT(),yT(),xT(),bT(),wT(),TT(),ET(),CT(),AT(),PT(),kT(),GT(),FT(),DT(),Ju=[Km,qu,Vo,u_,Uu,r_,a_,Yu,Zm,zu,s_,Ku],ec=[Xu,Hu,Lu,Gu,Wu,$u,Vu,Ou]}),tc,UT=y(()=>{Z(),tc=class{constructor(t){this._hash=Object.create(null),this._renderer=t}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let i=this._gpu.device,n=e.layout[r],s=[],a=this._renderer;for(let u in n){let c=t.resources[u]??t.resources[n[u]],f;if(c._resourceType==="uniformGroup"){let _=c;a.ubo.updateUniformGroup(_);let g=_.buffer;f={buffer:a.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(c._resourceType==="buffer"){let _=c;f={buffer:a.buffer.getGPUBuffer(_),offset:0,size:_.descriptor.size}}else if(c._resourceType==="bufferResource"){let _=c;f={buffer:a.buffer.getGPUBuffer(_.buffer),offset:_.offset,size:_.size}}else if(c._resourceType==="textureSampler"){let _=c;f=a.texture.getGpuSampler(_)}else if(c._resourceType==="textureSource"){let _=c;f=a.texture.getGpuSource(_).createView()}s.push({binding:n[u],resource:f})}let o=a.shader.getProgramData(e).bindGroups[r],l=i.createBindGroup({layout:o,entries:s});return this._hash[t._key]=l,l}destroy(){this._hash=null,this._renderer=null}},tc.extension={type:[k.WebGPUSystem],name:"bindGroup"}}),d_,rc,LT=y(()=>{Z(),ti(),er(),Mf(),d_=class{constructor(t){this.gpuBuffer=t}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}},rc=class{constructor(t){this._renderer=t,this._managedBuffers=new Yr({renderer:t,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(t){this._gpu=t}getGPUBuffer(t){return t._gcLastUsed=this._renderer.gc.now,t._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(t)}updateBuffer(t){let e=this.getGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(t){t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this)}createGPUBuffer(t){let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t._resourceId=dt("resource"),t.data&&(gh(t.data.buffer,e.getMappedRange()),e.unmap()),t._gpuData[this._renderer.uid]=new d_(e),this._managedBuffers.add(t)&&(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this)),e}onBufferChange(t){this._managedBuffers.remove(t),t._updateID=0,this.createGPUBuffer(t)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}},rc.extension={type:[k.WebGPUSystem],name:"buffer"}}),ic,NT=y(()=>{Z(),ic=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}},ic.extension={type:[k.WebGPUSystem],name:"colorMask"}}),Ko,zT=y(()=>{rr(),Z(),Ko=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=(t.gpu?Promise.resolve(t.gpu):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 Ht.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),i=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:i}}destroy(){this.gpu=null,this._renderer=null}},Ko.extension={type:[k.WebGPUSystem],name:"device"},Ko.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}}),nc,HT=y(()=>{Z(),nc=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,r,i){let n=this._renderer.pipeline.getPipeline(t,e,r,i);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,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.gc.now,this._renderer.tick);let i=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,i)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let i in r)this._setVertexBuffer(parseInt(i,10),t.attributes[r[i]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let i=t.groups[r];e||this._syncBindGroup(i),this.setBindGroup(r,i,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:i,topology:n,size:s,start:a,instanceCount:o,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,i,n),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,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,r={...this._boundVertexBuffer},i=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 r)this._setVertexBuffer(a,r[a]);for(let a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(i)}_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}},nc.extension={type:[k.WebGPUSystem],name:"encoder",priority:1}}),sc,jT=y(()=>{Z(),sc=class{constructor(t){this._renderer=t}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}},sc.extension={type:[k.WebGPUSystem],name:"limits"}}),ac,WT=y(()=>{Z(),Kn(),ac=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:sr.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let i=this._renderer;i.pipeline.setStencilMode(t),i.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}},ac.extension={type:[k.WebGPUSystem],name:"stencil"}}),oc,f_=y(()=>{Mm(),kn(),ln(),oc=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!Pm())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 $r({data:new Float32Array(e.layout.size/4),usage:bt.UNIFORM|bt.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let i=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),n=this._adaptor.createUboElements(i),s=this._generateUboSync(n.uboElements);r=this._syncFunctionHash[e]={layout:n,syncFunction:s}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let i=this.getUniformGroupData(t);t.buffer||(t.buffer=new $r({data:new Float32Array(i.layout.size/4),usage:bt.UNIFORM|bt.COPY_DST}));let n=null;return e||(e=t.buffer.data,n=t.buffer.dataInt32),r||(r=0),i.syncFunction(t.uniforms,e,n,r),!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 VT(t){let e=t.map(i=>({data:i,offset:0,size:0})),r=0;for(let i=0;i1&&(s=Math.max(s,a)*n.data.size),r=Math.ceil(r/a)*a,n.size=s,n.offset=r,r+=s}return r=Math.ceil(r/16)*16,{uboElements:e,size:r}}var ha,p_=y(()=>{"use strict";ha={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:4,size:4},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:8,size:6},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:8,size:8},"mat2x2":{align:8,size:16},"mat2x2":{align:4,size:8},"mat3x2":{align:8,size:24},"mat3x2":{align:4,size:12},"mat4x2":{align:8,size:32},"mat4x2":{align:4,size:16},"mat2x3":{align:16,size:32},"mat2x3":{align:8,size:16},"mat3x3":{align:16,size:48},"mat3x3":{align:8,size:24},"mat4x3":{align:16,size:64},"mat4x3":{align:8,size:32},"mat2x4":{align:16,size:32},"mat2x4":{align:8,size:16},"mat3x4":{align:16,size:48},"mat3x4":{align:8,size:24},"mat4x4":{align:16,size:64},"mat4x4":{align:8,size:32}}}),mn,g_=y(()=>{"use strict";mn=[{type:"mat3x3",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",test:t=>t.type==="vec4"&&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",test:t=>t.type==="vec2"&&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",test:t=>t.type==="vec4"&&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",test:t=>t.type==="vec3"&&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 m_(t,e,r,i){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;o1)f=l.offset/4,n.push(r(l,f-s));else{let _=i[l.data.type];f=l.offset/4,n.push(` v = uv.${u}; offset += ${f-s}; ${_}; `)}s=f}let a=n.join(` `);return new Function("uv","data","dataInt32","offset",a)}var __=y(()=>{g_()});function ps(t,e){return` for (let i = 0; i < ${t*e}; i++) { data[offset + (((i / ${t})|0) * 4) + (i % ${t})] = v[i]; } `}var lc,v_,y_=y(()=>{"use strict";lc={f32:` data[offset] = v;`,i32:` dataInt32[offset] = v;`,"vec2":` data[offset] = v[0]; data[offset + 1] = v[1];`,"vec3":` data[offset] = v[0]; data[offset + 1] = v[1]; data[offset + 2] = v[2];`,"vec4":` data[offset] = v[0]; data[offset + 1] = v[1]; data[offset + 2] = v[2]; data[offset + 3] = v[3];`,"vec2":` dataInt32[offset] = v[0]; dataInt32[offset + 1] = v[1];`,"vec3":` dataInt32[offset] = v[0]; dataInt32[offset + 1] = v[1]; dataInt32[offset + 2] = v[2];`,"vec4":` dataInt32[offset] = v[0]; dataInt32[offset + 1] = v[1]; dataInt32[offset + 2] = v[2]; dataInt32[offset + 3] = v[3];`,"mat2x2":` data[offset] = v[0]; data[offset + 1] = v[1]; data[offset + 4] = v[2]; data[offset + 5] = v[3];`,"mat3x3":` 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":` for (let i = 0; i < 16; i++) { data[offset + i] = v[i]; }`,"mat3x2":ps(3,2),"mat4x2":ps(4,2),"mat2x3":ps(2,3),"mat4x3":ps(4,3),"mat2x4":ps(2,4),"mat3x4":ps(3,4)},v_={...lc,"mat2x2":` data[offset] = v[0]; data[offset + 1] = v[1]; data[offset + 2] = v[2]; data[offset + 3] = v[3]; `}});function $T(t,e){let{size:r,align:i}=ha[t.data.type],n=(i-r)/4,s=t.data.type.indexOf("i32")>=0?"dataInt32":"data";return` v = uv.${t.data.name}; ${e!==0?`offset += ${e};`:""} arrayOffset = offset; t = 0; for(var i=0; i < ${t.data.size*(r/4)}; i++) { for(var j = 0; j < ${r/4}; j++) { ${s}[arrayOffset++] = v[t++]; } ${n!==0?`arrayOffset += ${n};`:""} } `}var XT=y(()=>{p_()});function YT(t){return m_(t,"uboWgsl",$T,v_)}var qT=y(()=>{__(),y_(),XT()}),hc,KT=y(()=>{Z(),f_(),p_(),qT(),hc=class extends oc{constructor(){super({createUboElements:VT,generateUboSync:YT})}},hc.extension={type:[k.WebGPUSystem],name:"ubo"}}),Zo,uc=y(()=>{Xt(),er(),Zo=class extends Tt{constructor({buffer:t,offset:e,size:r}){super(),this.uid=dt("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=dt("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=dt("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null,this.removeAllListeners()}}}),x_,ZT=y(()=>{"use strict";x_=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,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r{Z(),kn(),uc(),ln(),ZT(),Pn(),Ki=128,cc=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._batchBuffer=new x_({minUniformOffsetAlignment:Ki});let e=256/Ki;for(let r=0;r{It(),ts()}),Zi,T_=y(()=>{Kn(),Zi=[],Zi[sr.NONE]=void 0,Zi[sr.DISABLED]={stencilWriteMask:0,stencilReadMask:0},Zi[sr.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},Zi[sr.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},Zi[sr.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},Zi[sr.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}}});function eS(t,e,r,i,n){return t<<24|e<<16|r<<10|i<<5|n}function tS(t,e,r,i,n){return r<<8|t<<5|i<<3|n<<1|e}var S_,dc,rS=y(()=>{Z(),It(),w_(),Kn(),Ka(),T_(),S_={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4},dc=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._colorTargetCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(sr.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._colorTargetCount=t.colorTargetCount,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Zi[t],this._updatePipeHash())}setPipeline(t,e,r,i){let n=this.getPipeline(t,e,r);i.setPipeline(n)}getPipeline(t,e,r,i){t._layoutKey||(b_(t,e.attributeData),this._generateBufferKey(t)),i||(i=t.topology);let n=eS(t._layoutKey,e._layoutKey,r.data,r._blendModeId,S_[i]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(t,e,r,i),this._pipeCache[n])}_createPipeline(t,e,r,i){let n=this._gpu.device,s=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r,this._colorTargetCount),o=this._stencilMode===sr.RENDERING_MASK_ADD?0:this._colorMask;for(let c=0;c{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&&it(`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&&i.push(s)}),this._bufferLayoutsCache[r]=i,i}_updatePipeHash(){let t=tS(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment,this._colorTargetCount);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}},dc.extension={type:[k.WebGPUSystem],name:"pipeline"}});function iS(t,e,r,i,n,s){let a=s?1:-1;return t.identity(),t.a=1/i*2,t.d=a*(1/n*2),t.tx=-1-e*t.a,t.ty=-a-r*t.d,t}var nS=y(()=>{"use strict"});function sS(t){let e=t.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}var aS=y(()=>{"use strict"}),fc,E_=y(()=>{et(),nr(),sa(),nS(),Rm(),Bs(),lt(),Kt(),h_(),aS(),o_(),fc=class{constructor(t){this.rootViewPort=new Wt,this.viewport=new Wt,this.onRenderTargetChange=new Pu("onRenderTargetChange"),this.projectionMatrix=new me,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:i}){this._renderTargetStack.length=0,this.push(t,e,r,i),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=sS(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,i){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,u=o.pixelWidth,c=o.pixelHeight;if(!i&&t instanceof He&&(i=t.frame),i){let f=o._resolution;l.x=i.x*f+.5|0,l.y=i.y*f+.5|0,l.width=i.width*f+.5|0,l.height=i.height*f+.5|0}else l.x=0,l.y=0,l.width=u,l.height=c;return iS(this.projectionMatrix,0,0,l.width/o.resolution,l.height/o.resolution,!n.isRoot),this.adaptor.startRenderPass(n,e,r,l),s&&this.onRenderTargetChange.emit(n),n}clear(t,e=qr.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=qr.ALL,r,i){let n=this.bind(t,e,r,i);return this._renderTargetStack.push({renderTarget:n,frame:i}),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,r,i,n){r.x<0&&(i.width+=r.x,n.x-=r.x,r.x=0),r.y<0&&(i.height+=r.y,n.y-=r.y,r.y=0);let{pixelWidth:s,pixelHeight:a}=t;return i.width=Math.min(i.width,s-r.x),i.height=Math.min(i.height,a-r.y),this.adaptor.copyToTexture(t,e,r,i,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 ki.test(t)&&(t=l_(t).source),t instanceof Yo?e=t:t instanceof Ze&&(e=new Yo({colorTextures:[t]}),t.source instanceof ki&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}}),C_,oS=y(()=>{"use strict";C_=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}}),A_,lS=y(()=>{sa(),Bs(),lt(),oS(),A_=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,i,n){let s=this._renderer,a=this._getGpuColorTexture(t),o=s.texture.getGpuSource(e.source);return s.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:o,origin:n},i),e}startRenderPass(t,e=!0,r,i){let n=this._renderTargetSystem.getGpuRenderTarget(t),s=this.getDescriptor(t,e,r);n.descriptor=s,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(i)}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,r){typeof e=="boolean"&&(e=e?qr.ALL:qr.NONE);let i=this._renderTargetSystem,n=i.getGpuRenderTarget(t),s=t.colorTextures.map((o,l)=>{let u=n.contexts[l],c,f;u?c=u.getCurrentTexture().createView():c=this._renderer.texture.getGpuSource(o).createView({mipLevelCount:1}),n.msaaTextures[l]&&(f=c,c=this._renderer.texture.getTextureView(n.msaaTextures[l]));let _=e&qr.COLOR?"clear":"load";return r??(r=i.defaultClearColor),{view:c,resolveTarget:f,clearValue:r,storeOp:"store",loadOp:_}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=n.msaa?4:1),t.depthStencilTexture){let o=e&qr.STENCIL?"clear":"load",l=e&qr.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,r,i){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,r),u=o.beginRenderPass(l);u.setViewport(i.x,i.y,i.width,i.height,0,1),u.end();let c=o.finish();a.queue.submit([c])}else this.startRenderPass(t,e,r,i)}initGpuRenderTarget(t){t.isRoot=!0;let e=new C_;return e.colorTargetCount=t.colorTextures.length,t.colorTextures.forEach((r,i)=>{if(r instanceof ki){let n=r.resource.getContext("webgpu"),s=r.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[i]=n}if(e.msaa=r.source.antialias,r.source.antialias){let n=new Ze({width:0,height:0,sampleCount:4});e.msaaTextures[i]=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((r,i)=>{e.msaaTextures[i]?.resize(r.source.width,r.source.height,r.source._resolution)})}}}),pc,hS=y(()=>{Z(),E_(),lS(),pc=class extends fc{constructor(t){super(t),this.adaptor=new A_,this.adaptor.init(t,this)}},pc.extension={type:[k.WebGPUSystem],name:"renderTarget"}}),gc,uS=y(()=>{Z(),gc=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,r=t.gpuLayout.map(n=>e.createBindGroupLayout({entries:n})),i={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(i)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}},gc.extension={type:[k.WebGPUSystem],name:"shader"}}),Ur,cS=y(()=>{"use strict";Ur={},Ur.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},Ur.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},Ur.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},Ur.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},Ur.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},Ur.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},Ur["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},Ur["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},Ur["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},Ur.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},Ur.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},Ur.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}}),mc,dS=y(()=>{Z(),Gi(),cS(),mc=class{constructor(){this.defaultState=new di,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t,e){let r=Ur[t.blendMode]||Ur.normal,i=[],n={format:"bgra8unorm",writeMask:0,blend:r};for(let s=0;s{"use strict";P_={type:"image",upload(t,e,r){let i=t.resource,n=(t.pixelWidth|0)*(t.pixelHeight|0),s=i.byteLength/n;r.device.queue.writeTexture({texture:e},i,{offset:0,rowsPerImage:t.pixelHeight,bytesPerRow:t.pixelWidth*s},{width:t.pixelWidth,height:t.pixelHeight,depthOrArrayLayers:1})}}}),_c,M_,R_,pS=y(()=>{"use strict";_c={"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}},M_={blockBytes:4,blockWidth:1,blockHeight:1},R_={type:"compressed",upload(t,e,r){let i=t.pixelWidth,n=t.pixelHeight,s=_c[t.format]||M_;for(let a=0;a>1,1),n=Math.max(n>>1,1)}}}}),vc,k_=y(()=>{rr(),It(),vc={type:"image",upload(t,e,r){let i=t.resource;if(!i)return;if(globalThis.HTMLImageElement&&i instanceof HTMLImageElement){let o=Ht.get().createCanvas(i.width,i.height);o.getContext("2d").drawImage(i,0,0,i.width,i.height),t.resource=o,it("ImageSource: Image element passed, converting to canvas and replacing resource.")}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";r.device.queue.copyExternalImageToTexture({source:i},{texture:e,premultipliedAlpha:a},{width:n,height:s})}}}),B_,gS=y(()=>{k_(),B_={type:"video",upload(t,e,r){vc.upload(t,e,r)}}}),O_,mS=y(()=>{"use strict";O_=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 pos : array, 3> = array, 3>( vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0)); struct VertexOutput { @builtin(position) position : vec4, @location(0) texCoord : vec2, }; @vertex fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { var output : VertexOutput; output.texCoord = pos[vertexIndex] * vec2(0.5, -0.5) + vec2(0.5); output.position = vec4(pos[vertexIndex], 0.0, 1.0); return output; } @group(0) @binding(0) var imgSampler : sampler; @group(0) @binding(1) var img : texture_2d; @fragment fn fragmentMain(@location(0) texCoord : vec2) -> @location(0) vec4 { 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 r=t,i=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:i},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(o)}let s=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let o=0;o{rr(),Z(),ti(),Xr(),Js(),Pn(),fS(),pS(),k_(),gS(),mS(),I_=class{constructor(t){this.textureView=null,this.gpuTexture=t}destroy(){this.gpuTexture.destroy(),this.textureView=null,this.gpuTexture=null}},yc=class{constructor(t){this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._uploads={image:vc,buffer:P_,video:B_,compressed:R_},this._renderer=t,t.renderableGC.addManagedHash(this,"_bindGroupHash"),this._managedTextures=new Yr({renderer:t,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"gpuTextureSource"})}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(t){this._gpu=t}initSource(t){return t._gpuData[this._renderer.uid]?.gpuTexture||this._initSource(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 r=_c[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},i=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,n=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,s={label:t.label,size:{width:i,height:n},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(s);return t._gpuData[this._renderer.uid]=new I_(a),this._managedTextures.add(t)&&(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("updateMipmaps",this.onUpdateMipmaps,this)),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))}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new O_(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceUnload(t){t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this)}onSourceResize(t){t._gcLastUsed=this._renderer.gc.now;let e=t._gpuData[this._renderer.uid],r=e?.gpuTexture;r?(r.width!==t.pixelWidth||r.height!==t.pixelHeight)&&(e.destroy(),this._bindGroupHash[t.uid]=null,t._gpuData[this._renderer.uid]=null,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 t._gcLastUsed=this._renderer.gc.now,t._gpuData[this._renderer.uid]?.gpuTexture||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 Bi({0:e,1:e.style,2:new Gr({uTextureMatrix:{type:"mat3x3",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;e._gcLastUsed=this._renderer.gc.now;let r=e._gpuData[this._renderer.uid],i=null;return r||(this.initSource(e),r=e._gpuData[this._renderer.uid]),i=r.textureView||r.gpuTexture.createView(),i}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),i=Ht.get().createCanvas();i.width=t.source.pixelWidth,i.height=t.source.pixelHeight;let n=i.getContext("webgpu");return n.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:Ht.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:i.width,height:i.height}),e.gpu.device.queue.submit([r.finish()]),i}getPixels(t){let e=this.generateCanvas(t),r=Fi.getOptimalCanvasAndContext(e.width,e.height),i=r.context;i.drawImage(e,0,0);let{width:n,height:s}=e,a=i.getImageData(0,0,n,s),o=new Uint8ClampedArray(a.data.buffer);return Fi.returnCanvasAndContext(r),{pixels:o,width:n,height:s}}destroy(){this._managedTextures.destroy();for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}},yc.extension={type:[k.WebGPUSystem],name:"texture"}}),G_={};$t(G_,{WebGPURenderer:()=>L_});var F_,D_,U_,xc,bc,wc,L_,vS=y(()=>{Z(),rT(),iT(),nT(),Lo(),c_(),qi(),UT(),LT(),NT(),zT(),HT(),jT(),WT(),KT(),QT(),rS(),hS(),uS(),dS(),_S(),F_=[...Ju,hc,nc,Ko,sc,rc,yc,pc,gc,mc,dc,ic,ac,tc],D_=[...ec,cc],U_=[Bu,ku,Ru],xc=[],bc=[],wc=[],Se.handleByNamedList(k.WebGPUSystem,xc),Se.handleByNamedList(k.WebGPUPipes,bc),Se.handleByNamedList(k.WebGPUPipesAdaptor,wc),Se.add(...F_,...D_,...U_),L_=class extends aa{constructor(){let t={name:"webgpu",type:ci.WEBGPU,systems:xc,renderPipes:bc,renderPipeAdaptors:wc};super(t)}}}),Tc,yS=y(()=>{Z(),et(),In(),ro(),so(),ra(),Gn(),Ah(),Oi(),Xr(),Tc=class{contextChange(t){let e=new Gr({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new me,type:"mat3x3"},uRound:{value:0,type:"f32"}}),r=t.limits.maxBatchableTextures,i=Ls({name:"graphics",bits:[to,wh(r),Do,as]});this.shader=new _i({glProgram:i,resources:{localUniforms:e,batchSamplers:Eh(r)}})}execute(t,e){let r=e.context,i=r.customShader||this.shader,n=t.renderer,s=n.graphicsContext,{batcher:a,instructions:o}=s.getContextRenderData(r);i.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(i),n.geometry.bind(a.geometry,i.glProgram);let l=o.instructions;for(let u=0;u{Z(),et(),In(),ra(),Gn(),Im(),Oi(),Kt(),It(),Sc=class{init(){let t=Ls({name:"mesh",bits:[Do,Om,as]});this._shader=new _i({glProgram:t,resources:{uTexture:He.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new me}}}})}execute(t,e){let r=t.renderer,i=e._shader;if(i){if(!i.glProgram){it("Mesh shader has no glProgram",e.shader);return}}else{i=this._shader;let n=e.texture,s=n.source;i.resources.uTexture=s,i.resources.uSampler=s.style,i.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}i.groups[100]=r.globalUniforms.bindGroup,i.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}},Sc.extension={type:[k.WebGLPipesAdaptor],name:"mesh"}}),Ec,bS=y(()=>{Z(),Gi(),Ec=class{constructor(){this._tempState=di.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let i=t.renderer,n=this._didUploadHash[r.uid];i.shader.bind(r,n),n||(this._didUploadHash[r.uid]=!0),i.shader.updateUniformGroup(i.globalUniforms.uniformGroup),i.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let i=e.textures.textures;for(let n=0;n{"use strict";ua=(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))(ua||{})}),N_,TS=y(()=>{"use strict";N_=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}}),Cc,SS=y(()=>{Z(),ti(),ln(),wS(),TS(),Cc=class{constructor(t){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._managedBuffers=new Yr({renderer:t,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(t){return t._gcLastUsed=this._renderer.gc.now,t._gpuData[this._renderer.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let r=0,i=this._nextBindBaseIndex;for(;r<2;){i>=this._maxBindings&&(i=this._minBaseLocation,r++);let n=this._boundBufferBases[i];if(n&&n._lastBindCallId===this._bindCallId){i++;continue}break}return e=i,this._nextBindBaseIndex=i+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,i){let{_gl:n}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,n.bindBufferRange(n.UNIFORM_BUFFER,e||0,t.buffer,r*256,i||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let i=t.data,n=t.descriptor.usage&bt.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return i?r.byteLength>=i.byteLength?e.bufferSubData(r.type,0,i,0,t._updateSize/i.BYTES_PER_ELEMENT):(r.byteLength=i.byteLength,e.bufferData(r.type,i,n)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,n)),r}destroyAll(t=!1){this._managedBuffers.removeAll(t)}onBufferUnload(t,e=!1){let r=t._gpuData[this._renderer.uid];r&&(e||this._gl.deleteBuffer(r.buffer))}createGLBuffer(t){let{_gl:e}=this,r=ua.ARRAY_BUFFER;t.descriptor.usage&bt.INDEX?r=ua.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&bt.UNIFORM&&(r=ua.UNIFORM_BUFFER);let i=new N_(e.createBuffer(),r);return t._gpuData[this._renderer.uid]=i,this._managedBuffers.add(t),i}resetState(){this._boundBufferBases=Object.create(null)}},Cc.extension={type:[k.WebGLSystem],name:"buffer"}}),Qo,z_,ES=y(()=>{rr(),Z(),It(),Qo=class _x{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={..._x.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(it("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=Ht.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{let i=this._renderer.background.alpha<1,n=e.premultipliedAlpha??!0,s=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:i,premultipliedAlpha:n,antialias:s,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&it("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:r}=this;(r.width{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),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 r=e.getContextAttributes();r&&!r.stencil&&it("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,n=this.webGLVersion===2,s=this.extensions;i.uint32Indices=n||!!s.uint32ElementIndex,i.uniformBufferObject=n,i.vertexArrayObject=n||!!s.vertexArrayObject,i.srgbTextures=n||!!s.srgb,i.nonPowOf2wrapping=n,i.nonPowOf2mipmaps=n,i.msaa=n,i.uint32Indices||it("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}},Qo.extension={type:[k.WebGLSystem],name:"context"},Qo.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1},z_=Qo}),Jo,Ac,At,H_=y(()=>{"use strict";Jo=(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))(Jo||{}),Ac=(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))(Ac||{}),At=(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))(At||{})});function CS(t){return Pc[t]??Pc.float32}var Pc,AS=y(()=>{H_(),Pc={uint8x2:At.UNSIGNED_BYTE,uint8x4:At.UNSIGNED_BYTE,sint8x2:At.BYTE,sint8x4:At.BYTE,unorm8x2:At.UNSIGNED_BYTE,unorm8x4:At.UNSIGNED_BYTE,snorm8x2:At.BYTE,snorm8x4:At.BYTE,uint16x2:At.UNSIGNED_SHORT,uint16x4:At.UNSIGNED_SHORT,sint16x2:At.SHORT,sint16x4:At.SHORT,unorm16x2:At.UNSIGNED_SHORT,unorm16x4:At.UNSIGNED_SHORT,snorm16x2:At.SHORT,snorm16x4:At.SHORT,float16x2:At.HALF_FLOAT,float16x4:At.HALF_FLOAT,float32:At.FLOAT,float32x2:At.FLOAT,float32x3:At.FLOAT,float32x4:At.FLOAT,uint32:At.UNSIGNED_INT,uint32x2:At.UNSIGNED_INT,uint32x3:At.UNSIGNED_INT,uint32x4:At.UNSIGNED_INT,sint32:At.INT,sint32x2:At.INT,sint32x3:At.INT,sint32x4:At.INT}}),j_,W_,Mc,PS=y(()=>{Z(),ti(),ts(),w_(),AS(),j_={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},W_=class{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}},Mc=class{constructor(t){this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new Yr({renderer:t,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}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");this.destroyAll(!0);let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=i=>e.bindVertexArrayOES(i),t.deleteVertexArray=i=>e.deleteVertexArrayOES(i));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(i,n,s,a)=>{r.drawArraysInstancedANGLE(i,n,s,a)},t.drawElementsInstanced=(i,n,s,a,o)=>{r.drawElementsInstancedANGLE(i,n,s,a,o)},t.vertexAttribDivisor=(i,n)=>r.vertexAttribDivisorANGLE(i,n)),this._activeGeometry=null,this._activeVao=null}bind(t,e){let r=this.gl;this._activeGeometry=t;let i=this.getVao(t,e);this._activeVao!==i&&(this._activeVao=i,r.bindVertexArray(i)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r{Z(),It(),Fs(),Oi(),Gi(),lt(),Kt(),Bn(),V_=new Jn({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),el=class vx{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){let{useBackBuffer:r,antialias:i}={...vx.defaultOptions,...e};this.useBackBuffer=r,this._antialias=i,this._renderer.context.supports.msaa||(it("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=di.for2d();let n=new hn({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 _i({glProgram:n,resources:{uTexture:He.WHITE.source}})}renderStart(e){let r=this._renderer.renderTarget.getRenderTarget(e.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!r.isRoot,this._useBackBufferThisRender){let i=this._renderer.renderTarget.getRenderTarget(e.target);this._targetTexture=i.colorTexture,e.target=this._getBackBufferTexture(i.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:V_,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(e){return this._backBufferTexture=this._backBufferTexture||new He({source:new Ze({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)}},el.extension={type:[k.WebGLSystem],name:"backBuffer",priority:1},el.defaultOptions={useBackBuffer:!1},$_=el}),Rc,RS=y(()=>{Z(),Rc=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)))}},Rc.extension={type:[k.WebGLSystem],name:"colorMask"}}),kc,kS=y(()=>{Z(),kc=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:r,shader:i,state:n,skipSync:s,topology:a,size:o,start:l,instanceCount:u}=t;e.shader.bind(i,s),e.geometry.bind(r,e.shader._activeProgram),n&&e.state.set(n),e.geometry.draw(a,o,l,u??r.instanceCount)}destroy(){this._renderer=null}},kc.extension={type:[k.WebGLSystem],name:"encoder"}}),Bc,BS=y(()=>{Z(),Gf(),Bc=class{constructor(t){this._renderer=t}contextChange(){let t=this._renderer.gl;this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxBatchableTextures=Of(this.maxTextures,t);let e=this._renderer.context.webGLVersion===2;this.maxUniformBindings=e?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}destroy(){}},Bc.extension={type:[k.WebGLSystem],name:"limits"}}),Oc,OS=y(()=>{Z(),T_(),Kn(),Oc=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:sr.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.resetState()}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:sr.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=sr.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],i=this._gl,n=Zi[t],s=this._stencilCache;if(r.stencilMode=t,r.stencilReference=e,t===sr.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,i.disable(i.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,i.enable(i.STENCIL_TEST)),(t!==s.stencilMode||s.stencilReference!==e)&&(s.stencilMode=t,s.stencilReference=e,i.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],e,255),i.stencilOp(i.KEEP,i.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}},Oc.extension={type:[k.WebGLSystem],name:"stencil"}});function IS(t){let e=t.map(s=>({data:s,offset:0,size:0})),r=16,i=0,n=0;for(let s=0;s1&&(i=Math.max(i,r)*a.data.size);let o=i===12?16:i;a.size=i;let l=n%r;l>0&&r-l{"use strict";Ic={f32:4,i32:4,"vec2":8,"vec3":12,"vec4":16,"vec2":8,"vec3":12,"vec4":16,"mat2x2":32,"mat3x3":48,"mat4x4":64}});function GS(t,e){let r=Math.max(Ic[t.data.type]/16,1),i=t.data.value.length/t.data.size,n=(4-i%4)%4,s=t.data.type.indexOf("i32")>=0?"dataInt32":"data";return` v = uv.${t.data.name}; offset += ${e}; arrayOffset = offset; t = 0; for(var i=0; i < ${t.data.size*r}; i++) { for(var j = 0; j < ${i}; j++) { ${s}[arrayOffset++] = v[t++]; } ${n!==0?`arrayOffset += ${n};`:""} } `}var FS=y(()=>{X_()});function DS(t){return m_(t,"uboStd40",GS,lc)}var US=y(()=>{__(),y_(),FS()}),Gc,LS=y(()=>{Z(),f_(),X_(),US(),Gc=class extends oc{constructor(){super({createUboElements:IS,generateUboSync:DS})}},Gc.extension={type:[k.WebGLSystem],name:"ubo"}}),Y_,NS=y(()=>{"use strict";Y_=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}}),q_,zS=y(()=>{nr(),It(),Bs(),sa(),NS(),q_=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new Wt}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new Wt;let t=this._renderer.gl;this._drawBuffersCache=[];for(let e=1;e<=16;e++)this._drawBuffersCache[e]=Array.from({length:e},(r,i)=>t.COLOR_ATTACHMENT0+i)}copyToTexture(t,e,r,i,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,r.x,r.y,i.width,i.height),e}startRenderPass(t,e=!0,r,i){let n=this._renderTargetSystem,s=t.colorTexture,a=n.getGpuRenderTarget(t),o=i.y;t.isRoot&&(o=s.pixelHeight-i.height-i.y),t.colorTextures.forEach(c=>{this._renderer.texture.unbind(c)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer),t.colorTextures.length>1&&this._setDrawBuffers(t,l);let u=this._viewPortCache;(u.x!==i.x||u.y!==o||u.width!==i.width||u.height!==i.height)&&(u.x=i.x,u.y=o,u.width=i.width,u.height=i.height,l.viewport(i.x,o,i.width,i.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,r)}finishRenderPass(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);if(!e.msaa)return;let r=this._renderer.gl;r.bindFramebuffer(r.FRAMEBUFFER,e.resolveTargetFramebuffer),r.bindFramebuffer(r.READ_FRAMEBUFFER,e.framebuffer),r.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,r.COLOR_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,e.framebuffer)}initGpuRenderTarget(t){let e=this._renderer.gl,r=new Y_;return t.colorTexture instanceof ki?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),r.framebuffer=null,r):(this._initColor(t,r),e.bindFramebuffer(e.FRAMEBUFFER,null),r)}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(r=>{e.deleteRenderbuffer(r)}),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;let i=this._renderTargetSystem;typeof e=="boolean"&&(e=e?qr.ALL:qr.NONE);let n=this._renderer.gl;if(e&qr.COLOR){r??(r=i.defaultClearColor);let s=this._clearColorCache,a=r;(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 r=this._renderer,i=r.gl,n=i.createFramebuffer();if(e.resolveTargetFramebuffer=n,i.bindFramebuffer(i.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&&(r.context.supports.msaa?e.msaa=!0:it("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(o,0);let l=r.texture.getGlSource(o).texture;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+a,3553,l,0)}),e.msaa){let s=i.createFramebuffer();e.framebuffer=s,i.bindFramebuffer(i.FRAMEBUFFER,s),t.colorTextures.forEach((a,o)=>{let l=i.createRenderbuffer();e.msaaRenderBuffer[o]=l})}else e.framebuffer=n;this._resizeColor(t,e)}_resizeColor(t,e){let r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach((i,n)=>{n!==0&&i.source.resize(r.width,r.height,r._resolution)}),e.msaa){let i=this._renderer,n=i.gl,s=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,s),t.colorTextures.forEach((a,o)=>{let l=a.source;i.texture.bindSource(l,0);let u=i.texture.getGlSource(l).internalFormat,c=e.msaaRenderBuffer[o];n.bindRenderbuffer(n.RENDERBUFFER,c),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,u,l.pixelWidth,l.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,n.RENDERBUFFER,c)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),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)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&ki.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&ki.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}_setDrawBuffers(t,e){let r=t.colorTextures.length,i=this._drawBuffersCache[r];if(this._renderer.context.webGLVersion===1){let n=this._renderer.context.extensions.drawBuffers;n?n.drawBuffersWEBGL(i):it("[RenderTexture] This WebGL1 context does not support rendering to multiple targets")}else e.drawBuffers(i)}}}),Fc,HS=y(()=>{Z(),E_(),zS(),Fc=class extends fc{constructor(t){super(t),this.adaptor=new q_,this.adaptor.init(t,this)}},Fc.extension={type:[k.WebGLSystem],name:"renderTarget"}});function jS(t,e){let r=[],i=[` var g = s.groups; var sS = r.shader; var p = s.glProgram; var ugS = r.uniformGroup; var resources; `],n=!1,s=0,a=e._getProgramData(t.glProgram);for(let l in t.groups){let u=t.groups[l];r.push(` resources = g[${l}].resources; `);for(let c in u.resources){let f=u.resources[c];if(f instanceof Gr)if(f.ubo){let _=t._uniformBindMap[l][Number(c)];r.push(` sS.bindUniformBlock( resources[${c}], '${_}', ${t.glProgram._uniformBlockData[_].index} ); `)}else r.push(` ugS.updateUniformGroup(resources[${c}], p, sD); `);else if(f instanceof Zo){let _=t._uniformBindMap[l][Number(c)];r.push(` sS.bindUniformBlock( resources[${c}], '${_}', ${t.glProgram._uniformBlockData[_].index} ); `)}else if(f instanceof Ze){let _=t._uniformBindMap[l][c],g=a.uniformData[_];g&&(n||(n=!0,i.push(` var tS = r.texture; `)),e._gl.uniform1i(g.location,s),r.push(` tS.bind(resources[${c}], ${s}); `),s++)}}}let o=[...i,...r].join(` `);return new Function("r","s","sD",o)}var WS=y(()=>{uc(),Xr(),lt()}),K_,VS=y(()=>{"use strict";K_=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 Z_(t,e,r){let i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),i}var $S=y(()=>{"use strict"});function Dc(t){let e=new Array(t);for(let r=0;r{"use strict"});function ev(t,e){if(!ca){let r=Object.keys(Uc);ca={};for(let i=0;i{"use strict";ca=null,Uc={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"},tv={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 YS(t,e,r=!1){let i={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let a=0;aa>o?1:-1);for(let a=0;a{ts(),rv()});function KS(t,e){if(!e.ACTIVE_UNIFORM_BLOCKS)return{};let r={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORM_BLOCKS);for(let n=0;n{"use strict"});function QS(t,e){let r={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n{J_(),rv()});function iv(t,e){let r=t.getShaderSource(e).split(` `).map((u,c)=>`${c}: ${u}`),i=t.getShaderInfoLog(e),n=i.split(` `),s={},a=n.map(u=>parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(u=>u&&!s[u]?(s[u]=!0,!0):!1),o=[""];a.forEach(u=>{r[u-1]=`%c${r[u-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=r.join(` `);o[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function e2(t,e,r,i){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||iv(t,r),t.getShaderParameter(i,t.COMPILE_STATUS)||iv(t,i),console.error("PixiJS Error: Could not initialize shader."),t.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}var t2=y(()=>{"use strict"});function r2(t,e){let r=Z_(t,t.VERTEX_SHADER,e.vertex),i=Z_(t,t.FRAGMENT_SHADER,e.fragment),n=t.createProgram();t.attachShader(n,r),t.attachShader(n,i);let s=e.transformFeedbackVaryings;s&&(typeof t.transformFeedbackVaryings!="function"?it("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)||e2(t,n,r,i),e._attributeData=YS(n,t,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)),e._uniformData=QS(n,t),e._uniformBlockData=KS(n,t),t.deleteShader(r),t.deleteShader(i);let a={};for(let o in e._uniformData){let l=e._uniformData[o];a[o]={location:t.getUniformLocation(n,o),value:Q_(l.type,l.size)}}return new K_(n,a)}var i2=y(()=>{It(),VS(),$S(),J_(),qS(),ZS(),JS(),t2()}),da,Lc,n2=y(()=>{Z(),WS(),i2(),da={textureCount:0,blockIndex:0},Lc=class{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null}bind(t,e){if(this._setProgram(t.glProgram),e)return;da.textureCount=0,da.blockIndex=0;let r=this._shaderSyncFunctions[t.glProgram._key];r||(r=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),r(this._renderer,t,da)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,da)}bindUniformBlock(t,e,r=0){let i=this._renderer.buffer,n=this._getProgramData(this._activeProgram),s=t._bufferResource;s||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,o=i.updateBuffer(a),l=i.freeLocationForBufferBase(o);if(s){let{offset:c,size:f}=t;c===0&&f===a.data.byteLength?i.bindBufferBase(o,l):i.bindBufferRange(o,l,c)}else i.getLastBindBaseLocation(o)!==l&&i.bindBufferBase(o,l);let u=this._activeProgram._uniformBlockData[e].index;n.uniformBlockBindings[r]!==l&&(n.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(n.program,u,l))}_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]=r2(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy();this._programDataHash=null,this._shaderSyncFunctions=null,this._activeProgram=null,this._renderer=null,this._gl=null}_generateShaderSync(t,e){return jS(t,e)}resetState(){this._activeProgram=null}},Lc.extension={type:[k.WebGLSystem],name:"shader"}}),nv,sv,s2=y(()=>{"use strict";nv={f32:`if (cv !== v) { cu.value = v; gl.uniform1f(location, v); }`,"vec2":`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":`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":`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":`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":`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":`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":`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":`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":`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":`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":`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":`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":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);"},sv={f32:"gl.uniform1fv(location, v);","vec2":"gl.uniform2fv(location, v);","vec3":"gl.uniform3fv(location, v);","vec4":"gl.uniform4fv(location, v);","mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);"}});function a2(t,e){let r=[` var v = null; var cv = null; var cu = null; var t = 0; var gl = renderer.gl; var name = null; `];for(let i in t.uniforms){if(!e[i]){t.uniforms[i]instanceof Gr?t.uniforms[i].ubo?r.push(` renderer.shader.bindUniformBlock(uv.${i}, "${i}"); `):r.push(` renderer.shader.updateUniformGroup(uv.${i}); `):t.uniforms[i]instanceof Zo&&r.push(` renderer.shader.bindBufferResource(uv.${i}, "${i}"); `);continue}let n=t.uniformStructures[i],s=!1;for(let a=0;a{uc(),Xr(),g_(),s2()}),Nc,l2=y(()=>{Z(),o2(),Nc=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let i=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==i.uniformDirtyGroups[t.uid])&&(i.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(i.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),i=this._getSignature(t,e._uniformData,"u");return this._cache[i]||(this._cache[i]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[i],r[e._key]}_generateUniformsSync(t,e){return a2(t,e)}_getSignature(t,e,r){let i=t.uniforms,n=[`${r}-`];for(let s in i)n.push(s),e[s]&&n.push(e[s].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}},Nc.extension={type:[k.WebGLSystem],name:"uniformGroup"}});function h2(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 Ht.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 r=t.getExtension("EXT_blend_minmax");r&&(e.min=[t.ONE,t.ONE,t.ONE,t.ONE,r.MIN_EXT,r.MIN_EXT],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,r.MAX_EXT,r.MAX_EXT])}return e}var u2=y(()=>{rr()}),av,ov,lv,hv,uv,cv,zc,dv,c2=y(()=>{Z(),Gi(),u2(),av=0,ov=1,lv=2,hv=3,uv=4,cv=5,zc=class Md{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[av]=this.setBlend,this.map[ov]=this.setOffset,this.map[lv]=this.setCullFace,this.map[hv]=this.setDepthTest,this.map[uv]=this.setFrontFace,this.map[cv]=this.setDepthMask,this.checks=[],this.defaultState=di.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=h2(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let r=this.stateId^e.data,i=0;for(;r;)r&1&&this.map[i].call(this,!!(e.data&1<>=1,i++;this.stateId=e.data}for(let r=0;r{H_(),fv=class{constructor(t){this.target=Ac.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=At.UNSIGNED_BYTE,this.internalFormat=Jo.RGBA,this.format=Jo.RGBA,this.samplerType=0}destroy(){}}}),pv,f2=y(()=>{"use strict";pv={id:"buffer",upload(t,e,r){e.width===t.width||e.height===t.height?r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.width,t.height,e.format,e.type,t.resource):r.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}}}),gv,mv,p2=y(()=>{"use strict";gv={"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},mv={id:"compressed",upload(t,e,r){r.pixelStorei(r.UNPACK_ALIGNMENT,4);let i=t.pixelWidth,n=t.pixelHeight,s=!!gv[t.format];for(let a=0;a>1,1),n=Math.max(n>>1,1)}}}}),Hc,_v=y(()=>{"use strict";Hc={id:"image",upload(t,e,r,i){let n=e.width,s=e.height,a=t.pixelWidth,o=t.pixelHeight,l=t.resourceWidth,u=t.resourceHeight;l{_v(),vv={id:"video",upload(t,e,r,i){if(!t.isValid){r.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null);return}Hc.upload(t,e,r,i)}}}),jc,yv,tl,xv,m2=y(()=>{"use strict";jc={linear:9729,nearest:9728},yv={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},tl={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},xv={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function bv(t,e,r,i,n,s,a,o){let l=s;if(!o||t.addressModeU!=="repeat"||t.addressModeV!=="repeat"||t.addressModeW!=="repeat"){let u=tl[a?"clamp-to-edge":t.addressModeU],c=tl[a?"clamp-to-edge":t.addressModeV],f=tl[a?"clamp-to-edge":t.addressModeW];e[n](l,e.TEXTURE_WRAP_S,u),e[n](l,e.TEXTURE_WRAP_T,c),e.TEXTURE_WRAP_R&&e[n](l,e.TEXTURE_WRAP_R,f)}if((!o||t.magFilter!=="linear")&&e[n](l,e.TEXTURE_MAG_FILTER,jc[t.magFilter]),r){if(!o||t.mipmapFilter!=="linear"){let u=yv[t.minFilter][t.mipmapFilter];e[n](l,e.TEXTURE_MIN_FILTER,u)}}else e[n](l,e.TEXTURE_MIN_FILTER,jc[t.minFilter]);if(i&&t.maxAnisotropy>1){let u=Math.min(t.maxAnisotropy,e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[n](l,i.TEXTURE_MAX_ANISOTROPY_EXT,u)}t.compare&&e[n](l,e.TEXTURE_COMPARE_FUNC,xv[t.compare])}var _2=y(()=>{m2()});function v2(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 y2=y(()=>{"use strict"});function x2(t,e){let r={},i=t.RGBA;return t instanceof Ht.get().getWebGLRenderingContext()?e.srgb&&(r={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},i=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,...r,rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:i,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 b2=y(()=>{rr()});function w2(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 T2=y(()=>{"use strict"}),wv,Wc,S2=y(()=>{rr(),Z(),ti(),Kt(),d2(),f2(),p2(),_v(),g2(),_2(),y2(),b2(),T2(),wv=4,Wc=class{constructor(t){this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Hc,buffer:pv,video:vv,compressed:mv},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._managedTextures=new Yr({renderer:t,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"glTexture"})}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=x2(t,this._renderer.context.extensions),this._mapFormatToType=w2(t),this._mapFormatToFormat=v2(t)),this._managedTextures.removeAll(!0),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(He.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._gcLastUsed=this._renderer.gc.now,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=He.EMPTY.source);let i=this.getGlSource(t);r.bindTexture(i.target,i.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let i=this._getGlSampler(t);this._boundSamplers[e]!==i&&(this._boundSamplers[e]=i,r.bindSampler(e,i))}unbind(t){let e=t.source,r=this._boundTextures,i=this._gl;for(let n=0;n1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t,e=!1){let r=t._gpuData[this._renderer.uid];r&&(e||(this.unbind(t),this._gl.deleteTexture(r.texture)),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let i=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==i&&(this._premultiplyAlpha=i,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,r.internalFormat,t.pixelWidth,t.pixelHeight,0,r.format,r.type,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,bv(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return t._gcLastUsed=this._renderer.gc.now,t._gpuData[this._renderer.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:i}=this.getPixels(t),n=Ht.get().createCanvas();n.width=r,n.height=i;let s=n.getContext("2d");if(s){let a=s.createImageData(r,i);a.data.set(e),s.putImageData(a,0,0)}return n}getPixels(t){let e=t.source.resolution,r=t.frame,i=Math.max(Math.round(r.width*e),1),n=Math.max(Math.round(r.height*e),1),s=new Uint8Array(wv*i*n),a=this._renderer,o=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(o),u=a.gl;return u.bindFramebuffer(u.FRAMEBUFFER,l.resolveTargetFramebuffer),u.readPixels(Math.round(r.x*e),Math.round(r.y*e),i,n,u.RGBA,u.UNSIGNED_BYTE,s),{pixels:new Uint8ClampedArray(s.buffer),width:i,height:n}}destroy(){this._managedTextures.destroy(),this._glSamplers=null,this._boundTextures=null,this._boundSamplers=null,this._mapFormatToInternalFormat=null,this._mapFormatToType=null,this._mapFormatToFormat=null,this._uploads=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(He.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}},Wc.extension={type:[k.WebGLSystem],name:"texture"}}),Tv={};$t(Tv,{WebGLRenderer:()=>Av});var Sv,Ev,Cv,Vc,$c,Xc,Av,E2=y(()=>{Z(),yS(),xS(),bS(),Lo(),c_(),qi(),SS(),ES(),PS(),MS(),RS(),kS(),BS(),OS(),LS(),HS(),n2(),l2(),c2(),S2(),Sv=[...Ju,Gc,$_,z_,Bc,Cc,Wc,Fc,Mc,Nc,Lc,kc,dv,Oc,Rc],Ev=[...ec],Cv=[Ec,Sc,Tc],Vc=[],$c=[],Xc=[],Se.handleByNamedList(k.WebGLSystem,Vc),Se.handleByNamedList(k.WebGLPipes,$c),Se.handleByNamedList(k.WebGLPipesAdaptor,Xc),Se.add(...Sv,...Ev,...Cv),Av=class extends aa{constructor(){let t={name:"webgl",type:ci.WEBGL,systems:Vc,renderPipes:$c,renderPipeAdaptors:Xc};super(t)}}}),C2=Br((t,e)=>{"use strict";e.exports=i;function r(s){return s instanceof Buffer?Buffer.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function i(s){if(s=s||{},s.circles)return n(s);let a=new Map;if(a.set(Date,f=>new Date(f)),a.set(Map,(f,_)=>new Map(l(Array.from(f),_))),a.set(Set,(f,_)=>new Set(l(Array.from(f),_))),s.constructorHandlers)for(let f of s.constructorHandlers)a.set(f[0],f[1]);let o=null;return s.proto?c:u;function l(f,_){let g=Object.keys(f),b=new Array(g.length);for(let T=0;Tnew Date(g)),l.set(Map,(g,b)=>new Map(c(Array.from(g),b))),l.set(Set,(g,b)=>new Set(c(Array.from(g),b))),s.constructorHandlers)for(let g of s.constructorHandlers)l.set(g[0],g[1]);let u=null;return s.proto?_:f;function c(g,b){let T=Object.keys(g),x=new Array(T.length);for(let S=0;S{}};function Pv(){for(var t=0,e=arguments.length,r={},i;t=0&&(i=r.slice(n+1),r=r.slice(0,n)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}rl.prototype=Pv.prototype={constructor:rl,on:function(t,e){var r=this._,i=P2(t+"",r),n,s=-1,a=i.length;if(arguments.length<2){for(;++s0)for(var r=new Array(n),i=0,n,s;i=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),Rv.hasOwnProperty(e)?{space:Rv[e],local:t}:t}function R2(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Yc&&e.documentElement.namespaceURI===Yc?e.createElement(t):e.createElementNS(r,t)}}function k2(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function kv(t){var e=nl(t);return(e.local?k2:R2)(e)}function B2(){}function qc(t){return t==null?B2:function(){return this.querySelector(t)}}function O2(t){typeof t!="function"&&(t=qc(t));for(var e=this._groups,r=e.length,i=new Array(r),n=0;n=B&&(B=P+1);!(X=x[B])&&++B=0;)(a=i[n])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function nE(t){t||(t=sE);function e(f,_){return f&&_?t(f.__data__,_.__data__):!f-!_}for(var r=this._groups,i=r.length,n=new Array(i),s=0;se?1:t>=e?0:NaN}function aE(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function oE(){return Array.from(this)}function lE(){for(var t=this._groups,e=0,r=t.length;e1?this.each((e==null?yE:typeof e=="function"?bE:xE)(t,e,r??"")):gs(this.node(),t)}function gs(t,e){return t.style.getPropertyValue(e)||Fv(t).getComputedStyle(t,null).getPropertyValue(e)}function TE(t){return function(){delete this[t]}}function SE(t,e){return function(){this[t]=e}}function EE(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function CE(t,e){return arguments.length>1?this.each((e==null?TE:typeof e=="function"?EE:SE)(t,e)):this.node()[t]}function Dv(t){return t.trim().split(/^|\s+/)}function Kc(t){return t.classList||new Uv(t)}function Uv(t){this._node=t,this._names=Dv(t.getAttribute("class")||"")}Uv.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 Lv(t,e){for(var r=Kc(t),i=-1,n=e.length;++i=0&&(r=e.slice(i+1),e=e.slice(0,i)),{type:e,name:r}})}function eC(t){return function(){var e=this.__on;if(e){for(var r=0,i=-1,n=e.length,s;r()=>t;function Qc(t,{sourceEvent:e,subject:r,target:i,identifier:n,active:s,x:a,y:o,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,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:u,enumerable:!0,configurable:!0},_:{value:c}})}Qc.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function uC(t){return!t.ctrlKey&&!t.button}function cC(){return this.parentNode}function dC(t,e){return e??{x:t.x,y:t.y}}function fC(){return navigator.maxTouchPoints||"ontouchstart"in this}function pC(){var t=uC,e=cC,r=dC,i=fC,n={},s=il("start","drag","end"),a=0,o,l,u,c,f=0;function _(A){A.on("mousedown.drag",g).filter(i).on("touchstart.drag",x).on("touchmove.drag",S,hC).on("touchend.drag touchcancel.drag",P).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(A,X){if(!(c||!t.call(this,A,X))){var W=B(this,e.call(this,A,X),A,X,"mouse");W&&(vi(A.view).on("mousemove.drag",b,pa).on("mouseup.drag",T,pa),Wv(A.view),Zc(A),u=!1,o=A.clientX,l=A.clientY,W("start",A))}}function b(A){if(ms(A),!u){var X=A.clientX-o,W=A.clientY-l;u=X*X+W*W>f}n.mouse("drag",A)}function T(A){vi(A.view).on("mousemove.drag mouseup.drag",null),Vv(A.view,u),ms(A),n.mouse("end",A)}function x(A,X){if(t.call(this,A,X)){var W=A.changedTouches,q=e.call(this,A,X),ae=W.length,ce,ie;for(ce=0;ce>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?ll(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?ll(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=mC.exec(t))?new Kr(e[1],e[2],e[3],1):(e=_C.exec(t))?new Kr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=vC.exec(t))?ll(e[1],e[2],e[3],e[4]):(e=yC.exec(t))?ll(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=xC.exec(t))?Jv(e[1],e[2]/100,e[3]/100,1):(e=bC.exec(t))?Jv(e[1],e[2]/100,e[3]/100,e[4]):Xv.hasOwnProperty(t)?Kv(Xv[t]):t==="transparent"?new Kr(NaN,NaN,NaN,0):null}function Kv(t){return new Kr(t>>16&255,t>>8&255,t&255,1)}function ll(t,e,r,i){return i<=0&&(t=e=r=NaN),new Kr(t,e,r,i)}function SC(t){return t instanceof ga||(t=va(t)),t?(t=t.rgb(),new Kr(t.r,t.g,t.b,t.opacity)):new Kr}function hl(t,e,r,i){return arguments.length===1?SC(t):new Kr(t,e,r,i??1)}function Kr(t,e,r,i){this.r=+t,this.g=+e,this.b=+r,this.opacity=+i}Jc(Kr,hl,$v(ga,{brighter(t){return t=t==null?ol:Math.pow(ol,t),new Kr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ma:Math.pow(ma,t),new Kr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Kr(zn(this.r),zn(this.g),zn(this.b),ul(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:Zv,formatHex:Zv,formatHex8:EC,formatRgb:Qv,toString:Qv}));function Zv(){return`#${Hn(this.r)}${Hn(this.g)}${Hn(this.b)}`}function EC(){return`#${Hn(this.r)}${Hn(this.g)}${Hn(this.b)}${Hn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qv(){let t=ul(this.opacity);return`${t===1?"rgb(":"rgba("}${zn(this.r)}, ${zn(this.g)}, ${zn(this.b)}${t===1?")":`, ${t})`}`}function ul(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function zn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Hn(t){return t=zn(t),(t<16?"0":"")+t.toString(16)}function Jv(t,e,r,i){return i<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new yi(t,e,r,i)}function ey(t){if(t instanceof yi)return new yi(t.h,t.s,t.l,t.opacity);if(t instanceof ga||(t=va(t)),!t)return new yi;if(t instanceof yi)return t;t=t.rgb();var e=t.r/255,r=t.g/255,i=t.b/255,n=Math.min(e,r,i),s=Math.max(e,r,i),a=NaN,o=s-n,l=(s+n)/2;return o?(e===s?a=(r-i)/o+(r0&&l<1?0:a,new yi(a,o,l,t.opacity)}function CC(t,e,r,i){return arguments.length===1?ey(t):new yi(t,e,r,i??1)}function yi(t,e,r,i){this.h=+t,this.s=+e,this.l=+r,this.opacity=+i}Jc(yi,CC,$v(ga,{brighter(t){return t=t==null?ol:Math.pow(ol,t),new yi(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ma:Math.pow(ma,t),new yi(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,r=this.l,i=r+(r<.5?r:1-r)*e,n=2*r-i;return new Kr(ed(t>=240?t-240:t+120,n,i),ed(t,n,i),ed(t<120?t+240:t-120,n,i),this.opacity)},clamp(){return new yi(ty(this.h),cl(this.s),cl(this.l),ul(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=ul(this.opacity);return`${t===1?"hsl(":"hsla("}${ty(this.h)}, ${cl(this.s)*100}%, ${cl(this.l)*100}%${t===1?")":`, ${t})`}`}}));function ty(t){return t=(t||0)%360,t<0?t+360:t}function cl(t){return Math.max(0,Math.min(1,t||0))}function ed(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}function ry(t,e,r,i,n){var s=t*t,a=s*t;return((1-3*t+3*s-a)*e+(4-6*s+3*a)*r+(1+3*t+3*s-3*a)*i+a*n)/6}function AC(t){var e=t.length-1;return function(r){var i=r<=0?r=0:r>=1?(r=1,e-1):Math.floor(r*e),n=t[i],s=t[i+1],a=i>0?t[i-1]:2*n-s,o=i()=>t;function MC(t,e){return function(r){return t+r*e}}function RC(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(i){return Math.pow(t+i*e,r)}}function kC(t){return(t=+t)==1?ny:function(e,r){return r-e?RC(e,r,t):iy(isNaN(e)?r:e)}}function ny(t,e){var r=e-t;return r?MC(t,r):iy(isNaN(t)?e:t)}var sy=(function t(e){var r=kC(e);function i(n,s){var a=r((n=hl(n)).r,(s=hl(s)).r),o=r(n.g,s.g),l=r(n.b,s.b),u=ny(n.opacity,s.opacity);return function(c){return n.r=a(c),n.g=o(c),n.b=l(c),n.opacity=u(c),n+""}}return i.gamma=t,i})(1);function ay(t){return function(e){var r=e.length,i=new Array(r),n=new Array(r),s=new Array(r),a,o;for(a=0;ar&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:_n(i,n)})),r=rd.lastIndex;return r180?c+=360:c-u>180&&(u+=360),_.push({i:f.push(n(f)+"rotate(",null,i)-2,x:_n(u,c)})):c&&f.push(n(f)+"rotate("+c+i)}function o(u,c,f,_){u!==c?_.push({i:f.push(n(f)+"skewX(",null,i)-2,x:_n(u,c)}):c&&f.push(n(f)+"skewX("+c+i)}function l(u,c,f,_,g,b){if(u!==f||c!==_){var T=g.push(n(g)+"scale(",null,",",null,")");b.push({i:T-4,x:_n(u,f)},{i:T-2,x:_n(c,_)})}else(f!==1||_!==1)&&g.push(n(g)+"scale("+f+","+_+")")}return function(u,c){var f=[],_=[];return u=t(u),c=t(c),s(u.translateX,u.translateY,c.translateX,c.translateY,f,_),a(u.rotate,c.rotate,f,_),o(u.skewX,c.skewX,f,_),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,f,_),u=c=null,function(g){for(var b=-1,T=_.length,x;++b=0&&t._call.call(void 0,e),t=t._next;--vs}function fy(){jn=(pl=wa.now())+gl,vs=ya=0;try{WC()}finally{vs=0,$C(),jn=0}}function VC(){var t=wa.now(),e=t-pl;e>cy&&(gl-=e,pl=t)}function $C(){for(var t,e=fl,r,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:fl=r);ba=t,ad(i)}function ad(t){if(!vs){ya&&(ya=clearTimeout(ya));var e=t-jn;e>24?(t<1/0&&(ya=setTimeout(fy,t-wa.now()-gl)),xa&&(xa=clearInterval(xa))):(xa||(pl=wa.now(),xa=setInterval(VC,cy)),vs=1,dy(fy))}}function py(t,e,r){var i=new ml;return e=e==null?0:+e,i.restart(n=>{i.stop(),t(n+e)},e,r),i}var XC=il("start","end","cancel","interrupt"),YC=[],gy=0,my=1,od=2,_l=3,_y=4,ld=5,vl=6;function yl(t,e,r,i,n,s){var a=t.__transition;if(!a)t.__transition={};else if(r in a)return;qC(t,r,{name:e,index:i,group:n,on:XC,tween:YC,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:gy})}function hd(t,e){var r=xi(t,e);if(r.state>gy)throw new Error("too late; already scheduled");return r}function Li(t,e){var r=xi(t,e);if(r.state>_l)throw new Error("too late; already running");return r}function xi(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function qC(t,e,r){var i=t.__transition,n;i[e]=r,r.timer=sd(s,0,r.time);function s(u){r.state=my,r.timer.restart(a,r.delay,r.time),r.delay<=u&&a(u-r.delay)}function a(u){var c,f,_,g;if(r.state!==my)return l();for(c in i)if(g=i[c],g.name===r.name){if(g.state===_l)return py(a);g.state===_y?(g.state=vl,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete i[c]):+cod&&i.state=0&&(e=e.slice(0,r)),!e||e==="start"})}function EA(t,e,r){var i,n,s=SA(e)?hd:Li;return function(){var a=s(this,t),o=a.on;o!==i&&(n=(i=o).copy()).on(e,r),a.on=n}}function CA(t,e){var r=this._id;return arguments.length<2?xi(this.node(),r).on.on(t):this.each(EA(r,t,e))}function AA(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function PA(){return this.on("end.remove",AA(this._id))}function MA(t){var e=this._name,r=this._id;typeof t!="function"&&(t=qc(t));for(var i=this._groups,n=i.length,s=new Array(n),a=0;a=(f=(o+u)/2))?o=f:u=f,(x=r>=(_=(l+c)/2))?l=_:c=_,n=s,!(s=s[S=x<<1|T]))return n[S]=a,t;if(g=+t._x.call(null,s.data),b=+t._y.call(null,s.data),e===g&&r===b)return a.next=s,n?n[S]=a:t._root=a,t;do n=n?n[S]=new Array(4):t._root=new Array(4),(T=e>=(f=(o+u)/2))?o=f:u=f,(x=r>=(_=(l+c)/2))?l=_:c=_;while((S=x<<1|T)===(P=(b>=_)<<1|g>=f));return n[P]=s,n[S]=a,t}function nP(t){var e,r,i=t.length,n,s,a=new Array(i),o=new Array(i),l=1/0,u=1/0,c=-1/0,f=-1/0;for(r=0;rc&&(c=n),sf&&(f=s));if(l>c||u>f)return this;for(this.cover(l,u).cover(c,f),r=0;rt||t>=n||i>e||e>=s;)switch(u=(ec||(o=b.y0)>f||(l=b.x1)=S)<<1|t>=x)&&(b=_[_.length-1],_[_.length-1]=_[_.length-1-T],_[_.length-1-T]=b)}else{var P=t-+this._x.call(null,g.data),B=e-+this._y.call(null,g.data),A=P*P+B*B;if(A=(_=(a+l)/2))?a=_:l=_,(T=f>=(g=(o+u)/2))?o=g:u=g,e=r,!(r=r[x=T<<1|b]))return this;if(!r.length)break;(e[x+1&3]||e[x+2&3]||e[x+3&3])&&(i=e,S=x)}for(;r.data!==t;)if(n=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,n?(s?n.next=s:delete n.next,this):e?(s?e[x]=s:delete e[x],(r=e[0]||e[1]||e[2]||e[3])&&r===(e[3]||e[2]||e[1]||e[0])&&!r.length&&(i?i[S]=r:this._root=r),this):(this._root=s,this)}function uP(t){for(var e=0,r=t.length;e_.index){var he=g-ae.x-ae.vx,Be=b-ae.y-ae.vy,Ve=he*he+Be*Be;Veg+ie||Wb+ie||qu.r&&(u.r=u[c].r)}function l(){if(e){var u,c=e.length,f;for(r=new Array(c),u=0;u[e(X,W,a),X])),A;for(x=0,o=new Array(S);x(t=(1664525*t+1013904223)%4294967296)/4294967296}function EP(t){return t.x}function CP(t){return t.y}var AP=10,PP=Math.PI*(3-Math.sqrt(5));function MP(t){var e,r=1,i=.001,n=1-Math.pow(i,1/300),s=0,a=.6,o=new Map,l=sd(f),u=il("tick","end"),c=SP();t==null&&(t=[]);function f(){_(),u.call("tick",e),r1?(x==null?o.delete(T):o.set(T,b(x)),e):o.get(T)},find:function(T,x,S){var P=0,B=t.length,A,X,W,q,ae;for(S==null?S=1/0:S*=S,P=0;P1?(u.on(T,x),e):u.on(T)}}}function RP(){var t,e,r,i,n=bi(-30),s,a=1,o=1/0,l=.81;function u(g){var b,T=t.length,x=dd(t,EP,CP).visitAfter(f);for(i=g,b=0;b=o)){(g.data!==e||g.next)&&(S===0&&(S=vn(r),A+=S*S),P===0&&(P=vn(r),A+=P*P),A()=>t;function BP(t,{sourceEvent:e,target:r,transform:i,dispatch:n}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:n}})}function tn(t,e,r){this.k=t,this.x=e,this.y=r}tn.prototype={constructor:tn,scale:function(t){return t===1?this:new tn(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new tn(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 wl=new tn(1,0,0);OP.prototype=tn.prototype;function OP(t){for(;!t.__zoom;)if(!(t=t.parentNode))return wl;return t.__zoom}function pd(t){t.stopImmediatePropagation()}function Ta(t){t.preventDefault(),t.stopImmediatePropagation()}function IP(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function GP(){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 Ey(){return this.__zoom||wl}function FP(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function DP(){return navigator.maxTouchPoints||"ontouchstart"in this}function UP(t,e,r){var i=t.invertX(e[0][0])-r[0][0],n=t.invertX(e[1][0])-r[1][0],s=t.invertY(e[0][1])-r[0][1],a=t.invertY(e[1][1])-r[1][1];return t.translate(n>i?(i+n)/2:Math.min(0,i)||Math.max(0,n),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function LP(){var t=IP,e=GP,r=UP,i=FP,n=DP,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,l=HC,u=il("start","zoom","end"),c,f,_,g=500,b=150,T=0,x=10;function S(D){D.property("__zoom",Ey).on("wheel.zoom",ae,{passive:!1}).on("mousedown.zoom",ce).on("dblclick.zoom",ie).filter(n).on("touchstart.zoom",he).on("touchmove.zoom",Be).on("touchend.zoom touchcancel.zoom",Ve).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(D,Ee,$,re){var Qe=D.selection?D.selection():D;Qe.property("__zoom",Ey),D!==Qe?X(D,Ee,$,re):Qe.interrupt().each(function(){W(this,arguments).event(re).start().zoom(null,typeof Ee=="function"?Ee.apply(this,arguments):Ee).end()})},S.scaleBy=function(D,Ee,$,re){S.scaleTo(D,function(){var Qe=this.__zoom.k,Ce=typeof Ee=="function"?Ee.apply(this,arguments):Ee;return Qe*Ce},$,re)},S.scaleTo=function(D,Ee,$,re){S.transform(D,function(){var Qe=e.apply(this,arguments),Ce=this.__zoom,je=$==null?A(Qe):typeof $=="function"?$.apply(this,arguments):$,wt=Ce.invert(je),Lt=typeof Ee=="function"?Ee.apply(this,arguments):Ee;return r(B(P(Ce,Lt),je,wt),Qe,a)},$,re)},S.translateBy=function(D,Ee,$,re){S.transform(D,function(){return r(this.__zoom.translate(typeof Ee=="function"?Ee.apply(this,arguments):Ee,typeof $=="function"?$.apply(this,arguments):$),e.apply(this,arguments),a)},null,re)},S.translateTo=function(D,Ee,$,re,Qe){S.transform(D,function(){var Ce=e.apply(this,arguments),je=this.__zoom,wt=re==null?A(Ce):typeof re=="function"?re.apply(this,arguments):re;return r(wl.translate(wt[0],wt[1]).scale(je.k).translate(typeof Ee=="function"?-Ee.apply(this,arguments):-Ee,typeof $=="function"?-$.apply(this,arguments):-$),Ce,a)},re,Qe)};function P(D,Ee){return Ee=Math.max(s[0],Math.min(s[1],Ee)),Ee===D.k?D:new tn(Ee,D.x,D.y)}function B(D,Ee,$){var re=Ee[0]-$[0]*D.k,Qe=Ee[1]-$[1]*D.k;return re===D.x&&Qe===D.y?D:new tn(D.k,re,Qe)}function A(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function X(D,Ee,$,re){D.on("start.zoom",function(){W(this,arguments).event(re).start()}).on("interrupt.zoom end.zoom",function(){W(this,arguments).event(re).end()}).tween("zoom",function(){var Qe=this,Ce=arguments,je=W(Qe,Ce).event(re),wt=e.apply(Qe,Ce),Lt=$==null?A(wt):typeof $=="function"?$.apply(Qe,Ce):$,lr=Math.max(wt[1][0]-wt[0][0],wt[1][1]-wt[0][1]),or=Qe.__zoom,Tr=typeof Ee=="function"?Ee.apply(Qe,Ce):Ee,Rr=l(or.invert(Lt).concat(lr/or.k),Tr.invert(Lt).concat(lr/Tr.k));return function(kr){if(kr===1)kr=Tr;else{var hr=Rr(kr),Zr=lr/hr[2];kr=new tn(Zr,Lt[0]-hr[0]*Zr,Lt[1]-hr[1]*Zr)}je.zoom(null,kr)}})}function W(D,Ee,$){return!$&&D.__zooming||new q(D,Ee)}function q(D,Ee){this.that=D,this.args=Ee,this.active=0,this.sourceEvent=null,this.extent=e.apply(D,Ee),this.taps=0}q.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,Ee){return this.mouse&&D!=="mouse"&&(this.mouse[1]=Ee.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=Ee.invert(this.touch0[0])),this.touch1&&D!=="touch"&&(this.touch1[1]=Ee.invert(this.touch1[0])),this.that.__zoom=Ee,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(D){var Ee=vi(this.that).datum();u.call(D,this.that,new BP(D,{sourceEvent:this.sourceEvent,target:S,type:D,transform:this.that.__zoom,dispatch:u}),Ee)}};function ae(D,...Ee){if(!t.apply(this,arguments))return;var $=W(this,Ee).event(D),re=this.__zoom,Qe=Math.max(s[0],Math.min(s[1],re.k*Math.pow(2,i.apply(this,arguments)))),Ce=Qi(D);if($.wheel)($.mouse[0][0]!==Ce[0]||$.mouse[0][1]!==Ce[1])&&($.mouse[1]=re.invert($.mouse[0]=Ce)),clearTimeout($.wheel);else{if(re.k===Qe)return;$.mouse=[Ce,re.invert(Ce)],xl(this),$.start()}Ta(D),$.wheel=setTimeout(je,b),$.zoom("mouse",r(B(P(re,Qe),$.mouse[0],$.mouse[1]),$.extent,a));function je(){$.wheel=null,$.end()}}function ce(D,...Ee){if(_||!t.apply(this,arguments))return;var $=D.currentTarget,re=W(this,Ee,!0).event(D),Qe=vi(D.view).on("mousemove.zoom",Lt,!0).on("mouseup.zoom",lr,!0),Ce=Qi(D,$),je=D.clientX,wt=D.clientY;Wv(D.view),pd(D),re.mouse=[Ce,this.__zoom.invert(Ce)],xl(this),re.start();function Lt(or){if(Ta(or),!re.moved){var Tr=or.clientX-je,Rr=or.clientY-wt;re.moved=Tr*Tr+Rr*Rr>T}re.event(or).zoom("mouse",r(B(re.that.__zoom,re.mouse[0]=Qi(or,$),re.mouse[1]),re.extent,a))}function lr(or){Qe.on("mousemove.zoom mouseup.zoom",null),Vv(or.view,re.moved),Ta(or),re.event(or).end()}}function ie(D,...Ee){if(t.apply(this,arguments)){var $=this.__zoom,re=Qi(D.changedTouches?D.changedTouches[0]:D,this),Qe=$.invert(re),Ce=$.k*(D.shiftKey?.5:2),je=r(B(P($,Ce),re,Qe),e.apply(this,Ee),a);Ta(D),o>0?vi(this).transition().duration(o).call(X,je,re,D):vi(this).call(S.transform,je,re,D)}}function he(D,...Ee){if(t.apply(this,arguments)){var $=D.touches,re=$.length,Qe=W(this,Ee,D.changedTouches.length===re).event(D),Ce,je,wt,Lt;for(pd(D),je=0;je!0,load:async()=>{await Promise.resolve().then(()=>(Zw(),Kw))}};Z();var zP={extension:{type:k.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Jw(),Qw))}};Z(),ch(),sh(),Z(),rr(),Lo();var gd;function HP(t){return gd!==void 0||(gd=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:t??aa.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Ht.get().getWebGLRenderingContext())return!1;let r=Ht.get().createCanvas().getContext("webgl",e),i=!!r?.getContextAttributes()?.stencil;if(r){let n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,i}catch{return!1}})()),gd}rr();var md;async function jP(t={}){return md!==void 0||(md=await(async()=>{let e=Ht.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(t)).requestDevice(),!0}catch{return!1}})()),md}Lo();var Cy=["webgl","webgpu","canvas"];async function WP(t){let e=[];t.preference?(e.push(t.preference),Cy.forEach(s=>{s!==t.preference&&e.push(s)})):e=Cy.slice();let r,i={};for(let s=0;s(vS(),G_));r=o,i={...t,...t.webgpu};break}else if(a==="webgl"&&HP(t.failIfMajorPerformanceCaveat??aa.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:o}=await Promise.resolve().then(()=>(E2(),Tv));r=o,i={...t,...t.webgl};break}else if(a==="canvas")throw i={...t},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!r)throw new Error("No available renderer for the current environment");let n=new r;return await n.init(i),n}Pi(),Wm(),Ot();var Ay=class Rd{constructor(...e){this.stage=new Ir,e[0]!==void 0&&$e(gt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.stage||(this.stage=new Ir),this.renderer=await WP(e),Rd._plugins.forEach(r=>{r.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return $e(gt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,r=!1){let i=Rd._plugins.slice(0);i.reverse(),i.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(r),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Ay._plugins=[];var Py=Ay;Se.handleByList(k.Application,Py._plugins),Se.add(Nu),xe(),Ti(),Ot(),Zl();var VP=class extends ja{constructor(t,e){let{text:r,resolution:i,style:n,anchor:s,width:a,height:o,roundPixels:l,...u}=t;super({...u}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=n,this.resolution=i??null,this.allowChildren=!1,this._anchor=new Bt({_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 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)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,i=-e*this.anchor.x,n=0;return t.x>=i&&t.x<=i+e&&(n=-r*this.anchor.y,t.y>=n&&t.y<=n+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}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}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}};function $P(t,e){let r=t[0]??{};return(typeof r=="string"||t[1])&&($e(gt,`use new ${e}({ text: "hi!", style }) instead`),r={text:r,style:t[1]}),r}Wg(),ea(),Ro();var XP=class extends VP{constructor(...t){let e=$P(t,"Text");super(e,pn),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof _e?e.textureStyle:new _e(e.textureStyle))}updateBounds(){let t=this._bounds,e=this._anchor,r=0,i=0;if(this._style.trim){let{frame:n,canvasAndContext:s}=cs.getCanvasAndContext({text:this.text,style:this._style,resolution:1});cs.returnCanvasAndContext(s),r=n.width,i=n.height}else{let n=gi.measureText(this._text,this._style);r=n.width,i=n.height}t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*i,t.maxY=t.minY+i}};ig(),Af(),Pi(),$g(),Xt(),Se.add(NP,zP);var Sa=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-Sa.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?Sa.Bounce.In(t*2)*.5:Sa.Bounce.Out(t*2-1)*.5+.5}}),generatePow:function(t){return t===void 0&&(t=4),t=t1e4?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}}}}),Ea=function(){return performance.now()},Tl=(function(){function t(){for(var e=[],r=0;r0;){this._tweensAddedDuringUpdate={};for(var n=0;n1?s(t[r],t[r-1],r-i):s(t[n],t[n+1>r?r:n+1],i-n)},Bezier:function(t,e){for(var r=0,i=t.length-1,n=Math.pow,s=ys.Utils.Bernstein,a=0;a<=i;a++)r+=n(1-e,i-a)*n(e,a)*t[a]*s(i,a);return r},CatmullRom:function(t,e){var r=t.length-1,i=r*e,n=Math.floor(i),s=ys.Utils.CatmullRom;return t[0]===t[r]?(e<0&&(n=Math.floor(i=r*(1+e))),s(t[(n-1+r)%r],t[n],t[(n+1)%r],t[(n+2)%r],i-n)):e<0?t[0]-(s(t[0],t[0],t[1],t[1],-i)-t[0]):e>1?t[r]-(s(t[r],t[r],t[r-1],t[r-1],i-r)-t[r]):s(t[n?n-1:0],t[n],t[r1;i--)r*=i;return t[e]=r,r}})(),CatmullRom:function(t,e,r,i,n){var s=(r-t)*.5,a=(i-e)*.5,o=n*n,l=n*o;return(2*e-2*r+s+a)*l+(-3*e+3*r-2*s-a)*o+s*n+e}}},My=(function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t})(),_d=new Tl,Sl=(function(){function t(e,r){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=Sa.Linear.None,this._interpolationFunction=ys.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=My.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=_d,_d.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,r){if(r===void 0&&(r=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=r<0?0:r,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,r){if(e===void 0&&(e=Ea()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}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||r){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,r)}return this},t.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},t.prototype._setupProperties=function(e,r,i,n,s){for(var a in i){var o=e[a],l=Array.isArray(o),u=l?"array":typeof o,c=!l&&Array.isArray(i[a]);if(!(u==="undefined"||u==="function")){if(c){var f=i[a];if(f.length===0)continue;for(var _=[o],g=0,b=f.length;g"u"||s)&&(r[a]=o),l||(r[a]*=1),c?n[a]=i[a].slice().reverse():n[a]=r[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=Ea()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},t.prototype.resume=function(e){return e===void 0&&(e=Ea()),!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,r=this._chainedTweens.length;el)return 1;var T=Math.trunc(a/o),x=a-T*o,S=Math.min(x/i._duration,1);return S===0&&a===i._duration?1:S},c=u(),f=this._easingFunction(c);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,c),this._duration===0||a>=this._duration)if(this._repeat>0){var _=Math.min(Math.trunc((a-this._duration)/o)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=_);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*_,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;gt?.removeEventListener("click",r)),document.addEventListener("keydown",i),window.addCleanup(()=>document.removeEventListener("keydown",i))}function qP(t){for(;t.firstChild;)t.removeChild(t.firstChild)}var yM=Object.hasOwnProperty,KP=Sr(C2(),1),xM=(0,KP.default)();function ZP(t){return t.document.body.dataset.slug}function Ca(t){let e=ky(tM(t,"index"),!0);return e.length===0?"/":e}function QP(t){let e=t.split("/").filter(r=>r!=="").slice(0,-1).map(r=>"..").join("/");return e.length===0&&(e="."),e}function Ry(t,e){return JP(QP(t),Ca(e))}function JP(...t){if(t.length===0)return"";let e=t.filter(r=>r!==""&&r!=="/").map(r=>ky(r)).join("/");return t[0].startsWith("/")&&(e="/"+e),t[t.length-1].endsWith("/")&&(e=e+"/"),e}function eM(t,e){return t===e||t.endsWith("/"+e)}function tM(t,e){return eM(t,e)&&(t=t.slice(0,-e.length)),t}function ky(t,e){return t.startsWith("/")&&(t=t.substring(1)),!e&&t.endsWith("/")&&(t=t.slice(0,-1)),t}var By="graph-visited";function Oy(){return new Set(JSON.parse(localStorage.getItem(By)??"[]"))}function rM(t){let e=Oy();e.add(t),localStorage.setItem(By,JSON.stringify([...e]))}async function Iy(t,e){let r=Ca(e),i=Oy();qP(t);let{drag:n,zoom:s,depth:a,scale:o,repelForce:l,centerForce:u,linkDistance:c,fontSize:f,opacityScale:_,removeTags:g,showTags:b,focusOnHover:T,enableRadial:x}=JSON.parse(t.dataset.cfg),S=new Map(Object.entries(await fetchData).map(([te,ve])=>[Ca(te),ve])),P=[],B=[],A=new Set(S.keys()),X=new Map;for(let[te,ve]of S.entries()){let ht=ve.links??[];for(let Pt of ht)A.has(Pt)&&P.push({source:te,target:Pt});if(b){let Pt=ve.tags.filter(gr=>!g.includes(gr)).map(gr=>Ca("tags/"+gr));B.push(...Pt.filter(gr=>!B.includes(gr)));for(let gr of Pt)P.push({source:te,target:gr})}}let W=new Set,q=[r,"__SENTINEL"];if(a>=0)for(;a>=0&&q.length>0;){let te=q.shift();if(te==="__SENTINEL")a--,q.push("__SENTINEL");else{W.add(te);let ve=P.filter(Pt=>Pt.source===te),ht=P.filter(Pt=>Pt.target===te);q.push(...ve.map(Pt=>Pt.target),...ht.map(Pt=>Pt.source))}}else A.forEach(te=>W.add(te)),b&&B.forEach(te=>W.add(te));let ae=[...W].map(te=>{let ve=te.startsWith("tags/")?"#"+te.substring(5):S.get(te)?.title??te;return{id:te,text:ve,tags:S.get(te)?.tags??[]}}),ce={nodes:ae,links:P.filter(te=>W.has(te.source)&&W.has(te.target)).map(te=>({source:ae.find(ve=>ve.id===te.source),target:ae.find(ve=>ve.id===te.target)}))},ie=t.offsetWidth,he=Math.max(t.offsetHeight,250),Be=MP(ce.nodes).force("charge",RP().strength(-100*l)).force("center",rP().strength(u)).force("link",TP(ce.links).distance(c)).force("collide",bP(te=>$(te)).iterations(3)),Ve=Math.min(ie,he)/2*.8;x&&Be.force("radial",kP(Ve).strength(.2));let D=["--secondary","--tertiary","--gray","--light","--lightgray","--dark","--darkgray","--bodyFont"].reduce((te,ve)=>(te[ve]=getComputedStyle(document.documentElement).getPropertyValue(ve),te),{}),Ee=te=>te.id===r?D["--secondary"]:i.has(te.id)||te.id.startsWith("tags/")?D["--tertiary"]:D["--gray"];function $(te){let ve=ce.links.filter(ht=>ht.source.id===te.id||ht.target.id===te.id).length;return 2+Math.sqrt(ve)}let re=null,Qe=new Set,Ce=[],je=[];function wt(te){if(re=te,te===null){Qe=new Set;for(let ve of je)ve.active=!1;for(let ve of Ce)ve.active=!1}else{Qe=new Set;for(let ve of Ce){let ht=ve.simulationData;(ht.source.id===te||ht.target.id===te)&&(Qe.add(ht.source.id),Qe.add(ht.target.id)),ve.active=ht.source.id===te||ht.target.id===te}for(let ve of je)ve.active=Qe.has(ve.simulationData.id)}}let Lt=0,lr=!1;function or(){X.get("link")?.stop();let te=new Tl;for(let ve of Ce){let ht=1;re&&(ht=ve.active?1:.2),ve.color=ve.active?D["--gray"]:D["--lightgray"],te.add(new Sl(ve).to({alpha:ht},200))}te.getAll().forEach(ve=>ve.start()),X.set("link",{update:te.update.bind(te),stop(){te.getAll().forEach(ve=>ve.stop())}})}function Tr(){X.get("label")?.stop();let te=new Tl,ve=1/o,ht=ve*1.1;for(let Pt of je){let gr=Pt.simulationData.id;re===gr?te.add(new Sl(Pt.label).to({alpha:1,scale:{x:ht,y:ht}},100)):te.add(new Sl(Pt.label).to({alpha:Pt.label.alpha,scale:{x:ve,y:ve}},100))}te.getAll().forEach(Pt=>Pt.start()),X.set("label",{update:te.update.bind(te),stop(){te.getAll().forEach(Pt=>Pt.stop())}})}function Rr(){X.get("hover")?.stop();let te=new Tl;for(let ve of je){let ht=1;re!==null&&T&&(ht=ve.active?1:.2),te.add(new Sl(ve.gfx,te).to({alpha:ht},200))}te.getAll().forEach(ve=>ve.start()),X.set("hover",{update:te.update.bind(te),stop(){te.getAll().forEach(ve=>ve.stop())}})}function kr(){Rr(),or(),Tr()}X.forEach(te=>te.stop()),X.clear();let hr=new Py;await hr.init({width:ie,height:he,antialias:!0,autoStart:!1,autoDensity:!0,backgroundAlpha:0,preference:"webgpu",resolution:window.devicePixelRatio,eventMode:"static"}),t.appendChild(hr.canvas);let Zr=hr.stage;Zr.interactive=!1;let yn=new Ir({zIndex:3,isRenderGroup:!0}),xs=new Ir({zIndex:2,isRenderGroup:!0}),zi=new Ir({zIndex:1,isRenderGroup:!0});Zr.addChild(xs,yn,zi);for(let te of ce.nodes){let ve=te.id,ht=new XP({interactive:!1,eventMode:"none",text:te.text,alpha:0,anchor:{x:.5,y:1.2},style:{fontSize:f*15,fill:D["--dark"],fontFamily:D["--bodyFont"]},resolution:window.devicePixelRatio*4});ht.scale.set(1/o);let Pt=0,gr=ve.startsWith("tags/"),xd=new Io({interactive:!0,label:ve,eventMode:"static",hitArea:new $h(0,0,$(te)),cursor:"pointer"}).circle(0,0,$(te)).fill({color:gr?D["--light"]:Ee(te)}).on("pointerover",nM=>{wt(nM.target.label),Pt=ht.alpha,lr||kr()}).on("pointerleave",()=>{wt(null),ht.alpha=Pt,lr||kr()});gr&&xd.stroke({width:2,color:D["--tertiary"]}),xs.addChild(xd),yn.addChild(ht);let iM={simulationData:te,gfx:xd,label:ht,color:Ee(te),alpha:1,active:!1};je.push(iM)}for(let te of ce.links){let ve=new Io({interactive:!1,eventMode:"none"});zi.addChild(ve);let ht={simulationData:te,gfx:ve,color:D["--lightgray"],alpha:1,active:!1};Ce.push(ht)}let wi=wl;if(n)vi(hr.canvas).call(pC().container(()=>hr.canvas).subject(()=>ce.nodes.find(te=>te.id===re)).on("start",function(te){te.active||Be.alphaTarget(1).restart(),te.subject.fx=te.subject.x,te.subject.fy=te.subject.y,te.subject.__initialDragPos={x:te.subject.x,y:te.subject.y,fx:te.subject.fx,fy:te.subject.fy},Lt=Date.now(),lr=!0}).on("drag",function(te){let ve=te.subject.__initialDragPos;te.subject.fx=ve.x+(te.x-ve.x)/wi.k,te.subject.fy=ve.y+(te.y-ve.y)/wi.k}).on("end",function(te){if(te.active||Be.alphaTarget(0),te.subject.fx=null,te.subject.fy=null,lr=!1,Date.now()-Lt<500){let ve=ce.nodes.find(Pt=>Pt.id===te.subject.id),ht=Ry(e,ve.id);window.spaNavigate(new URL(ht,window.location.toString()))}}));else for(let te of je)te.gfx.on("click",()=>{let ve=Ry(e,te.simulationData.id);window.spaNavigate(new URL(ve,window.location.toString()))});s&&vi(hr.canvas).call(LP().extent([[0,0],[ie,he]]).scaleExtent([.25,4]).on("zoom",({transform:te})=>{wi=te,Zr.scale.set(te.k,te.k),Zr.position.set(te.x,te.y);let ve=te.k*_,ht=Math.max((ve-1)/3.75,0),Pt=je.filter(gr=>gr.active).flatMap(gr=>gr.label);for(let gr of yn.children)Pt.includes(gr)||(gr.alpha=ht)}));let Hi=!1;function ji(te){if(!Hi){for(let ve of je){let{x:ht,y:Pt}=ve.simulationData;!ht||!Pt||(ve.gfx.position.set(ht+ie/2,Pt+he/2),ve.label&&ve.label.position.set(ht+ie/2,Pt+he/2))}for(let ve of Ce){let ht=ve.simulationData;ve.gfx.clear(),ve.gfx.moveTo(ht.source.x+ie/2,ht.source.y+he/2),ve.gfx.lineTo(ht.target.x+ie/2,ht.target.y+he/2).stroke({alpha:ve.alpha,width:1,color:ve.color})}X.forEach(ve=>ve.update(te)),hr.renderer.render(Zr),requestAnimationFrame(ji)}}return requestAnimationFrame(ji),()=>{Hi=!0,hr.destroy()}}var vd=[],yd=[];function Gy(){for(let t of vd)t();vd=[]}function Fy(){for(let t of yd)t();yd=[]}document.addEventListener("nav",async t=>{let e=t.detail.url;rM(Ca(e));async function r(){Gy();let u=document.getElementsByClassName("graph-container");for(let c of u)vd.push(await Iy(c,e))}await r();let i=()=>{r()};document.addEventListener("themechange",i),window.addCleanup(()=>{document.removeEventListener("themechange",i)});let n=[...document.getElementsByClassName("global-graph-outer")];async function s(){let u=ZP(window);for(let c of n){c.classList.add("active");let f=c.closest(".sidebar");f&&(f.style.zIndex="1");let _=c.querySelector(".global-graph-container");YP(c,a),_&&yd.push(await Iy(_,u))}}function a(){Fy();for(let u of n){u.classList.remove("active");let c=u.closest(".sidebar");c&&(c.style.zIndex="")}}async function o(u){u.key==="g"&&(u.ctrlKey||u.metaKey)&&!u.shiftKey&&(u.preventDefault(),n.some(c=>c.classList.contains("active"))?a():s())}let l=document.getElementsByClassName("global-graph-icon");Array.from(l).forEach(u=>{u.addEventListener("click",s),window.addCleanup(()=>u.removeEventListener("click",s))}),document.addEventListener("keydown",o),window.addCleanup(()=>{document.removeEventListener("keydown",o),Gy(),Fy()})});/*! Bundled license information: tiny-lru/dist/tiny-lru.js: (** * tiny-lru * * @copyright 2025 Jason Mulligan * @license BSD-3-Clause * @version 11.4.5 *) */})(),(function(){var Zt=new IntersectionObserver(Rt=>{for(let Gt of Rt){let Ft=Gt.target.id,y=document.querySelectorAll(`a[data-for="${Ft}"]`),Br=Gt.rootBounds?.height;Br&&y.length>0&&(Gt.boundingClientRect.y$t.classList.add("in-view")):y.forEach($t=>$t.classList.remove("in-view")))}});function Mt(){this.classList.toggle("collapsed"),this.setAttribute("aria-expanded",this.getAttribute("aria-expanded")==="true"?"false":"true");let Rt=this.nextElementSibling;Rt&&Rt.classList.toggle("collapsed")}function Vt(){for(let Rt of document.getElementsByClassName("toc")){let Gt=Rt.querySelector(".toc-header"),Ft=Rt.querySelector(".toc-content");if(!Gt||!Ft)return;Gt.addEventListener("click",Mt),window.addCleanup(()=>Gt.removeEventListener("click",Mt))}}document.addEventListener("nav",()=>{Vt(),Zt.disconnect(),document.querySelectorAll("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").forEach(Rt=>Zt.observe(Rt))})})(),(function(){document.addEventListener("nav",Zt=>{const Mt=new IntersectionObserver(Gt=>{for(const Ft of Gt){const y=Ft.target.parentElement;if(!y)return;Ft.isIntersecting?y.classList.remove("gradient-active"):y.classList.add("gradient-active")}}),Vt=document.getElementById("list-1");if(!Vt)return;const Rt=Vt.querySelector(".overflow-end");Rt&&(Mt.observe(Rt),window.addCleanup(()=>Mt.disconnect()))})})(),(function(){document.addEventListener("nav",Zt=>{const Mt=new IntersectionObserver(Gt=>{for(const Ft of Gt){const y=Ft.target.parentElement;if(!y)return;Ft.isIntersecting?y.classList.remove("gradient-active"):y.classList.add("gradient-active")}}),Vt=document.getElementById("list-2");if(!Vt)return;const Rt=Vt.querySelector(".overflow-end");Rt&&(Mt.observe(Rt),window.addCleanup(()=>Mt.disconnect()))})})(),(function(){document.addEventListener("nav",Zt=>{const Mt=new IntersectionObserver(Gt=>{for(const Ft of Gt){const y=Ft.target.parentElement;if(!y)return;Ft.isIntersecting?y.classList.remove("gradient-active"):y.classList.add("gradient-active")}}),Vt=document.getElementById("list-3");if(!Vt)return;const Rt=Vt.querySelector(".overflow-end");Rt&&(Mt.observe(Rt),window.addCleanup(()=>Mt.disconnect()))})})(),(function(){var Zt=Object.create,Mt=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,Rt=Object.getOwnPropertyNames,Gt=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty,y=(M,O)=>()=>(O||M((O={exports:{}}).exports,O),O.exports),Br=(M,O,j,V)=>{if(O&&typeof O=="object"||typeof O=="function")for(let Q of Rt(O))!Ft.call(M,Q)&&Q!==j&&Mt(M,Q,{get:()=>O[Q],enumerable:!(V=Vt(O,Q))||V.enumerable});return M},$t=(M,O,j)=>(j=M!=null?Zt(Gt(M)):{},Br(O||!M||!M.__esModule?Mt(j,"default",{value:M,enumerable:!0}):j,M)),ni=y((M,O)=>{"use strict";O.exports=V;function j(K){return K instanceof Buffer?Buffer.from(K):new K.constructor(K.buffer.slice(),K.byteOffset,K.length)}function V(K){if(K=K||{},K.circles)return Q(K);let ne=new Map;if(ne.set(Date,se=>new Date(se)),ne.set(Map,(se,Oe)=>new Map(Te(Array.from(se),Oe))),ne.set(Set,(se,Oe)=>new Set(Te(Array.from(se),Oe))),K.constructorHandlers)for(let se of K.constructorHandlers)ne.set(se[0],se[1]);let le=null;return K.proto?Ue:Ae;function Te(se,Oe){let h=Object.keys(se),d=new Array(h.length);for(let p=0;pnew Date(h)),Te.set(Map,(h,d)=>new Map(Ue(Array.from(h),d))),Te.set(Set,(h,d)=>new Set(Ue(Array.from(h),d))),K.constructorHandlers)for(let h of K.constructorHandlers)Te.set(h[0],h[1]);let Ae=null;return K.proto?Oe:se;function Ue(h,d){let p=Object.keys(h),v=new Array(p.length);for(let m=0;m({x:M,y:M}),Se={left:"right",right:"left",bottom:"top",top:"bottom"},Z={start:"end",end:"start"};function mr(M,O,j){return k(M,Sr(O,j))}function Er(M,O){return typeof M=="function"?M(O):M}function Tt(M){return M.split("-")[0]}function Xt(M){return M.split("-")[1]}function si(M){return M==="x"?"y":"x"}function Qt(M){return M==="y"?"height":"width"}var Nt=new Set(["top","bottom"]);function yt(M){return Nt.has(Tt(M))?"y":"x"}function fr(M){return si(yt(M))}function Qr(M,O,j){j===void 0&&(j=!1);let V=Xt(M),Q=fr(M),K=Qt(Q),ne=Q==="x"?V===(j?"end":"start")?"right":"left":V==="start"?"bottom":"top";return O.reference[K]>O.floating[K]&&(ne=tt(ne)),[ne,tt(ne)]}function _r(M){let O=tt(M);return[ai(M),O,ai(O)]}function ai(M){return M.replace(/start|end/g,O=>Z[O])}var de=["left","right"],J=["right","left"],pe=["top","bottom"],Je=["bottom","top"];function st(M,O,j){switch(M){case"top":case"bottom":return j?O?J:de:O?de:J;case"left":case"right":return O?pe:Je;default:return[]}}function pt(M,O,j,V){let Q=Xt(M),K=st(Tt(M),j==="start",V);return Q&&(K=K.map(ne=>ne+"-"+Q),O&&(K=K.concat(K.map(ai)))),K}function tt(M){return M.replace(/left|right|bottom|top/g,O=>Se[O])}function _t(M){return{top:0,right:0,bottom:0,left:0,...M}}function ct(M){return typeof M!="number"?_t(M):{top:M,right:M,bottom:M,left:M}}function ut(M){let{x:O,y:j,width:V,height:Q}=M;return{width:V,height:Q,top:j,left:O,right:O+V,bottom:j+Q,x:O,y:j}}function kt(M,O,j){let{reference:V,floating:Q}=M,K=yt(O),ne=fr(O),le=Qt(ne),Te=Tt(O),Ae=K==="y",Ue=V.x+V.width/2-Q.width/2,se=V.y+V.height/2-Q.height/2,Oe=V[le]/2-Q[le]/2,h;switch(Te){case"top":h={x:Ue,y:V.y-Q.height};break;case"bottom":h={x:Ue,y:V.y+V.height};break;case"right":h={x:V.x+V.width,y:se};break;case"left":h={x:V.x-Q.width,y:se};break;default:h={x:V.x,y:V.y}}switch(Xt(O)){case"start":h[ne]-=Oe*(j&&Ae?-1:1);break;case"end":h[ne]+=Oe*(j&&Ae?-1:1);break}return h}var Fe=async(M,O,j)=>{let{placement:V="bottom",strategy:Q="absolute",middleware:K=[],platform:ne}=j,le=K.filter(Boolean),Te=await(ne.isRTL==null?void 0:ne.isRTL(O)),Ae=await ne.getElementRects({reference:M,floating:O,strategy:Q}),{x:Ue,y:se}=kt(Ae,V,Te),Oe=V,h={},d=0;for(let p=0;pue<=0)){var z,N;let ue=(((z=K.flip)==null?void 0:z.index)||0)+1,oe=U[ue];if(oe&&(!(se==="alignment"&&w!==yt(oe))||I.every(Ne=>yt(Ne.placement)===w?Ne.overflows[0]>0:!0)))return{data:{index:ue,overflows:I},reset:{placement:oe}};let Re=(N=I.filter(Ne=>Ne.overflows[0]<=0).sort((Ne,ot)=>Ne.overflows[1]-ot.overflows[1])[0])==null?void 0:N.placement;if(!Re)switch(h){case"bestFit":{var L;let Ne=(L=I.filter(ot=>{if(G){let Ye=yt(ot.placement);return Ye===w||Ye==="y"}return!0}).map(ot=>[ot.placement,ot.overflows.filter(Ye=>Ye>0).reduce((Ye,at)=>Ye+at,0)]).sort((ot,Ye)=>ot[1]-Ye[1])[0])==null?void 0:L[0];Ne&&(Re=Ne);break}case"initialPlacement":Re=le;break}if(Q!==Re)return{reset:{placement:Re}}}return{}}}};function ke(M){let O=Sr(...M.map(K=>K.left)),j=Sr(...M.map(K=>K.top)),V=k(...M.map(K=>K.right)),Q=k(...M.map(K=>K.bottom));return{x:O,y:j,width:V-O,height:Q-j}}function mt(M){let O=M.slice().sort((Q,K)=>Q.y-K.y),j=[],V=null;for(let Q=0;QV.height/2?j.push([K]):j[j.length-1].push(K),V=K}return j.map(Q=>ut(ke(Q)))}var Pe=function(M){return M===void 0&&(M={}),{name:"inline",options:M,async fn(O){let{placement:j,elements:V,rects:Q,platform:K,strategy:ne}=O,{padding:le=2,x:Te,y:Ae}=Er(M,O),Ue=Array.from(await(K.getClientRects==null?void 0:K.getClientRects(V.reference))||[]),se=mt(Ue),Oe=ut(ke(Ue)),h=ct(le);function d(){if(se.length===2&&se[0].left>se[1].right&&Te!=null&&Ae!=null)return se.find(v=>Te>v.left-h.left&&Tev.top-h.top&&Ae=2){if(yt(j)==="y"){let I=se[0],z=se[se.length-1],N=Tt(j)==="top",L=I.top,ue=z.bottom,oe=N?I.left:z.left,Re=N?I.right:z.right,Ne=Re-oe,ot=ue-L;return{top:L,bottom:ue,left:oe,right:Re,width:Ne,height:ot,x:oe,y:L}}let v=Tt(j)==="left",m=k(...se.map(I=>I.right)),w=Sr(...se.map(I=>I.left)),E=se.filter(I=>v?I.left===w:I.right===m),C=E[0].top,R=E[E.length-1].bottom,G=w,U=m,F=U-G,Y=R-C;return{top:C,bottom:R,left:G,right:U,width:F,height:Y,x:G,y:C}}return Oe}let p=await K.getElementRects({reference:{getBoundingClientRect:d},floating:V.floating,strategy:ne});return Q.reference.x!==p.reference.x||Q.reference.y!==p.reference.y||Q.reference.width!==p.reference.width||Q.reference.height!==p.reference.height?{reset:{rects:p}}:{}}}},ft=function(M){return M===void 0&&(M={}),{name:"shift",options:M,async fn(O){let{x:j,y:V,placement:Q}=O,{mainAxis:K=!0,crossAxis:ne=!1,limiter:le={fn:v=>{let{x:m,y:w}=v;return{x:m,y:w}}},...Te}=Er(M,O),Ae={x:j,y:V},Ue=await We(O,Te),se=yt(Tt(Q)),Oe=si(se),h=Ae[Oe],d=Ae[se];if(K){let v=Oe==="y"?"top":"left",m=Oe==="y"?"bottom":"right",w=h+Ue[v],E=h-Ue[m];h=mr(w,h,E)}if(ne){let v=se==="y"?"top":"left",m=se==="y"?"bottom":"right",w=d+Ue[v],E=d-Ue[m];d=mr(w,d,E)}let p=le.fn({...O,[Oe]:h,[se]:d});return{...p,data:{x:p.x-j,y:p.y-V,enabled:{[Oe]:K,[se]:ne}}}}}};function Ut(){return typeof window<"u"}function H(M){return De(M)?(M.nodeName||"").toLowerCase():"#document"}function ee(M){var O;return(M==null||(O=M.ownerDocument)==null?void 0:O.defaultView)||window}function fe(M){var O;return(O=(De(M)?M.ownerDocument:M.document)||window.document)==null?void 0:O.documentElement}function De(M){return Ut()?M instanceof Node||M instanceof ee(M).Node:!1}function Ge(M){return Ut()?M instanceof Element||M instanceof ee(M).Element:!1}function Me(M){return Ut()?M instanceof HTMLElement||M instanceof ee(M).HTMLElement:!1}function ge(M){return!Ut()||typeof ShadowRoot>"u"?!1:M instanceof ShadowRoot||M instanceof ee(M).ShadowRoot}var Ke=new Set(["inline","contents"]);function xt(M){let{overflow:O,overflowX:j,overflowY:V,display:Q}=Bt(M);return/auto|scroll|overlay|hidden|clip/.test(O+V+j)&&!Ke.has(Q)}var Jt=new Set(["table","td","th"]);function ur(M){return Jt.has(H(M))}var rt=[":popover-open",":modal"];function St(M){return rt.some(O=>{try{return M.matches(O)}catch{return!1}})}var Le=["transform","translate","scale","rotate","perspective"],ye=["transform","translate","scale","rotate","perspective","filter"],Et=["paint","layout","strict","content"];function we(M){let O=vr(),j=Ge(M)?Bt(M):M;return Le.some(V=>j[V]?j[V]!=="none":!1)||(j.containerType?j.containerType!=="normal":!1)||!O&&(j.backdropFilter?j.backdropFilter!=="none":!1)||!O&&(j.filter?j.filter!=="none":!1)||ye.some(V=>(j.willChange||"").includes(V))||Et.some(V=>(j.contain||"").includes(V))}function me(M){let O=dt(M);for(;Me(O)&&!et(O);){if(we(O))return O;if(St(O))return null;O=dt(O)}return null}function vr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var yr=new Set(["html","body","#document"]);function et(M){return yr.has(H(M))}function Bt(M){return ee(M).getComputedStyle(M)}function Ti(M){return Ge(M)?{scrollLeft:M.scrollLeft,scrollTop:M.scrollTop}:{scrollLeft:M.scrollX,scrollTop:M.scrollY}}function dt(M){if(H(M)==="html")return M;let O=M.assignedSlot||M.parentNode||ge(M)&&M.host||fe(M);return ge(O)?O.host:O}function Fr(M){let O=dt(M);return et(O)?M.ownerDocument?M.ownerDocument.body:M.body:Me(O)&&xt(O)?O:Fr(O)}function er(M,O,j){var V;O===void 0&&(O=[]),j===void 0&&(j=!0);let Q=Fr(M),K=Q===((V=M.ownerDocument)==null?void 0:V.body),ne=ee(Q);if(K){let le=oi(ne);return O.concat(ne,ne.visualViewport||[],xt(Q)?Q:[],le&&j?er(le):[])}return O.concat(Q,er(Q,[],j))}function oi(M){return M.parent&&Object.getPrototypeOf(M.parent)?M.frameElement:null}function gt(M){let O=Bt(M),j=parseFloat(O.width)||0,V=parseFloat(O.height)||0,Q=Me(M),K=Q?M.offsetWidth:j,ne=Q?M.offsetHeight:V,le=Dt(j)!==K||Dt(V)!==ne;return le&&(j=K,V=ne),{width:j,height:V,$:le}}function Vi(M){return Ge(M)?M:M.contextElement}function Cr(M){let O=Vi(M);if(!Me(O))return jt(1);let j=O.getBoundingClientRect(),{width:V,height:Q,$:K}=gt(O),ne=(K?Dt(j.width):j.width)/V,le=(K?Dt(j.height):j.height)/Q;return(!ne||!Number.isFinite(ne))&&(ne=1),(!le||!Number.isFinite(le))&&(le=1),{x:ne,y:le}}var $e=jt(0);function Ot(M){let O=ee(M);return!vr()||!O.visualViewport?$e:{x:O.visualViewport.offsetLeft,y:O.visualViewport.offsetTop}}function it(M,O,j){return O===void 0&&(O=!1),!j||O&&j!==ee(M)?!1:O}function Dr(M,O,j,V){O===void 0&&(O=!1),j===void 0&&(j=!1);let Q=M.getBoundingClientRect(),K=Vi(M),ne=jt(1);O&&(V?Ge(V)&&(ne=Cr(V)):ne=Cr(M));let le=it(K,j,V)?Ot(K):jt(0),Te=(Q.left+le.x)/ne.x,Ae=(Q.top+le.y)/ne.y,Ue=Q.width/ne.x,se=Q.height/ne.y;if(K){let Oe=ee(K),h=V&&Ge(V)?ee(V):V,d=Oe,p=oi(d);for(;p&&V&&h!==d;){let v=Cr(p),m=p.getBoundingClientRect(),w=Bt(p),E=m.left+(p.clientLeft+parseFloat(w.paddingLeft))*v.x,C=m.top+(p.clientTop+parseFloat(w.paddingTop))*v.y;Te*=v.x,Ae*=v.y,Ue*=v.x,se*=v.y,Te+=E,Ae+=C,d=ee(p),p=oi(d)}}return ut({width:Ue,height:se,x:Te,y:Ae})}function Si(M,O){let j=Ti(M).scrollLeft;return O?O.left+j:Dr(fe(M)).left+j}function It(M,O){let j=M.getBoundingClientRect(),V=j.left+O.scrollLeft-Si(M,j),Q=j.top+O.scrollTop;return{x:V,y:Q}}function li(M){let{elements:O,rect:j,offsetParent:V,strategy:Q}=M,K=Q==="fixed",ne=fe(V),le=O?St(O.floating):!1;if(V===ne||le&&K)return j;let Te={scrollLeft:0,scrollTop:0},Ae=jt(1),Ue=jt(0),se=Me(V);if((se||!se&&!K)&&((H(V)!=="body"||xt(ne))&&(Te=Ti(V)),Me(V))){let h=Dr(V);Ae=Cr(V),Ue.x=h.x+V.clientLeft,Ue.y=h.y+V.clientTop}let Oe=ne&&!se&&!K?It(ne,Te):jt(0);return{width:j.width*Ae.x,height:j.height*Ae.y,x:j.x*Ae.x-Te.scrollLeft*Ae.x+Ue.x+Oe.x,y:j.y*Ae.y-Te.scrollTop*Ae.y+Ue.y+Oe.y}}function zr(M){return Array.from(M.getClientRects())}function Wn(M){let O=fe(M),j=Ti(M),V=M.ownerDocument.body,Q=k(O.scrollWidth,O.clientWidth,V.scrollWidth,V.clientWidth),K=k(O.scrollHeight,O.clientHeight,V.scrollHeight,V.clientHeight),ne=-j.scrollLeft+Si(M),le=-j.scrollTop;return Bt(V).direction==="rtl"&&(ne+=k(O.clientWidth,V.clientWidth)-Q),{width:Q,height:K,x:ne,y:le}}var Hr=25;function $i(M,O){let j=ee(M),V=fe(M),Q=j.visualViewport,K=V.clientWidth,ne=V.clientHeight,le=0,Te=0;if(Q){K=Q.width,ne=Q.height;let Ue=vr();(!Ue||Ue&&O==="fixed")&&(le=Q.offsetLeft,Te=Q.offsetTop)}let Ae=Si(V);if(Ae<=0){let Ue=V.ownerDocument,se=Ue.body,Oe=getComputedStyle(se),h=Ue.compatMode==="CSS1Compat"&&parseFloat(Oe.marginLeft)+parseFloat(Oe.marginRight)||0,d=Math.abs(V.clientWidth-se.clientWidth-h);d<=Hr&&(K-=d)}else Ae<=Hr&&(K+=Ae);return{width:K,height:ne,x:le,y:Te}}var qt=new Set(["absolute","fixed"]);function jr(M,O){let j=Dr(M,!0,O==="fixed"),V=j.top+M.clientTop,Q=j.left+M.clientLeft,K=Me(M)?Cr(M):jt(1),ne=M.clientWidth*K.x,le=M.clientHeight*K.y,Te=Q*K.x,Ae=V*K.y;return{width:ne,height:le,x:Te,y:Ae}}function rn(M,O,j){let V;if(O==="viewport")V=$i(M,j);else if(O==="document")V=Wn(fe(M));else if(Ge(O))V=jr(O,j);else{let Q=Ot(M);V={x:O.x-Q.x,y:O.y-Q.y,width:O.width,height:O.height}}return ut(V)}function nn(M,O){let j=dt(M);return j===O||!Ge(j)||et(j)?!1:Bt(j).position==="fixed"||nn(j,O)}function Or(M,O){let j=O.get(M);if(j)return j;let V=er(M,[],!1).filter(le=>Ge(le)&&H(le)!=="body"),Q=null,K=Bt(M).position==="fixed",ne=K?dt(M):M;for(;Ge(ne)&&!et(ne);){let le=Bt(ne),Te=we(ne);!Te&&le.position==="fixed"&&(Q=null),(K?!Te&&!Q:!Te&&le.position==="static"&&Q&&qt.has(Q.position)||xt(ne)&&!Te&&nn(M,ne))?V=V.filter(Ae=>Ae!==ne):Q=le,ne=dt(ne)}return O.set(M,V),V}function xn(M){let{element:O,boundary:j,rootBoundary:V,strategy:Q}=M,K=[...j==="clippingAncestors"?St(O)?[]:Or(O,this._c):[].concat(j),V],ne=K[0],le=K.reduce((Te,Ae)=>{let Ue=rn(O,Ae,Q);return Te.top=k(Ue.top,Te.top),Te.right=Sr(Ue.right,Te.right),Te.bottom=Sr(Ue.bottom,Te.bottom),Te.left=k(Ue.left,Te.left),Te},rn(O,ne,Q));return{width:le.right-le.left,height:le.bottom-le.top,x:le.left,y:le.top}}function bn(M){let{width:O,height:j}=gt(M);return{width:O,height:j}}function sn(M,O,j){let V=Me(O),Q=fe(O),K=j==="fixed",ne=Dr(M,!0,K,O),le={scrollLeft:0,scrollTop:0},Te=jt(0);function Ae(){Te.x=Si(Q)}if(V||!V&&!K)if((H(O)!=="body"||xt(Q))&&(le=Ti(O)),V){let h=Dr(O,!0,K,O);Te.x=h.x+O.clientLeft,Te.y=h.y+O.clientTop}else Q&&Ae();K&&!V&&Q&&Ae();let Ue=Q&&!V&&!K?It(Q,le):jt(0),se=ne.left+le.scrollLeft-Te.x-Ue.x,Oe=ne.top+le.scrollTop-Te.y-Ue.y;return{x:se,y:Oe,width:ne.width,height:ne.height}}function Wr(M){return Bt(M).position==="static"}function Xi(M,O){if(!Me(M)||Bt(M).position==="fixed")return null;if(O)return O(M);let j=M.offsetParent;return fe(M)===j&&(j=j.ownerDocument.body),j}function hi(M,O){let j=ee(M);if(St(M))return j;if(!Me(M)){let Q=dt(M);for(;Q&&!et(Q);){if(Ge(Q)&&!Wr(Q))return Q;Q=dt(Q)}return j}let V=Xi(M,O);for(;V&&ur(V)&&Wr(V);)V=Xi(V,O);return V&&et(V)&&Wr(V)&&!we(V)?j:V||me(M)||j}var Vr=async function(M){let O=this.getOffsetParent||hi,j=this.getDimensions,V=await j(M.floating);return{reference:sn(M.reference,await O(M.floating),M.strategy),floating:{x:0,y:0,width:V.width,height:V.height}}};function Vn(M){return Bt(M).direction==="rtl"}var an={convertOffsetParentRelativeRectToViewportRelativeRect:li,getDocumentElement:fe,getClippingRect:xn,getOffsetParent:hi,getElementRects:Vr,getClientRects:zr,getDimensions:bn,getScale:Cr,isElement:Ge,isRTL:Vn},on=ft,ws=be,Ts=Pe,Ss=(M,O,j)=>{let V=new Map,Q={platform:an,...j},K={...Q.platform,_c:V};return Fe(M,O,{...Q,platform:K})},Ma=Object.hasOwnProperty,Ei=$t(ni(),1),Wt=(0,Ei.default)(),nr=(M,O,j)=>{let V=new URL(M.getAttribute(O),j);M.setAttribute(O,V.pathname+V.hash)};function wn(M,O){M.querySelectorAll('[href=""], [href^="./"], [href^="../"]').forEach(j=>nr(j,"href",O)),M.querySelectorAll('[src=""], [src^="./"], [src^="../"]').forEach(j=>nr(j,"src",O))}var pr=//;async function Ar(M){let O=await fetch(`${M}`);if(!O.headers.get("content-type")?.startsWith("text/html"))return O;let j=await O.clone().text(),[V,Q]=j.match(pr)??[];return Q?fetch(`${new URL(Q,M)}`):O}var cr=new DOMParser,Pr=null;async function xr({clientX:M,clientY:O}){let j=Pr=this;if(j.dataset.noPopover==="true")return;async function V(p){let{x:v,y:m}=await Ss(j,p,{strategy:"fixed",middleware:[Ts({x:M,y:O}),on(),ws()]});Object.assign(p.style,{transform:`translate(${v.toFixed()}px, ${m.toFixed()}px)`})}function Q(p){if(dr(),p.classList.add("active-popover"),V(p),ne!==""){let v=`#popover-internal-${ne.slice(1)}`,m=d.querySelector(v);m&&d.scroll({top:m.offsetTop-12,behavior:"instant"})}}let K=new URL(j.href),ne=decodeURIComponent(K.hash);K.hash="",K.search="";let le=`popover-${j.pathname}`,Te=document.getElementById(le);if(document.getElementById(le)){Q(Te);return}let Ae=await Ar(K).catch(p=>{console.error(p)});if(!Ae)return;let[Ue]=Ae.headers.get("Content-Type").split(";"),[se,Oe]=Ue.split("/"),h=document.createElement("div");h.id=le,h.classList.add("popover");let d=document.createElement("div");switch(d.classList.add("popover-inner"),d.dataset.contentType=Ue??void 0,h.appendChild(d),se){case"image":let p=document.createElement("img");p.src=K.toString(),p.alt=K.pathname,d.appendChild(p);break;case"application":if(Oe==="pdf"){let E=document.createElement("iframe");E.src=K.toString(),d.appendChild(E)}break;default:let v=await Ae.text(),m=cr.parseFromString(v,"text/html");wn(m,K),m.querySelectorAll("[id]").forEach(E=>{let C=`popover-internal-${E.id}`;E.id=C});let w=[...m.getElementsByClassName("popover-hint")];if(w.length===0)return;w.forEach(E=>d.appendChild(E))}document.getElementById(le)||(document.body.appendChild(h),Pr===this&&Q(h))}function dr(){Pr=null,document.querySelectorAll(".popover").forEach(M=>M.classList.remove("active-popover"))}document.addEventListener("nav",()=>{let M=[...document.querySelectorAll("a.internal")];for(let O of M)O.addEventListener("mouseenter",xr),O.addEventListener("mouseleave",dr),window.addCleanup(()=>{O.removeEventListener("mouseenter",xr),O.removeEventListener("mouseleave",dr)})})})(),(function(){const Zt=document.createElement("script");Zt.src="https://plausible.io/js/script.manual.js",Zt.setAttribute("data-domain",location.hostname),Zt.defer=!0,Zt.onload=()=>{window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)},plausible("pageview"),document.addEventListener("nav",()=>{plausible("pageview")})},document.head.appendChild(Zt)})(),(function(){var Zt=Object.create,Mt=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,Rt=Object.getOwnPropertyNames,Gt=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty,y=(H,ee)=>()=>(ee||H((ee={exports:{}}).exports,ee),ee.exports),Br=(H,ee,fe,De)=>{if(ee&&typeof ee=="object"||typeof ee=="function")for(let Ge of Rt(ee))!Ft.call(H,Ge)&&Ge!==fe&&Mt(H,Ge,{get:()=>ee[Ge],enumerable:!(De=Vt(ee,Ge))||De.enumerable});return H},$t=(H,ee,fe)=>(fe=H!=null?Zt(Gt(H)):{},Br(ee||!H||!H.__esModule?Mt(fe,"default",{value:H,enumerable:!0}):fe,H)),ni=y((H,ee)=>{"use strict";ee.exports=De;function fe(Me){return Me instanceof Buffer?Buffer.from(Me):new Me.constructor(Me.buffer.slice(),Me.byteOffset,Me.length)}function De(Me){if(Me=Me||{},Me.circles)return Ge(Me);let ge=new Map;if(ge.set(Date,rt=>new Date(rt)),ge.set(Map,(rt,St)=>new Map(xt(Array.from(rt),St))),ge.set(Set,(rt,St)=>new Set(xt(Array.from(rt),St))),Me.constructorHandlers)for(let rt of Me.constructorHandlers)ge.set(rt[0],rt[1]);let Ke=null;return Me.proto?ur:Jt;function xt(rt,St){let Le=Object.keys(rt),ye=new Array(Le.length);for(let Et=0;Etnew Date(Le)),xt.set(Map,(Le,ye)=>new Map(ur(Array.from(Le),ye))),xt.set(Set,(Le,ye)=>new Set(ur(Array.from(Le),ye))),Me.constructorHandlers)for(let Le of Me.constructorHandlers)xt.set(Le[0],Le[1]);let Jt=null;return Me.proto?St:rt;function ur(Le,ye){let Et=Object.keys(Le),we=new Array(Et.length);for(let me=0;me(ee,fe)=>ee[`node${H}`]===fe[`node${H}`],k=Sr("Name"),Dt=Sr("Type"),jt=Sr("Value");function Se(H,ee){if(H.attributes.length===0&&ee.attributes.length===0)return[];let fe=[],De=new Map,Ge=new Map;for(let Me of H.attributes)De.set(Me.name,Me.value);for(let Me of ee.attributes){let ge=De.get(Me.name);Me.value===ge?De.delete(Me.name):(typeof ge<"u"&&De.delete(Me.name),Ge.set(Me.name,Me.value))}for(let Me of De.keys())fe.push({type:5,name:Me});for(let[Me,ge]of Ge.entries())fe.push({type:4,name:Me,value:ge});return fe}function Z(H,ee=!0){let fe=`${H.localName}`;for(let{name:De,value:Ge}of H.attributes)ee&&De.startsWith("data-")||(fe+=`[${De}=${Ge}]`);return fe+=H.innerHTML,fe}function mr(H){switch(H.tagName){case"BASE":case"TITLE":return H.localName;case"META":{if(H.hasAttribute("name"))return`meta[name="${H.getAttribute("name")}"]`;if(H.hasAttribute("property"))return`meta[name="${H.getAttribute("property")}"]`;break}case"LINK":{if(H.hasAttribute("rel")&&H.hasAttribute("href"))return`link[rel="${H.getAttribute("rel")}"][href="${H.getAttribute("href")}"]`;if(H.hasAttribute("href"))return`link[href="${H.getAttribute("href")}"]`;break}}return Z(H)}function Er(H){let[ee,fe=""]=H.split("?");return`${ee}?t=${Date.now()}&${fe.replace(/t=\d+/g,"")}`}function Tt(H){if(H.nodeType===1&&H.hasAttribute("data-persist"))return H;if(H.nodeType===1&&H.localName==="script"){let ee=document.createElement("script");for(let{name:fe,value:De}of H.attributes)fe==="src"&&(De=Er(De)),ee.setAttribute(fe,De);return ee.innerHTML=H.innerHTML,ee}return H.cloneNode(!0)}function Xt(H,ee){if(H.children.length===0&&ee.children.length===0)return[];let fe=[],De=new Map,Ge=new Map,Me=new Map;for(let ge of H.children)De.set(mr(ge),ge);for(let ge of ee.children){let Ke=mr(ge),xt=De.get(Ke);xt?Z(ge,!1)!==Z(xt,!1)&&Ge.set(Ke,Tt(ge)):Me.set(Ke,Tt(ge)),De.delete(Ke)}for(let ge of H.childNodes){if(ge.nodeType===1){let Ke=mr(ge);if(De.has(Ke)){fe.push({type:1});continue}else if(Ge.has(Ke)){let xt=Ge.get(Ke);fe.push({type:3,attributes:Se(ge,xt),children:si(ge,xt)});continue}}fe.push(void 0)}for(let ge of Me.values())fe.push({type:0,node:Tt(ge)});return fe}function si(H,ee){let fe=[],De=Math.max(H.childNodes.length,ee.childNodes.length);for(let Ge=0;Geyt(De,Ke,ge[xt])));return}}}function fr(H,ee){let fe=Qt(H,ee);return yt(H,fe)}var Qr=Object.hasOwnProperty,_r=$t(ni(),1),ai=(0,_r.default)();function de(H){return H.document.body.dataset.slug}var J=(H,ee,fe)=>{let De=new URL(H.getAttribute(ee),fe);H.setAttribute(ee,De.pathname+De.hash)};function pe(H,ee){H.querySelectorAll('[href=""], [href^="./"], [href^="../"]').forEach(fe=>J(fe,"href",ee)),H.querySelectorAll('[src=""], [src^="./"], [src^="../"]').forEach(fe=>J(fe,"src",ee))}var Je=//;async function st(H){let ee=await fetch(`${H}`);if(!ee.headers.get("content-type")?.startsWith("text/html"))return ee;let fe=await ee.clone().text(),[De,Ge]=fe.match(Je)??[];return Ge?fetch(`${new URL(Ge,H)}`):ee}var pt=1,tt=document.createElement("route-announcer"),_t=H=>H?.nodeType===pt,ct=H=>{try{let ee=new URL(H);if(window.location.origin===ee.origin)return!0}catch{}return!1},ut=H=>{let ee=H.origin===window.location.origin,fe=H.pathname===window.location.pathname;return ee&&fe},kt=({target:H})=>{if(!_t(H)||H.attributes.getNamedItem("target")?.value==="_blank")return;let ee=H.closest("a");if(!ee||"routerIgnore"in ee.dataset)return;let{href:fe}=ee;if(ct(fe))return{url:new URL(fe),scroll:"routerNoscroll"in ee.dataset?!1:void 0}};function Fe(H){let ee=new CustomEvent("nav",{detail:{url:H}});document.dispatchEvent(ee)}var We=new Set;window.addCleanup=H=>We.add(H);function be(){let H=document.createElement("div");H.className="navigation-progress",H.style.width="0",document.body.contains(H)||document.body.appendChild(H),setTimeout(()=>{H.style.width="80%"},100)}var ke=!1,mt;async function Pe(H,ee=!1){ke=!0,be(),mt=mt||new DOMParser;let fe=await st(H).then(ge=>{if(ge.headers.get("content-type")?.startsWith("text/html"))return ge.text();window.location.assign(H)}).catch(()=>{window.location.assign(H)});if(!fe)return;let De=new CustomEvent("prenav",{detail:{}});document.dispatchEvent(De),We.forEach(ge=>ge()),We.clear();let Ge=mt.parseFromString(fe,"text/html");pe(Ge,H);let Me=Ge.querySelector("title")?.textContent;if(Me)document.title=Me;else{let ge=document.querySelector("h1");Me=ge?.innerText??ge?.textContent??H.pathname}tt.textContent!==Me&&(tt.textContent=Me),tt.dataset.persist="",Ge.body.appendChild(tt),await fr(document.body,Ge.body),ee||(H.hash?document.getElementById(decodeURIComponent(H.hash.substring(1)))?.scrollIntoView():window.scrollTo({top:0})),document.head.querySelectorAll(":not([data-persist])").forEach(ge=>ge.remove()),Ge.head.querySelectorAll(":not([data-persist])").forEach(ge=>document.head.appendChild(ge)),ee||history.pushState({},"",H),Fe(de(window)),delete tt.dataset.persist}async function ft(H,ee=!1){if(!ke){ke=!0;try{await Pe(H,ee)}catch(fe){console.error(fe),window.location.assign(H)}finally{ke=!1}}}window.spaNavigate=ft;function Ut(){return typeof window<"u"&&(window.addEventListener("click",async H=>{let{url:ee}=kt(H)??{};if(!(!ee||H.ctrlKey||H.metaKey)){if(H.preventDefault(),ut(ee)&&ee.hash){document.getElementById(decodeURIComponent(ee.hash.substring(1)))?.scrollIntoView(),history.pushState({},"",ee);return}ft(ee,!1)}}),window.addEventListener("popstate",H=>{let{url:ee}=kt(H)??{};window.location.hash&&window.location.pathname===ee?.pathname||ft(new URL(window.location.toString()),!0)})),new class{go(H){let ee=new URL(H,window.location.toString());return ft(ee,!1)}back(){return window.history.back()}forward(){return window.history.forward()}}}if(Ut(),Fe(de(window)),!customElements.get("route-announcer")){let H={"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,fe]of Object.entries(H))this.setAttribute(ee,fe)}})}})();