(function(){var gt='',Pt='';document.addEventListener("nav",()=>{let jt=document.getElementsByTagName("pre");for(let Et=0;Et{ze.blur(),ze.innerHTML=Pt,setTimeout(()=>{ze.innerHTML=gt,ze.style.borderColor=""},2e3)},Rt=>console.error(Rt))};var it=v;let Ue=Bt.innerText.replace(/\n\n/g,` `),ze=document.createElement("button");ze.className="clipboard-button",ze.type="button",ze.innerHTML=gt,ze.ariaLabel="Copy source",ze.addEventListener("click",v),window.addCleanup(()=>ze.removeEventListener("click",v)),jt[Et].prepend(ze)}}})})(),function(){var gt=Object.create,Pt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,it=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty,v=(c,g)=>()=>(g||c((g={exports:{}}).exports,g),g.exports),Ue=(c,g,m,x)=>{if(g&&typeof g=="object"||typeof g=="function")for(let w of it(g))!Bt.call(c,w)&&w!==m&&Pt(c,w,{get:()=>g[w],enumerable:!(x=jt(g,w))||x.enumerable});return c},ze=(c,g,m)=>(m=c!=null?gt(Et(c)):{},Ue(g||!c||!c.__esModule?Pt(m,"default",{value:c,enumerable:!0}):m,c)),Rt=v(()=>{}),ht=v((c,g)=>{"use strict";g.exports=x;function m(S){return S instanceof Buffer?Buffer.from(S):new S.constructor(S.buffer.slice(),S.byteOffset,S.length)}function x(S){if(S=S||{},S.circles)return w(S);let k=new Map;if(k.set(Date,V=>new Date(V)),k.set(Map,(V,L)=>new Map(N(Array.from(V),L))),k.set(Set,(V,L)=>new Set(N(Array.from(V),L))),S.constructorHandlers)for(let V of S.constructorHandlers)k.set(V[0],V[1]);let B=null;return S.proto?F:X;function N(V,L){let I=Object.keys(V),D=new Array(I.length);for(let $=0;$new Date(I)),N.set(Map,(I,D)=>new Map(F(Array.from(I),D))),N.set(Set,(I,D)=>new Set(F(Array.from(I),D))),S.constructorHandlers)for(let I of S.constructorHandlers)N.set(I[0],I[1]);let X=null;return S.proto?L:V;function F(I,D){let $=Object.keys(I),se=new Array($.length);for(let xe=0;xe<$.length;xe++){let Me=$[xe],Ge=I[Me];if(typeof Ge!="object"||Ge===null)se[Me]=Ge;else if(Ge.constructor!==Object&&(X=N.get(Ge.constructor)))se[Me]=X(Ge,D);else if(ArrayBuffer.isView(Ge))se[Me]=m(Ge);else{let ct=k.indexOf(Ge);ct!==-1?se[Me]=B[ct]:se[Me]=D(Ge)}}return se}function V(I){if(typeof I!="object"||I===null)return I;if(Array.isArray(I))return F(I,V);if(I.constructor!==Object&&(X=N.get(I.constructor)))return X(I,V);let D={};k.push(I),B.push(D);for(let $ in I){if(Object.hasOwnProperty.call(I,$)===!1)continue;let se=I[$];if(typeof se!="object"||se===null)D[$]=se;else if(se.constructor!==Object&&(X=N.get(se.constructor)))D[$]=X(se,V);else if(ArrayBuffer.isView(se))D[$]=m(se);else{let xe=k.indexOf(se);xe!==-1?D[$]=B[xe]:D[$]=V(se)}}return k.pop(),B.pop(),D}function L(I){if(typeof I!="object"||I===null)return I;if(Array.isArray(I))return F(I,L);if(I.constructor!==Object&&(X=N.get(I.constructor)))return X(I,L);let D={};k.push(I),B.push(D);for(let $ in I){let se=I[$];if(typeof se!="object"||se===null)D[$]=se;else if(se.constructor!==Object&&(X=N.get(se.constructor)))D[$]=X(se,L);else if(ArrayBuffer.isView(se))D[$]=m(se);else{let xe=k.indexOf(se);xe!==-1?D[$]=B[xe]:D[$]=L(se)}}return k.pop(),B.pop(),D}}}),G;function kt(c){return typeof c<"u"?c:!0}function je(c){let g=Array(c);for(let m=0;m=this.B&&(V||!F[D])){var S=Zt(L,x,I),k="";switch(this.G){case"full":if(2S;B--)if(B-S>=this.B){var N=Zt(L,x,I,w,S);k=D.substring(S,B),Yt(this,F,k,N,c,m)}break}case"reverse":if(1=this.B&&Yt(this,F,k,Zt(L,x,I,w,B),c,m);k=""}case"forward":if(1=this.B&&Yt(this,F,k,S,c,m);break}default:if(this.C&&(S=Math.min(S/this.C(g,D,I)|0,L-1)),Yt(this,F,D,S,c,m),V&&1=this.B&&!w[D]){w[D]=1;let $=this.l&&D>S;Yt(this,X,$?S:D,Zt(k+(x/2>k?0:1),x,I,B-1,N-1),c,m,$?D:S)}}}}}this.m||(this.register[c]=1)}}return this};function Zt(c,g,m,x,w){return m&&1=this.B&&!m[L])if(this.s||S||this.map[L])N[V++]=L,m[L]=1;else return x;c=N,w=c.length}if(!w)return x;g||(g=100),B=this.depth&&1=x))));L++);if(F){if(S)return W(N,x,0);g[g.length]=N;return}}return!m&&N}function W(c,g,m){return c=c.length===1?c[0]:[].concat.apply([],c),m||c.length>g?c.slice(m,m+g):c}function re(c,g,m,x){return m?(x=x&&g>m,c=(c=c[x?g:m])&&c[x?m:g]):c=c[g],c}G.contain=function(c){return!!this.register[c]},G.update=function(c,g){return this.remove(c).add(c,g)},G.remove=function(c,g){let m=this.register[c];if(m){if(this.m)for(let x=0,w;x"u"&&(k=new Promise(X=>{S=X}));let B,N;switch(w||(w=0)){case 0:if(B="reg",this.m){N=pe();for(let X in this.register)N[X]=1}else N=this.register;break;case 1:B="cfg",N={doc:0,opt:this.s?1:0};break;case 2:B="map",N=this.map;break;case 3:B="ctx",N=this.h;break;default:typeof m>"u"&&S&&S();return}return Ai(c,g||this,m,B,x,w,N,S),k},G.import=function(c,g){if(g)switch(dt(g)&&(g=JSON.parse(g)),c){case"cfg":this.s=!!g.opt;break;case"reg":this.m=!1,this.register=g;break;case"map":this.map=g;break;case"ctx":this.h=g}},Fi(Xt.prototype);function _e(c){c=c.data;var g=self._index;let m=c.args;var x=c.task;switch(x){case"init":x=c.options||{},c=c.factory,g=x.encode,x.cache=!1,g&&g.indexOf("function")===0&&(x.encode=Function("return "+g)()),c?(Function("return "+c)()(self),self._index=new self.FlexSearch.Index(x),delete self.FlexSearch):self._index=new Xt(x);break;default:c=c.id,g=g[x].apply(g,m),postMessage(x==="search"?{id:c,msg:g}:{id:c})}}var we=0;function ye(c){if(!(this instanceof ye))return new ye(c);var g;c?Je(g=c.encode)&&(c.encode=g.toString()):c={},(g=(self||window)._factory)&&(g=g.toString());let m=typeof window>"u"&&self.exports,x=this;this.o=qe(g,m,c.worker),this.h=pe(),this.o&&(m?this.o.on("message",function(w){x.h[w.id](w.msg),delete x.h[w.id]}):this.o.onmessage=function(w){w=w.data,x.h[w.id](w.msg),delete x.h[w.id]},this.o.postMessage({task:"init",factory:g,options:c}))}Ce("add"),Ce("append"),Ce("search"),Ce("update"),Ce("remove");function Ce(c){ye.prototype[c]=ye.prototype[c+"Async"]=function(){let g=this,m=[].slice.call(arguments);var x=m[m.length-1];let w;return Je(x)&&(w=x,m.splice(m.length-1,1)),x=new Promise(function(S){setTimeout(function(){g.h[++we]=S,g.o.postMessage({task:c,id:we,args:m})})}),w?(x.then(w),this):x}}function qe(c,g,m){let x;try{x=g?new(Rt()).Worker(__dirname+"/node/node.js"):c?new Worker(URL.createObjectURL(new Blob(["onmessage="+_e.toString()],{type:"text/javascript"}))):new Worker(dt(m)?m:"worker/worker.js",{type:"module"})}catch{}return x}function Ke(c){if(!(this instanceof Ke))return new Ke(c);var g=c.document||c.doc||c,m;this.K=[],this.h=[],this.A=[],this.register=pe(),this.key=(m=g.key||g.id)&&ut(m,this.A)||"id",this.m=kt(c.fastupdate),this.C=(m=g.store)&&m!==!0&&[],this.store=m&&pe(),this.I=(m=g.tag)&&ut(m,this.A),this.l=m&&pe(),this.cache=(m=c.cache)&&new Kt(m),c.cache=!1,this.o=c.worker,this.async=!1,m=pe();let x=g.index||g.field||g;dt(x)&&(x=[x]);for(let w=0,S,k;wg||m)&&(w=w.slice(m,m+g)),x&&(w=Se.call(this,w)),{tag:c,result:w}}function Se(c){let g=Array(c.length);for(let m=0,x;m"u"&&(k=new Promise(B=>{S=B})),w||(w=0),x||(x=0),xc?.removeEventListener("click",m)),document.addEventListener("keydown",x),window.addCleanup(()=>document.removeEventListener("keydown",x))}function bt(c){for(;c.firstChild;)c.removeChild(c.firstChild)}var Xe=Object.hasOwnProperty,fr=ze(ht(),1),Ve=(0,fr.default)();function wt(c){let g=Qr(Jr(c,"index"),!0);return g.length===0?"/":g}var tr=(c,g,m)=>{let x=new URL(c.getAttribute(g),m);c.setAttribute(g,x.pathname+x.hash)};function Kr(c,g){c.querySelectorAll('[href^="./"], [href^="../"]').forEach(m=>tr(m,"href",g)),c.querySelectorAll('[src^="./"], [src^="../"]').forEach(m=>tr(m,"src",g))}function Zr(c){let g=c.split("/").filter(m=>m!=="").slice(0,-1).map(m=>"..").join("/");return g.length===0&&(g="."),g}function Le(c,g){return Ht(Zr(c),wt(g))}function Ht(...c){return c.filter(g=>g!=="").join("/").replace(/\/\/+/g,"/")}function Br(c,g){return c===g||c.endsWith("/"+g)}function Jr(c,g){return Br(c,g)&&(c=c.slice(0,-g.length)),c}function Qr(c,g){return c.startsWith("/")&&(c=c.substring(1)),!g&&c.endsWith("/")&&(c=c.slice(0,-1)),c}var xi="basic",Ct="",Ir=c=>c.toLowerCase().split(/([^a-z]|[^\x00-\x7F])/),Ni=new at.Document({charset:"latin:extra",encode:Ir,document:{id:"id",tag:"tags",index:[{field:"title",tokenize:"forward"},{field:"content",tokenize:"forward"},{field:"tags",tokenize:"forward"}]}}),pr=new DOMParser,en=new Map,ir=30,Gr=8,Or=5,tn=c=>{let g=c.split(/\s+/).filter(x=>x.trim()!==""),m=g.length;if(m>1)for(let x=1;xw.length-x.length)};function Hi(c,g,m){let x=tn(c),w=g.split(/\s+/).filter(N=>N!==""),S=0,k=w.length-1;if(m){let N=L=>x.some(I=>L.toLowerCase().startsWith(I.toLowerCase())),X=w.map(N),F=0,V=0;for(let L=0;LD+($?1:0),0);I>=F&&(F=I,V=L)}S=Math.max(V-ir,0),k=Math.min(S+2*ir,w.length-1),w=w.slice(S,k)}let B=w.map(N=>{for(let X of x)if(N.toLowerCase().includes(X.toLowerCase())){let F=new RegExp(X.toLowerCase(),"gi");return N.replace(F,'$&')}return N}).join(" ");return`${S===0?"":"..."}${B}${k===w.length-1?"":"..."}`}function ot(c,g){let m=new DOMParser,x=tn(c),w=m.parseFromString(g.innerHTML,"text/html"),S=B=>{let N=document.createElement("span");return N.className="highlight",N.textContent=B,N},k=(B,N)=>{if(B.nodeType===Node.TEXT_NODE){let X=B.nodeValue??"",F=new RegExp(N.toLowerCase(),"gi"),V=X.match(F);if(!V||V.length===0)return;let L=document.createElement("span"),I=0;for(let D of V){let $=X.indexOf(D,I);L.appendChild(document.createTextNode(X.slice(I,$))),L.appendChild(S(D)),I=$+D.length}L.appendChild(document.createTextNode(X.slice(I))),B.parentNode?.replaceChild(L,B)}else if(B.nodeType===Node.ELEMENT_NODE){if(B.classList.contains("highlight"))return;Array.from(B.childNodes).forEach(X=>k(X,N))}};for(let B of x)k(w.body,B);return w.body}document.addEventListener("nav",async c=>{let g=c.detail.url,m=await fetchData,x=document.getElementById("search-container"),w=x?.closest(".sidebar"),S=document.getElementById("search-button"),k=document.getElementById("search-bar"),B=document.getElementById("search-layout"),N=Object.keys(m),X=Ae=>{B?.querySelector(`#${Ae.id}`)===null&&B?.appendChild(Ae)},F=B?.dataset?.preview==="true",V,L,I=document.createElement("div");I.id="results-container",X(I),F&&(V=document.createElement("div"),V.id="preview-container",X(V));function D(){x?.classList.remove("active"),k&&(k.value=""),w&&(w.style.zIndex="unset"),I&&bt(I),V&&bt(V),B&&B.classList.remove("display-results"),xi="basic",S?.focus()}function $(Ae){xi=Ae,w&&(w.style.zIndex="1"),x?.classList.add("active"),k?.focus()}let se=null;async function xe(Ae){if(Ae.key==="k"&&(Ae.ctrlKey||Ae.metaKey)&&!Ae.shiftKey){Ae.preventDefault(),x?.classList.contains("active")?D():$("basic");return}else if(Ae.shiftKey&&(Ae.ctrlKey||Ae.metaKey)&&Ae.key.toLowerCase()==="k"){Ae.preventDefault(),x?.classList.contains("active")?D():$("tags"),k&&(k.value="#");return}if(se&&se.classList.remove("focus"),!!x?.classList.contains("active")){if(Ae.key==="Enter")if(I?.contains(document.activeElement)){let Be=document.activeElement;if(Be.classList.contains("no-match"))return;await di(Be),Be.click()}else{let Be=document.getElementsByClassName("result-card")[0];if(!Be||Be?.classList.contains("no-match"))return;await di(Be),Be.click()}else if(Ae.key==="ArrowUp"||Ae.shiftKey&&Ae.key==="Tab"){if(Ae.preventDefault(),I?.contains(document.activeElement)){let Be=se||document.activeElement,He=Be?.previousElementSibling;Be?.classList.remove("focus"),He?.focus(),He&&(se=He),await di(He)}}else if((Ae.key==="ArrowDown"||Ae.key==="Tab")&&(Ae.preventDefault(),document.activeElement===k||se!==null)){let Be=se||document.getElementsByClassName("result-card")[0],He=Be?.nextElementSibling;Be?.classList.remove("focus"),He?.focus(),He&&(se=He),await di(He)}}}let Me=(Ae,Be)=>{let He=N[Be];return{id:Be,slug:He,title:xi==="tags"?m[He].title:Hi(Ae,m[He].title??""),content:Hi(Ae,m[He].content??"",!0),tags:Ge(Ae.substring(1),m[He].tags)}};function Ge(Ae,Be){return!Be||xi!=="tags"?[]:Be.map(He=>He.toLowerCase().includes(Ae.toLowerCase())?`
  • #${He}

  • `:`
  • #${He}

  • `).slice(0,Or)}function ct(Ae){return new URL(Le(g,Ae),location.toString())}let Qt=({slug:Ae,title:Be,content:He,tags:ft})=>{let et=ft.length>0?`
      ${ft.join("")}
    `:"",lt=document.createElement("a");lt.classList.add("result-card"),lt.id=Ae,lt.href=ct(Ae).toString(),lt.innerHTML=`

    ${Be}

    ${et}${F&&window.innerWidth>600?"":`

    ${He}

    `}`,lt.addEventListener("click",oi=>{oi.altKey||oi.ctrlKey||oi.metaKey||oi.shiftKey||D()});let zt=oi=>{oi.altKey||oi.ctrlKey||oi.metaKey||oi.shiftKey||D()};async function Ci(oi){if(!oi.target)return;let ko=oi.target;await di(ko)}return lt.addEventListener("mouseenter",Ci),window.addCleanup(()=>lt.removeEventListener("mouseenter",Ci)),lt.addEventListener("click",zt),window.addCleanup(()=>lt.removeEventListener("click",zt)),lt};async function ei(Ae){if(I)if(bt(I),Ae.length===0?I.innerHTML=`

    No results.

    Try another search term?

    `:I.append(...Ae.map(Qt)),Ae.length===0&&V)bt(V);else{let Be=I.firstElementChild;Be.classList.add("focus"),se=Be,await di(Be)}}async function qt(Ae){if(en.has(Ae))return en.get(Ae);let Be=ct(Ae).toString(),He=await fetch(Be).then(ft=>ft.text()).then(ft=>{if(ft===void 0)throw new Error(`Could not fetch ${Be}`);let et=pr.parseFromString(ft??"","text/html");return Kr(et,Be),[...et.getElementsByClassName("popover-hint")]});return en.set(Ae,He),He}async function di(Ae){if(!B||!F||!Ae||!V)return;let Be=Ae.id,He=await qt(Be).then(ft=>ft.flatMap(et=>[...ot(Ct,et).children]));L=document.createElement("div"),L.classList.add("preview-inner"),L.append(...He),V.replaceChildren(L),[...V.querySelectorAll(".highlight")].sort((ft,et)=>et.innerHTML.length-ft.innerHTML.length)[0]?.scrollIntoView({block:"start"})}async function Ut(Ae){if(!B||!Ni)return;Ct=Ae.target.value,B.classList.toggle("display-results",Ct!==""),xi=Ct.startsWith("#")?"tags":"basic";let Be;if(xi==="tags"){Ct=Ct.substring(1).trim();let et=Ct.indexOf(" ");if(et!=-1){let lt=Ct.substring(0,et),zt=Ct.substring(et+1).trim();Be=await Ni.searchAsync({query:zt,limit:Math.max(Gr,1e4),index:["title","content"],tag:lt});for(let Ci of Be)Ci.result=Ci.result.slice(0,Gr);xi="basic",Ct=zt}else Be=await Ni.searchAsync({query:Ct,limit:Gr,index:["tags"]})}else xi==="basic"&&(Be=await Ni.searchAsync({query:Ct,limit:Gr,index:["title","content"]}));let He=et=>{let lt=Be.filter(zt=>zt.field===et);return lt.length===0?[]:[...lt[0].result]},ft=[...new Set([...He("title"),...He("content"),...He("tags")])].map(et=>Me(Ct,et));await ei(ft)}document.addEventListener("keydown",xe),window.addCleanup(()=>document.removeEventListener("keydown",xe)),S?.addEventListener("click",()=>$("basic")),window.addCleanup(()=>S?.removeEventListener("click",()=>$("basic"))),k?.addEventListener("input",Ut),window.addCleanup(()=>k?.removeEventListener("input",Ut)),dr(x,D),await E(m)});async function E(c){let g=0,m=[];for(let[x,w]of Object.entries(c))m.push(Ni.addAsync(g++,{id:g,slug:x,title:w.title,content:w.content,tags:w.tags}));return await Promise.all(m)}}(),function(){var gt,Pt=new IntersectionObserver(Ue=>{let ze=document.getElementById("explorer-ul");if(ze)for(let Rt of Ue)Rt.isIntersecting?ze.classList.add("no-background"):ze.classList.remove("no-background")});function jt(){this.classList.toggle("collapsed"),this.setAttribute("aria-expanded",this.getAttribute("aria-expanded")==="true"?"false":"true");let Ue=this.nextElementSibling;Ue&&(Ue.classList.toggle("collapsed"),Ue.style.maxHeight=Ue.style.maxHeight==="0px"?Ue.scrollHeight+"px":"0px")}function it(Ue){Ue.stopPropagation();let ze=Ue.target;if(!ze)return;let Rt=ze.nodeName==="svg",ht=Rt?ze.parentElement?.nextSibling:ze.parentElement?.parentElement?.nextElementSibling,G=Rt?ze.nextElementSibling:ze.parentElement;if(!(ht&&G))return;ht.classList.toggle("open");let kt=ht.classList.contains("open");Bt(ht,!kt);let je=G.dataset.folderpath;v(gt,je);let pe=JSON.stringify(gt);localStorage.setItem("fileTree",pe)}function Et(){let Ue=document.getElementById("explorer");if(!Ue)return;if(Ue.dataset.behavior==="collapse")for(let je of document.getElementsByClassName("folder-button"))je.addEventListener("click",it),window.addCleanup(()=>je.removeEventListener("click",it));Ue.addEventListener("click",jt),window.addCleanup(()=>Ue.removeEventListener("click",jt));for(let je of document.getElementsByClassName("folder-icon"))je.addEventListener("click",it),window.addCleanup(()=>je.removeEventListener("click",it));let ze=localStorage.getItem("fileTree"),Rt=Ue?.dataset.savestate==="true",ht=ze&&Rt?JSON.parse(ze):[],G=new Map(ht.map(je=>[je.path,je.collapsed])),kt=Ue.dataset.tree?JSON.parse(Ue.dataset.tree):[];gt=[];for(let{path:je,collapsed:pe}of kt)gt.push({path:je,collapsed:G.get(je)??pe});gt.map(je=>{let pe=document.querySelector(`[data-folderpath='${je.path}']`)?.parentElement?.nextElementSibling;pe&&Bt(pe,je.collapsed)})}window.addEventListener("resize",Et),document.addEventListener("nav",()=>{Et(),Pt.disconnect();let Ue=document.getElementById("explorer-end");Ue&&Pt.observe(Ue)});function Bt(Ue,ze){return ze?Ue.classList.remove("open"):Ue.classList.add("open")}function v(Ue,ze){let Rt=Ue.find(ht=>ht.path===ze);Rt&&(Rt.collapsed=!Rt.collapsed)}}(),function(){var gt=Object.create,Pt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,it=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty,v=(e,t)=>()=>(e&&(t=e(e=0)),t),Ue=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ze=(e,t)=>{for(var i in t)Pt(e,i,{get:t[i],enumerable:!0})},Rt=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of it(t))!Bt.call(e,n)&&n!==i&&Pt(e,n,{get:()=>t[n],enumerable:!(r=jt(t,n))||r.enumerable});return e},ht=(e,t,i)=>(i=e!=null?gt(Et(e)):{},Rt(t||!e||!e.__esModule?Pt(i,"default",{value:e,enumerable:!0}):i,e)),G,kt,je,pe,te=v(()=>{"use strict";G=(e=>(e.Application="application",e.WebGLPipes="webgl-pipes",e.WebGLPipesAdaptor="webgl-pipes-adaptor",e.WebGLSystem="webgl-system",e.WebGPUPipes="webgpu-pipes",e.WebGPUPipesAdaptor="webgpu-pipes-adaptor",e.WebGPUSystem="webgpu-system",e.CanvasSystem="canvas-system",e.CanvasPipesAdaptor="canvas-pipes-adaptor",e.CanvasPipes="canvas-pipes",e.Asset="asset",e.LoadParser="load-parser",e.ResolveParser="resolve-parser",e.CacheParser="cache-parser",e.DetectionParser="detection-parser",e.MaskEffect="mask-effect",e.BlendMode="blend-mode",e.TextureSource="texture-source",e.Environment="environment",e.ShapeBuilder="shape-builder",e))(G||{}),kt=e=>{if(typeof e=="function"||typeof e=="object"&&e.extension){if(!e.extension)throw new Error("Extension class must have an extension object");e={...typeof e.extension!="object"?{type:e.extension}:e.extension,ref:e}}if(typeof e=="object")e={...e};else throw new Error("Invalid extension type");return typeof e.type=="string"&&(e.type=[e.type]),e},je=(e,t)=>kt(e).priority??t,pe={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...e){return e.map(kt).forEach(t=>{t.type.forEach(i=>this._removeHandlers[i]?.(t))}),this},add(...e){return e.map(kt).forEach(t=>{t.type.forEach(i=>{let r=this._addHandlers,n=this._queue;r[i]?r[i]?.(t):(n[i]=n[i]||[],n[i]?.push(t))})}),this},handle(e,t,i){let r=this._addHandlers,n=this._removeHandlers;if(r[e]||n[e])throw new Error(`Extension type ${e} already has a handler`);r[e]=t,n[e]=i;let s=this._queue;return s[e]&&(s[e]?.forEach(a=>t(a)),delete s[e]),this},handleByMap(e,t){return this.handle(e,i=>{i.name&&(t[i.name]=i.ref)},i=>{i.name&&delete t[i.name]})},handleByNamedList(e,t,i=-1){return this.handle(e,r=>{t.findIndex(n=>n.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((n,s)=>je(s.value,i)-je(n.value,i)))},r=>{let n=t.findIndex(s=>s.name===r.name);n!==-1&&t.splice(n,1)})},handleByList(e,t,i=-1){return this.handle(e,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((n,s)=>je(s,i)-je(n,i)))},r=>{let n=t.indexOf(r.ref);n!==-1&&t.splice(n,1)})}}}),dt=Ue((e,t)=>{"use strict";var i=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function s(h,u,d){this.fn=h,this.context=u,this.once=d||!1}function a(h,u,d,p,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var y=new s(d,p||h,f),b=r?r+u:u;return h._events[b]?h._events[b].fn?h._events[b]=[h._events[b],y]:h._events[b].push(y):(h._events[b]=y,h._eventsCount++),h}function o(h,u){--h._eventsCount===0?h._events=new n:delete h._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var h=[],u,d;if(this._eventsCount===0)return h;for(d in u=this._events)i.call(u,d)&&h.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(u)):h},l.prototype.listeners=function(h){var u=r?r+h:h,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var p=0,f=d.length,y=new Array(f);p{Nt=ht(dt(),1),Je=Nt.default}),Ui,It,rt,mt,nt,Qi,yi,cr,ui,Gt,Fi,si,Ot,Di,Kt,Li,er,Ai,Xt,Zt,Yt,ai,W,re,fe,_e,we,ye,Ce,qe=v(()=>{Ui={grad:.9,turn:360,rad:360/(2*Math.PI)},It=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},rt=function(e,t,i){return t===void 0&&(t=0),i===void 0&&(i=Math.pow(10,t)),Math.round(i*e)/i+0},mt=function(e,t,i){return t===void 0&&(t=0),i===void 0&&(i=1),e>i?i:e>t?e:t},nt=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Qi=function(e){return{r:mt(e.r,0,255),g:mt(e.g,0,255),b:mt(e.b,0,255),a:mt(e.a)}},yi=function(e){return{r:rt(e.r),g:rt(e.g),b:rt(e.b),a:rt(e.a,3)}},cr=/^#([0-9a-f]{3,8})$/i,ui=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Gt=function(e){var t=e.r,i=e.g,r=e.b,n=e.a,s=Math.max(t,i,r),a=s-Math.min(t,i,r),o=a?s===t?(i-r)/a:s===i?2+(r-t)/a:4+(t-i)/a:0;return{h:60*(o<0?o+6:o),s:s?a/s*100:0,v:s/255*100,a:n}},Fi=function(e){var t=e.h,i=e.s,r=e.v,n=e.a;t=t/360*6,i/=100,r/=100;var s=Math.floor(t),a=r*(1-i),o=r*(1-(t-s)*i),l=r*(1-(1-t+s)*i),h=s%6;return{r:255*[r,o,a,a,l,r][h],g:255*[l,r,r,o,a,a][h],b:255*[a,a,l,r,r,o][h],a:n}},si=function(e){return{h:nt(e.h),s:mt(e.s,0,100),l:mt(e.l,0,100),a:mt(e.a)}},Ot=function(e){return{h:rt(e.h),s:rt(e.s),l:rt(e.l),a:rt(e.a,3)}},Di=function(e){return Fi((i=(t=e).s,{h:t.h,s:(i*=((r=t.l)<50?r:100-r)/100)>0?2*i/(r+i)*100:0,v:r+i,a:t.a}));var t,i,r},Kt=function(e){return{h:(t=Gt(e)).h,s:(n=(200-(i=t.s))*(r=t.v)/100)>0&&n<200?i*r/100/(n<=100?n:200-n)*100:0,l:n/2,a:t.a};var t,i,r,n},Li=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,er=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ai=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zt={string:[[function(e){var t=cr.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?rt(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?rt(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Ai.exec(e)||Xt.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Qi({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=Li.exec(e)||er.exec(e);if(!t)return null;var i,r,n=si({h:(i=t[1],r=t[2],r===void 0&&(r="deg"),Number(i)*(Ui[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Di(n)},"hsl"]],object:[[function(e){var t=e.r,i=e.g,r=e.b,n=e.a,s=n===void 0?1:n;return It(t)&&It(i)&&It(r)?Qi({r:Number(t),g:Number(i),b:Number(r),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,i=e.s,r=e.l,n=e.a,s=n===void 0?1:n;if(!It(t)||!It(i)||!It(r))return null;var a=si({h:Number(t),s:Number(i),l:Number(r),a:Number(s)});return Di(a)},"hsl"],[function(e){var t=e.h,i=e.s,r=e.v,n=e.a,s=n===void 0?1:n;if(!It(t)||!It(i)||!It(r))return null;var a=function(o){return{h:nt(o.h),s:mt(o.s,0,100),v:mt(o.v,0,100),a:mt(o.a)}}({h:Number(t),s:Number(i),v:Number(r),a:Number(s)});return Fi(a)},"hsv"]]},Yt=function(e,t){for(var i=0;i=.5},e.prototype.toHex=function(){return t=yi(this.rgba),i=t.r,r=t.g,n=t.b,a=(s=t.a)<1?ui(rt(255*s)):"","#"+ui(i)+ui(r)+ui(n)+a;var t,i,r,n,s,a},e.prototype.toRgb=function(){return yi(this.rgba)},e.prototype.toRgbString=function(){return t=yi(this.rgba),i=t.r,r=t.g,n=t.b,(s=t.a)<1?"rgba("+i+", "+r+", "+n+", "+s+")":"rgb("+i+", "+r+", "+n+")";var t,i,r,n,s},e.prototype.toHsl=function(){return Ot(Kt(this.rgba))},e.prototype.toHslString=function(){return t=Ot(Kt(this.rgba)),i=t.h,r=t.s,n=t.l,(s=t.a)<1?"hsla("+i+", "+r+"%, "+n+"%, "+s+")":"hsl("+i+", "+r+"%, "+n+"%)";var t,i,r,n,s},e.prototype.toHsv=function(){return t=Gt(this.rgba),{h:rt(t.h),s:rt(t.s),v:rt(t.v),a:rt(t.a,3)};var t},e.prototype.invert=function(){return we({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),we(W(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),we(W(this.rgba,-t))},e.prototype.grayscale=function(){return we(W(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),we(fe(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),we(fe(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?we({r:(i=this.rgba).r,g:i.g,b:i.b,a:t}):rt(this.rgba.a,3);var i},e.prototype.hue=function(t){var i=Kt(this.rgba);return typeof t=="number"?we({h:t,s:i.s,l:i.l,a:i.a}):rt(i.h)},e.prototype.isEqual=function(t){return this.toHex()===we(t).toHex()},e}(),we=function(e){return e instanceof _e?e:new _e(e)},ye=[],Ce=function(e){e.forEach(function(t){ye.indexOf(t)<0&&(t(_e,Zt),ye.push(t))})}});function Ke(e,t){var i={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var n in i)r[i[n]]=n;var s={};e.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,l,h=r[this.toHex()];if(h)return h;if(a?.closest){var u=this.toRgb(),d=1/0,p="black";if(!s.length)for(var f in i)s[f]=new e(i[f]).toRgb();for(var y in i){var b=(o=u,l=s[y],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));b{}),_t,ue,Ie=v(()=>{qe(),ut(),Ce([Ke]),_t=class As{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof As)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._normalize(t),this._value=this._cloneSource(t))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,i){let r=typeof t;if(r!==typeof i)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===i;if(Array.isArray(t)&&Array.isArray(i)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(i))return t.length!==i.length?!1:t.every((n,s)=>n===i[s]);if(t!==null&&i!==null){let n=Object.keys(t),s=Object.keys(i);return n.length!==s.length?!1:n.every(a=>t[a]===i[a])}return t===i}toRgba(){let[t,i,r,n]=this._components;return{r:t,g:i,b:r,a:n}}toRgb(){let[t,i,r]=this._components;return{r:t,g:i,b:r}}toRgbaString(){let[t,i,r]=this.toUint8RgbArray();return`rgba(${t},${i},${r},${this.alpha})`}toUint8RgbArray(t){let[i,r,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb,t[0]=Math.round(i*255),t[1]=Math.round(r*255),t[2]=Math.round(n*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t=t||this._arrayRgba;let[i,r,n,s]=this._components;return t[0]=i,t[1]=r,t[2]=n,t[3]=s,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb;let[i,r,n]=this._components;return t[0]=i,t[1]=r,t[2]=n,t}toNumber(){return this._int}toBgrNumber(){let[t,i,r]=this.toUint8RgbArray();return(r<<16)+(i<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[i,r,n,s]=As._temp.setValue(t)._components;return this._components[0]*=i,this._components[1]*=r,this._components[2]*=n,this._components[3]*=s,this._refreshInt(),this._value=null,this}premultiply(t,i=!0){return i&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,i=!0){if(t===1)return(255<<24)+this._int;if(t===0)return i?0:this._int;let r=this._int>>16&255,n=this._int>>8&255,s=this._int&255;return i&&(r=r*t+.5|0,n=n*t+.5|0,s=s*t+.5|0),(t*255<<24)+(r<<16)+(n<<8)+s}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let i,r,n,s;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let a=t;i=(a>>16&255)/255,r=(a>>8&255)/255,n=(a&255)/255,s=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[i,r,n,s=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[i,r,n,s=255]=t,i/=255,r/=255,n/=255,s/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let o=As.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}let a=we(t);a.isValid()&&({r:i,g:r,b:n,a:s}=a.rgba,i/=255,r/=255,n/=255)}if(i!==void 0)this._components[0]=i,this._components[1]=r,this._components[2]=n,this._components[3]=s,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,i,r]=this._components;this._int=(t*255<<16)+(i*255<<8)+(r*255|0)}_clamp(t,i=0,r=1){return typeof t=="number"?Math.min(Math.max(t,i),r):(t.forEach((n,s)=>{t[s]=Math.min(Math.max(n,i),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof As||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}},_t.shared=new _t,_t._temp=new _t,_t.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i,ue=_t}),ve,Se=v(()=>{"use strict";ve={cullArea:null,cullable:!1,cullableChildren:!0}}),$e,Fe,st,Jt=v(()=>{"use strict";$e=Math.PI*2,Fe=180/Math.PI,st=Math.PI/180}),De,ci,At=v(()=>{"use strict";De=class $_{constructor(t=0,i=0){this.x=0,this.y=0,this.x=t,this.y=i}clone(){return new $_(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,i=t){return this.x=t,this.y=i,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return ci.x=0,ci.y=0,ci}},ci=new De}),ke,Pr,Rr,We=v(()=>{Jt(),At(),ke=class X_{constructor(t=1,i=0,r=0,n=1,s=0,a=0){this.array=null,this.a=t,this.b=i,this.c=r,this.d=n,this.tx=s,this.ty=a}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,i,r,n,s,a){return this.a=t,this.b=i,this.c=r,this.d=n,this.tx=s,this.ty=a,this}toArray(t,i){this.array||(this.array=new Float32Array(9));let r=i||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,i){i=i||new De;let r=t.x,n=t.y;return i.x=this.a*r+this.c*n+this.tx,i.y=this.b*r+this.d*n+this.ty,i}applyInverse(t,i){i=i||new De;let r=this.a,n=this.b,s=this.c,a=this.d,o=this.tx,l=this.ty,h=1/(r*a+s*-n),u=t.x,d=t.y;return i.x=a*h*u+-s*h*d+(l*s-o*a)*h,i.y=r*h*d+-n*h*u+(-l*r+o*n)*h,i}translate(t,i){return this.tx+=t,this.ty+=i,this}scale(t,i){return this.a*=t,this.d*=i,this.c*=t,this.b*=i,this.tx*=t,this.ty*=i,this}rotate(t){let i=Math.cos(t),r=Math.sin(t),n=this.a,s=this.c,a=this.tx;return this.a=n*i-this.b*r,this.b=n*r+this.b*i,this.c=s*i-this.d*r,this.d=s*r+this.d*i,this.tx=a*i-this.ty*r,this.ty=a*r+this.ty*i,this}append(t){let i=this.a,r=this.b,n=this.c,s=this.d;return this.a=t.a*i+t.b*n,this.b=t.a*r+t.b*s,this.c=t.c*i+t.d*n,this.d=t.c*r+t.d*s,this.tx=t.tx*i+t.ty*n+this.tx,this.ty=t.tx*r+t.ty*s+this.ty,this}appendFrom(t,i){let r=t.a,n=t.b,s=t.c,a=t.d,o=t.tx,l=t.ty,h=i.a,u=i.b,d=i.c,p=i.d;return this.a=r*h+n*d,this.b=r*u+n*p,this.c=s*h+a*d,this.d=s*u+a*p,this.tx=o*h+l*d+i.tx,this.ty=o*u+l*p+i.ty,this}setTransform(t,i,r,n,s,a,o,l,h){return this.a=Math.cos(o+h)*s,this.b=Math.sin(o+h)*s,this.c=-Math.sin(o-l)*a,this.d=Math.cos(o-l)*a,this.tx=t-(r*this.a+n*this.c),this.ty=i-(r*this.b+n*this.d),this}prepend(t){let i=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,n=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=n*t.a+this.d*t.c,this.d=n*t.b+this.d*t.d}return this.tx=i*t.a+this.ty*t.c+t.tx,this.ty=i*t.b+this.ty*t.d+t.ty,this}decompose(t){let i=this.a,r=this.b,n=this.c,s=this.d,a=t.pivot,o=-Math.atan2(-n,s),l=Math.atan2(r,i),h=Math.abs(o+l);return h<1e-5||Math.abs($e-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=l),t.scale.x=Math.sqrt(i*i+r*r),t.scale.y=Math.sqrt(n*n+s*s),t.position.x=this.tx+(a.x*i+a.y*n),t.position.y=this.ty+(a.x*r+a.y*s),t}invert(){let t=this.a,i=this.b,r=this.c,n=this.d,s=this.tx,a=t*n-i*r;return this.a=n/a,this.b=-i/a,this.c=-r/a,this.d=t/a,this.tx=(r*this.ty-n*s)/a,this.ty=-(t*this.ty-i*s)/a,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new X_;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return Rr.identity()}static get shared(){return Pr.identity()}},Pr=new ke,Rr=new ke}),$t,kr=v(()=>{"use strict";$t=class Y_{constructor(t,i,r){this._x=i||0,this._y=r||0,this._observer=t}clone(t){return new Y_(t??this._observer,this._x,this._y)}set(t=0,i=t){return(this._x!==t||this._y!==i)&&(this._x=t,this._y=i,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function at(e="default"){return dr[e]===void 0&&(dr[e]=-1),++dr[e]}var dr,bt=v(()=>{"use strict";dr={default:-1}});function Xe(e,t,i=3){if(fr[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t} Deprecated since v${e}`):(r=r.split(` `).splice(i).join(` `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t} Deprecated since v${e}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} Deprecated since v${e}`),console.warn(r))),fr[t]=!0}var fr,Ve,wt=v(()=>{"use strict";fr={},Ve="8.0.0"}),tr,Kr=v(()=>{"use strict";tr=class{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t0?t=this._pool[--this._index]:t=new this._classType,t.init?.(e),t}return(e){e.reset?.(),this._pool[this._index++]=e}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}}),Zr,Le,Ht=v(()=>{Kr(),Zr=class{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new tr(e)),this._poolsByClass.get(e)}stats(){let e={};return this._poolsByClass.forEach(t=>{let i=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[i]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}},Le=new Zr});function Br(e,t,i){let r=e.length,n;if(t>=r||i===0)return;i=t+i>r?r-t:i;let s=r-i;for(n=t;n{"use strict"}),Qr,xi=v(()=>{Jr(),wt(),Qr={allowChildren:!0,removeChildren(e=0,t){let i=t??this.children.length,r=i-e,n=[];if(r>0&&r<=i){for(let a=i-1;a>=e;a--){let o=this.children[a];o&&(n.push(o),o.parent=null)}Br(this.children,e,i);let s=this.renderGroup||this.parentRenderGroup;s&&s.removeChildren(n);for(let a=0;a=this.children.length)throw new Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]},setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(e),this.addChildAt(e,t)},getChildIndex(e){let t=this.children.indexOf(e);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(e,t){this.allowChildren||Xe(Ve,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:i}=this;if(t<0||t>i.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${i.length}`);if(e.parent){let n=e.parent.children.indexOf(e);if(e.parent===this&&n===t)return e;n!==-1&&e.parent.children.splice(n,1)}t===i.length?i.push(e):i.splice(t,0,e),e.parent=this,e.didChange=!0,e.didViewUpdate=!1,e._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(e),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",e,this,t),e.emit("added",this),e},swapChildren(e,t){if(e===t)return;let i=this.getChildIndex(e),r=this.getChildIndex(t);this.children[i]=t,this.children[r]=e;let n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...e){return e.length===1?this.reparentChildAt(e[0],this.children.length):(e.forEach(t=>this.reparentChildAt(t,this.children.length)),e[0])},reparentChildAt(e,t){if(e.parent===this)return this.setChildIndex(e,t),e;let i=e.worldTransform.clone();e.removeFromParent(),this.addChildAt(e,t);let r=this.worldTransform.clone();return r.invert(),i.prepend(r),e.setFromMatrix(i),e}}}),Ct,Ir=v(()=>{"use strict";Ct=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e{te(),Ht(),Ni=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let t=0;t{Ir(),en(),ir={_maskEffect:null,_filterEffect:null,effects:[],addEffect(e){if(this.effects.indexOf(e)!==-1)return;this.effects.push(e),this.effects.sort((i,r)=>i.priority-r.priority);let t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0),this._updateIsSimple()},removeEffect(e){let t=this.effects.indexOf(e);t!==-1&&(this.effects.splice(t,1),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(e){let t=this._maskEffect;t?.mask!==e&&(t&&(this.removeEffect(t),pr.returnMaskEffect(t),this._maskEffect=null),e!=null&&(this._maskEffect=pr.getMaskEffect(e),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},set filters(e){!Array.isArray(e)&&e&&(e=[e]);let t=this._filterEffect||(this._filterEffect=new Ct);e=e;let i=e?.length>0,r=t.filters?.length>0,n=i!==r;e=Array.isArray(e)?e.slice(0):e,t.filters=Object.freeze(e),n&&(i?this.addEffect(t):(this.removeEffect(t),t.filters=e??null))},get filters(){return this._filterEffect?.filters},set filterArea(e){this._filterEffect||(this._filterEffect=new Ct),this._filterEffect.filterArea=e},get filterArea(){return this._filterEffect?.filterArea}}}),Or,tn=v(()=>{wt(),Or={label:null,get name(){return Xe(Ve,"Container.name property has been removed, use Container.label instead"),this.label},set name(e){Xe(Ve,"Container.name property has been removed, use Container.label instead"),this.label=e},getChildByName(e,t=!1){return this.getChildByLabel(e,t)},getChildByLabel(e,t=!1){let i=this.children;for(let r=0;r{At(),Hi=[new De,new De,new De,new De],ot=class Po{constructor(t=0,i=0,r=0,n=0){this.type="rectangle",this.x=Number(t),this.y=Number(i),this.width=Number(r),this.height=Number(n)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new Po(0,0,0,0)}clone(){return new Po(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,i){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&i=l&&t<=h&&i>=u&&i<=d&&!(t>p&&ty&&it.right?t.right:this.right)<=Q)return!1;let Y=this.yt.bottom?t.bottom:this.bottom)>Y}let r=this.left,n=this.right,s=this.top,a=this.bottom;if(n<=r||a<=s)return!1;let o=Hi[0].set(t.left,t.top),l=Hi[1].set(t.left,t.bottom),h=Hi[2].set(t.right,t.top),u=Hi[3].set(t.right,t.bottom);if(h.x<=o.x||l.y<=o.y)return!1;let d=Math.sign(i.a*i.d-i.b*i.c);if(d===0||(i.apply(o,o),i.apply(l,l),i.apply(h,h),i.apply(u,u),Math.max(o.x,l.x,h.x,u.x)<=r||Math.min(o.x,l.x,h.x,u.x)>=n||Math.max(o.y,l.y,h.y,u.y)<=s||Math.min(o.y,l.y,h.y,u.y)>=a))return!1;let p=d*(l.y-o.y),f=d*(o.x-l.x),y=p*r+f*s,b=p*n+f*s,_=p*r+f*a,T=p*n+f*a;if(Math.max(y,b,_,T)<=p*o.x+f*o.y||Math.min(y,b,_,T)>=p*u.x+f*u.y)return!1;let C=d*(o.y-h.y),O=d*(h.x-o.x),R=C*r+O*s,z=C*n+O*s,ee=C*r+O*a,ne=C*n+O*a;return!(Math.max(R,z,ee,ne)<=C*o.x+O*o.y||Math.min(R,z,ee,ne)>=C*u.x+O*u.y)}pad(t=0,i=t){return this.x-=t,this.y-=i,this.width+=t*2,this.height+=i*2,this}fit(t){let i=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),n=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=i,this.width=Math.max(r-i,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(t=1,i=.001){let r=Math.ceil((this.x+this.width-i)*t)/t,n=Math.ceil((this.y+this.height-i)*t)/t;return this.x=Math.floor((this.x+i)*t)/t,this.y=Math.floor((this.y+i)*t)/t,this.width=r-this.x,this.height=n-this.y,this}enlarge(t){let i=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=i,this.width=r-i,this.y=n,this.height=s-n,this}getBounds(t){return t=t||new Po,t.copyFrom(this),t}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}}),c,g,m=v(()=>{We(),E(),c=new ke,g=class q_{constructor(t=1/0,i=1/0,r=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=c,this.minX=t,this.minY=i,this.maxX=r,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new ot);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=c,this}set(t,i,r,n){this.minX=t,this.minY=i,this.maxX=r,this.maxY=n}addFrame(t,i,r,n,s){s||(s=this.matrix);let a=s.a,o=s.b,l=s.c,h=s.d,u=s.tx,d=s.ty,p=this.minX,f=this.minY,y=this.maxX,b=this.maxY,_=a*t+l*i+u,T=o*t+h*i+d;_y&&(y=_),T>b&&(b=T),_=a*r+l*i+u,T=o*r+h*i+d,_y&&(y=_),T>b&&(b=T),_=a*t+l*n+u,T=o*t+h*n+d,_y&&(y=_),T>b&&(b=T),_=a*r+l*n+u,T=o*r+h*n+d,_y&&(y=_),T>b&&(b=T),this.minX=p,this.minY=f,this.maxX=y,this.maxY=b}addRect(t,i){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,i)}addBounds(t,i){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,i)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxXthis.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=a*i+l*s+u,f=o*i+h*s+d,this.minX=pthis.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=a*n+l*s+u,f=o*n+h*s+d,this.minX=pthis.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minXt.right&&(this.maxX=t.right),this.minYt.bottom&&(this.maxY=t.bottom),this}fitBounds(t,i,r,n){return this.minXi&&(this.maxX=i),this.minYn&&(this.maxY=n),this}pad(t,i=t){return this.minX-=t,this.maxX+=t,this.minY-=i,this.maxY+=i,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new q_(this.minX,this.minY,this.maxX,this.maxY)}scale(t,i=t){return this.minX*=t,this.minY*=i,this.maxX*=t,this.maxY*=i,this}get x(){return this.minX}set x(t){let i=this.maxX-this.minX;this.minX=t,this.maxX=t+i}get y(){return this.minY}set y(t){let i=this.maxY-this.minY;this.minY=t,this.maxY=t+i}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,i,r,n){let s=this.minX,a=this.minY,o=this.maxX,l=this.maxY;n||(n=this.matrix);let h=n.a,u=n.b,d=n.c,p=n.d,f=n.tx,y=n.ty;for(let b=i;bo?C:o,l=O>l?O:l}this.minX=s,this.minY=a,this.maxX=o,this.maxY=l}containsPoint(t,i){return this.minX<=t&&this.minY<=i&&this.maxX>=t&&this.maxY>=i}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}}}),x,w,S=v(()=>{We(),Kr(),m(),x=new tr(ke),w=new tr(g)});function k(e,t,i){i.clear();let r,n;return e.parent?t?r=e.parent.worldTransform:(n=x.get().identity(),r=N(e,n)):r=ke.IDENTITY,B(e,i,r,t),n&&x.return(n),i.isValid||i.set(0,0,0,0),i}function B(e,t,i,r){if(!e.visible||!e.measurable)return;let n;r?n=e.worldTransform:(e.updateLocalTransform(),n=x.get(),n.appendFrom(e.localTransform,i));let s=t,a=!!e.effects.length;if(a&&(t=w.get().clear()),e.boundsArea)t.addRect(e.boundsArea,n);else{e.addBounds&&(t.matrix=n,e.addBounds(t));for(let o=0;o{We(),S()});function F(...e){V!==L&&(V++,V===L?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...e))}var V,L,I=v(()=>{"use strict";V=0,L=500});function D(e,t,i){return t.clear(),i||(i=ke.IDENTITY),$(e,t,i,e,!0),t.isValid||t.set(0,0,0,0),t}function $(e,t,i,r,n){let s;if(n)s=x.get(),s=i.copyTo(s);else{if(!e.visible||!e.measurable)return;e.updateLocalTransform();let l=e.localTransform;s=x.get(),s.appendFrom(l,i)}let a=t,o=!!e.effects.length;if(o&&(t=w.get().clear()),e.boundsArea)t.addRect(e.boundsArea,s);else{e.renderPipeId&&(t.matrix=s,e.addBounds(t));let l=e.children;for(let h=0;h{We(),S()});function xe(e,t){let i=e.children;for(let r=0;r{"use strict"}),Ge,ct,Qt=v(()=>{We(),m(),X(),se(),Me(),Ge=new ke,ct={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(e,t){let i=Math.sign(this.scale.x)||1;t!==0?this.scale.x=e/t*i:this.scale.x=i},_setHeight(e,t){let i=Math.sign(this.scale.y)||1;t!==0?this.scale.y=e/t*i:this.scale.y=i},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new g});let e=this._localBoundsCacheData;return e.index=1,e.didChange=!1,e.data[0]!==this._didViewChangeTick&&(e.didChange=!0,e.data[0]=this._didViewChangeTick),xe(this,e),e.didChange&&D(this,e.localBounds,Ge),e.localBounds},getBounds(e,t){return k(this,e,t||new g)}}}),ei,qt=v(()=>{"use strict";ei={_onRender:null,set onRender(e){let t=this.renderGroup||this.parentRenderGroup;if(!e){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=e},get onRender(){return this._onRender}}});function di(e,t){return e._zIndex-t._zIndex}var Ut,Ae=v(()=>{"use strict";Ut={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(e){this._zIndex!==e&&(this._zIndex=e,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(di))}}}),Be,He=v(()=>{We(),At(),X(),Be={getGlobalPosition(e=new De,t=!1){return this.parent?this.parent.toGlobal(this._position,e,t):(e.x=this._position.x,e.y=this._position.y),e},toGlobal(e,t,i=!1){if(!i){this.updateLocalTransform();let r=N(this,new ke);return r.append(this.localTransform),r.apply(e,t)}return this.worldTransform.apply(e,t)},toLocal(e,t,i,r){if(t&&(e=t.toGlobal(e,i,r)),!r){this.updateLocalTransform();let n=N(this,new ke);return n.append(this.localTransform),n.applyInverse(e,i)}return this.worldTransform.applyInverse(e,i)}}}),ft,et,lt=v(()=>{bt(),ft=0,et=class{constructor(){this.uid=at("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.tick=0}reset(){this.instructionSize=0,this.tick=ft++}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}}),zt,Ci=v(()=>{We(),lt(),zt=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new ke,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new et,this._onRenderContainers=[]}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;let t=e.children;for(let i=0;i-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);let t=e.children;for(let i=0;i0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(){for(let e=0;e{"use strict"}),Ms,Ps,Rs,Mn,ks,rn,Tt,zi=v(()=>{xt(),Ie(),Se(),We(),Jt(),kr(),bt(),wt(),Ht(),xi(),Gr(),tn(),Qt(),qt(),Ae(),He(),Ci(),ko(),Ms=new $t(null),Ps=new $t(null),Rs=new $t(null,1,1),Mn=1,ks=2,rn=4,Tt=class K_ extends Je{constructor(t={}){super(),this.uid=at("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new ke,this.relativeGroupTransform=new ke,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new $t(this,0,0),this._scale=Rs,this._pivot=Ps,this._skew=Ms,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],oi(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(i=>this.addChild(i)),t.parent?.addChild(this)}static mixin(t){Object.defineProperties(K_.prototype,Object.getOwnPropertyDescriptors(t))}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||Xe(Ve,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let n=0;n1){for(let n=0;n-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(i):this.parentRenderGroup&&this.parentRenderGroup.removeChild(i),i.parent=null,this.emit("childRemoved",i,this,r),i.emit("removed",this)),i}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=Le.get(zt,this),this.groupTransform=ke.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),Le.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new ke),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Fe}set angle(t){this.rotation=t*st}get pivot(){return this._pivot===Ps&&(this._pivot=new $t(this,0,0)),this._pivot}set pivot(t){this._pivot===Ps&&(this._pivot=new $t(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Ms&&(this._skew=new $t(this,0,0)),this._skew}set skew(t){this._skew===Ms&&(this._skew=new $t(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Rs&&(this._scale=new $t(this,1,1)),this._scale}set scale(t){this._scale===Rs&&(this._scale=new $t(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let i=this.getLocalBounds().width;this._setWidth(t,i)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let i=this.getLocalBounds().height;this._setHeight(t,i)}getSize(t){t||(t={});let i=this.getLocalBounds();return t.width=Math.abs(this.scale.x*i.width),t.height=Math.abs(this.scale.y*i.height),t}setSize(t,i){let r=this.getLocalBounds(),n,s;typeof t!="object"?(n=t,s=i??t):(n=t.width,s=t.height??t.width),n!==void 0&&this._setWidth(n,r.width),s!==void 0&&this._setHeight(s,r.height)}_updateSkew(){let t=this._rotation,i=this._skew;this._cx=Math.cos(t+i._y),this._sx=Math.sin(t+i._y),this._cy=-Math.sin(t-i._x),this._sy=Math.cos(t-i._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let i=this.localTransform,r=this._scale,n=this._pivot,s=this._position,a=r._x,o=r._y,l=n._x,h=n._y;i.a=this._cx*a,i.b=this._sx*a,i.c=this._cy*o,i.d=this._sy*o,i.tx=s._x-(l*i.a+h*i.c),i.ty=s._y-(l*i.b+h*i.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Mn,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=ue.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Mn,this._onUpdate())}get tint(){let t=this.localColor;return((t&255)<<16)+(t&65280)+(t>>16&255)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ks,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let i=t?2:0;(this.localDisplayStatus&2)!==i&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=rn,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let i=t?0:4;(this.localDisplayStatus&4)!==i&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=rn,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let i=t?1:0;(this.localDisplayStatus&1)!==i&&(this._updateFlags|=rn,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let i=this.removeChildren(0,this.children.length);if(this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.children)for(let r=0;r{At(),Bs=class Z_{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Z_.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new De,this.page=new De,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,i,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,i,r,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function Ev(e){return function(t){return t.test(e)}}function Rc(e){var t={userAgent:"",platform:"",maxTouchPoints:0};!e&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof e=="string"?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0});var i=t.userAgent,r=i.split("[FBAN");typeof r[1]<"u"&&(i=r[0]),r=i.split("Twitter"),typeof r[1]<"u"&&(i=r[0]);var n=Ev(i),s={apple:{phone:n(Is)&&!n(Wi),ipod:n(Io),tablet:!n(Is)&&(n(Go)||Wo(t))&&!n(Wi),universal:n(Oo),device:(n(Is)||n(Io)||n(Go)||n(Oo)||Wo(t))&&!n(Wi)},amazon:{phone:n(Ur),tablet:!n(Ur)&&n(Pn),device:n(Ur)||n(Pn)},android:{phone:!n(Wi)&&n(Ur)||!n(Wi)&&n(Gs),tablet:!n(Wi)&&!n(Ur)&&!n(Gs)&&(n(Pn)||n(Uo)),device:!n(Wi)&&(n(Ur)||n(Pn)||n(Gs)||n(Uo))||n(/\bokhttp\b/i)},windows:{phone:n(Wi),tablet:n(Fo),device:n(Wi)||n(Fo)},other:{blackberry:n(Do),blackberry10:n(Lo),opera:n(No),firefox:n(zo),chrome:n(Ho),device:n(Do)||n(Lo)||n(No)||n(zo)||n(Ho)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var Is,Io,Go,Oo,Gs,Uo,Ur,Pn,Wi,Fo,Do,Lo,No,Ho,zo,Wo,kc=v(()=>{Is=/iPhone/i,Io=/iPod/i,Go=/iPad/i,Oo=/\biOS-universal(?:.+)Mac\b/i,Gs=/\bAndroid(?:.+)Mobile\b/i,Uo=/Android/i,Ur=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Pn=/Silk/i,Wi=/Windows Phone/i,Fo=/\bWindows(?:.+)ARM\b/i,Do=/BlackBerry/i,Lo=/BB10/i,No=/Opera Mini/i,Ho=/\b(CriOS|Chrome)(?:.+)Mobile/i,zo=/Mobile(?:.+)Firefox\b/i,Wo=function(e){return typeof e<"u"&&e.platform==="MacIntel"&&typeof e.maxTouchPoints=="number"&&e.maxTouchPoints>1&&typeof MSStream>"u"}}),Av=v(()=>{kc(),kc()}),Bc,Ic,Cv=v(()=>{Av(),Bc=Rc.default??Rc,Ic=Bc(globalThis.navigator)}),Gc,Rn,Oc,Uc,Vo,jo,Fc,Dc,Lc,$o,Mv=v(()=>{Bo(),te(),Cv(),Jr(),Gc=9,Rn=100,Oc=0,Uc=0,Vo=2,jo=1,Fc=-1e3,Dc=-1e3,Lc=2,$o=class{constructor(e,t=Ic){this._mobileInfo=t,this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook();let i=document.createElement("div");i.style.width=`${Rn}px`,i.style.height=`${Rn}px`,i.style.position="absolute",i.style.top=`${Oc}px`,i.style.left=`${Uc}px`,i.style.zIndex=Vo.toString(),this._div=i,this._renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let e=document.createElement("button");e.style.width=`${jo}px`,e.style.height=`${jo}px`,e.style.position="absolute",e.style.top=`${Fc}px`,e.style.left=`${Dc}px`,e.style.zIndex=Lc.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.add(this),this._renderer.view.canvas.parentNode?.appendChild(this._div))}_deactivate(){!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this),this._div.parentNode?.removeChild(this._div))}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&e.isInteractive()&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let t=e.children;if(t)for(let i=0;i 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:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let t=this._pool.pop();t||(t=document.createElement("button"),t.style.width=`${Rn}px`,t.style.height=`${Rn}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=Vo.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this._updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){let{container:i}=e.target,r=this._renderer.events.rootBoundary,n=Object.assign(new Bs(r),{target:i});r.rootTarget=this._renderer.lastObjectRendered,t.forEach(s=>r.dispatchEvent(n,s))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode===Gc&&this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._destroyTouchHook(),this._div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this._pool=null,this._children=null,this._renderer=null}},$o.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"accessibility"}}),Nc,Pv=v(()=>{"use strict";Nc={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}}),Rv=v(()=>{te(),zi(),Mv(),Pv(),pe.add($o),Tt.mixin(Nc)}),Xo,kv=v(()=>{te(),Xo=class{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let t,i;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:r,clientHeight:n}=this._resizeTo;t=r,i=n}this.renderer.resize(t,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}},Xo.extension=G.Application}),nn,Yo=v(()=>{"use strict";nn=(e=>(e[e.INTERACTION=50]="INTERACTION",e[e.HIGH=25]="HIGH",e[e.NORMAL=0]="NORMAL",e[e.LOW=-25]="LOW",e[e.UTILITY=-50]="UTILITY",e))(nn||{})}),Os,Bv=v(()=>{"use strict";Os=class{constructor(e,t=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=t,this.priority=i,this._once=r}match(e,t=null){return this._fn===e&&this._context===t}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));let t=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let t=this.next;return this.next=e?null:t,this.previous=null,t}}}),qo,Mi,Us=v(()=>{Yo(),Bv(),qo=class vi{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Os(null,null,1/0),this.deltaMS=1/vi.targetFPMS,this.elapsedMS=1/vi.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,i,r=nn.NORMAL){return this._addListener(new Os(t,i,r))}addOnce(t,i,r=nn.NORMAL){return this._addListener(new Os(t,i,r,!0))}_addListener(t){let i=this._head.next,r=this._head;if(!i)t.connect(r);else{for(;i;){if(t.priority>i.priority){t.connect(r);break}r=i,i=i.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,i){let r=this._head.next;for(;r;)r.match(t,i)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,i=this._head;for(;i=i.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let i;if(t>this.lastTime){if(i=this.elapsedMS=t-this.lastTime,i>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){let s=t-this._lastFrame|0;if(s{te(),Yo(),Us(),Ko=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,nn.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Mi.shared:new Mi,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}},Ko.extension=G.Application}),Hc=v(()=>{te(),kv(),Iv(),pe.add(Xo),pe.add(Ko)}),zc,rr,Wc=v(()=>{Yo(),Us(),zc=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(Mi.system.add(this._tickerUpdate,this,nn.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Mi.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTime{At(),Bo(),kn=class extends Bs{constructor(){super(...arguments),this.client=new De,this.movement=new De,this.offset=new De,this.global=new De,this.screen=new De}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,i){return e.worldTransform.applyInverse(i||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,i,r,n,s,a,o,l,h,u,d,p,f,y){throw new Error("Method not implemented.")}}}),bi,Vc=v(()=>{Zo(),bi=class extends kn{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}}),Fr,jc=v(()=>{Zo(),Fr=class extends kn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}},Fr.DOM_DELTA_PIXEL=0,Fr.DOM_DELTA_LINE=1,Fr.DOM_DELTA_PAGE=2}),$c,Xc,sn,Yc,Gv=v(()=>{xt(),At(),I(),Wc(),Zo(),Vc(),jc(),$c=2048,Xc=new De,sn=new De,Yc=class{constructor(e){this.dispatch=new Je,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((i,r)=>i.priority-r.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;let t=this.mappingTable[e.type];if(t)for(let i=0,r=t.length;i=0;r--)if(e.currentTarget=i[r],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;let r=Array.isArray(t)?t:[t];for(let n=i.length-1;n>=0;n--)r.forEach(s=>{e.currentTarget=i[n],this.notifyTarget(e,s)})}propagationPath(e){let t=[e];for(let i=0;i<$c&&e!==this.rootTarget&&e.parent;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,i,r,n,s=!1){let a=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(rr.pauseUpdate=!1),e.interactiveChildren&&e.children){let h=e.children;for(let u=h.length-1;u>=0;u--){let d=h[u],p=this.hitTestMoveRecursive(d,this._isInteractive(t)?t:d.eventMode,i,r,n,s||n(e,i));if(p){if(p.length>0&&!p[p.length-1].parent)continue;let f=e.isInteractive();(p.length>0||f)&&(f&&this._allInteractiveElements.push(e),p.push(e)),this._hitElements.length===0&&(this._hitElements=p),a=!0}}}let o=this._isInteractive(t),l=e.isInteractive();return l&&l&&this._allInteractiveElements.push(e),s||this._hitElements.length>0?null:a?this._hitElements:o&&!n(e,i)&&r(e,i)?l?[e]:[]:null}hitTestRecursive(e,t,i,r,n){if(this._interactivePrune(e)||n(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(rr.pauseUpdate=!1),e.interactiveChildren&&e.children){let o=e.children,l=i;for(let h=o.length-1;h>=0;h--){let u=o[h],d=this.hitTestRecursive(u,this._isInteractive(t)?t:u.eventMode,l,r,n);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let p=e.isInteractive();return(d.length>0||p)&&d.push(e),d}}}let s=this._isInteractive(t),a=e.isInteractive();return s&&r(e,i)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.includeInBuild||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,sn),!e.hitArea.contains(sn.x,sn.y)))return!0;if(e.effects&&e.effects.length)for(let i=0;i0&&n!==t.target){let o=e.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(e,o,n);if(this.dispatchEvent(l,"pointerout"),i&&this.dispatchEvent(l,"mouseout"),!t.composedPath().includes(n)){let h=this.createPointerEvent(e,"pointerleave",n);for(h.eventPhase=h.AT_TARGET;h.target&&!t.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),i&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(l)}if(n!==t.target){let o=e.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(t,o);this.dispatchEvent(l,"pointerover"),i&&this.dispatchEvent(l,"mouseover");let h=n?.parent;for(;h&&h!==this.rootTarget.parent&&h!==t.target;)h=h.parent;if(!h||h===this.rootTarget.parent){let u=this.clonePointerEvent(t,"pointerenter");for(u.eventPhase=u.AT_TARGET;u.target&&u.target!==n&&u.target!==this.rootTarget.parent;)u.currentTarget=u.target,this.notifyTarget(u),i&&this.notifyTarget(u,"mouseenter"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(l)}let s=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?s.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&s.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?s.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&s.push("globaltouchmove")),i&&(this.moveOnAll?s.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&s.push("globalmousemove"),this.cursor=t.target?.cursor),s.length>0&&this.all(t,s),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),r=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId);if(t.overTargets){let i=e.pointerType==="mouse"||e.pointerType==="pen",r=this.findMountedTarget(t.overTargets),n=this.createPointerEvent(e,"pointerout",r);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");let s=this.createPointerEvent(e,"pointerleave",r);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),i&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;t.overTargets=null,this.freeEvent(n),this.freeEvent(s)}this.cursor=null}mapPointerUp(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let r=this.trackingData(e.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[e.button]),s=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let o=i.button===2;this.notifyTarget(i,o?"rightupoutside":"mouseupoutside")}a=a.parent}delete r.pressTargetsByButton[e.button],s=a}if(s){let a=this.clonePointerEvent(i,"click");a.target=s,a.path=null,r.clicksByButton[e.button]||(r.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});let o=r.clicksByButton[e.button];if(o.target===a.target&&t-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=a.target,o.timeStamp=t,a.detail=o.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),r=this.createPointerEvent(e);if(i){let n=i;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(r)}mapWheel(e){if(!(e instanceof Fr)){F("EventBoundary cannot map a non-wheel event as a wheel event");return}let t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i{te(),Gv(),Wc(),Vc(),jc(),qc=1,Kc={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Fs=class bc{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Yc(null),rr.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new bi(null),this._rootWheelEvent=new Fr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...bc.defaultEventFeatures},{set:(i,r,n)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),i[r]=n,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:i,resolution:r}=this.renderer;this.setTargetElement(i),this.resolution=r,bc._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t=t||"default";let i=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(i=!1),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case"string":i&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":i&&Object.assign(this.domElement.style,r);break}else i&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let i=this._normalizeToPointerData(t);this.autoPreventDefault&&i[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,n=i.length;r0&&(i=t.composedPath()[0]);let r=i!==this.domElement?"outside":"",n=this._normalizeToPointerData(t);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=t.touches.length===1&&t.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=t.type,i.push(s)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=qc),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,i.push(r)}else i.push(t);return i}normalizeWheelEvent(t){let i=this._rootWheelEvent;return this._transferMouseData(i,t),i.deltaX=t.deltaX,i.deltaY=t.deltaY,i.deltaZ=t.deltaZ,i.deltaMode=t.deltaMode,this.mapPositionToPoint(i.screen,t.clientX,t.clientY),i.global.copyFrom(i.screen),i.offset.copyFrom(i.screen),i.nativeEvent=t,i.type=t.type,i}_bootstrapEvent(t,i){return t.originalEvent=null,t.nativeEvent=i,t.pointerId=i.pointerId,t.width=i.width,t.height=i.height,t.isPrimary=i.isPrimary,t.pointerType=i.pointerType,t.pressure=i.pressure,t.tangentialPressure=i.tangentialPressure,t.tiltX=i.tiltX,t.tiltY=i.tiltY,t.twist=i.twist,this._transferMouseData(t,i),this.mapPositionToPoint(t.screen,i.clientX,i.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=i.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Kc[t.type]||t.type),t}_transferMouseData(t,i){t.isTrusted=i.isTrusted,t.srcElement=i.srcElement,t.timeStamp=performance.now(),t.type=i.type,t.altKey=i.altKey,t.button=i.button,t.buttons=i.buttons,t.client.x=i.clientX,t.client.y=i.clientY,t.ctrlKey=i.ctrlKey,t.metaKey=i.metaKey,t.movement.x=i.movementX,t.movement.y=i.movementY,t.page.x=i.pageX,t.page.y=i.pageY,t.relatedTarget=null,t.shiftKey=i.shiftKey}},Fs.extension={name:"events",type:[G.WebGLSystem,G.CanvasSystem,G.WebGPUSystem],priority:-1},Fs.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},Jo=Fs}),Jc,Ov=v(()=>{Zc(),Bo(),Jc={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(e){this.eventMode=e?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Jo.defaultEventMode},set eventMode(e){this._internalEventMode=e},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(e,t,i){let r=typeof i=="boolean"&&i||typeof i=="object"&&i.capture,n=typeof i=="object"?i.signal:void 0,s=typeof i=="object"?i.once===!0:!1,a=typeof t=="function"?void 0:t;e=r?`${e}capture`:e;let o=typeof t=="function"?t:t.handleEvent,l=this;n&&n.addEventListener("abort",()=>{l.off(e,o,a)}),s?l.once(e,o,a):l.on(e,o,a)},removeEventListener(e,t,i){let r=typeof i=="boolean"&&i||typeof i=="object"&&i.capture,n=typeof t=="function"?void 0:t;e=r?`${e}capture`:e,t=typeof t=="function"?t:t.handleEvent,this.off(e,t,n)},dispatchEvent(e){if(!(e instanceof Bs))throw new Error("Container cannot propagate events outside of the Federated Events API");return e.defaultPrevented=!1,e.path=null,e.target=this,e.manager.dispatchEvent(e),!e.defaultPrevented}}}),Uv=v(()=>{te(),zi(),Zc(),Ov(),pe.add(Jo),Tt.mixin(Jc)}),Qo,Fv=v(()=>{"use strict";Qo=(e=>(e[e.Low=0]="Low",e[e.Normal=1]="Normal",e[e.High=2]="High",e))(Qo||{})}),Qc,Dv=v(()=>{"use strict";Qc={createCanvas:(e,t)=>{let i=document.createElement("canvas");return i.width=e,i.height=t,i},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(e,t)=>fetch(e,t),parseXML:e=>new DOMParser().parseFromString(e,"text/xml")}}),el,vt,Ft=v(()=>{Dv(),el=Qc,vt={get(){return el},set(e){el=e}}});function Pi(e){if(typeof e!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function Bn(e){return e.split("?")[0].split("#")[0]}function Lv(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nv(e,t,i){return e.replace(new RegExp(Lv(t),"g"),i)}function Hv(e,t){let i="",r=0,n=-1,s=0,a=-1;for(let o=0;o<=e.length;++o){if(o2){let l=i.lastIndexOf("/");if(l!==i.length-1){l===-1?(i="",r=0):(i=i.slice(0,l),r=i.length-1-i.lastIndexOf("/")),n=o,s=0;continue}}else if(i.length===2||i.length===1){i="",r=0,n=o,s=0;continue}}t&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+=`/${e.slice(n+1,o)}`:i=e.slice(n+1,o),r=o-n-1;n=o,s=0}else a===46&&s!==-1?++s:s=-1}return i}var an,ed=v(()=>{Ft(),an={toPosix(e){return Nv(e,"\\","/")},isUrl(e){return/^https?:/.test(this.toPosix(e))},isDataUrl(e){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e)},isBlobUrl(e){return e.startsWith("blob:")},hasProtocol(e){return/^[^/:]+:/.test(this.toPosix(e))},getProtocol(e){Pi(e),e=this.toPosix(e);let t=/^file:\/\/\//.exec(e);if(t)return t[0];let i=/^[^/:]+:\/{0,2}/.exec(e);return i?i[0]:""},toAbsolute(e,t,i){if(Pi(e),this.isDataUrl(e)||this.isBlobUrl(e))return e;let r=Bn(this.toPosix(t??vt.get().getBaseUrl())),n=Bn(this.toPosix(i??this.rootname(r)));return e=this.toPosix(e),e.startsWith("/")?an.join(n,e.slice(1)):this.isAbsolute(e)?e:this.join(r,e)},normalize(e){if(Pi(e),e.length===0)return".";if(this.isDataUrl(e)||this.isBlobUrl(e))return e;e=this.toPosix(e);let t="",i=e.startsWith("/");this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));let r=e.endsWith("/");return e=Hv(e,!1),e.length>0&&r&&(e+="/"),i?`/${e}`:t+e},isAbsolute(e){return Pi(e),e=this.toPosix(e),this.hasProtocol(e)?!0:e.startsWith("/")},join(...e){if(e.length===0)return".";let t;for(let i=0;i0)if(t===void 0)t=r;else{let n=e[i-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(e){if(Pi(e),e.length===0)return".";e=this.toPosix(e);let t=e.charCodeAt(0),i=t===47,r=-1,n=!0,s=this.getProtocol(e),a=e;e=e.slice(s.length);for(let o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":this.isUrl(a)?s+e:s:i&&r===1?"//":s+e.slice(0,r)},rootname(e){Pi(e),e=this.toPosix(e);let t="";if(e.startsWith("/")?t="/":t=this.getProtocol(e),this.isUrl(e)){let i=e.indexOf("/",t.length);i!==-1?t=e.slice(0,i):t=e,t.endsWith("/")||(t+="/")}return t},basename(e,t){Pi(e),t&&Pi(t),e=Bn(this.toPosix(e));let i=0,r=-1,n=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let a=t.length-1,o=-1;for(s=e.length-1;s>=0;--s){let l=e.charCodeAt(s);if(l===47){if(!n){i=s+1;break}}else o===-1&&(n=!1,o=s+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(r=s):(a=-1,r=o))}return i===r?r=o:r===-1&&(r=e.length),e.slice(i,r)}for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!n){i=s+1;break}}else r===-1&&(n=!1,r=s+1);return r===-1?"":e.slice(i,r)},extname(e){Pi(e),e=Bn(this.toPosix(e));let t=-1,i=0,r=-1,n=!0,s=0;for(let a=e.length-1;a>=0;--a){let o=e.charCodeAt(a);if(o===47){if(!n){i=a+1;break}continue}r===-1&&(n=!1,r=a+1),o===46?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||r===-1||s===0||s===1&&t===r-1&&t===i+1?"":e.slice(t,r)},parse(e){Pi(e);let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;e=Bn(this.toPosix(e));let i=e.charCodeAt(0),r=this.isAbsolute(e),n,s="";t.root=this.rootname(e),r||this.hasProtocol(e)?n=1:n=0;let a=-1,o=0,l=-1,h=!0,u=e.length-1,d=0;for(;u>=n;--u){if(i=e.charCodeAt(u),i===47){if(!h){o=u+1;break}continue}l===-1&&(h=!1,l=u+1),i===46?a===-1?a=u:d!==1&&(d=1):a!==-1&&(d=-1)}return a===-1||l===-1||d===0||d===1&&a===l-1&&a===o+1?l!==-1&&(o===0&&r?t.base=t.name=e.slice(1,l):t.base=t.name=e.slice(o,l)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,l)):(t.name=e.slice(o,a),t.base=e.slice(o,l)),t.ext=e.slice(a,l)),t.dir=this.dirname(e),s&&(t.dir=s+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}}),Dr,td=v(()=>{"use strict";Dr=(e,t,i=!1)=>(Array.isArray(e)||(e=[e]),t?e.map(r=>typeof r=="string"||i?t(r):r):e)});function id(e,t,i,r,n){let s=t[i];for(let a=0;a{let a=s.substring(1,s.length-1).split(",");n.push(a)}),id(e,n,0,i,r)}else r.push(e);return r}var Wv=v(()=>{"use strict"}),tl,Vv=v(()=>{"use strict";tl=e=>!Array.isArray(e)});function jv(e){return e.split(".").pop().split("?").shift().split("#").shift()}var il,$v=v(()=>{I(),ed(),td(),Wv(),Vv(),il=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{let t=e;this._defaultSearchParams=Object.keys(t).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(t[i])}`).join("&")}}getAlias(e){let{alias:t,src:i}=e;return Dr(t||i,r=>typeof r=="string"?r:Array.isArray(r)?r.map(n=>n?.src??n):r?.src?r.src:r,!0)}addManifest(e){this._manifest&&F("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(t=>{this.addBundle(t.name,t.assets)})}addBundle(e,t){let i=[],r=t;Array.isArray(t)||(r=Object.entries(t).map(([n,s])=>typeof s=="string"||Array.isArray(s)?{alias:n,src:s}:{alias:n,...s})),r.forEach(n=>{let s=n.src,a=n.alias,o;if(typeof a=="string"){let l=this._createBundleAssetId(e,a);i.push(l),o=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(e,h));i.push(...l),o=[...a,...l]}this.add({...n,alias:o,src:s})}),this._bundles[e]=i}add(e){let t=[];Array.isArray(e)?t.push(...e):t.push(e);let i;i=r=>{this.hasKey(r)&&F(`[Resolver] already has key: ${r} overwriting`)},Dr(t).forEach(r=>{let{src:n}=r,{data:s,format:a,loadParser:o}=r,l=Dr(n).map(d=>typeof d=="string"?zv(d):Array.isArray(d)?d:[d]),h=this.getAlias(r);Array.isArray(h)?h.forEach(i):i(h);let u=[];l.forEach(d=>{d.forEach(p=>{let f={};if(typeof p!="object"){f.src=p;for(let y=0;y{this._assetMap[d]=u})})}resolveBundle(e){let t=tl(e);e=Dr(e);let i={};return e.forEach(r=>{let n=this._bundles[r];if(n){let s=this.resolve(n),a={};for(let o in s){let l=s[o];a[this._extractAssetIdFromBundle(r,o)]=l}i[r]=a}}),t?i[e[0]]:i}resolveUrl(e){let t=this.resolve(e);if(typeof e!="string"){let i={};for(let r in t)i[r]=t[r].src;return i}return t.src}resolve(e){let t=tl(e);e=Dr(e);let i={};return e.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r],s=this._getPreferredOrder(n);s?.priority.forEach(a=>{s.params[a].forEach(o=>{let l=n.filter(h=>h[a]?h[a]===o:!1);l.length&&(n=l)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),t?i[e[0]]:i}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;tn.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;let t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}_buildResolvedAsset(e,t){let{aliases:i,data:r,loadParser:n,format:s}=t;return(this._basePath||this._rootPath)&&(e.src=an.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=i??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...r||{},...e.data},e.loadParser=n??e.loadParser,e.format=s??e.format??jv(e.src),e}},il.RETINA_PREFIX=/@([0-9\.]+)x/}),rl,Xv=v(()=>{"use strict";rl=(e,t)=>{let i=t.split("?")[1];return i&&(e+=`?${i}`),e}});function Yv(){for(let e=0;e<16;e++){let t=[];Ds.push(t);for(let i=0;i<16;i++){let r=In(gr[e]*gr[i]+_r[e]*mr[i]),n=In(mr[e]*gr[i]+vr[e]*mr[i]),s=In(gr[e]*_r[i]+_r[e]*vr[i]),a=In(mr[e]*_r[i]+vr[e]*vr[i]);for(let o=0;o<16;o++)if(gr[o]===r&&mr[o]===n&&_r[o]===s&&vr[o]===a){t.push(o);break}}}for(let e=0;e<16;e++){let t=new ke;t.set(gr[e],mr[e],_r[e],vr[e],0,0),nl.push(t)}}var gr,mr,_r,vr,Ds,nl,In,yt,qv=v(()=>{We(),gr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],mr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],_r=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ds=[],nl=[],In=Math.sign,Yv(),yt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:e=>gr[e],uY:e=>mr[e],vX:e=>_r[e],vY:e=>vr[e],inv:e=>e&8?e&15:-e&7,add:(e,t)=>Ds[e][t],sub:(e,t)=>Ds[e][yt.inv(t)],rotate180:e=>e^4,isVertical:e=>(e&3)===2,byDirection:(e,t)=>Math.abs(e)*2<=Math.abs(t)?t>=0?yt.S:yt.N:Math.abs(t)*2<=Math.abs(e)?e>0?yt.E:yt.W:t>0?e>0?yt.SE:yt.SW:e>0?yt.NE:yt.NW,matrixAppendRotationInv:(e,t,i=0,r=0)=>{let n=nl[yt.inv(t)];n.tx=i,n.ty=r,e.append(n)}}}),sl,Kv=v(()=>{"use strict";sl=()=>{}});function on(e){return e+=e===0?1:0,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+1}function rd(e){return!(e&e-1)&&!!e}var Ls=v(()=>{"use strict"});function Zv(e){let t={};for(let i in e)e[i]!==void 0&&(t[i]=e[i]);return t}var Jv=v(()=>{"use strict"});function Qv(e){let t=al[e];return t===void 0&&(al[e]=at("resource")),t}var al,ol,nd,ey=v(()=>{xt(),bt(),wt(),al=Object.create(null),ol=class J_ extends Je{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...J_.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){Xe(Ve,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Qv(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}},ol.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"},nd=ol}),ll,Dt,fi=v(()=>{xt(),Ls(),Jv(),bt(),ey(),ll=class Q_ extends Je{constructor(t={}){super(),this.options=t,this.uid=at("textureSource"),this._resourceType="textureSource",this._resourceId=at("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...Q_.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new nd(Zv(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=at("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,i,r){r=r||this._resolution,t=t||this.width,i=i||this.height;let n=Math.round(t*r),s=Math.round(i*r);return this.width=n/r,this.height=s/r,this._resolution=r,this.pixelWidth===n&&this.pixelHeight===s?!1:(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=s,this.emit("resize",this),this._resourceId=at("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=rd(this.pixelWidth)&&rd(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}},ll.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1},Dt=ll}),Ns,sd=v(()=>{te(),fi(),Ns=class extends Dt{constructor(e){let t=e.resource||new Float32Array(e.width*e.height*4),i=e.format;i||(t instanceof Float32Array?i="rgba32float":t instanceof Int32Array||t instanceof Uint32Array?i="rgba32uint":t instanceof Int16Array||t instanceof Uint16Array?i="rgba16uint":(t instanceof Int8Array,i="bgra8unorm")),super({...e,resource:t,format:i}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}},Ns.extension=G.TextureSource}),hl,ul,ad=v(()=>{We(),hl=new ke,ul=class{constructor(e,t){this.mapCoord=new ke,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof t>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=t,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){this.texture!==e&&(this._texture?.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(e,t){t===void 0&&(t=e);let i=this.mapCoord;for(let r=0;r{xt(),qv(),E(),bt(),wt(),Kv(),sd(),fi(),ad(),Re=class extends Je{constructor({source:e,label:t,frame:i,orig:r,trim:n,defaultAnchor:s,defaultBorders:a,rotate:o,dynamic:l}={}){if(super(),this.uid=at("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new ot,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new Dt,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=r||this.frame,this.trim=n,this.rotate=o??0,this.defaultAnchor=s,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new ul(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:e,frame:t}=this,{width:i,height:r}=this._source,n=t.x/i,s=t.y/r,a=t.width/i,o=t.height/r,l=this.rotate;if(l){let h=a/2,u=o/2,d=n+h,p=s+u;l=yt.add(l,yt.NW),e.x0=d+h*yt.uX(l),e.y0=p+u*yt.uY(l),l=yt.add(l,2),e.x1=d+h*yt.uX(l),e.y1=p+u*yt.uY(l),l=yt.add(l,2),e.x2=d+h*yt.uX(l),e.y2=p+u*yt.uY(l),l=yt.add(l,2),e.x3=d+h*yt.uX(l),e.y3=p+u*yt.uY(l)}else e.x0=n,e.y0=s,e.x1=n+a,e.y1=s,e.x2=n+a,e.y2=s+o,e.x3=n,e.y3=s+o}destroy(e=!1){this._source&&e&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return Xe(Ve,"Texture.baseTexture is now Texture.source"),this._source}},Re.EMPTY=new Re({label:"EMPTY",source:new Dt({label:"EMPTY"})}),Re.EMPTY.destroy=sl,Re.WHITE=new Re({source:new Ns({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),Re.WHITE.destroy=sl}),cl,dl,ty=v(()=>{E(),pt(),cl=class Cs{constructor(t,i){this.linkedSheets=[],this._texture=t instanceof Re?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=i;let r=parseFloat(i.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Cs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let i=t,r=Cs.BATCH_SIZE;for(;i-t{this._batchIndex*Cs.BATCH_SIZE{r[n]=t}),Object.keys(t.textures).forEach(n=>{r[n]=t.textures[n]}),!i){let n=an.dirname(e[0]);t.linkedSheets.forEach((s,a)=>{let o=od([`${n}/${t.data.meta.related_multi_packs[a]}`],s,!0);Object.assign(r,o)})}return r}var ld,hd,iy=v(()=>{Fv(),$v(),Xv(),te(),pt(),ed(),ty(),ld=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"],hd={extension:G.Asset,cache:{test:e=>e instanceof dl,getCacheableAssets:(e,t)=>od(e,t,!1)},resolver:{extension:{type:G.ResolveParser,name:"resolveSpritesheet"},test:e=>{let t=e.split("?")[0].split("."),i=t.pop(),r=t.pop();return i==="json"&&ld.includes(r)},parse:e=>{let t=e.split(".");return{resolution:parseFloat(il.RETINA_PREFIX.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{name:"spritesheetLoader",extension:{type:G.LoadParser,priority:Qo.Normal,name:"spritesheetLoader"},async testParse(e,t){return an.extname(t.src).toLowerCase()===".json"&&!!e.frames},async parse(e,t,i){let{texture:r,imageFilename:n}=t?.data??{},s=an.dirname(t.src);s&&s.lastIndexOf("/")!==s.length-1&&(s+="/");let a;if(r instanceof Re)a=r;else{let h=rl(s+(n??e.meta.image),t.src);a=(await i.load([h]))[h]}let o=new dl(a.source,e);await o.parse();let l=e?.meta?.related_multi_packs;if(Array.isArray(l)){let h=[];for(let d of l){if(typeof d!="string")continue;let p=s+d;t.data?.ignoreMultiPack||(p=rl(p,t.src),h.push(i.load({src:p,data:{ignoreMultiPack:!0}})))}let u=await Promise.all(h);o.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(p=>p!==d))})}return o},async unload(e,t,i){await i.unload(e.textureSource._sourceOrigin),e.destroy(!1)}}}}),fl=v(()=>{te(),iy(),pe.add(hd)});function Hs(e,t,i,r){let{width:n,height:s}=i.orig,a=i.trim;if(a){let o=a.width,l=a.height;e.minX=a.x-t._x*n-r,e.maxX=e.minX+o,e.minY=a.y-t._y*s-r,e.maxY=e.minY+l}else e.minX=-t._x*n-r,e.maxX=e.minX+n,e.minY=-t._y*s-r,e.maxY=e.minY+s}var pl=v(()=>{"use strict"}),zs,gl=v(()=>{m(),zi(),zs=class extends Tt{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=0,this._lastInstructionTick=-1,this._bounds=new g(0,1,0,0),this._boundsDirty=!0}_updateBounds(){}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){let t=this.bounds,{x:i,y:r}=e;return i>=t.minX&&i<=t.maxX&&r>=t.minY&&r<=t.maxY}destroy(e){super.destroy(e),this._bounds=null}}}),Ws,ud=v(()=>{kr(),pt(),pl(),gl(),Ws=class wc extends zs{constructor(t=Re.EMPTY){t instanceof Re&&(t={texture:t});let{texture:i=Re.EMPTY,anchor:r,roundPixels:n,width:s,height:a,...o}=t;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._didSpriteUpdate=!1,this._sourceBounds={minX:0,maxX:1,minY:0,maxY:0},this._sourceBoundsDirty=!0,this._anchor=new $t({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:i.defaultAnchor&&(this.anchor=i.defaultAnchor),this.texture=i,this.allowChildren=!1,this.roundPixels=n??!1,s!==void 0&&(this.width=s),a!==void 0&&(this.height=a)}static from(t,i=!1){return t instanceof Re?new wc(t):new wc(Re.from(t,i))}set texture(t){t||(t=Re.EMPTY);let i=this._texture;i!==t&&(i&&i.dynamic&&i.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get sourceBounds(){return this._sourceBoundsDirty&&(this._updateSourceBounds(),this._sourceBoundsDirty=!1),this._sourceBounds}containsPoint(t){let i=this.sourceBounds;return t.x>=i.maxX&&t.x<=i.minX&&t.y>=i.maxY&&t.y<=i.minY}addBounds(t){let i=this._texture.trim?this.sourceBounds:this.bounds;t.addFrame(i.minX,i.minY,i.maxX,i.maxY)}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this._sourceBoundsDirty=this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_updateBounds(){Hs(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){let t=this._anchor,i=this._texture,r=this._sourceBounds,{width:n,height:s}=i.orig;r.maxX=-t._x*n,r.minX=r.maxX+n,r.maxY=-t._y*s,r.minY=r.maxY+s}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(i)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,i){let r,n;typeof t!="object"?(r=t,n=i??t):(r=t.width,n=t.height??t.width),r!==void 0&&this._setWidth(r,this._texture.orig.width),n!==void 0&&this._setHeight(n,this._texture.orig.height)}}});function cd(e,t,i){let r=dd;e.measurable=!0,k(e,i,r),t.addBoundsMask(r),e.measurable=!1}var dd,fd=v(()=>{m(),X(),dd=new g});function pd(e,t,i){let r=w.get();e.measurable=!0;let n=x.get().identity(),s=gd(e,i,n);D(e,r,s),e.measurable=!1,t.addBoundsMask(r),x.return(n),w.return(r)}function gd(e,t,i){return e?(e!==t&&(gd(e.parent,t,i),e.updateLocalTransform(),i.append(e.localTransform)),i):(F("Mask bounds, renderable is not inside the root container"),i)}var md=v(()=>{se(),S(),I()}),ml,ry=v(()=>{te(),ud(),fd(),md(),ml=class{constructor(e){this.priority=0,this.pipe="alphaMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof Ws),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(e,t){cd(this.mask,e,t)}addLocalBounds(e,t){pd(this.mask,e,t)}containsPoint(e,t){let i=this.mask;return t(i,e)}destroy(){this.reset()}static test(e){return e instanceof Ws}},ml.extension=G.MaskEffect}),_l,ny=v(()=>{te(),_l=class{constructor(e){this.priority=0,this.pipe="colorMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}},_l.extension=G.MaskEffect}),vl,sy=v(()=>{te(),zi(),fd(),md(),vl=class{constructor(e){this.priority=0,this.pipe="stencilMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(e,t){cd(this.mask,e,t)}addLocalBounds(e,t){pd(this.mask,e,t)}containsPoint(e,t){let i=this.mask;return t(i,e)}destroy(){this.reset()}static test(e){return e instanceof Tt}},vl.extension=G.MaskEffect}),Lr,Vs=v(()=>{Ft(),te(),fi(),Lr=class extends Dt{constructor(e){e.resource||(e.resource=vt.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity;let t=e.resource;(this.pixelWidth!==t.width||this.pixelWidth!==t.height)&&this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(e=this.width,t=this.height,i=this._resolution){let r=super.resize(e,t,i);return r&&this.resizeCanvas(),r}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}},Lr.extension=G.TextureSource}),Gn,yl=v(()=>{Ft(),te(),I(),fi(),Gn=class extends Dt{constructor(e){if(e.resource&&globalThis.HTMLImageElement&&e.resource instanceof HTMLImageElement){let t=vt.get().createCanvas(e.resource.width,e.resource.height);t.getContext("2d").drawImage(e.resource,0,0,e.resource.width,e.resource.height),e.resource=t,F("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}},Gn.extension=G.TextureSource});async function ay(){return xl??(xl=(async()=>{let e=document.createElement("canvas").getContext("webgl");if(!e)return"premultiply-alpha-on-upload";let t=await new Promise(s=>{let a=document.createElement("video");a.onloadeddata=()=>s(a),a.onerror=()=>s(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return"premultiply-alpha-on-upload";let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);let r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);let n=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,n),e.deleteFramebuffer(r),e.deleteTexture(i),e.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),xl}var xl,oy=v(()=>{"use strict"}),On,_d,ly=v(()=>{te(),Us(),oy(),fi(),On=class ev extends Dt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...ev.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Mi.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,i=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(i.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await ay(),this._load=new Promise((r,n)=>{this.isValid?r(this):(this._resolve=r,this._reject=n,i.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${i.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Mi.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Mi.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Mi.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}},On.extension=G.TextureSource,On.defaultOptions={...Dt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},On.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},_d=On}),vd,Wt,js=v(()=>{I(),td(),vd=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){let t=this._cache.get(e);return t||F(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){let i=Dr(e),r;for(let o=0;o{n.set(o,t)});let s=[...n.keys()],a={cacheKeys:s,keys:i};i.forEach(o=>{this._cacheMap.set(o,a)}),s.forEach(o=>{let l=r?r[o]:t;this._cache.has(o)&&this._cache.get(o)!==l&&F("[Cache] already has key:",o),this._cache.set(o,n.get(o))})}remove(e){if(!this._cacheMap.has(e)){F(`[Assets] Asset id ${e} was not found in the Cache`);return}let t=this._cacheMap.get(e);t.cacheKeys.forEach(i=>{this._cache.delete(i)}),t.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}},Wt=new vd});function yd(e={}){let t=e&&e.resource,i=t?e.resource:e,r=t?e:{resource:e};for(let n=0;n<$s.length;n++){let s=$s[n];if(s.test(i))return new s(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function hy(e={},t=!1){let i=e&&e.resource,r=i?e.resource:e,n=i?e:{resource:e};if(!t&&Wt.has(r))return Wt.get(r);let s=new Re({source:yd(n)});return s.on("destroy",()=>{Wt.has(r)&&Wt.remove(r)}),t||Wt.set(r,s),s}function uy(e,t=!1){return typeof e=="string"?Wt.get(e):e instanceof Dt?new Re({source:e}):hy(e,t)}var $s,xd=v(()=>{js(),te(),fi(),pt(),$s=[],pe.handleByList(G.TextureSource,$s),Re.from=uy,Dt.from=yd}),bl=v(()=>{te(),ry(),ny(),sy(),sd(),Vs(),yl(),ly(),xd(),pe.add(ml,_l,vl,_d,Gn,Lr,Ns)}),Vi,Nr=v(()=>{"use strict";Vi=class{constructor(e){this.resources=Object.create(null),this._dirty=!0;let t=0;for(let i in e){let r=e[i];this.setResource(r,t++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let e=[],t=0;for(let i in this.resources)e[t++]=this.resources[i]._resourceId;this._key=e.join("|")}setResource(e,t){let i=this.resources[t];e!==i&&(i&&e.off?.("change",this.onResourceChange,this),e.on?.("change",this.onResourceChange,this),this.resources[t]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e){let t=this.resources;for(let i in t)t[i]._touched=e}destroy(){let e=this.resources;for(let t in e)e[t].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(e){if(this._dirty=!0,e.destroyed){let t=this.resources;for(let i in t)t[i]===e&&(t[i]=null)}else this._updateKey()}}});function bd(){return(!Xs||Xs?.isContextLost())&&(Xs=vt.get().createCanvas().getContext("webgl",{})),Xs}var Xs,wd=v(()=>{Ft()});function cy(e){let t="";for(let i=0;i0&&(t+=` else `),i{"use strict";Td=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` `)});function yr(){if(Hr)return Hr;let e=bd();return Hr=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),Hr=dy(Hr,e),e.getExtension("WEBGL_lose_context")?.loseContext(),Hr}var Hr,xr=v(()=>{wd(),fy(),Hr=null});function wl(e,t){let i=2166136261;for(let r=0;r>>=0;return Tl[i]||py(e,t,i)}function py(e,t,i){let r={},n=0;Ys||(Ys=yr());for(let a=0;a{Nr(),pt(),xr(),Tl={},Ys=0}),El,gy=v(()=>{"use strict";El=class{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}});function Al(e,t){let i=e.byteLength/8|0,r=new Float64Array(e,0,i);new Float64Array(t,0,i).set(r);let n=e.byteLength-i*8;if(n>0){let s=new Uint8Array(e,i*8,n);new Uint8Array(t,i*8,n).set(s)}}var Sd=v(()=>{"use strict"}),Ed,Lt,ln=v(()=>{"use strict";Ed={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Lt=(e=>(e[e.DISABLED=0]="DISABLED",e[e.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",e[e.MASK_ACTIVE=2]="MASK_ACTIVE",e[e.RENDERING_MASK_REMOVE=3]="RENDERING_MASK_REMOVE",e[e.NONE=4]="NONE",e))(Lt||{})});function qs(e,t){return t.alphaMode==="no-premultiply-alpha"&&Ed[e]||e}var Cl=v(()=>{ln()}),Ad,my=v(()=>{"use strict";Ad=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e0?Ml[--Ks]:new Pd}function Md(e){Ml[Ks++]=e}var Pd,Ml,Ks,hn,Pl,Rl,Rd=v(()=>{bt(),gy(),Sd(),Cl(),xr(),my(),Pd=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ad,this.blendMode="normal",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Ml=[],Ks=0,hn=0,Pl=class Ro{constructor(t={}){this.uid=at("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._vertexSize=6,this._elements=[],Ro.defaultOptions.maxTextures=Ro.defaultOptions.maxTextures??yr(),t={...Ro.defaultOptions,...t};let{vertexSize:i,indexSize:r,maxTextures:n}=t;this.attributeBuffer=new El(i*this._vertexSize*4),this.indexBuffer=new Uint16Array(r),this.maxTextures=n}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;tthis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let o=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,h=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,p="startBatch",f=this.maxTextures;for(let y=this.elementStart;y=f||C)&&(this._finishBatch(r,d,u-d,n,a,t,p),p="renderBatch",d=u,a=T,r=Cd(),n=r.textures,n.clear(),++hn),b.textureId=_._textureBindLocation=n.count,n.ids[_.uid]=n.count,n.textures[n.count++]=_,b.batch=r,u+=b.indexSize,b.packAttributes(o,l,b.location,b.textureId),b.packIndex(h,b.indexStart,b.location/this._vertexSize)}n.count>0&&(this._finishBatch(r,d,u-d,n,a,t,p),d=u,++hn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,i,r,n,s,a,o){t.gpuBindGroup=null,t.bindGroup=null,t.action=o,t.batcher=this,t.textures=n,t.blendMode=s,t.start=i,t.size=r,++hn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let i=Math.max(t,this.attributeBuffer.size*2),r=new El(i);Al(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let i=this.indexBuffer,r=Math.max(t,i.length*1.5);r+=r%2;let n=r>65535?new Uint32Array(r):new Uint16Array(r);if(n.BYTES_PER_ELEMENT!==i.BYTES_PER_ELEMENT)for(let s=0;s{"use strict";tt=(e=>(e[e.MAP_READ=1]="MAP_READ",e[e.MAP_WRITE=2]="MAP_WRITE",e[e.COPY_SRC=4]="COPY_SRC",e[e.COPY_DST=8]="COPY_DST",e[e.INDEX=16]="INDEX",e[e.VERTEX=32]="VERTEX",e[e.UNIFORM=64]="UNIFORM",e[e.STORAGE=128]="STORAGE",e[e.INDIRECT=256]="INDIRECT",e[e.QUERY_RESOLVE=512]="QUERY_RESOLVE",e[e.STATIC=1024]="STATIC",e))(tt||{})}),wi,un=v(()=>{xt(),bt(),zr(),wi=class extends Je{constructor(e){let{data:t,size:i}=e,{usage:r,label:n,shrinkToFit:s}=e;super(),this.uid=at("buffer"),this._resourceType="buffer",this._resourceId=at("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,t instanceof Array&&(t=new Float32Array(t)),this._data=t,i=i??t?.byteLength;let a=!!t;this.descriptor={size:i,usage:r,mappedAtCreation:a,label:n},this.shrinkToFit=s??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get static(){return!!(this.descriptor.usage&tt.STATIC)}set static(e){e?this.descriptor.usage|=tt.STATIC:this.descriptor.usage&=~tt.STATIC}setDataWithSize(e,t,i){if(this._updateID++,this._updateSize=t*e.BYTES_PER_ELEMENT,this._data===e){i&&this.emit("update",this);return}let r=this._data;if(this._data=e,r.length!==e.length){!this.shrinkToFit&&e.byteLength{un(),zr()});function vy(e,t,i){let r=e.getAttribute(t);if(!r)return i.minX=0,i.minY=0,i.maxX=0,i.maxY=0,i;let n=r.buffer.data,s=1/0,a=1/0,o=-1/0,l=-1/0,h=n.BYTES_PER_ELEMENT,u=(r.offset||0)/h,d=(r.stride||2*4)/h;for(let p=u;po&&(o=f),y>l&&(l=y),f{"use strict"});function xy(e){return(e instanceof wi||Array.isArray(e)||e.BYTES_PER_ELEMENT)&&(e={buffer:e}),e.buffer=kd(e.buffer,!1),e}var Un,Zs=v(()=>{xt(),m(),bt(),un(),_y(),yy(),Un=class extends Je{constructor(e){let{attributes:t,indexBuffer:i,topology:r}=e;super(),this.uid=at("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new g,this._boundsDirty=!0,this.attributes=t,this.buffers=[],this.instanceCount=e.instanceCount||1;for(let n in t){let s=t[n]=xy(t[n]);this.buffers.indexOf(s.buffer)===-1&&(this.buffers.push(s.buffer),s.buffer.on("update",this.onBufferUpdate,this),s.buffer.on("change",this.onBufferUpdate,this))}i&&(this.indexBuffer=kd(i,!0),this.buffers.push(this.indexBuffer)),this.topology=r||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}getSize(){for(let e in this.attributes){let t=this.attributes[e];return t.buffer.data.length/(t.stride/4||t.size)}return 0}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,vy(this,"aPosition",this._bounds)):this._bounds}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(t=>t.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}}),Bd,Id,kl,Gd=v(()=>{un(),zr(),Zs(),Bd=new Float32Array(1),Id=new Uint32Array(1),kl=class extends Un{constructor(){let e=new wi({data:Bd,label:"attribute-batch-buffer",usage:tt.VERTEX|tt.COPY_DST,shrinkToFit:!1}),t=new wi({data:Id,label:"index-batch-buffer",usage:tt.INDEX|tt.COPY_DST,shrinkToFit:!1}),i=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:5*4}},indexBuffer:t})}}});function by(e,t,i,r,n,s,a,o=null){let l=0;i*=t,n*=s;let h=o.a,u=o.b,d=o.c,p=o.d,f=o.tx,y=o.ty;for(;l{"use strict"});function Od(e,t,i,r,n){let s=t.a,a=t.b,o=t.c,l=t.d,h=t.tx,u=t.ty;i=i||0,r=r||2,n=n||e.length/r-i;let d=i*r;for(let p=0;p{"use strict"});function Ey(e,t){if(e===16777215||!t)return t;if(t===16777215||!e)return e;let i=e>>16&255,r=e>>8&255,n=e&255,s=t>>16&255,a=t>>8&255,o=t&255,l=i*s/255,h=r*a/255,u=n*o/255;return(l<<16)+(h<<8)+u}var Ay=v(()=>{"use strict"}),Js,Ud=v(()=>{Ay(),Js=class{constructor(){this.batcher=null,this.batch=null,this.applyTransform=!0,this.roundPixels=0}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}packIndex(e,t,i){let r=this.geometryData.indices;for(let n=0;n>16|u&65280|(u&255)<<16;if(this.applyTransform){let p=Ey(d,s.groupColor)+(this.alpha*s.groupAlpha*255<<24),f=s.groupTransform,y=r<<16|this.roundPixels&65535,b=f.a,_=f.b,T=f.c,C=f.d,O=f.tx,R=f.ty;for(let z=l;z{te(),cn={extension:{type:G.ShapeBuilder,name:"circle"},build(e,t){let i,r,n,s,a,o;if(e.type==="circle"){let R=e;i=R.x,r=R.y,a=o=R.radius,n=s=0}else if(e.type==="ellipse"){let R=e;i=R.x,r=R.y,a=R.halfWidth,o=R.halfHeight,n=s=0}else{let R=e,z=R.width/2,ee=R.height/2;i=R.x+z,r=R.y+ee,a=o=Math.max(0,Math.min(R.radius,Math.min(z,ee))),n=z-a,s=ee-o}if(!(a>=0&&o>=0&&n>=0&&s>=0))return t;let l=Math.ceil(2.3*Math.sqrt(a+o)),h=l*8+(n?4:0)+(s?4:0);if(h===0)return t;if(l===0)return t[0]=t[6]=i+n,t[1]=t[3]=r+s,t[2]=t[4]=i-n,t[5]=t[7]=r-s,t;let u=0,d=l*4+(n?2:0)+2,p=d,f=h,y=n+a,b=s,_=i+y,T=i-y,C=r+b;if(t[u++]=_,t[u++]=C,t[--d]=C,t[--d]=T,s){let R=r-b;t[p++]=T,t[p++]=R,t[--f]=R,t[--f]=_}for(let R=1;R0&&(n[s++]=l,n[s++]=h,n[s++]=l-1),l++;n[s++]=h+1,n[s++]=h,n[s++]=l-1}},Fd={...cn,extension:{...cn.extension,name:"ellipse"}},Dd={...cn,extension:{...cn.extension,name:"roundedRectangle"}}});function My(e){let t=e.length;if(t<6)return 1;let i=0;for(let r=0,n=e[t-2],s=e[t-1];r{"use strict"});function Ld(e,t,i,r,n,s,a,o){let l=e-i*n,h=t-r*n,u=e+i*s,d=t+r*s,p,f;a?(p=r,f=-i):(p=-r,f=i);let y=l+p,b=h+f,_=u+p,T=d+f;return o.push(y,b),o.push(_,T),2}function Wr(e,t,i,r,n,s,a,o){let l=i-e,h=r-t,u=Math.atan2(l,h),d=Math.atan2(n-e,s-t);o&&ud&&(d+=Math.PI*2);let p=u,f=d-u,y=Math.abs(f),b=Math.sqrt(l*l+h*h),_=(15*y*Math.sqrt(b)/Math.PI>>0)+1,T=f/_;if(p+=T,o){a.push(e,t),a.push(i,r);for(let C=1,O=p;C<_;C++,O+=T)a.push(e,t),a.push(e+Math.sin(O)*b,t+Math.cos(O)*b);a.push(e,t),a.push(n,s)}else{a.push(i,r),a.push(e,t);for(let C=1,O=p;C<_;C++,O+=T)a.push(e+Math.sin(O)*b,t+Math.cos(O)*b),a.push(e,t);a.push(n,s),a.push(e,t)}return _*2}function Ry(e,t,i,r,n,s,a,o,l){let h=1e-4;if(e.length===0)return;let u=t,d=u.alignment;if(t.alignment!==.5){let H=My(e);i&&(H*=-1),d=(d-.5)*H+.5}let p=new De(e[0],e[1]),f=new De(e[e.length-2],e[e.length-1]),y=r,b=Math.abs(p.x-f.x)=0&&(u.join==="round"?C+=Wr(Y,ie,Y-ce*P,ie-U*P,Y-ae*P,ie-K*P,_,!1)+4:C+=2,_.push(Y-ae*A,ie-K*A),_.push(Y+ae*P,ie+K*P));continue}let Ye=(-ce+ne)*(-U+ie)-(-ce+Y)*(-U+Q),St=(-ae+Te)*(-K+ie)-(-ae+Y)*(-K+Pe),Ze=(J*St-oe*Ye)/Oe,_i=(be*Ye-Z*St)/Oe,Oi=(Ze-Y)*(Ze-Y)+(_i-ie)*(_i-ie),q=Y+(Ze-Y)*P,le=ie+(_i-ie)*P,he=Y-(Ze-Y)*A,ge=ie-(_i-ie)*A,Mt=Math.min(J*J+Z*Z,oe*oe+be*be),Es=Ne?P:A,xc=Mt+Es*Es*z;Oi<=xc?u.join==="bevel"||Oi/z>ee?(Ne?(_.push(q,le),_.push(Y+ce*A,ie+U*A),_.push(q,le),_.push(Y+ae*A,ie+K*A)):(_.push(Y-ce*P,ie-U*P),_.push(he,ge),_.push(Y-ae*P,ie-K*P),_.push(he,ge)),C+=2):u.join==="round"?Ne?(_.push(q,le),_.push(Y+ce*A,ie+U*A),C+=Wr(Y,ie,Y+ce*A,ie+U*A,Y+ae*A,ie+K*A,_,!0)+4,_.push(q,le),_.push(Y+ae*A,ie+K*A)):(_.push(Y-ce*P,ie-U*P),_.push(he,ge),C+=Wr(Y,ie,Y-ce*P,ie-U*P,Y-ae*P,ie-K*P,_,!1)+4,_.push(Y-ae*P,ie-K*P),_.push(he,ge)):(_.push(q,le),_.push(he,ge)):(_.push(Y-ce*P,ie-U*P),_.push(Y+ce*A,ie+U*A),u.join==="round"?Ne?C+=Wr(Y,ie,Y+ce*A,ie+U*A,Y+ae*A,ie+K*A,_,!0)+2:C+=Wr(Y,ie,Y-ce*P,ie-U*P,Y-ae*P,ie-K*P,_,!1)+2:u.join==="miter"&&Oi/z<=ee&&(Ne?(_.push(he,ge),_.push(he,ge)):(_.push(q,le),_.push(q,le)),C+=2),_.push(Y-ae*P,ie-K*P),_.push(Y+ae*A,ie+K*A),C+=2)}ne=e[(T-2)*2],Q=e[(T-2)*2+1],Y=e[(T-1)*2],ie=e[(T-1)*2+1],ce=-(Q-ie),U=ne-Y,de=Math.sqrt(ce*ce+U*U),ce/=de,U/=de,ce*=R,U*=R,_.push(Y-ce*P,ie-U*P),_.push(Y+ce*A,ie+U*A),y||(u.cap==="round"?C+=Wr(Y-ce*(P-A)*.5,ie-U*(P-A)*.5,Y-ce*P,ie-U*P,Y+ce*A,ie+U*A,_,!1)+2:u.cap==="square"&&(C+=Ld(Y,ie,ce,U,P,A,!1,_)));let j=1e-4*1e-4;for(let H=O;H{At(),Py()}),Nd=Ue((e,t)=>{"use strict";t.exports=i,t.exports.default=i;function i(M,P,A){A=A||2;var j=P&&P.length,H=j?P[0]*A:M.length,J=r(M,0,H,A,!0),Z=[];if(!J||J.next===J.prev)return Z;var oe,be,me,Oe,Ne,Ye,St;if(j&&(J=u(M,P,J,A)),M.length>80*A){oe=me=M[0],be=Oe=M[1];for(var Ze=A;Zeme&&(me=Ne),Ye>Oe&&(Oe=Ye);St=Math.max(me-oe,Oe-be),St=St!==0?32767/St:0}return s(J,Z,A,oe,be,St,0),Z}function r(M,P,A,j,H){var J,Z;if(H===de(M,P,A,j)>0)for(J=P;J=P;J-=j)Z=U(J,M[J],M[J+1],Z);return Z&&ee(Z,Z.next)&&(ae(Z),Z=Z.next),Z}function n(M,P){if(!M)return M;P||(P=M);var A=M,j;do if(j=!1,!A.steiner&&(ee(A,A.next)||z(A.prev,A,A.next)===0)){if(ae(A),A=P=A.prev,A===A.next)break;j=!0}else A=A.next;while(j||A!==P);return P}function s(M,P,A,j,H,J,Z){if(M){!Z&&J&&b(M,j,H,J);for(var oe=M,be,me;M.prev!==M.next;){if(be=M.prev,me=M.next,J?o(M,j,H,J):a(M)){P.push(be.i/A|0),P.push(M.i/A|0),P.push(me.i/A|0),ae(M),M=me.next,oe=me.next;continue}if(M=me,M===oe){Z?Z===1?(M=l(n(M),P,A),s(M,P,A,j,H,J,2)):Z===2&&h(M,P,A,j,H,J):s(n(M),P,A,j,H,J,1);break}}}}function a(M){var P=M.prev,A=M,j=M.next;if(z(P,A,j)>=0)return!1;for(var H=P.x,J=A.x,Z=j.x,oe=P.y,be=A.y,me=j.y,Oe=HJ?H>Z?H:Z:J>Z?J:Z,St=oe>be?oe>me?oe:me:be>me?be:me,Ze=j.next;Ze!==P;){if(Ze.x>=Oe&&Ze.x<=Ye&&Ze.y>=Ne&&Ze.y<=St&&O(H,oe,J,be,Z,me,Ze.x,Ze.y)&&z(Ze.prev,Ze,Ze.next)>=0)return!1;Ze=Ze.next}return!0}function o(M,P,A,j){var H=M.prev,J=M,Z=M.next;if(z(H,J,Z)>=0)return!1;for(var oe=H.x,be=J.x,me=Z.x,Oe=H.y,Ne=J.y,Ye=Z.y,St=oebe?oe>me?oe:me:be>me?be:me,Oi=Oe>Ne?Oe>Ye?Oe:Ye:Ne>Ye?Ne:Ye,q=T(St,Ze,P,A,j),le=T(_i,Oi,P,A,j),he=M.prevZ,ge=M.nextZ;he&&he.z>=q&&ge&&ge.z<=le;){if(he.x>=St&&he.x<=_i&&he.y>=Ze&&he.y<=Oi&&he!==H&&he!==Z&&O(oe,Oe,be,Ne,me,Ye,he.x,he.y)&&z(he.prev,he,he.next)>=0||(he=he.prevZ,ge.x>=St&&ge.x<=_i&&ge.y>=Ze&&ge.y<=Oi&&ge!==H&&ge!==Z&&O(oe,Oe,be,Ne,me,Ye,ge.x,ge.y)&&z(ge.prev,ge,ge.next)>=0))return!1;ge=ge.nextZ}for(;he&&he.z>=q;){if(he.x>=St&&he.x<=_i&&he.y>=Ze&&he.y<=Oi&&he!==H&&he!==Z&&O(oe,Oe,be,Ne,me,Ye,he.x,he.y)&&z(he.prev,he,he.next)>=0)return!1;he=he.prevZ}for(;ge&&ge.z<=le;){if(ge.x>=St&&ge.x<=_i&&ge.y>=Ze&&ge.y<=Oi&&ge!==H&&ge!==Z&&O(oe,Oe,be,Ne,me,Ye,ge.x,ge.y)&&z(ge.prev,ge,ge.next)>=0)return!1;ge=ge.nextZ}return!0}function l(M,P,A){var j=M;do{var H=j.prev,J=j.next.next;!ee(H,J)&&ne(H,j,j.next,J)&&Te(H,J)&&Te(J,H)&&(P.push(H.i/A|0),P.push(j.i/A|0),P.push(J.i/A|0),ae(j),ae(j.next),j=M=J),j=j.next}while(j!==M);return n(j)}function h(M,P,A,j,H,J){var Z=M;do{for(var oe=Z.next.next;oe!==Z.prev;){if(Z.i!==oe.i&&R(Z,oe)){var be=ce(Z,oe);Z=n(Z,Z.next),be=n(be,be.next),s(Z,P,A,j,H,J,0),s(be,P,A,j,H,J,0);return}oe=oe.next}Z=Z.next}while(Z!==M)}function u(M,P,A,j){var H=[],J,Z,oe,be,me;for(J=0,Z=P.length;J=A.next.y&&A.next.y!==A.y){var oe=A.x+(H-A.y)*(A.next.x-A.x)/(A.next.y-A.y);if(oe<=j&&oe>J&&(J=oe,Z=A.x=A.x&&A.x>=me&&j!==A.x&&O(HZ.x||A.x===Z.x&&y(Z,A)))&&(Z=A,Ne=Ye)),A=A.next;while(A!==be);return Z}function y(M,P){return z(M.prev,M,P.prev)<0&&z(P.next,M,M.next)<0}function b(M,P,A,j){var H=M;do H.z===0&&(H.z=T(H.x,H.y,P,A,j)),H.prevZ=H.prev,H.nextZ=H.next,H=H.next;while(H!==M);H.prevZ.nextZ=null,H.prevZ=null,_(H)}function _(M){var P,A,j,H,J,Z,oe,be,me=1;do{for(A=M,M=null,J=null,Z=0;A;){for(Z++,j=A,oe=0,P=0;P0||be>0&&j;)oe!==0&&(be===0||!j||A.z<=j.z)?(H=A,A=A.nextZ,oe--):(H=j,j=j.nextZ,be--),J?J.nextZ=H:M=H,H.prevZ=J,J=H;A=j}J.nextZ=null,me*=2}while(Z>1);return M}function T(M,P,A,j,H){return M=(M-A)*H|0,P=(P-j)*H|0,M=(M|M<<8)&16711935,M=(M|M<<4)&252645135,M=(M|M<<2)&858993459,M=(M|M<<1)&1431655765,P=(P|P<<8)&16711935,P=(P|P<<4)&252645135,P=(P|P<<2)&858993459,P=(P|P<<1)&1431655765,M|P<<1}function C(M){var P=M,A=M;do(P.x=(M-Z)*(J-oe)&&(M-Z)*(j-oe)>=(A-Z)*(P-oe)&&(A-Z)*(J-oe)>=(H-Z)*(j-oe)}function R(M,P){return M.next.i!==P.i&&M.prev.i!==P.i&&!ie(M,P)&&(Te(M,P)&&Te(P,M)&&Pe(M,P)&&(z(M.prev,M,P.prev)||z(M,P.prev,P))||ee(M,P)&&z(M.prev,M,M.next)>0&&z(P.prev,P,P.next)>0)}function z(M,P,A){return(P.y-M.y)*(A.x-P.x)-(P.x-M.x)*(A.y-P.y)}function ee(M,P){return M.x===P.x&&M.y===P.y}function ne(M,P,A,j){var H=Y(z(M,P,A)),J=Y(z(M,P,j)),Z=Y(z(A,j,M)),oe=Y(z(A,j,P));return!!(H!==J&&Z!==oe||H===0&&Q(M,A,P)||J===0&&Q(M,j,P)||Z===0&&Q(A,M,j)||oe===0&&Q(A,P,j))}function Q(M,P,A){return P.x<=Math.max(M.x,A.x)&&P.x>=Math.min(M.x,A.x)&&P.y<=Math.max(M.y,A.y)&&P.y>=Math.min(M.y,A.y)}function Y(M){return M>0?1:M<0?-1:0}function ie(M,P){var A=M;do{if(A.i!==M.i&&A.next.i!==M.i&&A.i!==P.i&&A.next.i!==P.i&&ne(A,A.next,M,P))return!0;A=A.next}while(A!==M);return!1}function Te(M,P){return z(M.prev,M,M.next)<0?z(M,P,M.next)>=0&&z(M,M.prev,P)>=0:z(M,P,M.prev)<0||z(M,M.next,P)<0}function Pe(M,P){var A=M,j=!1,H=(M.x+P.x)/2,J=(M.y+P.y)/2;do A.y>J!=A.next.y>J&&A.next.y!==A.y&&H<(A.next.x-A.x)*(J-A.y)/(A.next.y-A.y)+A.x&&(j=!j),A=A.next;while(A!==M);return j}function ce(M,P){var A=new K(M.i,M.x,M.y),j=new K(P.i,P.x,P.y),H=M.next,J=P.prev;return M.next=P,P.prev=M,A.next=H,H.prev=A,j.next=A,A.prev=j,J.next=j,j.prev=J,j}function U(M,P,A,j){var H=new K(M,P,A);return j?(H.next=j.next,H.prev=j,j.next.prev=H,j.next=H):(H.prev=H,H.next=H),H}function ae(M){M.next.prev=M.prev,M.prev.next=M.next,M.prevZ&&(M.prevZ.nextZ=M.nextZ),M.nextZ&&(M.nextZ.prevZ=M.prevZ)}function K(M,P,A){this.i=M,this.x=P,this.y=A,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}i.deviation=function(M,P,A,j){var H=P&&P.length,J=H?P[0]*A:M.length,Z=Math.abs(de(M,0,J,A));if(H)for(var oe=0,be=P.length;oe0&&(j+=M[H-1].length,A.holes.push(j))}return A}});function Hd(e,t,i,r,n,s,a){let o=(0,zd.default)(e,t,2);if(!o)return;for(let h=0;h{zd=ht(Nd(),1)}),Vd,jd,By=v(()=>{te(),Wd(),Vd=[],jd={extension:{type:G.ShapeBuilder,name:"polygon"},build(e,t){for(let i=0;i{te(),$d={extension:{type:G.ShapeBuilder,name:"rectangle"},build(e,t){let i=e,r=i.x,n=i.y,s=i.width,a=i.height;return s>=0&&a>=0&&(t[0]=r,t[1]=n,t[2]=r+s,t[3]=n,t[4]=r+s,t[5]=n+a,t[6]=r,t[7]=n+a),t},triangulate(e,t,i,r,n,s){let a=0;r*=i,t[r+a]=e[0],t[r+a+1]=e[1],a+=i,t[r+a]=e[2],t[r+a+1]=e[3],a+=i,t[r+a]=e[6],t[r+a+1]=e[7],a+=i,t[r+a]=e[4],t[r+a+1]=e[5],a+=i;let o=r/i;n[s++]=o,n[s++]=o+1,n[s++]=o+2,n[s++]=o+1,n[s++]=o+3,n[s++]=o+2}}}),Xd,Gy=v(()=>{te(),Xd={extension:{type:G.ShapeBuilder,name:"triangle"},build(e,t){return t[0]=e.x,t[1]=e.y,t[2]=e.x2,t[3]=e.y2,t[4]=e.x3,t[5]=e.y3,t},triangulate(e,t,i,r,n,s){let a=0;r*=i,t[r+a]=e[0],t[r+a+1]=e[1],a+=i,t[r+a]=e[2],t[r+a+1]=e[3],a+=i,t[r+a]=e[4],t[r+a+1]=e[5];let o=r/i;n[s++]=o,n[s++]=o+1,n[s++]=o+2}}});function Oy(e,t){let{geometryData:i,batches:r}=t;r.length=0,i.indices.length=0,i.vertices.length=0,i.uvs.length=0;for(let n=0;n{let f=l.length,y=a.length/2,b=[],_=Fn[u.type];if(_.build(u,b),d&&Od(b,d),r){let R=u.closePath??!0;Ry(b,t,!1,R,a,2,y,l,f)}else if(i&&h===p){h!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");let R=[],z=b.slice();Fy(i.shapePath).forEach(ee=>{R.push(z.length/2),z.push(...ee)}),Hd(z,R,a,2,y,l,f)}else _.triangulate(b,a,2,y,l,f);let T=o.length/2,C=t.texture;if(C!==Re.WHITE){let R=t.matrix;R&&(d&&R.append(d.clone().invert()),by(a,2,y,o,T,2,a.length/2-y,R))}else wy(o,T,2,a.length/2-y);let O=Le.get(Js);O.indexOffset=f,O.indexSize=l.length-f,O.vertexOffset=y,O.vertexSize=a.length/2-y,O.color=t.color,O.alpha=t.alpha,O.texture=C,O.geometryData=s,n.push(O)})}function Fy(e){if(!e)return[];let t=e.shapePrimitives,i=[];for(let r=0;r{te(),E(),Ty(),Sy(),pt(),Ht(),Ud(),Cy(),ky(),By(),Iy(),Gy(),Wd(),Fn={},pe.handleByMap(G.ShapeBuilder,Fn),pe.add($d,jd,Xd,cn,Fd,Dd),qd=new ot}),Kd,Zd,Qs,ea,Bl=v(()=>{te(),Sl(),Rd(),Gd(),lt(),Ht(),Dy(),Kd=class{constructor(){this.batcher=new Rl,this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Zd=class{constructor(){this.geometry=new kl,this.instructions=new et}init(){this.instructions.reset()}},Qs=class Tc{constructor(){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null)}init(t){Tc.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Tc.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let i=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){i?this._cleanGraphicsContextData(t):i=this._initContext(t),Oy(t,i);let r=t.batchMode;t.customShader||r==="no-batch"?i.isBatchable=!1:r==="auto"&&(i.isBatchable=i.geometryData.vertices.length<400),t.dirty=!1}return i}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let i=Le.get(Zd),{batches:r,geometryData:n,batcher:s}=this._gpuContextHash[t.uid],a=n.vertices.length,o=n.indices.length;for(let u=0;u{Le.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}},Qs.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"graphicsContext"},Qs.defaultOptions={bezierSmoothness:.5},ea=Qs}),Jd,ta,ia,ra,na,sa,aa,oa,ji,nr=v(()=>{"use strict";Jd={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},ta=0,ia=1,ra=2,na=3,sa=4,aa=5,oa=class tv{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<>24&255)/255;t[i++]=(e&255)/255*r,t[i++]=(e>>8&255)/255*r,t[i++]=(e>>16&255)/255*r,t[i++]=r}var ha=v(()=>{"use strict"}),Il,Ly=v(()=>{te(),nr(),Ht(),ha(),Ud(),Il=class{constructor(e,t){this.state=ji.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init()}validateRenderable(e){let t=e.context,i=!!this._graphicsBatchesHash[e.uid],r=this.renderer.graphicsContext.updateGpuContext(t);return!!(r.isBatchable||i!==r.isBatchable)}addRenderable(e,t){let i=this.renderer.graphicsContext.updateGpuContext(e.context);e._didGraphicsUpdate&&(e._didGraphicsUpdate=!1,this._rebuild(e)),i.isBatchable?this._addToBatcher(e):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){let t=this._graphicsBatchesHash[e.uid];if(t)for(let i=0;i{let a=Le.get(Js);return s.copyTo(a),a.renderable=e,a.roundPixels=r,a});return this._graphicsBatchesHash[e.uid]===void 0&&e.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[e.uid]=n,n}_removeBatchForRenderable(e){this._graphicsBatchesHash[e].forEach(t=>{Le.return(t)}),this._graphicsBatchesHash[e]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let e in this._graphicsBatchesHash)this._removeBatchForRenderable(e);this._graphicsBatchesHash=null}},Il.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"graphics"}}),Qd=v(()=>{te(),Bl(),Ly(),pe.add(Il),pe.add(ea)});function Dn(e,t){let i=Gl[e];return i===void 0&&(ua[t]===void 0&&(ua[t]=1),Gl[e]=i=ua[t]++),i}var ua,Gl,ca=v(()=>{"use strict";ua=Object.create(null),Gl=Object.create(null)}),Ol,ef,Ny=v(()=>{"use strict";Ol=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4"],ef=Ol.reduce((e,t)=>(e[t]=!0,e),{})});function Hy(e,t){switch(e){case"f32":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);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 zy=v(()=>{"use strict"}),Ul,ti,pi=v(()=>{bt(),ca(),Ny(),zy(),Ul=class iv{constructor(t,i){this._touched=0,this.uid=at("uniform"),this._resourceType="uniformGroup",this._resourceId=at("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,i={...iv.defaultOptions,...i},this.uniformStructures=t;let r={};for(let n in t){let s=t[n];if(s.name=n,s.size=s.size??1,!ef[s.type])throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${Ol.join(", ")}`);s.value??(s.value=Hy(s.type,s.size)),r[n]=s.value}this.uniforms=r,this._dirtyId=1,this.ubo=i.ubo,this.isStatic=i.isStatic,this._signature=Dn(Object.keys(r).map(n=>`${n}-${t[n].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}},Ul.defaultOptions={ubo:!1,isStatic:!1},ti=Ul}),da,Fl=v(()=>{"use strict";da=class{constructor(){this.batcher=null,this.batch=null,this.roundPixels=0,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.mesh.groupBlendMode}reset(){this.mesh=null,this.texture=null,this.batcher=null,this.batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}packIndex(e,t,i){let r=this.geometry.indices;for(let n=0;n{te(),We(),Nr(),pi(),Cl(),Ht(),ha(),Fl(),Dl=class{constructor(e,t){this.localUniforms=new ti({uTransformMatrix:{value:new ke,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Vi({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init()}validateRenderable(e){let t=this._getMeshData(e),i=t.batched,r=e.batched;if(t.batched=r,i!==r)return!0;if(r){let n=e._geometry;if(n.indices.length!==t.indexSize||n.positions.length!==t.vertexSize)return t.indexSize=n.indices.length,t.vertexSize=n.positions.length,!0;let s=this._getBatchableMesh(e),a=e.texture;if(s.texture._source!==a._source&&s.texture._source!==a._source)return!s.batcher.checkAndUpdateTexture(s,a)}return!1}addRenderable(e,t){let i=this.renderer.renderPipes.batch,{batched:r}=this._getMeshData(e);if(r){let n=this._getBatchableMesh(e);n.texture=e._texture,n.geometry=e._geometry,i.addToBatch(n)}else i.break(t),t.add(e)}updateRenderable(e){if(e.batched){let t=this._gpuBatchableMeshHash[e.uid];t.texture=e._texture,t.geometry=e._geometry,t.batcher.updateElement(t)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;let t=this._gpuBatchableMeshHash[e.uid];t&&(Le.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=qs(e.groupBlendMode,e.texture._source);let t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),la(e.groupColorAlpha,t.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){return this._meshDataHash[e.uid]||this._initMeshData(e)}_initMeshData(e){return this._meshDataHash[e.uid]={batched:e.batched,indexSize:e._geometry.indices?.length,vertexSize:e._geometry.positions?.length},e.on("destroyed",this._destroyRenderableBound),this._meshDataHash[e.uid]}_getBatchableMesh(e){return this._gpuBatchableMeshHash[e.uid]||this._initBatchableMesh(e)}_initBatchableMesh(e){let t=Le.get(da);return t.mesh=e,t.texture=e._texture,t.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=t,t.mesh=e,t}destroy(){for(let e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&Le.return(this._gpuBatchableMeshHash[e]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}},Dl.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"mesh"}}),tf=v(()=>{te(),Wy(),pe.add(Dl)}),fa,Ll=v(()=>{"use strict";fa=class{constructor(){this.vertexSize=4,this.indexSize=6,this.location=0,this.batcher=null,this.batch=null,this.roundPixels=0}get blendMode(){return this.renderable.groupBlendMode}packAttributes(e,t,i,r){let n=this.renderable,s=this.texture,a=n.groupTransform,o=a.a,l=a.b,h=a.c,u=a.d,d=a.tx,p=a.ty,f=this.bounds,y=f.maxX,b=f.minX,_=f.maxY,T=f.minY,C=s.uvs,O=n.groupColorAlpha,R=r<<16|this.roundPixels&65535;e[i+0]=o*b+h*T+d,e[i+1]=u*T+l*b+p,e[i+2]=C.x0,e[i+3]=C.y0,t[i+4]=O,t[i+5]=R,e[i+6]=o*y+h*T+d,e[i+7]=u*T+l*y+p,e[i+8]=C.x1,e[i+9]=C.y1,t[i+10]=O,t[i+11]=R,e[i+12]=o*y+h*_+d,e[i+13]=u*_+l*y+p,e[i+14]=C.x2,e[i+15]=C.y2,t[i+16]=O,t[i+17]=R,e[i+18]=o*b+h*_+d,e[i+19]=u*_+l*b+p,e[i+20]=C.x3,e[i+21]=C.y3,t[i+22]=O,t[i+23]=R}packIndex(e,t,i){e[t]=i+0,e[t+1]=i+1,e[t+2]=i+2,e[t+3]=i+0,e[t+4]=i+2,e[t+5]=i+3}reset(){this.renderable=null,this.texture=null,this.batcher=null,this.batch=null,this.bounds=null}}}),Nl,Vy=v(()=>{te(),pl(),Ht(),Ll(),Nl=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e].batchableSprite.renderable;t._autoResolution&&(t._resolution=this._renderer.resolution,t.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();if(t.currentKey!==i){let{width:r,height:n}=this._renderer.canvasText.getTextureSize(e.text,e.resolution,e._style);return!(this._renderer.canvasText.getReferenceCount(t.currentKey)===1&&r===t.texture._source.width&&n===t.texture._source.height)}return!1}addRenderable(e,t){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(e){let t=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),t.batcher.updateElement(t)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let t=this._gpuText[e];this._renderer.canvasText.decreaseReferenceCount(t.currentKey),Le.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),r=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e),e._didTextUpdate=!1;let n=e._style.padding;Hs(r.bounds,e._anchor,r.texture,n)}_updateGpuText(e){let t=this._getGpuText(e),i=t.batchableSprite;t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),t.texture=i.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e._getKey(),i.texture=t.texture}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:null,currentKey:"--",batchableSprite:Le.get(fa)};return t.batchableSprite.renderable=e,t.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},t.batchableSprite.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuText[e.uid]=t,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._updateText(e),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}},Nl.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"text"}}),rf,$i,pa=v(()=>{Ft(),Ls(),rf=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let i=vt.get().createCanvas();i.width=e,i.height=t;let r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(e,t,i=1){e=Math.ceil(e*i-1e-6),t=Math.ceil(t*i-1e-6),e=on(e),t=on(t);let r=(e<<17)+(t<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let n=this._canvasPool[r].pop();return n||(n=this._createCanvasAndContext(e,t)),n}returnCanvasAndContext(e){let t=e.canvas,{width:i,height:r}=t,n=(i<<17)+(r<<1);this._canvasPool[n].push(e)}clear(){this._canvasPool={}}},$i=new rf}),nf,sf,gi,Ln=v(()=>{Ls(),fi(),pt(),nf=0,sf=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,t,i){let r=new Dt({...this.textureOptions,width:e,height:t,resolution:1,antialias:i,autoGarbageCollect:!0});return new Re({source:r,label:`texturePool_${nf++}`})}getOptimalTexture(e,t,i=1,r){let n=Math.ceil(e*i-1e-6),s=Math.ceil(t*i-1e-6);n=on(n),s=on(s);let a=(n<<17)+(s<<1)+(r?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let o=this._texturePool[a].pop();return o||(o=this.createTexture(n,s,r)),o.source._resolution=i,o.source.width=n/i,o.source.height=s/i,o.source.pixelWidth=n,o.source.pixelHeight=s,o.frame.x=0,o.frame.y=0,o.frame.width=e,o.frame.height=t,o.updateUvs(),this._poolKeyHash[o.uid]=a,o}getSameSizeTexture(e,t=!1){let i=e.source;return this.getOptimalTexture(e.width,e.height,i._resolution,t)}returnTexture(e){let t=this._poolKeyHash[e.uid];this._texturePool[t].push(e)}clear(e){if(e=e!==!1,e)for(let t in this._texturePool){let i=this._texturePool[t];if(i)for(let r=0;r{E()}),Hl,dn,zl=v(()=>{Ie(),Ft(),We(),yl(),pt(),bt(),Hl=class Sc{constructor(t,i,r,n){this.uid=at("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=i,this.x1=r,this.y1=n}addColorStop(t,i){return this.gradientStops.push({offset:t,color:ue.shared.setValue(i).toHexa()}),this._styleKey=null,this}buildLinearGradient(){let t=Sc.defaultTextureSize,{gradientStops:i}=this,r=vt.get().createCanvas();r.width=t,r.height=t;let n=r.getContext("2d"),s=n.createLinearGradient(0,0,Sc.defaultTextureSize,1);for(let b=0;b`${n.offset}-${n.color}`).join("-"),i=this.texture.uid,r=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${i}-${r}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}},Hl.defaultTextureSize=256,dn=Hl}),Wl,Nn,Vl=v(()=>{We(),bt(),Wl={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},Nn=class{constructor(e,t){this.uid=at("fillPattern"),this.transform=new ke,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=Wl[t].addressModeU,e.source.style.addressModeV=Wl[t].addressModeV)}setTransform(e){let t=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/t.frame.width,1/t.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}}),Xy=Ue((e,t)=>{t.exports=n;var i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(o){var l=[];return o.replace(r,function(h,u,d){var p=u.toLowerCase();for(d=a(d),p=="m"&&d.length>2&&(l.push([u].concat(d.splice(0,2))),p="l",u=u=="m"?"l":"L");;){if(d.length==i[p])return d.unshift(u),l.push(d);if(d.length0&&(n=r.pop(),n?(s=n.startX,a=n.startY):(s=0,a=0)),n=null;break;default:F(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&n===null&&(n={startX:s,startY:a},r.push(n))}return t}var lf,qy=v(()=>{lf=ht(Xy(),1),I()}),jl,hf=v(()=>{E(),jl=class rv{constructor(t=0,i=0,r=0){this.type="circle",this.x=t,this.y=i,this.radius=r}clone(){return new rv(this.x,this.y,this.radius)}contains(t,i){if(this.radius<=0)return!1;let r=this.radius*this.radius,n=this.x-t,s=this.y-i;return n*=n,s*=s,n+s<=r}strokeContains(t,i,r){if(this.radius===0)return!1;let n=this.x-t,s=this.y-i,a=this.radius,o=r/2,l=Math.sqrt(n*n+s*s);return la-o}getBounds(t){return t=t||new ot,t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}}),uf,Ky=v(()=>{E(),uf=class nv{constructor(t=0,i=0,r=0,n=0){this.type="ellipse",this.x=t,this.y=i,this.halfWidth=r,this.halfHeight=n}clone(){return new nv(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,i){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,n=(i-this.y)/this.halfHeight;return r*=r,n*=n,r+n<=1}strokeContains(t,i,r){let{halfWidth:n,halfHeight:s}=this;if(n<=0||s<=0)return!1;let a=r/2,o=n-a,l=s-a,h=n+a,u=s+a,d=t-this.x,p=i-this.y,f=d*d/(o*o)+p*p/(l*l),y=d*d/(h*h)+p*p/(u*u);return f>1&&y<=1}getBounds(t){return t=t||new ot,t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function Zy(e,t,i,r,n,s){let a=e-i,o=t-r,l=n-i,h=s-r,u=a*l+o*h,d=l*l+h*h,p=-1;d!==0&&(p=u/d);let f,y;p<0?(f=i,y=r):p>1?(f=n,y=s):(f=i+p*l,y=r+p*h);let b=e-f,_=t-y;return b*b+_*_}var Jy=v(()=>{"use strict"}),ga,Qy=v(()=>{Jy(),E(),ga=class sv{constructor(...t){this.type="polygon";let i=Array.isArray(t[0])?t[0]:t;if(typeof i[0]!="number"){let r=[];for(let n=0,s=i.length;ni!=u>i&&t<(h-o)*((i-l)/(u-l))+o&&(r=!r)}return r}strokeContains(t,i,r){let n=r/2,s=n*n,{points:a}=this,o=a.length-(this.closePath?0:2);for(let l=0;ln?h:n,s=ua?u:a}return t.x=r,t.width=n-r,t.y=s,t.height=a-s,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,i)=>`${t}, ${i}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}}),Hn,cf,ex=v(()=>{E(),Hn=(e,t,i,r,n,s)=>{let a=e-i,o=t-r,l=Math.sqrt(a*a+o*o);return l>=n-s&&l<=n+s},cf=class av{constructor(t=0,i=0,r=0,n=0,s=20){this.type="roundedRectangle",this.x=t,this.y=i,this.width=r,this.height=n,this.radius=s}getBounds(t){return t=t||new ot,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new av(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,i){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&i>=this.y&&i<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(i>=this.y+r&&i<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let n=t-(this.x+r),s=i-(this.y+r),a=r*r;if(n*n+s*s<=a||(n=t-(this.x+this.width-r),n*n+s*s<=a)||(s=i-(this.y+this.height-r),n*n+s*s<=a)||(n=t-(this.x+r),n*n+s*s<=a))return!0}return!1}strokeContains(t,i,r){let{x:n,y:s,width:a,height:o,radius:l}=this,h=r/2,u=n+l,d=s+l,p=a-l*2,f=o-l*2,y=n+a,b=s+o;return(t>=n-h&&t<=n+h||t>=y-h&&t<=y+h)&&i>=d&&i<=d+f||(i>=s-h&&i<=s+h||i>=b-h&&i<=b+h)&&t>=u&&t<=u+p?!0:ty-l&&iy-l&&i>b-l&&Hn(t,i,y-l,b-l,l,h)||tb-l&&Hn(t,i,u,b-l,l,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function df(e,t,i,r,n,s,a,o,l,h){let u=Math.min(.99,Math.max(0,h??ea.defaultOptions.bezierSmoothness)),d=(pf-u)/1;return d*=d,tx(t,i,r,n,s,a,o,l,e,d),e}function tx(e,t,i,r,n,s,a,o,l,h){$l(e,t,i,r,n,s,a,o,l,h,0),l.push(a,o)}function $l(e,t,i,r,n,s,a,o,l,h,u){if(u>ff)return;let d=Math.PI,p=(e+i)/2,f=(t+r)/2,y=(i+n)/2,b=(r+s)/2,_=(n+a)/2,T=(s+o)/2,C=(p+y)/2,O=(f+b)/2,R=(y+_)/2,z=(b+T)/2,ee=(C+R)/2,ne=(O+z)/2;if(u>0){let Q=a-e,Y=o-t,ie=Math.abs((i-a)*Y-(r-o)*Q),Te=Math.abs((n-a)*Y-(s-o)*Q),Pe,ce;if(ie>zn&&Te>zn){if((ie+Te)*(ie+Te)<=h*(Q*Q+Y*Y)){if(Vr=d&&(Pe=2*d-Pe),ce>=d&&(ce=2*d-ce),Pe+cebr){l.push(i,r);return}if(ce>br){l.push(n,s);return}}}}else if(ie>zn){if(ie*ie<=h*(Q*Q+Y*Y)){if(Vr=d&&(Pe=2*d-Pe),Pebr){l.push(i,r);return}}}else if(Te>zn){if(Te*Te<=h*(Q*Q+Y*Y)){if(Vr=d&&(Pe=2*d-Pe),Pebr){l.push(n,s);return}}}else if(Q=ee-(e+a)/2,Y=ne-(t+o)/2,Q*Q+Y*Y<=h){l.push(ee,ne);return}}$l(e,t,p,f,C,O,ee,ne,l,h,u+1),$l(ee,ne,R,z,_,T,a,o,l,h,u+1)}var ff,zn,pf,ma,Vr,br,gf=v(()=>{Bl(),ff=8,zn=11920929e-14,pf=1,ma=.01,Vr=0,br=0});function ix(e,t,i,r,n,s,a,o){let l=Math.min(.99,Math.max(0,o??ea.defaultOptions.bezierSmoothness)),h=(vf-l)/1;return h*=h,rx(t,i,r,n,s,a,e,h),e}function rx(e,t,i,r,n,s,a,o){Xl(a,e,t,i,r,n,s,o,0),a.push(n,s)}function Xl(e,t,i,r,n,s,a,o,l){if(l>mf)return;let h=Math.PI,u=(t+r)/2,d=(i+n)/2,p=(r+s)/2,f=(n+a)/2,y=(u+p)/2,b=(d+f)/2,_=s-t,T=a-i,C=Math.abs((r-s)*T-(n-a)*_);if(C>_f){if(C*C<=o*(_*_+T*T)){if(Yl=h&&(O=2*h-O),O{Bl(),mf=8,_f=11920929e-14,vf=1,yf=.01,Yl=0});function xf(e,t,i,r,n,s,a,o){let l=Math.abs(n-s);(!a&&n>s||a&&s>n)&&(l=2*Math.PI-l),o=o||Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI))),o=Math.max(o,3);let h=l/o,u=n;h*=a?-1:1;for(let d=0;d{"use strict"});function sx(e,t,i,r,n,s){let a=e[e.length-2],o=e[e.length-1]-i,l=a-t,h=n-i,u=r-t,d=Math.abs(o*u-l*h);if(d<1e-8||s===0){(e[e.length-2]!==t||e[e.length-1]!==i)&&e.push(t,i);return}let p=o*o+l*l,f=h*h+u*u,y=o*h+l*u,b=s*Math.sqrt(p)/d,_=s*Math.sqrt(f)/d,T=b*y/p,C=_*y/f,O=b*u+_*l,R=b*h+_*o,z=l*(_+T),ee=o*(_+T),ne=u*(b+C),Q=h*(b+C),Y=Math.atan2(ee-R,z-O),ie=Math.atan2(Q-R,ne-O);xf(e,O+t,R+i,s,Y,ie,l*h>u*o)}var ax=v(()=>{bf()});function ox(e,t){let i=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:i,n=Math.cos(e),s=Math.sin(e),a=Math.cos(e+t),o=Math.sin(e+t);return[{x:n-s*r,y:s+n*r},{x:a+o*r,y:o-a*r},{x:a,y:o}]}function lx(e,t,i,r,n,s,a,o=0,l=0,h=0){if(s===0||a===0)return;let u=Math.sin(o*fn/360),d=Math.cos(o*fn/360),p=d*(t-r)/2+u*(i-n)/2,f=-u*(t-r)/2+d*(i-n)/2;if(p===0&&f===0)return;s=Math.abs(s),a=Math.abs(a);let y=Math.pow(p,2)/Math.pow(s,2)+Math.pow(f,2)/Math.pow(a,2);y>1&&(s*=Math.sqrt(y),a*=Math.sqrt(y)),wf(t,i,r,n,s,a,l,h,u,d,p,f,_a);let{ang1:b,ang2:_}=_a,{centerX:T,centerY:C}=_a,O=Math.abs(_)/(fn/4);Math.abs(1-O)<1e-7&&(O=1);let R=Math.max(Math.ceil(O),1);_/=R;let z=e[e.length-2],ee=e[e.length-1],ne={x:0,y:0};for(let Q=0;Q{gf(),fn=Math.PI*2,_a={centerX:0,centerY:0,ang1:0,ang2:0},va=({x:e,y:t},i,r,n,s,a,o,l)=>{e*=i,t*=r;let h=n*e-s*t,u=s*e+n*t;return l.x=h+a,l.y=u+o,l},ql=(e,t,i,r)=>{let n=e*r-t*i<0?-1:1,s=e*i+t*r;return s>1&&(s=1),s<-1&&(s=-1),n*Math.acos(s)},wf=(e,t,i,r,n,s,a,o,l,h,u,d,p)=>{let f=Math.pow(n,2),y=Math.pow(s,2),b=Math.pow(u,2),_=Math.pow(d,2),T=f*y-f*_-y*b;T<0&&(T=0),T/=f*_+y*b,T=Math.sqrt(T)*(a===o?-1:1);let C=T*n/s*d,O=T*-s/n*u,R=h*C-l*O+(e+i)/2,z=l*C+h*O+(t+r)/2,ee=(u-C)/n,ne=(d-O)/s,Q=(-u-C)/n,Y=(-d-O)/s,ie=ql(1,0,ee,ne),Te=ql(ee,ne,Q,Y);o===0&&Te>0&&(Te-=fn),o===1&&Te<0&&(Te+=fn),p.centerX=R,p.centerY=z,p.ang1=ie,p.ang2=Te}});function ux(e,t,i){let r=(a,o)=>{let l=o.x-a.x,h=o.y-a.y,u=Math.sqrt(l*l+h*h),d=l/u,p=h/u;return{len:u,nx:d,ny:p}},n=(a,o)=>{a===0?e.moveTo(o.x,o.y):e.lineTo(o.x,o.y)},s=t[t.length-1];for(let a=0;a0&&(f=-1,y=!0);let b=p/2,_,T=Math.abs(Math.cos(b)*l/Math.sin(b));T>Math.min(u.len/2,d.len/2)?(T=Math.min(u.len/2,d.len/2),_=Math.abs(T*Math.sin(b)/Math.cos(b))):_=l;let C=o.x+d.nx*T+-d.ny*_*f,O=o.y+d.ny*T+d.nx*_*f,R=Math.atan2(u.ny,u.nx)+Math.PI/2*f,z=Math.atan2(d.ny,d.nx)-Math.PI/2*f;a===0&&e.moveTo(C+Math.cos(R)*_,O+Math.sin(R)*_),e.arc(C,O,_,R,z,y),s=o}}function cx(e,t,i,r){let n=(o,l)=>Math.sqrt((o.x-l.x)**2+(o.y-l.y)**2),s=(o,l,h)=>({x:o.x+(l.x-o.x)*h,y:o.y+(l.y-o.y)*h}),a=t.length;for(let o=0;o{"use strict"}),Tf,Sf,fx=v(()=>{hf(),Ky(),Qy(),E(),ex(),m(),gf(),nx(),bf(),ax(),hx(),dx(),Tf=new ot,Sf=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new g,this._graphicsPath2D=e}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();let i=this._currentPoly.points,r=i[i.length-2],n=i[i.length-1];return(r!==e||n!==t)&&i.push(e,t),this}arc(e,t,i,r,n,s){this._ensurePoly(!1);let a=this._currentPoly.points;return xf(a,e,t,i,r,n,s),this}arcTo(e,t,i,r,n){this._ensurePoly();let s=this._currentPoly.points;return sx(s,e,t,i,r,n),this}arcToSvg(e,t,i,r,n,s,a){let o=this._currentPoly.points;return lx(o,this._currentPoly.lastX,this._currentPoly.lastY,s,a,e,t,i,r,n),this}bezierCurveTo(e,t,i,r,n,s,a){this._ensurePoly();let o=this._currentPoly;return df(this._currentPoly.points,o.lastX,o.lastY,e,t,i,r,n,s,a),this}quadraticCurveTo(e,t,i,r,n){this._ensurePoly();let s=this._currentPoly;return ix(this._currentPoly.points,s.lastX,s.lastY,e,t,i,r,n),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));for(let i=0;i=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,s)}ellipse(e,t,i,r,n){return this.drawShape(new uf(e,t,i,r),n),this}roundRect(e,t,i,r,n,s){return this.drawShape(new cf(e,t,i,r,n),s),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let i=this._currentPoly;return i&&this.endPoly(),i=new ga,i.points.push(e,t),this._currentPoly=i,this}endPoly(e=!1){let t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new ga,e)){let t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let i=t.shape.x,r=t.shape.y;if(t.transform&&!t.transform.isIdentity()){let n=t.transform,s=i;i=n.a*i+n.c*r+n.tx,r=n.b*s+n.d*r+n.ty}this._currentPoly.points.push(i,r)}else this._currentPoly.points.push(0,0)}}buildPath(){let e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let t=0;t{At(),bt(),I(),qy(),fx(),Vn=class ov{constructor(t){this.instructions=[],this.uid=at("graphicsPath"),this._dirty=!0,typeof t=="string"?Yy(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Sf(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,i){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,i]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,i,r,n,s){let a=this.instructions[this.instructions.length-1],o=this.getLastPoint(De.shared),l=0,h=0;if(!a||a.action!=="bezierCurveTo")l=o.x,h=o.y;else{l=a.data[2],h=a.data[3];let u=o.x,d=o.y;l=u+(u-l),h=d+(d-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,i,r,n,s]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,i,r){let n=this.instructions[this.instructions.length-1],s=this.getLastPoint(De.shared),a=0,o=0;if(!n||n.action!=="quadraticCurveTo")a=s.x,o=s.y;else{a=n.data[0],o=n.data[1];let l=s.x,h=s.y;a=l+(l-a),o=h+(h-o)}return this.instructions.push({action:"quadraticCurveTo",data:[a,o,t,i,r]}),this._dirty=!0,this}rect(t,i,r,n,s){return this.instructions.push({action:"rect",data:[t,i,r,n,s]}),this._dirty=!0,this}circle(t,i,r,n){return this.instructions.push({action:"circle",data:[t,i,r,n]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,i,r,n,s,a,o){s=s||n/2;let l=-1*Math.PI/2+a,h=r*2,u=Math.PI*2/h,d=[];for(let p=0;pparseInt(Q,10)),t.context.poly(C,!0),i&&t.context.fill(),r&&t.context.stroke();break;case"polyline":O=e.getAttribute("points"),C=O.match(/\d+/g).map(Q=>parseInt(Q,10)),t.context.poly(C,!1),r&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${e.nodeName}> elements unsupported`);break}}for(let Q=0;Q{Ie(),Ef()});function _x(e){return ue.isColorLike(e)}function Cf(e){return e instanceof Nn}function Mf(e){return e instanceof dn}function vx(e,t,i){let r=ue.shared.setValue(t??0);return e.color=r.toNumber(),e.alpha=r.alpha===1?i.alpha:r.alpha,e.texture=Re.WHITE,{...i,...e}}function Pf(e,t,i){return e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,{...i,...e}}function Rf(e,t,i){return t.buildLinearGradient(),e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,{...i,...e}}function yx(e,t){let i={...t,...e};if(i.texture){if(i.texture!==Re.WHITE){let s=i.matrix?.invert()||new ke;s.translate(i.texture.frame.x,i.texture.frame.y),s.scale(1/i.texture.source.width,1/i.texture.source.height),i.matrix=s}let n=i.texture.source.style;n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update())}let r=ue.shared.setValue(i.color);return i.alpha*=r.alpha,i.color=r.toNumber(),i.matrix=i.matrix?i.matrix.clone():null,i}function jr(e,t){if(e==null)return null;let i={},r=e;return _x(e)?vx(i,e,t):Cf(e)?Pf(i,e,t):Mf(e)?Rf(i,e,t):r.fill&&Cf(r.fill)?Pf(r,r.fill,t):r.fill&&Mf(r.fill)?Rf(r,r.fill,t):yx(r,t)}function ya(e,t){let{width:i,alignment:r,miterLimit:n,cap:s,join:a,...o}=t,l=jr(e,o);return l?{width:i,alignment:r,miterLimit:n,cap:s,join:a,...l}:null}var kf=v(()=>{Ie(),We(),pt(),zl(),Vl()}),Bf,Kl,xa,Ti,If=v(()=>{xt(),Ie(),We(),At(),pt(),bt(),wt(),m(),Ef(),mx(),kf(),Bf=new De,Kl=new ke,xa=class Ji extends Je{constructor(){super(...arguments),this.uid=at("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Vn,this._transform=new ke,this._fillStyle={...Ji.defaultFillStyle},this._strokeStyle={...Ji.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new g,this._boundsDirty=!0}clone(){let t=new Ji;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=jr(t,Ji.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ya(t,Ji.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=jr(t,Ji.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=jr(t,Ji.defaultStrokeStyle),this}texture(t,i,r,n,s,a){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:n||0,dw:s||t.frame.width,dh:a||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:i?ue.shared.setValue(i).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Vn,this}fill(t,i){let r,n=this.instructions[this.instructions.length-1];return this._tick===0&&n&&n.action==="stroke"?r=n.data.path:r=this._activePath.clone(),r?(t!=null&&(i!==void 0&&typeof t=="number"&&(Xe(Ve,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:i}),this._fillStyle=jr(t,Ji.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:i}=this._activePath.getLastPoint(De.shared);this._activePath.clear(),this._activePath.moveTo(t,i)}stroke(t){let i,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?i=r.data.path:i=this._activePath.clone(),i?(t!=null&&(this._strokeStyle=ya(t,Ji.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let i=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(i&&(i.action==="stroke"||i.action==="fill"))if(i.data.hole)i.data.hole.addPath(r);else{i.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,i,r,n,s,a){this._tick++;let o=this._transform;return this._activePath.arc(o.a*t+o.c*i+o.tx,o.b*t+o.d*i+o.ty,r,n,s,a),this}arcTo(t,i,r,n,s){this._tick++;let a=this._transform;return this._activePath.arcTo(a.a*t+a.c*i+a.tx,a.b*t+a.d*i+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,s),this}arcToSvg(t,i,r,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,i,r,n,s,l.a*a+l.c*o+l.tx,l.b*a+l.d*o+l.ty),this}bezierCurveTo(t,i,r,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*i+l.tx,l.b*t+l.d*i+l.ty,l.a*r+l.c*n+l.tx,l.b*r+l.d*n+l.ty,l.a*s+l.c*a+l.tx,l.b*s+l.d*a+l.ty,o),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,i,r,n){return this._tick++,this._activePath.ellipse(t,i,r,n,this._transform.clone()),this}circle(t,i,r){return this._tick++,this._activePath.circle(t,i,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,i){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*i+r.tx,r.b*t+r.d*i+r.ty),this}moveTo(t,i){this._tick++;let r=this._transform,n=this._activePath.instructions,s=r.a*t+r.c*i+r.tx,a=r.b*t+r.d*i+r.ty;return n.length===1&&n[0].action==="moveTo"?(n[0].data[0]=s,n[0].data[1]=a,this):(this._activePath.moveTo(s,a),this)}quadraticCurveTo(t,i,r,n,s){this._tick++;let a=this._transform;return this._activePath.quadraticCurveTo(a.a*t+a.c*i+a.tx,a.b*t+a.d*i+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,s),this}rect(t,i,r,n){return this._tick++,this._activePath.rect(t,i,r,n,this._transform.clone()),this}roundRect(t,i,r,n,s){return this._tick++,this._activePath.roundRect(t,i,r,n,s,this._transform.clone()),this}poly(t,i){return this._tick++,this._activePath.poly(t,i,this._transform.clone()),this}regularPoly(t,i,r,n,s=0,a){return this._tick++,this._activePath.regularPoly(t,i,r,n,s,a),this}roundPoly(t,i,r,n,s,a){return this._tick++,this._activePath.roundPoly(t,i,r,n,s,a),this}roundShape(t,i,r,n){return this._tick++,this._activePath.roundShape(t,i,r,n),this}filletRect(t,i,r,n,s){return this._tick++,this._activePath.filletRect(t,i,r,n,s),this}chamferRect(t,i,r,n,s,a){return this._tick++,this._activePath.chamferRect(t,i,r,n,s,a),this}star(t,i,r,n,s=0,a=0){return this._tick++,this._activePath.star(t,i,r,n,s,a,this._transform.clone()),this}svg(t){return this._tick++,px(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,i=t){return this._transform.scale(t,i),this}setTransform(t,i,r,n,s,a){return t instanceof ke?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,i,r,n,s,a),this)}transform(t,i,r,n,s,a){return t instanceof ke?(this._transform.append(t),this):(Kl.set(t,i,r,n,s,a),this._transform.append(Kl),this)}translate(t,i=t){return this._transform.translate(t,i),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let i=0;i{Ie(),Zl=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function wx(e){let t=e;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let i=Xi.defaultDropShadow;e.dropShadow={alpha:t.dropShadowAlpha??i.alpha,angle:t.dropShadowAngle??i.angle,blur:t.dropShadowBlur??i.blur,color:t.dropShadowColor??i.color,distance:t.dropShadowDistance??i.distance}}if(t.strokeThickness!==void 0){Xe(Ve,"strokeThickness is now a part of stroke");let i=t.stroke,r={};if(ue.isColorLike(i))r.color=i;else if(i instanceof dn||i instanceof Nn)r.fill=i;else if(Object.hasOwnProperty.call(i,"color")||Object.hasOwnProperty.call(i,"fill"))r=i;else throw new Error("Invalid stroke value.");e.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){Xe(Ve,"gradient fill is now a fill pattern: `new FillGradient(...)`");let i;e.fontSize==null?e.fontSize=Xi.defaultTextStyle.fontSize:typeof e.fontSize=="string"?i=parseInt(e.fontSize,10):i=e.fontSize;let r=new dn(0,0,0,i*1.7),n=t.fillGradientStops.map(s=>ue.shared.setValue(s).toNumber());n.forEach((s,a)=>{let o=a/(n.length-1);r.addColorStop(o,s)}),e.fill={fill:r}}}var ba,Xi,jn=v(()=>{xt(),Ie(),wt(),zl(),Vl(),If(),kf(),Uf(),ba=class Cn extends Je{constructor(t={}){super(),wx(t);let i={...Cn.defaultTextStyle,...t};for(let r in i){let n=r;this[n]=i[r]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...Cn.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Cn.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t,this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Ti.defaultFillStyle,...t},()=>{this._fill=jr({...this._originalFill},Ti.defaultFillStyle)})),this._fill=jr(t===0?"black":t,Ti.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ti.defaultStrokeStyle,...t},()=>{this._stroke=ya({...this._originalStroke},Ti.defaultStrokeStyle)})),this._stroke=ya(t,Ti.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Gf(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Cn.defaultTextStyle;for(let i in t)this[i]=t[i]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Cn({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,i){return new Proxy(t,{set:(r,n,s)=>(r[n]=s,i?.(n,s),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(ue.isColorLike(t)||t instanceof dn||t instanceof Nn)}},ba.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},ba.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100},Xi=ba});function Ff(e,t,i,r){let n=Df;n.minX=0,n.minY=0,n.maxX=e.width/r|0,n.maxY=e.height/r|0;let s=gi.getOptimalTexture(n.width,n.height,r,!1);return s.source.uploadMethodId="image",s.source.resource=e,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=t/r,s.frame.height=i/r,s.source.emit("update",s.source),s.updateUvs(),s}var Df,Lf=v(()=>{Ln(),m(),Df=new g});function wa(e){let t=typeof e.fontSize=="number"?`${e.fontSize}px`:e.fontSize,i=e.fontFamily;Array.isArray(e.fontFamily)||(i=e.fontFamily.split(","));for(let r=i.length-1;r>=0;r--){let n=i[r].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!Nf.includes(n)&&(n=`"${n}"`),i[r]=n}return`${e.fontStyle} ${e.fontVariant} ${e.fontWeight} ${t} ${i.join(",")}`}var Nf,Jl=v(()=>{"use strict";Nf=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]}),Ta,Si,Ri,Sa=v(()=>{Ft(),Jl(),Ta={willReadFrequently:!0},Si=class Ee{static get experimentalLetterSpacingSupported(){let t=Ee._experimentalLetterSpacingSupported;if(t!==void 0){let i=vt.get().getCanvasRenderingContext2D().prototype;t=Ee._experimentalLetterSpacingSupported="letterSpacing"in i||"textLetterSpacing"in i}return t}constructor(t,i,r,n,s,a,o,l,h){this.text=t,this.style=i,this.width=r,this.height=n,this.lines=s,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=l,this.fontProperties=h}static measureText(t=" ",i,r=Ee._canvas,n=i.wordWrap){let s=`${t}:${i.styleKey}`;if(Ee._measurementCache[s])return Ee._measurementCache[s];let a=wa(i),o=Ee.measureFont(a);o.fontSize===0&&(o.fontSize=i.fontSize,o.ascent=i.fontSize);let l=Ee.__context;l.font=a;let h=(n?Ee._wordWrap(t,i,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let _=0;_0&&(n?s-=i:s+=(Ee.graphemeSegmenter(t).length-1)*i),s}static _wordWrap(t,i,r=Ee._canvas){let n=r.getContext("2d",Ta),s=0,a="",o="",l=Object.create(null),{letterSpacing:h,whiteSpace:u}=i,d=Ee._collapseSpaces(u),p=Ee._collapseNewlines(u),f=!d,y=i.wordWrapWidth+h,b=Ee._tokenize(t);for(let _=0;_y)if(a!==""&&(o+=Ee._addLine(a),a="",s=0),Ee.canBreakWords(T,i.breakWords)){let O=Ee.wordWrapSplit(T);for(let R=0;Ry&&(o+=Ee._addLine(a),f=!1,a="",s=0),a+=z,s+=Q}}else{a.length>0&&(o+=Ee._addLine(a),a="",s=0);let O=_===b.length-1;o+=Ee._addLine(T,!O),f=!1,a="",s=0}else C+s>y&&(f=!1,o+=Ee._addLine(a),a="",s=0),(a.length>0||!Ee.isBreakingSpace(T)||f)&&(a+=T,s+=C)}return o+=Ee._addLine(a,!1),o}static _addLine(t,i=!0){return t=Ee._trimRight(t),t=i?`${t} `:t,t}static _getFromCache(t,i,r,n){let s=r[t];return typeof s!="number"&&(s=Ee._measureText(t,i,n)+i,r[t]=s),s}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let i=t.length-1;i>=0;i--){let r=t[i];if(!Ee.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:Ee._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,i){return typeof t!="string"?!1:Ee._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let i=[],r="";if(typeof t!="string")return i;for(let n=0;n{if(typeof Intl?.Segmenter=="function"){let e=new Intl.Segmenter;return t=>[...e.segment(t)].map(i=>i.segment)}return e=>[...e]})(),Si.experimentalLetterSpacing=!1,Si._fonts={},Si._newlines=[10,13],Si._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Si._measurementCache={},Ri=Si});function Ea(e,t){if(e.texture===Re.WHITE&&!e.fill)return ue.shared.setValue(e.color).setAlpha(e.alpha??1).toHexa();if(e.fill){if(e.fill instanceof Nn){let i=e.fill,r=t.createPattern(i.texture.source.resource,"repeat"),n=i.transform.copyTo(ke.shared);return n.scale(i.texture.frame.width,i.texture.frame.height),r.setTransform(n),r}else if(e.fill instanceof dn){let i=e.fill;if(i.type==="linear"){let r=t.createLinearGradient(i.x0,i.y0,i.x1,i.y1);return i.gradientStops.forEach(n=>{r.addColorStop(n.offset,ue.shared.setValue(n.color).toHex())}),r}}}else{let i=t.createPattern(e.texture.source.resource,"repeat"),r=e.matrix.copyTo(ke.shared);return r.scale(e.texture.frame.width,e.texture.frame.height),i.setTransform(r),i}return F("FillStyle not recognised",e),"red"}var Hf=v(()=>{Ie(),We(),pt(),I(),zl(),Vl()}),Ql,Tx=v(()=>{Ie(),te(),Ls(),pa(),Ln(),$y(),wt(),jn(),Lf(),Sa(),Jl(),Hf(),Ql=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,t,i){let r=Ri.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,r.width)+i.padding*2)*t),s=Math.ceil(Math.ceil(Math.max(1,r.height)+i.padding*2)*t);return n=Math.ceil(n-1e-6),s=Math.ceil(s-1e-6),n=on(n),s=on(s),{width:n,height:s}}getTexture(e,t,i,r){typeof e=="string"&&(Xe("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:i,resolution:t}),e.style instanceof Xi||(e.style=new Xi(e.style));let{texture:n,canvasAndContext:s}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(n._source),$i.returnCanvasAndContext(s),n}createTextureAndCanvas(e){let{text:t,style:i}=e,r=e.resolution??this._renderer.resolution,n=Ri.measureText(t||" ",i),s=Math.ceil(Math.ceil(Math.max(1,n.width)+i.padding*2)*r),a=Math.ceil(Math.ceil(Math.max(1,n.height)+i.padding*2)*r),o=$i.getOptimalCanvasAndContext(s,a),{canvas:l}=o;this.renderTextToCanvas(t,i,r,o);let h=Ff(l,s,a,r);if(i.trim){let u=jy(l,r);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:o}}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;let t=e._getKey();if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;let{texture:i,canvasAndContext:r}=this.createTextureAndCanvas(e);return this._activeTextures[t]={canvasAndContext:r,texture:i,usageCount:1},i}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}decreaseReferenceCount(e){let t=this._activeTextures[e];if(t.usageCount--,t.usageCount===0){$i.returnCanvasAndContext(t.canvasAndContext),gi.returnTexture(t.texture);let i=t.texture.source;i.resource=null,i.uploadMethodId="unknown",i.alphaMode="no-premultiply-alpha",this._activeTextures[e]=null}}getReferenceCount(e){return this._activeTextures[e].usageCount}renderTextToCanvas(e,t,i,r){let{canvas:n,context:s}=r,a=wa(t),o=Ri.measureText(e||" ",t),l=o.lines,h=o.lineHeight,u=o.lineWidths,d=o.maxLineWidth,p=o.fontProperties,f=n.height;s.resetTransform(),s.scale(i,i);let y=t.padding*2;if(s.clearRect(0,0,o.width+4+y,o.height+4+y),t._stroke?.width){let C=t._stroke;s.lineWidth=C.width,s.miterLimit=C.miterLimit,s.lineJoin=C.join,s.lineCap=C.cap}s.font=a;let b,_,T=t.dropShadow?2:1;for(let C=0;C{te(),Vy(),Tx(),pe.add(Ql),pe.add(Nl)}),Aa,Wf=v(()=>{wt(),gl(),If(),Aa=class Ec extends zs{constructor(t){t instanceof Ti&&(t={context:t});let{context:i,roundPixels:r,...n}=t||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",i?this._context=i:this._context=this._ownedContext=new Ti,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(t){t.addBounds(this._context.bounds)}containsPoint(t){return this._context.containsPoint(t)}onViewUpdate(){if(this._didViewChangeTick++,this._didGraphicsUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,i){return this.context[t](...i),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new Ec(this._context.clone()):(this._ownedContext=null,new Ec(this._context))}lineStyle(t,i,r){Xe(Ve,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let n={};return t&&(n.width=t),i&&(n.color=i),r&&(n.alpha=r),this.context.strokeStyle=n,this}beginFill(t,i){Xe(Ve,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t&&(r.color=t),i&&(r.alpha=i),this.context.fillStyle=r,this}endFill(){Xe(Ve,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Ti.defaultStrokeStyle.width||t.color!==Ti.defaultStrokeStyle.color||t.alpha!==Ti.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return Xe(Ve,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return Xe(Ve,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return Xe(Ve,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return Xe(Ve,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return Xe(Ve,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return Xe(Ve,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});function Sx(){if(!Ca){Ca="mediump";let e=bd();e&&e.getShaderPrecisionFormat&&(Ca=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision?"highp":"mediump")}return Ca}var Ca,Ex=v(()=>{wd()});function Ax(e,t,i){return t?e:i?(e=e.replace("out vec4 finalColor;",""),` #ifdef GL_ES // This checks if it is WebGL1 #define in varying #define finalColor gl_FragColor #define texture texture2D #endif ${e} `):` #ifdef GL_ES // This checks if it is WebGL1 #define in attribute #define out varying #endif ${e} `}var Cx=v(()=>{"use strict"});function Mx(e,t,i){let r=i?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(e.substring(0,9)!=="precision"){let n=i?t.requestedFragmentPrecision:t.requestedVertexPrecision;return n==="highp"&&r!=="highp"&&(n="mediump"),`precision ${n} float; ${e}`}else if(r!=="highp"&&e.substring(0,15)==="precision highp")return e.replace("precision highp","precision mediump");return e}var Px=v(()=>{"use strict"});function Rx(e,t){return t?`#version 300 es ${e}`:e}var kx=v(()=>{"use strict"});function Bx(e,{name:t="pixi-program"},i=!0){t=t.replace(/\s+/g,"-"),t+=i?"-fragment":"-vertex";let r=i?Vf:jf;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,e.indexOf("#define SHADER_NAME")!==-1?e:`${`#define SHADER_NAME ${t}`} ${e}`}var Vf,jf,Ix=v(()=>{"use strict";Vf={},jf={}});function Gx(e,t){return t?e.replace("#version 300 es",""):e}var Ox=v(()=>{"use strict"}),Ma,Pa,eh,pn,$n=v(()=>{ca(),Ex(),Cx(),Px(),kx(),Ix(),Ox(),Ma={stripVersion:Gx,ensurePrecision:Mx,addProgramDefines:Ax,setProgramName:Bx,insertVersion:Rx},Pa=Object.create(null),eh=class Ac{constructor(t){t={...Ac.defaultOptions,...t};let i=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:i,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Sx()},setProgramName:{name:t.name},addProgramDefines:i,insertVersion:i},n=t.fragment,s=t.vertex;Object.keys(Ma).forEach(a=>{let o=r[a];n=Ma[a](n,o,!0),s=Ma[a](s,o,!1)}),this.fragment=n,this.vertex=s,this._key=Dn(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(t){let i=`${t.vertex}:${t.fragment}`;return Pa[i]||(Pa[i]=new Ac(t)),Pa[i]}},eh.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"},pn=eh});function Xn(e){return th[e]??th.float32}var th,Ra=v(()=>{"use strict";th={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function Ux({source:e,entryPoint:t}){let i={},r=e.indexOf(`fn ${t}`);if(r!==-1){let n=e.indexOf("->",r);if(n!==-1){let s=e.substring(r,n),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,o;for(;(o=a.exec(s))!==null;){let l=$f[o[3]]??"float32";i[o[2]]={location:parseInt(o[1],10),format:l,stride:Xn(l).stride,offset:0,instance:!1,start:0}}}}return i}var $f,Fx=v(()=>{Ra(),$f={f32:"float32","vec2":"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 ih(e){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,i=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,n=/var(<[^>]+>)? (\w+)/,s=/:\s*(\w+)/,a=/struct\s+(\w+)\s*{([^}]+)}/g,o=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=e.match(t)?.map(d=>({group:parseInt(d.match(i)[1],10),binding:parseInt(d.match(r)[1],10),name:d.match(n)[2],isUniform:d.match(n)[1]==="",type:d.match(s)[1]}));if(!h)return{groups:[],structs:[]};let u=e.match(a)?.map(d=>{let p=d.match(l)[1],f=d.match(o).reduce((y,b)=>{let[_,T]=b.split(":");return y[_.trim()]=T.trim(),y},{});return f?{name:p,members:f}:null}).filter(({name:d})=>h.some(p=>p.type===d))??[];return{groups:h,structs:u}}var Dx=v(()=>{"use strict"}),gn,Lx=v(()=>{"use strict";gn=(e=>(e[e.VERTEX=1]="VERTEX",e[e.FRAGMENT=2]="FRAGMENT",e[e.COMPUTE=4]="COMPUTE",e))(gn||{})});function Nx({groups:e}){let t=[];for(let i=0;i{Lx()});function zx({groups:e}){let t=[];for(let i=0;i{"use strict"});function Vx(e,t){let i=new Set,r=new Set,n=[...e.structs,...t.structs].filter(a=>i.has(a.name)?!1:(i.add(a.name),!0)),s=[...e.groups,...t.groups].filter(a=>{let o=`${a.name}-${a.binding}`;return r.has(o)?!1:(r.add(o),!0)});return{structs:n,groups:s}}var jx=v(()=>{"use strict"}),ka,Yn,Ba=v(()=>{ca(),Fx(),Dx(),Hx(),Wx(),jx(),ka=Object.create(null),Yn=class lv{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:i,vertex:r,layout:n,gpuLayout:s,name:a}=t;if(this.name=a,this.fragment=i,this.vertex=r,i.source===r.source){let o=ih(i.source);this.structsAndGroups=o}else{let o=ih(r.source),l=ih(i.source);this.structsAndGroups=Vx(o,l)}this.layout=n??zx(this.structsAndGroups),this.gpuLayout=s??Nx(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:t,fragment:i}=this,r=t.source+i.source+t.entryPoint+i.entryPoint;this._layoutKey=Dn(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Ux(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){let i=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return ka[i]||(ka[i]=new lv(t)),ka[i]}}});function Xf(e,t,i){if(e)for(let r in e){let n=r.toLocaleLowerCase(),s=t[n];if(s){let a=e[r];r==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),i&&s.push(`//----${i}----//`),s.push(a)}else F(`${r} placement hook does not exist in shader`)}}var $x=v(()=>{I()});function Yf(e){let t={};return(e.match(qf)?.map(i=>i.replace(/[{()}]/g,""))??[]).forEach(i=>{t[i]=[]}),t}var qf,Xx=v(()=>{"use strict";qf=/\{\{(.*?)\}\}/g});function Kf(e,t){let i,r=/@in\s+([^;]+);/g;for(;(i=r.exec(e))!==null;)t.push(i[1])}function Zf(e,t,i=!1){let r=[];Kf(t,r),e.forEach(o=>{o.header&&Kf(o.header,r)});let n=r;i&&n.sort();let s=n.map((o,l)=>` @location(${l}) ${o},`).join(` `),a=t.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",` ${s} `),a}var Yx=v(()=>{"use strict"});function Jf(e,t){let i,r=/@out\s+([^;]+);/g;for(;(i=r.exec(e))!==null;)t.push(i[1])}function qx(e){let t=/\b(\w+)\s*:/g.exec(e);return t?t[1]:""}function Kx(e){let t=/@.*?\s+/g;return e.replace(t,"")}function Zx(e,t){let i=[];Jf(t,i),e.forEach(l=>{l.header&&Jf(l.header,i)});let r=0,n=i.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`, `),s=i.sort().map(l=>` var ${Kx(l)};`).join(` `),a=`return VSOutput( ${i.sort().map(l=>` ${qx(l)}`).join(`, `)});`,o=t.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",` ${n} `),o=o.replace("{{start}}",` ${s} `),o=o.replace("{{return}}",` ${a} `),o}var Jx=v(()=>{"use strict"});function Qf(e,t){let i=e;for(let r in t){let n=t[r];n.join(` `).length?i=i.replace(`{{${r}}}`,`//-----${r} START-----// ${n.join(` `)} //----${r} FINISH----//`):i=i.replace(`{{${r}}}`,"")}return i}var Qx=v(()=>{"use strict"});function e0({template:e,bits:t}){let i=ep(e,t);if(wr[i])return wr[i];let{vertex:r,fragment:n}=i0(e,t);return wr[i]=tp(r,n,t),wr[i]}function t0({template:e,bits:t}){let i=ep(e,t);return wr[i]||(wr[i]=tp(e.vertex,e.fragment,t)),wr[i]}function i0(e,t){let i=t.map(a=>a.vertex).filter(a=>!!a),r=t.map(a=>a.fragment).filter(a=>!!a),n=Zf(i,e.vertex,!0);n=Zx(i,n);let s=Zf(r,e.fragment,!0);return{vertex:n,fragment:s}}function ep(e,t){return t.map(i=>(Ia.has(i)||Ia.set(i,ip++),Ia.get(i))).sort((i,r)=>i-r).join("-")+e.vertex+e.fragment}function tp(e,t,i){let r=Yf(e),n=Yf(t);return i.forEach(s=>{Xf(s.vertex,r,s.name),Xf(s.fragment,n,s.name)}),{vertex:Qf(e,r),fragment:Qf(t,n)}}var wr,Ia,ip,r0=v(()=>{$x(),Xx(),Yx(),Jx(),Qx(),wr=Object.create(null),Ia=new Map,ip=0}),rp,np,sp,ap,n0=v(()=>{"use strict";rp=` @in aPosition: vec2; @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}} }; `,np=` @in vUV : vec2; @in vColor : vec4; {{header}} @fragment fn main( {{in}} ) -> @location(0) vec4 { {{start}} var outColor:vec4; {{main}} return outColor * vColor; }; `,sp=` in vec2 aPosition; in vec2 aUV; out vec4 vColor; out vec2 vUV; {{header}} void main(void){ mat3 worldTransformMatrix = uWorldTransformMatrix; mat3 modelMatrix = mat3( 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 ); vec2 position = aPosition; vec2 uv = aUV; {{start}} vColor = vec4(1.); {{main}} vUV = uv; mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix; gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); vColor *= uWorldColorAlpha; {{end}} } `,ap=` in vec4 vColor; in vec2 vUV; out vec4 finalColor; {{header}} void main(void) { {{start}} vec4 outColor; {{main}} finalColor = outColor * vColor; } `}),op,lp,s0=v(()=>{"use strict";op={name:"global-uniforms-bit",vertex:{header:` struct GlobalUniforms { uProjectionMatrix:mat3x3, uWorldTransformMatrix:mat3x3, uWorldColorAlpha: vec4, uResolution: vec2, } @group(0) @binding(0) var globalUniforms : GlobalUniforms; `}},lp={name:"global-uniforms-bit",vertex:{header:` uniform mat3 uProjectionMatrix; uniform mat3 uWorldTransformMatrix; uniform vec4 uWorldColorAlpha; uniform vec2 uResolution; `}}});function qn({bits:e,name:t}){let i=e0({template:{fragment:np,vertex:rp},bits:[op,...e]});return Yn.from({name:t,vertex:{source:i.vertex,entryPoint:"main"},fragment:{source:i.fragment,entryPoint:"main"}})}function Kn({bits:e,name:t}){return new pn({name:t,...t0({template:{vertex:sp,fragment:ap},bits:[lp,...e]})})}var Tr=v(()=>{$n(),Ba(),r0(),n0(),s0()}),Ga,Oa,Zn=v(()=>{"use strict";Ga={name:"color-bit",vertex:{header:` @in aColor: vec4; `,main:` vColor *= vec4(aColor.rgb * aColor.a, aColor.a); `}},Oa={name:"color-bit",vertex:{header:` in vec4 aColor; `,main:` vColor *= vec4(aColor.rgb * aColor.a, aColor.a); `}}});function a0(e){let t=[];if(e===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let i=0;for(let r=0;r;`),t.push(`@group(1) @binding(${i++}) var textureSampler${r+1}: sampler;`)}return t.join(` `)}function o0(e){let t=[];if(e===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let i=0;i; @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; ${a0(e)} `,main:` var uvDx = dpdx(vUV); var uvDy = dpdy(vUV); ${o0(e)} `}}),Ua[e]}function l0(e){let t=[];for(let i=0;i0&&t.push("else"),i{"use strict";Ua={},Fa={}}),mn,_n,Sr=v(()=>{"use strict";mn={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; } `}},_n={name:"round-pixels-bit",vertex:{header:` vec2 roundPixels(vec2 position, vec2 targetSize) { return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; } `}}});function sh(e){let t=ah[e];if(t)return t;let i=new Int32Array(e);for(let r=0;r{pi(),ah={}}),Ei,sr=v(()=>{"use strict";Ei=(e=>(e[e.WEBGL=1]="WEBGL",e[e.WEBGPU=2]="WEBGPU",e[e.BOTH=3]="BOTH",e))(Ei||{})}),ki,Yi=v(()=>{xt(),$n(),Nr(),Ba(),sr(),pi(),ki=class hv extends Je{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:i,glProgram:r,groups:n,resources:s,compatibleRenderers:a,groupMap:o}=t;this.gpuProgram=i,this.glProgram=r,a===void 0&&(a=0,i&&(a|=Ei.WEBGPU),r&&(a|=Ei.WEBGL)),this.compatibleRenderers=a;let l={};if(!s&&!n&&(s={}),s&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!i&&n&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!i&&n&&o)for(let h in o)for(let u in o[h]){let d=o[h][u];l[d]={group:h,binding:u,name:d}}else if(i&&n&&!o){let h=i.structsAndGroups.groups;o={},h.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u})}else if(s){n={},o={},i&&i.structsAndGroups.groups.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(let u in s)l[u]||(n[99]||(n[99]=new Vi,this._ownedBindGroups.push(n[99])),l[u]={group:99,binding:h,name:u},o[99]=o[99]||{},o[99][h]=u,h++);for(let u in s){let d=u,p=s[u];!p.source&&!p._resourceType&&(p=new ti(p));let f=l[d];f&&(n[f.group]||(n[f.group]=new Vi,this._ownedBindGroups.push(n[f.group])),n[f.group].setResource(p,f.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,l)}addResource(t,i,r){var n,s;(n=this._uniformBindMap)[i]||(n[i]={}),(s=this._uniformBindMap[i])[r]||(s[r]=t),this.groups[i]||(this.groups[i]=new Vi,this._ownedBindGroups.push(this.groups[i]))}_buildResourceAccessor(t,i){let r={};for(let n in i){let s=i[n];Object.defineProperty(r,s.name,{get(){return t[s.group].getResource(s.binding)},set(a){t[s.group].setResource(a,s.binding)}})}return r}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(i=>{i.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:i,gl:r,...n}=t,s,a;return i&&(s=Yn.from(i)),r&&(a=pn.from(r)),new hv({gpuProgram:s,glProgram:a,...n})}}}),hp,up,h0=v(()=>{"use strict";hp={name:"local-uniform-msdf-bit",vertex:{header:` struct LocalUniforms { uColor:vec4, 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)); `}},up={name:"local-uniform-msdf-bit",vertex:{header:` uniform mat3 uTransformMatrix; uniform vec4 uColor; uniform float uRound; `,main:` vColor *= uColor; modelMatrix *= uTransformMatrix; `,end:` if(uRound == 1.) { gl_Position.xy = roundPixels(gl_Position.xy, uResolution); } `},fragment:{header:` uniform float uDistance; `,main:` outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance)); `}}}),cp,dp,u0=v(()=>{"use strict";cp={name:"msdf-bit",fragment:{header:` fn calculateMSDFAlpha(msdfColor:vec4, 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; } `}},dp={name:"msdf-bit",fragment:{header:` float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) { // MSDF float median = msdfColor.r + msdfColor.g + msdfColor.b - min(msdfColor.r, min(msdfColor.g, msdfColor.b)) - max(msdfColor.r, max(msdfColor.g, msdfColor.b)); // SDF median = min(median, msdfColor.a); float screenPxDistance = distance * (median - 0.5); float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0); if (median < 0.01) { alpha = 0.0; } else if (median > 0.99) { alpha = 1.0; } // Gamma correction for coverage-like alpha float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114)); float gamma = mix(1.0, 1.0 / 2.2, luma); float coverage = pow(shapeColor.a * alpha, gamma); return coverage; } `}}}),lh,hh,fp,c0=v(()=>{We(),xr(),Tr(),Zn(),Jn(),Sr(),oh(),Yi(),pi(),h0(),u0(),fp=class extends ki{constructor(){let e=new ti({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new ke,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),t=yr();lh??(lh=qn({name:"sdf-shader",bits:[Ga,rh(t),hp,cp,mn]})),hh??(hh=Kn({name:"sdf-shader",bits:[Oa,nh(t),up,dp,_n]})),super({glProgram:hh,gpuProgram:lh,resources:{localUniforms:e,batchSamplers:sh(t)}})}}}),pp,d0=v(()=>{xt(),wt(),pp=class extends Je{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return Xe(Ve,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return Xe(Ve,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return Xe(Ve,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return Xe(Ve,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return Xe(Ve,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners();for(let t in this.chars)this.chars[t].texture?.destroy();this.chars=null,e&&(this.pages.forEach(t=>t.texture.destroy(!0)),this.pages=null)}}});function gp(e){if(e==="")return[];typeof e=="string"&&(e=[e]);let t=[];for(let i=0,r=e.length;i{"use strict"}),uh,ch,f0=v(()=>{Ie(),E(),pa(),yl(),pt(),wt(),Sa(),Jl(),Hf(),jn(),d0(),mp(),uh=class uv extends pp{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let i={...uv.defaultOptions,...t};this._textureSize=i.textureSize,this._mipmap=i.mipmap;let r=i.style.clone();i.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=Re.WHITE,r._fill.fill=null),this.applyFillAsTint=i.overrideFill;let n=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let s=wa(r);i.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/n):r.fontSize=this.baseRenderedFontSize=n,this._style=r,this._skipKerning=i.skipKerning??!1,this.resolution=i.resolution??1,this._padding=i.padding??4,this.fontMetrics=Ri.measureFont(s),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(t){let i=gp(t).filter(b=>!this._currentChars.includes(b)).filter((b,_,T)=>T.indexOf(b)===_);if(!i.length)return;this._currentChars=[...this._currentChars,...i];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:n,context:s}=r.canvasAndContext,a=r.texture.source,o=this._style,l=this._currentX,h=this._currentY,u=this.baseRenderedFontSize/this.baseMeasurementFontSize,d=this._padding*u,p=o.fontStyle==="italic"?2:1,f=0,y=!1;for(let b=0;bthis._textureSize&&(h+=f,f=z,l=0,h+f>this._textureSize)){a.update();let ne=this._nextPage();n=ne.canvasAndContext.canvas,s=ne.canvasAndContext.context,a=ne.texture.source,h=0}let ee=C/u-(o.dropShadow?.distance??0)-(o._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:ee,kerning:{}},y){this._drawGlyph(s,T,l+d,h+d,u,o);let ne=a.width*u,Q=a.height*u,Y=new ot(l/ne*a.width,h/Q*a.height,R/ne*a.width,z/Q*a.height);this.chars[_].texture=new Re({source:a,frame:Y}),l+=Math.ceil(R)}}a.update(),this._currentX=l,this._currentY=h,this._skipKerning&&this._applyKerning(i,s)}get pageTextures(){return Xe(Ve,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,i){let r=this._measureCache;for(let n=0;n{let y=n.width;for(let b=0;b{let f=n.chars.length-1,y=n.chars[f];for(;y===" ";)n.width-=i.chars[y].xAdvance,y=n.chars[--f];r.width=Math.max(r.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,r.lines.push(n),r.height+=i.lineHeight},u=i.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,p=t.wordWrapWidth*u;for(let f=0;fp?(h(),l(o),b||n.charPositions.push(0)):(o.start=n.width,l(o),b||n.charPositions.push(0)),y==="\r"||y===` `)n.width!==0&&h();else if(!b){let T=_.xAdvance+(_.kerning[s]||0)+d;n.width+=T,n.spaceWidth=T,n.spacesIndex.push(n.charPositions.length),n.chars.push(y)}}else{let T=_.kerning[s]||0,C=_.xAdvance+T+d;o.positions[o.index++]=o.width+T,o.chars.push(y),o.width+=C}s=y}return h(),t.align==="center"?p0(r):t.align==="right"?g0(r):t.align==="justify"&&m0(r),r}function p0(e){for(let t=0;t{"use strict"}),Qn,yp,xp,_0=v(()=>{js(),wt(),I(),jn(),f0(),vp(),mp(),Qn=0,yp=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(e,t){let i=`${t.fontFamily}-bitmap`,r=!0;if(t._fill.fill&&!t._stroke)i+=t._fill.fill.styleKey,r=!1;else if(t._stroke||t.dropShadow){let s=t.styleKey;s=s.substring(0,s.lastIndexOf("-")),i=`${s}-bitmap`,r=!1}if(!Wt.has(i)){let s=new ch({style:t,overrideFill:r,overrideSize:!0,...this.defaultOptions});Qn++,Qn>50&&F("BitmapText",`You have dynamically created ${Qn} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),s.once("destroy",()=>{Qn--,Wt.remove(i)}),Wt.set(i,s)}let n=Wt.get(i);return n.ensureCharacters?.(e),n}getLayout(e,t){let i=this.getFont(e,t);return _p([...e],t,i)}measureText(e,t){return this.getLayout(e,t)}install(...e){let t=e[0];typeof t=="string"&&(t={name:t,style:e[1],chars:e[2]?.chars,resolution:e[2]?.resolution,padding:e[2]?.padding,skipKerning:e[2]?.skipKerning},Xe(Ve,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=t?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");t={...this.defaultOptions,...t};let r=t.style,n=r instanceof Xi?r:new Xi(r),s=n._fill.fill!==null&&n._fill.fill!==void 0,a=new ch({style:n,overrideFill:s,skipKerning:t.skipKerning,padding:t.padding,resolution:t.resolution,overrideSize:!1}),o=gp(t.chars);return a.ensureCharacters(o.join("")),Wt.set(`${i}-bitmap`,a),a.once("destroy",()=>Wt.remove(`${i}-bitmap`)),a}uninstall(e){let t=`${e}-bitmap`,i=Wt.get(t);i&&(Wt.remove(t),i.destroy())}},xp=new yp});function bp(e,t){t.groupTransform=e.groupTransform,t.groupColorAlpha=e.groupColorAlpha,t.groupColor=e.groupColor,t.groupBlendMode=e.groupBlendMode,t.globalDisplayStatus=e.globalDisplayStatus,t.groupTransform=e.groupTransform,t.localDisplayStatus=e.localDisplayStatus,t.groupAlpha=e.groupAlpha,t._roundPixels=e._roundPixels}var dh,v0=v(()=>{js(),te(),Ht(),Wf(),c0(),_0(),vp(),dh=class{constructor(e){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}validateRenderable(e){let t=this._getGpuBitmapText(e);return e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,t)),this._renderer.renderPipes.graphics.validateRenderable(t)}addRenderable(e,t){let i=this._getGpuBitmapText(e);bp(e,i),e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,i)),this._renderer.renderPipes.graphics.addRenderable(i,t),i.context.customShader&&this._updateDistanceField(e)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(e.uid)}_destroyRenderableByUid(e){let t=this._gpuBitmapText[e].context;t.customShader&&(Le.return(t.customShader),t.customShader=null),Le.return(this._gpuBitmapText[e]),this._gpuBitmapText[e]=null}updateRenderable(e){let t=this._getGpuBitmapText(e);bp(e,t),this._renderer.renderPipes.graphics.updateRenderable(t),t.context.customShader&&this._updateDistanceField(e)}_updateContext(e,t){let{context:i}=t,r=xp.getFont(e.text,e._style);i.clear(),r.distanceField.type!=="none"&&(i.customShader||(i.customShader=Le.get(fp)));let n=Array.from(e.text),s=e._style,a=r.baseLineOffset,o=_p(n,s,r),l=0,h=s.padding,u=o.scale,d=o.width,p=o.height+o.offsetY;s._stroke&&(d+=s._stroke.width/u,p+=s._stroke.width/u),i.translate(-e._anchor._x*d-h,-e._anchor._y*p-h).scale(u,u);let f=r.applyFillAsTint?s._fill.color:16777215;for(let y=0;y{te(),v0(),pe.add(dh)}),fh,y0=v(()=>{te(),pt(),pl(),Ht(),Ll(),fh=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e].batchableSprite.renderable;t._autoResolution&&(t._resolution=this._renderer.resolution,t.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();return t.textureNeedsUploading?(t.textureNeedsUploading=!1,!0):t.currentKey!==i}addRenderable(e,t){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(e){let t=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),t.batcher.updateElement(t)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let t=this._gpuText[e];this._renderer.htmlText.decreaseReferenceCount(t.currentKey),Le.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),r=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e).catch(s=>{console.error(s)}),e._didTextUpdate=!1;let n=e._style.padding;Hs(r.bounds,e._anchor,r.texture,n)}async _updateGpuText(e){e._didTextUpdate=!1;let t=this._getGpuText(e);if(t.generatingTexture)return;let i=e._getKey();this._renderer.htmlText.decreaseReferenceCount(t.currentKey),t.generatingTexture=!0,t.currentKey=i;let r=e.resolution??this._renderer.resolution,n=await this._renderer.htmlText.getManagedTexture(e.text,r,e._style,e._getKey()),s=t.batchableSprite;s.texture=t.texture=n,t.generatingTexture=!1,t.textureNeedsUploading=!0,e.onViewUpdate();let a=e._style.padding;Hs(s.bounds,e._anchor,s.texture,a)}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:Re.EMPTY,currentKey:"--",batchableSprite:Le.get(fa),textureNeedsUploading:!1,generatingTexture:!1},i=t.batchableSprite;return i.renderable=e,i.texture=Re.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|e._roundPixels,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._gpuText[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}},fh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"htmlText"}});function x0(){let{userAgent:e}=vt.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(e)}var b0=v(()=>{Ft()}),ph,gh,mh,Tp=v(()=>{"use strict";ph="http://www.w3.org/2000/svg",gh="http://www.w3.org/1999/xhtml",mh=class{constructor(){this.svgRoot=document.createElementNS(ph,"svg"),this.foreignObject=document.createElementNS(ph,"foreignObject"),this.domElement=document.createElementNS(gh,"div"),this.styleElement=document.createElementNS(gh,"style"),this.image=new Image;let{foreignObject:e,svgRoot:t,styleElement:i,domElement:r}=this;e.setAttribute("width","10000"),e.setAttribute("height","10000"),e.style.overflow="hidden",t.appendChild(e),e.appendChild(i),e.appendChild(r)}}});function w0(e){let t=e._stroke,i=e._fill,r=[`div { ${[`color: ${ue.shared.setValue(i.color).toHex()}`,`font-size: ${e.fontSize}px`,`font-family: ${e.fontFamily}`,`font-weight: ${e.fontWeight}`,`font-style: ${e.fontStyle}`,`font-variant: ${e.fontVariant}`,`letter-spacing: ${e.letterSpacing}px`,`text-align: ${e.align}`,`padding: ${e.padding}px`,`white-space: ${e.whiteSpace==="pre"&&e.wordWrap?"pre-wrap":e.whiteSpace}`,...e.lineHeight?[`line-height: ${e.lineHeight}px`]:[],...e.wordWrap?[`word-wrap: ${e.breakWords?"break-all":"break-word"}`,`max-width: ${e.wordWrapWidth}px`]:[],...t?[Ep(t)]:[],...e.dropShadow?[Sp(e.dropShadow)]:[],...e.cssOverrides].join(";")} }`];return T0(e.tagStyles,r),r.join(" ")}function Sp(e){let t=ue.shared.setValue(e.color).setAlpha(e.alpha).toHexa(),i=Math.round(Math.cos(e.angle)*e.distance),r=Math.round(Math.sin(e.angle)*e.distance),n=`${i}px ${r}px`;return e.blur>0?`text-shadow: ${n} ${e.blur}px ${t}`:`text-shadow: ${n} ${t}`}function Ep(e){return[`-webkit-text-stroke-width: ${e.width}px`,`-webkit-text-stroke-color: ${ue.shared.setValue(e.color).toHex()}`,`text-stroke-width: ${e.width}px`,`text-stroke-color: ${ue.shared.setValue(e.color).toHex()}`,"paint-order: stroke"].join(";")}function T0(e,t){for(let i in e){let r=e[i],n=[];for(let s in r)vh[s]?n.push(vh[s](r[s])):_h[s]&&n.push(_h[s].replace("{{VALUE}}",r[s]));t.push(`${i} { ${n.join(";")} }`)}}var _h,vh,S0=v(()=>{Ie(),_h={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},vh={fill:e=>`color: ${ue.shared.setValue(e).toHex()}`,breakWords:e=>`word-wrap: ${e?"break-all":"break-word"}`,stroke:Ep,dropShadow:Sp}}),Ap,E0=v(()=>{I(),jn(),Uf(),S0(),Ap=class cv extends Xi{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Gf(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new cv({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=w0(this)),this._cssStyle}addOverride(...t){let i=t.filter(r=>!this.cssOverrides.includes(r));i.length>0&&(this.cssOverrides.push(...i),this.update())}removeOverride(...t){let i=t.filter(r=>this.cssOverrides.includes(r));i.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!i.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function A0(e,t){let i=t.fontFamily,r=[],n={},s=/font-family:([^;"\s]+)/g,a=e.match(s);function o(l){n[l]||(r.push(l),n[l]=!0)}if(Array.isArray(i))for(let l=0;l{let h=l.split(":")[1].trim();o(h)});for(let l in t.tagStyles){let h=t.tagStyles[l].fontFamily;o(h)}return r}var C0=v(()=>{"use strict"});async function M0(e){let t=await(await vt.get().fetch(e)).blob(),i=new FileReader;return await new Promise((r,n)=>{i.onloadend=()=>r(i.result),i.onerror=n,i.readAsDataURL(t)})}var P0=v(()=>{Ft()});async function Cp(e,t){let i=await M0(t);return`@font-face { font-family: "${e.fontFamily}"; src: url('${i}'); font-weight: ${e.fontWeight}; font-style: ${e.fontStyle}; }`}var R0=v(()=>{P0()});async function k0(e,t,i){let r=e.filter(n=>Wt.has(`${n}-and-url`)).map((n,s)=>{if(!es.has(n)){let{url:a}=Wt.get(`${n}-and-url`);s===0?es.set(n,Cp({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:n},a)):es.set(n,Cp({fontWeight:i.fontWeight,fontStyle:i.fontStyle,fontFamily:n},a))}return es.get(n)});return(await Promise.all(r)).join(` `)}var es,B0=v(()=>{js(),R0(),es=new Map});function I0(e,t,i,r,n){let{domElement:s,styleElement:a,svgRoot:o}=n;s.innerHTML=`
    ${e}
    `,s.setAttribute("style",`transform: scale(${i});transform-origin: top left; display: inline-block`),a.textContent=r;let{width:l,height:h}=n.image;return o.setAttribute("width",l.toString()),o.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(o)}var G0=v(()=>{"use strict"});function O0(e,t){let i=$i.getOptimalCanvasAndContext(e.width,e.height,t),{context:r}=i;return r.clearRect(0,0,e.width,e.height),r.drawImage(e,0,0),$i.returnCanvasAndContext(i),i.canvas}var U0=v(()=>{pa()});function F0(e,t,i){return new Promise(async r=>{i&&await new Promise(n=>setTimeout(n,100)),e.onload=()=>{r()},e.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,e.crossOrigin="anonymous"})}var D0=v(()=>{"use strict"});function L0(e,t,i,r){r=r||Mp||(Mp=new mh);let{domElement:n,styleElement:s,svgRoot:a}=r;n.innerHTML=`
    ${e}
    `,n.setAttribute("style","transform-origin: top left; display: inline-block"),i&&(s.textContent=i),document.body.appendChild(a);let o=n.getBoundingClientRect();a.remove();let l=Ri.measureFont(t.fontStyle).descent,h=t.padding*2;return{width:o.width-h,height:o.height+l-h}}var Mp,N0=v(()=>{Sa(),Tp()}),Da,H0=v(()=>{te(),Ln(),sr(),b0(),I(),Ht(),Lf(),Tp(),E0(),C0(),B0(),G0(),U0(),D0(),N0(),Da=class{constructor(e){this._activeTextures={},this._renderer=e,this._createCanvas=e.type===Ei.WEBGPU}getTexture(e){return this._buildTexturePromise(e.text,e.resolution,e.style)}getManagedTexture(e,t,i,r){if(this._activeTextures[r])return this._increaseReferenceCount(r),this._activeTextures[r].promise;let n=this._buildTexturePromise(e,t,i).then(s=>(this._activeTextures[r].texture=s,s));return this._activeTextures[r]={texture:null,promise:n,usageCount:1},n}async _buildTexturePromise(e,t,i){let r=Le.get(mh),n=A0(e,i),s=await k0(n,i,Ap.defaultTextStyle),a=L0(e,i,s,r),o=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*t),l=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*t),h=r.image,u=2;h.width=(o|0)+u,h.height=(l|0)+u;let d=I0(e,i,t,s,r);await F0(h,d,x0()&&n.length>0);let p=h;this._createCanvas&&(p=O0(h,t));let f=Ff(p,h.width-u,h.height-u,t);return this._createCanvas&&this._renderer.texture.initSource(f.source),Le.return(r),f}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}decreaseReferenceCount(e){let t=this._activeTextures[e];t&&(t.usageCount--,t.usageCount===0&&(t.texture?this._cleanUp(t):t.promise.then(i=>{t.texture=i,this._cleanUp(t)}).catch(()=>{F("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[e]=null))}_cleanUp(e){gi.returnTexture(e.texture),e.texture.source.resource=null,e.texture.source.uploadMethodId="unknown"}getReferenceCount(e){return this._activeTextures[e].usageCount}destroy(){this._activeTextures=null}},Da.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"htmlText"},Da.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}}),Pp=v(()=>{te(),y0(),H0(),pe.add(Da),pe.add(fh)}),yh,La,xh=v(()=>{un(),zr(),Zs(),wt(),yh=class dv extends Un{constructor(...t){let i=t[0]??{};i instanceof Float32Array&&(Xe(Ve,"use new MeshGeometry({ positions, uvs, indices }) instead"),i={positions:i,uvs:t[1],indices:t[2]}),i={...dv.defaultOptions,...i};let r=i.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=i.uvs||new Float32Array([0,0,1,0,1,1,0,1]),s=i.indices||new Uint32Array([0,1,2,0,2,3]),a=i.shrinkBuffersToFit,o=new wi({data:r,label:"attribute-mesh-positions",shrinkToFit:a,usage:tt.VERTEX|tt.COPY_DST}),l=new wi({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:tt.VERTEX|tt.COPY_DST}),h=new wi({data:s,label:"index-mesh-buffer",shrinkToFit:a,usage:tt.INDEX|tt.COPY_DST});super({attributes:{aPosition:{buffer:o,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:h,topology:i.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}},yh.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1},La=yh}),vn,Rp,Na,ts=v(()=>{"use strict";vn={name:"local-uniform-bit",vertex:{header:` struct LocalUniforms { uTransformMatrix:mat3x3, 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); } `}},Rp={...vn,vertex:{...vn.vertex,header:vn.vertex.header.replace("group(1)","group(2)")}},Na={name:"local-uniform-bit",vertex:{header:` uniform mat3 uTransformMatrix; uniform vec4 uColor; uniform float uRound; `,main:` vColor *= uColor; modelMatrix = uTransformMatrix; `,end:` if(uRound == 1.) { gl_Position.xy = roundPixels(gl_Position.xy, uResolution); } `}}}),kp,Bp,z0=v(()=>{"use strict";kp={name:"tiling-bit",vertex:{header:` struct TilingUniforms { uMapCoord:mat3x3, 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); `}},Bp={name:"tiling-bit",vertex:{header:` uniform mat3 uTextureTransform; uniform vec4 uSizeAnchor; `,main:` uv = (uTextureTransform * vec3(aUV, 1.0)).xy; position = (position - uSizeAnchor.zw) * uSizeAnchor.xy; `},fragment:{header:` uniform sampler2D uTexture; uniform mat3 uMapCoord; uniform vec4 uClampFrame; uniform vec2 uClampOffset; `,main:` vec2 coord = vUV + ceil(uClampOffset - vUV); coord = (uMapCoord * vec3(coord, 1.0)).xy; vec2 unclamped = coord; coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0 `}}}),bh,wh,Ip,W0=v(()=>{We(),Tr(),ts(),Sr(),Yi(),pi(),pt(),z0(),Ip=class extends ki{constructor(){bh??(bh=qn({name:"tiling-sprite-shader",bits:[vn,kp,mn]})),wh??(wh=Kn({name:"tiling-sprite-shader",bits:[Na,Bp,_n]}));let e=new ti({uMapCoord:{value:new ke,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new ke,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:wh,gpuProgram:bh,resources:{localUniforms:new ti({uTransformMatrix:{value:new ke,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:Re.EMPTY.source,uSampler:Re.EMPTY.source.style}})}updateUniforms(e,t,i,r,n,s){let a=this.resources.tilingUniforms,o=s.width,l=s.height,h=s.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*o/e,i.b*o/t,i.c*l/e,i.d*l/t,i.tx/e,i.ty/t),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=e,a.uniforms.uSizeAnchor[1]=t,a.uniforms.uSizeAnchor[2]=r,a.uniforms.uSizeAnchor[3]=n,s&&(this.resources.uTexture=s.source,this.resources.uSampler=s.source.style)}}}),Gp,V0=v(()=>{xh(),Gp=class extends La{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}});function j0(e,t){let i=e.anchor.x,r=e.anchor.y;t[0]=-i*e.width,t[1]=-r*e.height,t[2]=(1-i)*e.width,t[3]=-r*e.height,t[4]=(1-i)*e.width,t[5]=(1-r)*e.height,t[6]=-i*e.width,t[7]=(1-r)*e.height}var $0=v(()=>{"use strict"});function X0(e,t,i,r){let n=0,s=e.length/(t||2),a=r.a,o=r.b,l=r.c,h=r.d,u=r.tx,d=r.ty;for(i*=t;n{"use strict"});function q0(e,t){let i=e.texture,r=i.frame.width,n=i.frame.height,s=0,a=0;e._applyAnchorToTexture&&(s=e.anchor.x,a=e.anchor.y),t[0]=t[6]=-s,t[2]=t[4]=1-s,t[1]=t[3]=-a,t[5]=t[7]=1-a;let o=ke.shared;o.copyFrom(e._tileTransform.matrix),o.tx/=e.width,o.ty/=e.height,o.invert(),o.scale(e.width/r,e.height/n),X0(t,2,0,o)}var K0=v(()=>{We(),Y0()}),is,Th,Z0=v(()=>{te(),Cl(),nr(),sr(),ha(),Fl(),xh(),W0(),V0(),$0(),K0(),is=new Gp,Th=class{constructor(e){this._state=ji.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}validateRenderable(e){let t=this._getTilingSpriteData(e),i=t.canBatch;this._updateCanBatch(e);let r=t.canBatch;if(r&&r===i){let{batchableMesh:n}=t;if(n&&n.texture._source!==e.texture._source)return!n.batcher.checkAndUpdateTexture(n,e.texture)}return i!==r}addRenderable(e,t){let i=this._renderer.renderPipes.batch;this._updateCanBatch(e);let r=this._getTilingSpriteData(e),{geometry:n,canBatch:s}=r;if(s){r.batchableMesh||(r.batchableMesh=new da);let a=r.batchableMesh;e._didTilingSpriteUpdate&&(e._didTilingSpriteUpdate=!1,this._updateBatchableMesh(e),a.geometry=n,a.mesh=e,a.texture=e._texture),a.roundPixels=this._renderer._roundPixels|e._roundPixels,i.addToBatch(a)}else i.break(t),r.shader||(r.shader=new Ip),this.updateRenderable(e),t.add(e)}execute(e){let{shader:t}=this._tilingSpriteDataHash[e.uid];t.groups[0]=this._renderer.globalUniforms.bindGroup;let i=t.resources.localUniforms.uniforms;i.uTransformMatrix=e.groupTransform,i.uRound=this._renderer._roundPixels|e._roundPixels,la(e.groupColorAlpha,i.uColor,0),this._state.blendMode=qs(e.groupBlendMode,e.texture._source),this._renderer.encoder.draw({geometry:is,shader:t,state:this._state})}updateRenderable(e){let t=this._getTilingSpriteData(e),{canBatch:i}=t;if(i){let{batchableMesh:r}=t;e._didTilingSpriteUpdate&&this._updateBatchableMesh(e),r.batcher.updateElement(r)}else if(e._didTilingSpriteUpdate){let{shader:r}=t;r.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}e._didTilingSpriteUpdate=!1}destroyRenderable(e){let t=this._getTilingSpriteData(e);t.batchableMesh=null,t.shader?.destroy(),this._tilingSpriteDataHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(e){return this._tilingSpriteDataHash[e.uid]||this._initTilingSpriteData(e)}_initTilingSpriteData(e){let t=new La({indices:is.indices,positions:is.positions.slice(),uvs:is.uvs.slice()});return this._tilingSpriteDataHash[e.uid]={canBatch:!0,renderable:e,geometry:t},e.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[e.uid]}_updateBatchableMesh(e){let t=this._getTilingSpriteData(e),{geometry:i}=t,r=e.texture.source.style;r.addressMode!=="repeat"&&(r.addressMode="repeat",r.update()),q0(e,i.uvs),j0(e,i.positions)}destroy(){for(let e in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[e].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(e){let t=this._getTilingSpriteData(e),i=e.texture,r=!0;return this._renderer.type===Ei.WEBGL&&(r=this._renderer.context.supports.nonPowOf2wrapping),t.canBatch=i.textureMatrix.isSimple&&(r||i.source.isPowerOfTwo),t.canBatch}},Th.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"tilingSprite"}}),Op=v(()=>{te(),Z0(),pe.add(Th)}),Sh,Up,J0=v(()=>{wt(),xh(),Sh=class fv extends La{constructor(...t){super({});let i=t[0]??{};typeof i=="number"&&(Xe(Ve,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),i={width:i,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(i)}build(t){t={...fv.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let i=this.verticesX*this.verticesY,r=[],n=[],s=[],a=this.verticesX-1,o=this.verticesY-1,l=this.width/a,h=this.height/o;for(let d=0;d{J0(),Eh=class pv extends Up{constructor(t={}){t={...pv.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,i=this._leftWidth+this._rightWidth,r=this.width>i?1:this.width/i,n=this._topHeight+this._bottomHeight,s=this.height>n?1:this.height/n,a=Math.min(r,s);t[9]=t[11]=t[13]=t[15]=this._topHeight*a,t[17]=t[19]=t[21]=t[23]=this.height-this._bottomHeight*a,t[25]=t[27]=t[29]=t[31]=this.height,t[2]=t[10]=t[18]=t[26]=this._leftWidth*a,t[4]=t[12]=t[20]=t[28]=this.width-this._rightWidth*a,t[6]=t[14]=t[22]=t[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let i=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=i*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-i*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}},Eh.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100},Fp=Eh}),Ah,eb=v(()=>{te(),Ht(),Fl(),Q0(),Ah=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}addRenderable(e,t){let i=this._getGpuSprite(e);e._didSpriteUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e._didSpriteUpdate&&this._updateBatchableSprite(e,t),t.batcher.updateElement(t)}validateRenderable(e){let t=e._texture,i=this._getGpuSprite(e);return i.texture._source!==t._source?!i.batcher.checkAndUpdateTexture(i,t):!1}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];Le.return(t.geometry),Le.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){e._didSpriteUpdate=!1,t.geometry.update(e),t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=Le.get(da);return t.geometry=Le.get(Fp),t.mesh=e,t.texture=e._texture,t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._didSpriteUpdate=!0,this._gpuSpriteHash[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}},Ah.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"nineSliceSprite"}}),Dp=v(()=>{te(),eb(),pe.add(Ah)}),Ch,tb=v(()=>{te(),Ch=class{constructor(e){this._renderer=e}push(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}},Ch.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"filter"}});function ib(e,t){return t.clear(),Lp(e,t),t.isValid||t.set(0,0,0,0),e.renderGroup?t.applyMatrix(e.renderGroup.localTransform):t.applyMatrix(e.parentRenderGroup.worldTransform),t}function Lp(e,t){if(e.localDisplayStatus!==7||!e.measurable)return;let i=!!e.effects.length,r=t;if((e.renderGroup||i)&&(r=w.get().clear()),e.boundsArea)t.addRect(e.boundsArea,e.worldTransform);else{if(e.renderPipeId){let s=e.bounds;r.addFrame(s.minX,s.minY,s.maxX,s.maxY,e.groupTransform)}let n=e.children;for(let s=0;s{We(),S(),Np=new ke});function nb(e,t){t.clear();let i=t.matrix;for(let r=0;r{"use strict"}),Hp,Mh,ab=v(()=>{te(),We(),At(),Nr(),Zs(),pi(),pt(),Ln(),sr(),m(),rb(),sb(),I(),Hp=new Un({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Mh=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new ti({uInputSize:{value:new Float32Array(4),type:"vec4"},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 Vi({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let t=this.renderer,i=e.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let r=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){r.skip=!0;return}let n=r.bounds;e.renderables?nb(e.renderables,n):e.filterEffect.filterArea?(n.clear(),n.addRect(e.filterEffect.filterArea),n.applyMatrix(e.container.worldTransform)):ib(e.container,n);let s=t.renderTarget.renderTarget.colorTexture.source,a=1/0,o=0,l=!0,h=!1,u=!1;for(let p=0;p0?this._filterStack[this._filterStackIndex-1].bounds:null,o=e.renderTarget.getRenderTarget(t.previousRenderSurface);n=this.getBackTexture(o,r,a)}t.backTexture=n;let s=t.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),e.globalUniforms.pop(),s.length===1)s[0].apply(this,i,t.previousRenderSurface,!1),gi.returnTexture(i);else{let a=t.inputTexture,o=gi.getOptimalTexture(r.width,r.height,a.source._resolution,!1),l=0;for(l=0;l0&&this._filterStack[u].skip;)--u;u>0&&(h=this._filterStack[u].inputTexture.source._resolution);let d=this._filterGlobalUniforms,p=d.uniforms,f=p.uOutputFrame,y=p.uInputSize,b=p.uInputPixel,_=p.uInputClamp,T=p.uGlobalFrame,C=p.uOutputTexture;if(l){let z=this._filterStackIndex;for(;z>0;){z--;let ee=this._filterStack[this._filterStackIndex-1];if(!ee.skip){o.x=ee.bounds.minX,o.y=ee.bounds.minY;break}}f[0]=a.minX-o.x,f[1]=a.minY-o.y}else f[0]=0,f[1]=0;f[2]=t.frame.width,f[3]=t.frame.height,y[0]=t.source.width,y[1]=t.source.height,y[2]=1/y[0],y[3]=1/y[1],b[0]=t.source.pixelWidth,b[1]=t.source.pixelHeight,b[2]=1/b[0],b[3]=1/b[1],_[0]=.5*b[2],_[1]=.5*b[3],_[2]=t.frame.width*y[2]-.5*b[2],_[3]=t.frame.height*y[3]-.5*b[3];let O=this.renderer.renderTarget.rootRenderTarget.colorTexture;T[0]=o.x*h,T[1]=o.y*h,T[2]=O.source.width*h,T[3]=O.source.height*h;let R=this.renderer.renderTarget.getRenderTarget(i);if(n.renderTarget.bind(i,!!r),i instanceof Re?(C[0]=i.frame.width,C[1]=i.frame.height):(C[0]=R.width,C[1]=R.height),C[2]=R.isRoot?-1:1,d.update(),n.renderPipes.uniformBatch){let z=n.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(z,0)}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:Hp,shader:e,state:e._state,topology:"triangle-list"}),n.type===Ei.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new g,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,t){let i=this._activeFilterData,r=e.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),n=t.worldTransform.copyTo(ke.shared);return n.invert(),r.prepend(n),r.scale(1/t.texture.frame.width,1/t.texture.frame.height),r.translate(t.anchor.x,t.anchor.y),r}},Mh.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"filter"}}),zp=v(()=>{te(),tb(),ab(),pe.add(Mh),pe.add(Ch)}),ob={},lb=v(()=>{Rv(),Hc(),Uv(),fl(),bl(),Qd(),tf(),zf(),wp(),Pp(),Op(),Dp(),zp()}),hb={},ub=v(()=>{Hc(),fl(),bl(),Qd(),tf(),zf(),wp(),Pp(),Op(),Dp(),zp()}),Ph,Wp,cb=v(()=>{$n(),Ba(),Yi(),nr(),Ph=class Cc extends ki{constructor(t){t={...Cc.defaultOptions,...t},super(t),this.enabled=!0,this._state=ji.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.addResource("uTexture",0,1)}apply(t,i,r,n){t.applyFilter(this,i,r,n)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:i,gl:r,...n}=t,s,a;return i&&(s=Yn.from(i)),r&&(a=pn.from(r)),new Cc({gpuProgram:s,glProgram:a,...n})}},Ph.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1},Wp=Ph});async function db(e){if(!e)for(let t=0;t{te(),Ha=[],pe.handleByNamedList(G.Environment,Ha)});function Vp(){if(typeof rs=="boolean")return rs;try{rs=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{rs=!1}return rs}var rs,jp=v(()=>{"use strict"}),li,ns=v(()=>{"use strict";li=(e=>(e[e.NONE=0]="NONE",e[e.COLOR=16384]="COLOR",e[e.STENCIL=1024]="STENCIL",e[e.DEPTH=256]="DEPTH",e[e.COLOR_DEPTH=16640]="COLOR_DEPTH",e[e.COLOR_STENCIL=17408]="COLOR_STENCIL",e[e.DEPTH_STENCIL=1280]="DEPTH_STENCIL",e[e.ALL=17664]="ALL",e))(li||{})}),Rh,$p=v(()=>{"use strict";Rh=class{constructor(e){this.items=[],this._name=e}emit(e,t,i,r,n,s,a,o){let{name:l,items:h}=this;for(let u=0,d=h.length;u{Ie(),fb(),zi(),jp(),wt(),ns(),$p(),xt(),Xp=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],kh=class gv extends Je{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let i=[...Xp,...this.config.runners??[]];this._addRunners(...i),this._unsafeEvalCheck()}async init(t={}){let i=t.skipExtensionImports===!0?!0:t.manageImports===!1;await db(i),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...gv.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r{this.runners[i]=new Rh(i)})}_addSystems(t){let i;for(i in t){let r=t[i];this._addSystem(r.value,r.name)}}_addSystem(t,i){let r=new t(this);if(this[i])throw new Error(`Whoops! The name "${i}" is already in use`);this[i]=r,this._systemsHash[i]=r;for(let n in this.runners)this.runners[n].add(r);return this}_addPipes(t,i){let r=i.reduce((n,s)=>(n[s.name]=s.value,n),{});t.forEach(n=>{let s=n.value,a=n.name,o=r[a];this.renderPipes[a]=new s(this,o?new o:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(i=>{i.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Vp())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}},kh.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1},ss=kh}),Bh,pb=v(()=>{te(),We(),xr(),Sl(),Tr(),Zn(),Jn(),ts(),Sr(),Yi(),pi(),Bh=class{init(){let e=new ti({uTransformMatrix:{value:new ke,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),t=qn({name:"graphics",bits:[Ga,rh(yr()),Rp,mn]});this.shader=new ki({gpuProgram:t,resources:{localUniforms:e}})}execute(e,t){let i=t.context,r=i.customShader||this.shader,n=e.renderer,s=n.graphicsContext,{geometry:a,instructions:o}=s.getContextRenderData(i),l=n.encoder;l.setPipelineFromGeometryProgramAndState(a,r.gpuProgram,e.state),l.setGeometry(a,r.gpuProgram);let h=n.globalUniforms.bindGroup;l.setBindGroup(0,h,r.gpuProgram);let u=n.renderPipes.uniformBatch.getUniformBindGroup(r.resources.localUniforms,!0);l.setBindGroup(2,u,r.gpuProgram);let d=o.instructions;for(let p=0;p{"use strict";Yp={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); `}},qp={name:"texture-bit",vertex:{header:` uniform mat3 uTextureMatrix; `,main:` uv = (uTextureMatrix * vec3(uv, 1.0)).xy; `},fragment:{header:` uniform sampler2D uTexture; `,main:` outColor = texture(uTexture, vUV); `}}}),Ih,gb=v(()=>{te(),We(),Tr(),ts(),Sr(),Kp(),Yi(),pt(),I(),Ih=class{init(){let e=qn({name:"mesh",bits:[vn,Yp,mn]});this._shader=new ki({gpuProgram:e,resources:{uTexture:Re.EMPTY._source,uSampler:Re.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new ke}}}})}execute(e,t){let i=e.renderer,r=t._shader;if(!r)r=this._shader,r.groups[2]=i.texture.getTextureBindGroup(t.texture);else if(!r.gpuProgram){F("Mesh shader has no gpuProgram",t.shader);return}let n=r.gpuProgram;if(n.autoAssignGlobalUniforms&&(r.groups[0]=i.globalUniforms.bindGroup),n.autoAssignLocalUniforms){let s=e.localUniforms;r.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(s,!0)}i.encoder.draw({geometry:t._geometry,shader:r,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}},Ih.extension={type:[G.WebGPUPipesAdaptor],name:"mesh"}}),as,Gh,mb=v(()=>{te(),Tr(),Zn(),Jn(),Sr(),Yi(),nr(),xr(),Sl(),as=ji.for2d(),Gh=class{init(){let e=qn({name:"batch",bits:[Ga,rh(yr()),mn]});this._shader=new ki({gpuProgram:e,groups:{}})}start(e,t){let i=e.renderer,r=i.encoder,n=this._shader.gpuProgram;this._geometry=t,r.setGeometry(t,n),as.blendMode="normal",i.pipeline.getPipeline(t,n,as);let s=i.globalUniforms.bindGroup;r.resetBindGroup(1),r.setBindGroup(0,s,n)}execute(e,t){let i=this._shader.gpuProgram,r=e.renderer,n=r.encoder;if(!t.bindGroup){let o=t.textures;t.bindGroup=wl(o.textures,o.count)}as.blendMode=t.blendMode;let s=r.bindGroup.getBindGroup(t.bindGroup,i,1),a=r.pipeline.getPipeline(this._geometry,i,as);t.bindGroup._touch(r.textureGC.count),n.setPipeline(a),n.renderPassEncoder.setBindGroup(1,s),n.renderPassEncoder.drawIndexed(t.size,1,t.start)}destroy(){this._shader.destroy(!0),this._shader=null}},Gh.extension={type:[G.WebGPUPipesAdaptor],name:"batch"}}),Oh,_b=v(()=>{te(),Oh=class{constructor(e){this._renderer=e}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}},Oh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"customRender"}});function Zp(e,t){let i=e.instructionSet,r=i.instructions;for(let n=0;n{"use strict"}),Uh,vb=v(()=>{te(),Jp(),Uh=class{constructor(e){this._renderer=e}addRenderGroup(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:e.worldTransform,worldColor:e.worldColorAlpha}),Zp(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}},Uh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"renderGroup"}});function yb(e,t){let i=e.root,r=e.instructionSet;r.reset();let n=t.renderPipes?t:t.batch.renderer,s=n.renderPipes;s.batch.buildStart(r),s.blendMode.buildStart(),s.colorMask.buildStart(),i.sortableChildren&&i.sortChildren(),Qp(i,r,n,!0),s.batch.buildEnd(r),s.blendMode.buildEnd(r)}function Wa(e,t,i){let r=i.renderPipes?i:i.batch.renderer;e.globalDisplayStatus<7||!e.includeInBuild||(e.sortableChildren&&e.sortChildren(),e.isSimple?xb(e,t,r):Qp(e,t,r,!1))}function xb(e,t,i){if(e.renderPipeId){let{renderPipes:r,renderableGC:n}=i;r.blendMode.setBlendMode(e,e.groupBlendMode,t),e.didViewUpdate=!1,r[e.renderPipeId].addRenderable(e,t),n.addRenderable(e,t)}if(!e.renderGroup){let r=e.children,n=r.length;for(let s=0;s=0;l--){let h=e.effects[l];n[h.pipe].pop(h,e,t)}}}var Fh=v(()=>{"use strict"});function Dh(e,t){t||(t=0);for(let i=t;i{"use strict"});function tg(e,t=[]){t.push(e);for(let i=0;i{"use strict"});function wb(e,t,i){let r=e>>16&255,n=e>>8&255,s=e&255,a=t>>16&255,o=t>>8&255,l=t&255,h=r+(a-r)*i,u=n+(o-n)*i,d=s+(l-s)*i;return(h<<16)+(u<<8)+d}var Tb=v(()=>{"use strict"});function ig(e,t){return e===Va||t===Va?e+t-Va:wb(e,t,.5)}var Va,Sb=v(()=>{Tb(),Va=16777215});function rg(e,t=!1){Eb(e);let i=e.childrenToUpdate,r=e.updateTick++;for(let n in i){let s=Number(n),a=i[n],o=a.list,l=a.index;for(let h=0;h1?1:i,e.worldAlpha=i,e.worldColorAlpha=e.worldColor+((i*255|0)<<24)}function ng(e,t,i){if(t===e.updateTick)return;e.updateTick=t,e.didChange=!1;let r=e.localTransform;e.updateLocalTransform();let n=e.parent;if(n&&!n.renderGroup?(i=i|e._updateFlags,e.relativeGroupTransform.appendFrom(r,n.relativeGroupTransform),i&Lh&&sg(e,n,i)):(i=e._updateFlags,e.relativeGroupTransform.copyFrom(r),i&Lh&&sg(e,ag,i)),!e.renderGroup){let s=e.children,a=s.length;for(let l=0;l1?1:r,e.groupAlpha=r,e.groupColorAlpha=e.groupColor+((r*255|0)<<24)}i&ks&&(e.groupBlendMode=e.localBlendMode==="inherit"?t.groupBlendMode:e.localBlendMode),i&rn&&(e.globalDisplayStatus=e.localDisplayStatus&t.globalDisplayStatus),e._updateFlags=0}var ag,Lh,Ab=v(()=>{zi(),eg(),Sb(),ag=new Tt,Lh=rn|Mn|ks});function Cb(e,t){let{list:i,index:r}=e.childrenRenderablesToUpdate,n=!1;for(let s=0;s{"use strict"});function Pb(e){let{list:t,index:i}=e.childrenRenderablesToUpdate;for(let r=0;r{te(),We(),Fh(),eg(),bb(),Jp(),Ab(),Mb(),og=new ke,Nh=class{constructor(e){this._renderer=e}render({container:e,transform:t}){e.isRenderGroup=!0;let i=e.parent,r=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;let n=this._renderer,s=tg(e.renderGroup,[]),a=og;t&&(a=a.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));let o=n.renderPipes;for(let l=0;l{te(),Ht(),Ll(),Hh=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}addRenderable(e,t){let i=this._getGpuSprite(e);e._didSpriteUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e._didSpriteUpdate&&this._updateBatchableSprite(e,t),t.batcher.updateElement(t)}validateRenderable(e){let t=e._texture,i=this._getGpuSprite(e);return i.texture._source!==t._source?!i.batcher.checkAndUpdateTexture(i,t):!1}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];Le.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){e._didSpriteUpdate=!1,t.bounds=e.bounds,t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=Le.get(fa);return t.renderable=e,t.texture=e._texture,t.bounds=e.bounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e._didSpriteUpdate=!1,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)Le.return(this._gpuSpriteHash[e]);this._gpuSpriteHash=null,this._renderer=null}},Hh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"sprite"}}),zh,Wh,lg=v(()=>{te(),zh=class{static init(){globalThis.__PIXI_APP_INIT__?.(this)}static destroy(){}},zh.extension=G.Application,Wh=class{constructor(e){this._renderer=e}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer)}destroy(){this._renderer=null}},Wh.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"initHook",priority:-10}}),Vh,Bb=v(()=>{te(),nr(),Rd(),Gd(),Vh=class{constructor(e,t){this.state=ji.for2d(),this._batches=Object.create(null),this._geometries=Object.create(null),this.renderer=e,this._adaptor=t,this._adaptor.init(this)}buildStart(e){if(!this._batches[e.uid]){let t=new Rl;this._batches[e.uid]=t,this._geometries[t.uid]=new kl}this._activeBatch=this._batches[e.uid],this._activeGeometry=this._geometries[this._activeBatch.uid],this._activeBatch.begin()}addToBatch(e){this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){let t=this._activeBatch,i=this._activeGeometry;t.finish(e),i.indexBuffer.setDataWithSize(t.indexBuffer,t.indexSize,!0),i.buffers[0].setDataWithSize(t.attributeBuffer.float32View,t.attributeSize,!1)}upload(e){let t=this._batches[e.uid],i=this._geometries[t.uid];t.dirty&&(t.dirty=!1,i.buffers[0].update(t.attributeSize*4))}execute(e){if(e.action==="startBatch"){let t=e.batcher,i=this._geometries[t.uid];this._adaptor.start(this,i)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor.destroy(),this._adaptor=null;for(let e in this._batches)this._batches[e].destroy();this._batches=null;for(let e in this._geometries)this._geometries[e].destroy();this._geometries=null}},Vh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"batch"}}),hg,Ib=v(()=>{hg=`in vec2 vMaskCoord; in vec2 vTextureCoord; uniform sampler2D uTexture; uniform sampler2D uMaskTexture; uniform float uAlpha; uniform vec4 uMaskClamp; out vec4 finalColor; void main(void) { float clip = step(3.5, step(uMaskClamp.x, vMaskCoord.x) + step(uMaskClamp.y, vMaskCoord.y) + step(vMaskCoord.x, uMaskClamp.z) + step(vMaskCoord.y, uMaskClamp.w)); // TODO look into why this is needed float npmAlpha = uAlpha; vec4 original = texture(uTexture, vTextureCoord); vec4 masky = texture(uMaskTexture, vMaskCoord); float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a); original *= (alphaMul * masky.r * uAlpha * clip); finalColor = original; } `}),ug,Gb=v(()=>{ug=`in vec2 aPosition; out vec2 vTextureCoord; out vec2 vMaskCoord; uniform vec4 uInputSize; uniform vec4 uOutputFrame; uniform vec4 uOutputTexture; uniform mat3 uFilterMatrix; vec4 filterVertexPosition( vec2 aPosition ) { vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; return vec4(position, 0.0, 1.0); } vec2 filterTextureCoord( vec2 aPosition ) { return aPosition * (uOutputFrame.zw * uInputSize.zw); } vec2 getFilterCoord( vec2 aPosition ) { return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; } void main(void) { gl_Position = filterVertexPosition(aPosition); vTextureCoord = filterTextureCoord(aPosition); vMaskCoord = getFilterCoord(aPosition); } `}),jh,Ob=v(()=>{jh=`struct GlobalFilterUniforms { uInputSize:vec4, uInputPixel:vec4, uInputClamp:vec4, uOutputFrame:vec4, uGlobalFrame:vec4, uOutputTexture:vec4, }; struct MaskUniforms { uFilterMatrix:mat3x3, uMaskClamp:vec4, uAlpha: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 clip = step(3.5, step(maskClamp.x, filterUv.x) + step(maskClamp.y, filterUv.y) + step(filterUv.x, maskClamp.z) + step(filterUv.y, maskClamp.w)); var mask = textureSample(uMaskTexture, uSampler, filterUv); var source = textureSample(uTexture, uSampler, uv); var npmAlpha = 0.0; var alphaMul = 1.0 - npmAlpha * (1.0 - mask.a); var a = (alphaMul * mask.r) * clip; return vec4(source.rgb, source.a) * a; }`}),cg,Ub=v(()=>{We(),$n(),Ba(),pi(),ad(),cb(),Ib(),Gb(),Ob(),cg=class extends Wp{constructor(e){let{sprite:t,...i}=e,r=new ul(t.texture),n=new ti({uFilterMatrix:{value:new ke,type:"mat3x3"},uMaskClamp:{value:r.uClampFrame,type:"vec4"},uAlpha:{value:1,type:"f32"}}),s=Yn.from({vertex:{source:jh,entryPoint:"mainVertex"},fragment:{source:jh,entryPoint:"mainFragment"}}),a=pn.from({vertex:ug,fragment:hg,name:"mask-filter"});super({...i,gpuProgram:s,glProgram:a,resources:{filterUniforms:n,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=r}apply(e,t,i,r){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,i,r)}}}),dg,fg,$h,Fb=v(()=>{te(),Ir(),Ub(),m(),X(),Fh(),ud(),Ht(),pt(),Ln(),sr(),dg=new g,fg=class extends Ct{constructor(){super(),this.filters=[new cg({sprite:new Ws(Re.EMPTY),resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}},$h=class{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,i){let r=this._renderer;if(r.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,canBundle:!1,maskedContainer:t}),e.renderMaskToTexture){let n=e.mask;n.includeInBuild=!0,Wa(n,i,r),n.includeInBuild=!1}r.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,canBundle:!1})}pop(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,canBundle:!1})}execute(e){let t=this._renderer,i=e.mask.renderMaskToTexture;if(e.action==="pushMaskBegin"){let r=Le.get(fg);if(i){e.mask.mask.measurable=!0;let n=k(e.mask.mask,!0,dg);e.mask.mask.measurable=!1,n.ceil();let s=t.renderTarget.renderTarget.colorTexture.source,a=gi.getOptimalTexture(n.width,n.height,s._resolution,s.antialias);t.renderTarget.push(a,!0),t.globalUniforms.push({offset:n,worldColor:4294967295});let o=r.sprite;o.texture=a,o.worldTransform.tx=n.minX,o.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:r,maskedContainer:e.maskedContainer,filterTexture:a})}else r.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:r,maskedContainer:e.maskedContainer})}else if(e.action==="pushMaskEnd"){let r=this._activeMaskStage[this._activeMaskStage.length-1];i&&(t.type===Ei.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:r.maskedContainer,filterEffect:r.filterEffect,canBundle:!1})}else if(e.action==="popMaskEnd"){t.filter.pop();let r=this._activeMaskStage.pop();i&&gi.returnTexture(r.filterTexture),Le.return(r.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}},$h.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"alphaMask"}}),Xh,Db=v(()=>{te(),Xh=class{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,i){this._renderer.renderPipes.batch.break(i);let r=this._colorStack;r[this._colorStackIndex]=r[this._colorStackIndex-1]&e.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(e,t,i){this._renderer.renderPipes.batch.break(i);let r=this._colorStack;this._colorStackIndex--;let n=r[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._colorStack=null}},Xh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"colorMask"}}),Yh,Lb=v(()=>{te(),Fh(),ns(),ln(),Yh=class{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,i){var r;let n=e,s=this._renderer;s.renderPipes.batch.break(i),s.renderPipes.blendMode.setBlendMode(n.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,canBundle:!1});let a=n.mask;a.includeInBuild=!0,this._maskHash.has(n)||this._maskHash.set(n,{instructionsStart:0,instructionsLength:0});let o=this._maskHash.get(n);o.instructionsStart=i.instructionSize,Wa(a,i,s),a.includeInBuild=!1,s.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,canBundle:!1});let l=i.instructionSize-o.instructionsStart-1;o.instructionsLength=l;let h=s.renderTarget.renderTarget.uid;(r=this._maskStackHash)[h]??(r[h]=0)}pop(e,t,i){let r=e,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(r.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",canBundle:!1});let s=this._maskHash.get(e);for(let a=0;a{Ie(),te(),ja=class mv{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ue(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...mv.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}},ja.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"background",priority:0},ja.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},pg=ja}),yn,qh,Hb=v(()=>{te(),Ir(),I(),yn={},pe.handle(G.BlendMode,e=>{if(!e.name)throw new Error("BlendMode extension must have a name property");yn[e.name]=e.ref},e=>{delete yn[e.name]}),qh=class{constructor(e){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e}setBlendMode(e,t,i){if(this._activeBlendMode===t){this._isAdvanced&&this._renderableList.push(e);return}this._activeBlendMode=t,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!yn[t],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(e))}_beginAdvancedBlendMode(e){this._renderer.renderPipes.batch.break(e);let t=this._activeBlendMode;if(!yn[t]){F(`Unable to assign BlendMode: '${t}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[t];i||(i=this._filterHash[t]=new Ct,i.filters=[new yn[t]]);let r={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=r.renderables,e.add(r)}_endAdvancedBlendMode(e){this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(let e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}},qh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"blendMode"}}),$a,Xa,gg,zb=v(()=>{te(),zi(),pt(),$a={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Xa=class _v{constructor(t){this._renderer=t}_normalizeOptions(t,i={}){return t instanceof Tt||t instanceof Re?{target:t,...i}:{...i,...t}}async image(t){let i=new Image;return i.src=await this.base64(t),i}async base64(t){t=this._normalizeOptions(t,_v.defaultImageOptions);let{format:i,quality:r}=t,n=this.canvas(t);if(n.toBlob!==void 0)return new Promise((s,a)=>{n.toBlob(o=>{if(!o){a(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>s(l.result),l.onerror=a,l.readAsDataURL(o)},$a[i],r)});if(n.toDataURL!==void 0)return n.toDataURL($a[i],r);if(n.convertToBlob!==void 0){let s=await n.convertToBlob({type:$a[i],quality:r});return new Promise((a,o)=>{let l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(s)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let i=t.target,r=this._renderer;if(i instanceof Re)return r.texture.generateCanvas(i);let n=r.textureGenerator.generateTexture(t),s=r.texture.generateCanvas(n);return n.destroy(),s}pixels(t){t=this._normalizeOptions(t);let i=t.target,r=this._renderer,n=i instanceof Re?i:r.textureGenerator.generateTexture(t),s=r.texture.getPixels(n);return i instanceof Tt&&n.destroy(),s}texture(t){return t=this._normalizeOptions(t),t.target instanceof Re?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let i=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=i.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let i=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),n=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);let s=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}destroy(){this._renderer=null}},Xa.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"extract"},Xa.defaultImageOptions={format:"png",quality:1},gg=Xa}),mg,Wb=v(()=>{fi(),pt(),mg=class vv extends Re{static create(t){return new vv({source:new Dt(t)})}resize(t,i,r){return this.source.resize(t,i,r),this}}}),_g,vg,yg,Kh,Vb=v(()=>{Ie(),te(),We(),E(),m(),se(),zi(),Wb(),_g=new ot,vg=new g,yg=[0,0,0,0],Kh=class{constructor(e){this._renderer=e}generateTexture(e){e instanceof Tt&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});let t=e.resolution||this._renderer.resolution,i=e.antialias||this._renderer.view.antialias,r=e.target,n=e.clearColor;n?n=Array.isArray(n)&&n.length===4?n:ue.shared.setValue(n).toArray():n=yg;let s=e.frame?.copyTo(_g)||D(r,vg).rectangle;s.width=Math.max(s.width,1/t)|0,s.height=Math.max(s.height,1/t)|0;let a=mg.create({...e.textureSourceOptions,width:s.width,height:s.height,resolution:t,antialias:i}),o=ke.shared.translate(-s.x,-s.y);return this._renderer.render({container:r,transform:o,target:a,clearColor:n}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}},Kh.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"textureGenerator"}}),Zh,jb=v(()=>{te(),We(),At(),ha(),Nr(),sr(),pi(),Zh=class{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e"},uWorldTransformMatrix:{value:new ke,type:"mat3x3"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4"},uResolution:{value:[0,0],type:"vec2"}},{isStatic:!0})}destroy(){this._renderer=null}},Zh.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"globalUniforms"}}),xg,Jh,$b=v(()=>{te(),Us(),xg=1,Jh=class{constructor(){this._tasks=[]}init(){Mi.system.add(this._update,this)}repeat(e,t){let i=xg++;return this._tasks.push({func:e,duration:t,start:performance.now(),last:performance.now(),repeat:!0,id:i}),i}cancel(e){for(let t=0;t=i.duration){let r=e-i.start;i.func(r),i.last=e}}}destroy(){Mi.system.remove(this._update,this),this._tasks.length=0}},Jh.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"scheduler",priority:0}});function Xb(e){if(!Qh){if(vt.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${eu} (${e}) http://www.pixijs.com/ `,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${eu} - ${e} - http://www.pixijs.com/`);Qh=!0}}var Qh,eu,Yb=v(()=>{Ft(),Qh=!1,eu="8.3.3"}),Ya,qb=v(()=>{te(),Yb(),sr(),Ya=class{constructor(e){this._renderer=e}init(e){if(e.hello){let t=this._renderer.name;this._renderer.type===Ei.WEBGL&&(t+=` ${this._renderer.context.webGLVersion}`),Xb(t)}}},Ya.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"hello",priority:-2},Ya.defaultOptions={hello:!1}}),qa,bg,Kb=v(()=>{te(),qa=class yv{constructor(t){this._managedRenderables=[],this._renderer=t}init(t){t={...yv.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency):this._renderer.scheduler.cancel(this._handler))}prerender(){this._now=performance.now()}addRenderable(t,i){t._lastUsed=this._now,t._lastInstructionTick===-1&&this._managedRenderables.push(t),t._lastInstructionTick=i.tick}run(){let t=performance.now(),i=this._managedRenderables,r=this._renderer.renderPipes,n=0;for(let s=0;sthis.maxUnusedTime?(a.destroyed||r[a.renderPipeId].destroyRenderable(a),a._lastInstructionTick=-1,n++):i[s-n]=a}i.length=i.length-n}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0}},qa.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"renderableGC"},qa.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4},bg=qa}),Ka,wg,Zb=v(()=>{te(),Ka=class xv{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...xv.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let i=0;i-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}},Ka.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"textureGC"},Ka.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600},wg=Ka}),tu,Za,Tg=v(()=>{bt(),fi(),pt(),tu=class bv{constructor(t={}){if(this.uid=at("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...bv.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let i=0;ir.source)];let i=this.colorTexture.source;this.resize(i.width,i.height,i._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof Re||t.depthStencilTexture instanceof Dt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new Dt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,i,r=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach((s,a)=>{n&&a===0||s.source.resize(t,i,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,i,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}},tu.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1},Za=tu});function Sg(e,t){if(!xn.has(e)){let i=new Re({source:new Lr({resource:e,...t})}),r=()=>{xn.get(e)===i&&xn.delete(e)};i.once("destroy",r),i.source.once("destroy",r),xn.set(e,i)}return xn.get(e)}var xn,Eg=v(()=>{Vs(),pt(),xn=new Map}),Ja,Ag,Jb=v(()=>{Ft(),te(),E(),wt(),Tg(),Eg(),Ja=class wv{get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={...wv.defaultOptions,...t},t.view&&(Xe(Ve,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new ot(0,0,t.width,t.height),this.canvas=t.canvas||vt.get().createCanvas(),this.antialias=!!t.antialias,this.texture=Sg(this.canvas,t),this.renderTarget=new Za({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.multiView=!!t.multiView,this.autoDensity&&(this.canvas.style.width=`${this.texture.width}px`,this.canvas.style.height=`${this.texture.height}px`),this.resolution=t.resolution}resize(t,i,r){this.texture.source.resize(t,i,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height,this.autoDensity&&(this.canvas.style.width=`${t}px`,this.canvas.style.height=`${i}px`)}destroy(t=!1){(typeof t=="boolean"?t:t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}},Ja.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"view",priority:0},Ja.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1},Ag=Ja}),iu,ru,Cg=v(()=>{_b(),vb(),Rb(),kb(),lg(),Bb(),Fb(),Db(),Lb(),Nb(),Hb(),zb(),Vb(),jb(),$b(),qb(),Kb(),Zb(),Jb(),iu=[pg,Zh,Ya,Ag,Nh,wg,Kh,gg,Wh,bg,Jh],ru=[qh,Vh,Hh,Uh,$h,Yh,Xh,Oh]}),nu,Qb=v(()=>{te(),nu=class{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,i){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,i)}_createBindGroup(e,t,i){let r=this._gpu.device,n=t.layout[i],s=[],a=this._renderer;for(let h in n){let u=e.resources[h]??e.resources[n[h]],d;if(u._resourceType==="uniformGroup"){let p=u;a.ubo.updateUniformGroup(p);let f=p.buffer;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="buffer"){let p=u;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.descriptor.size}}else if(u._resourceType==="bufferResource"){let p=u;d={buffer:a.buffer.getGPUBuffer(p.buffer),offset:p.offset,size:p.size}}else if(u._resourceType==="textureSampler"){let p=u;d=a.texture.getGpuSampler(p)}else if(u._resourceType==="textureSource"){let p=u;d=a.texture.getGpuSource(p).createView({})}s.push({binding:n[h],resource:d})}let o=a.shader.getProgramData(t).bindGroups[i],l=r.createBindGroup({layout:o,entries:s});return this._hash[e._key]=l,l}destroy(){for(let e of Object.keys(this._hash))this._hash[e]=null;this._hash=null,this._renderer=null}},nu.extension={type:[G.WebGPUSystem],name:"bindGroup"}}),su,e1=v(()=>{te(),Sd(),su=class{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(e){this._gpu=e}getGPUBuffer(e){return this._gpuBuffers[e.uid]||this.createGPUBuffer(e)}updateBuffer(e){let t=this._gpuBuffers[e.uid]||this.createGPUBuffer(e),i=e.data;return e._updateID&&i&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,i.buffer,0,(e._updateSize||i.byteLength)+3&-4)),t}destroyAll(){for(let e in this._gpuBuffers)this._gpuBuffers[e].destroy();this._gpuBuffers={}}createGPUBuffer(e){this._gpuBuffers[e.uid]||(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this),e.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(e));let t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e.data&&(Al(e.data.buffer,t.getMappedRange()),t.unmap()),this._gpuBuffers[e.uid]=t,t}onBufferChange(e){this._gpuBuffers[e.uid].destroy(),e._updateID=0,this._gpuBuffers[e.uid]=this.createGPUBuffer(e)}onBufferDestroy(e){this._managedBuffers.splice(this._managedBuffers.indexOf(e),1),this._destroyBuffer(e)}destroy(){this._managedBuffers.forEach(e=>this._destroyBuffer(e)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(e){this._gpuBuffers[e.uid].destroy(),e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this),e.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[e.uid]=null}},su.extension={type:[G.WebGPUSystem],name:"buffer"}}),au,t1=v(()=>{te(),au=class{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}},au.extension={type:[G.WebGPUSystem],name:"colorMask"}}),Qa,i1=v(()=>{Ft(),te(),Qa=class{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(e).then(t=>{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){let t=await vt.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>t.features.has(n)),r=await t.requestDevice({requiredFeatures:i});return{adapter:t,device:r}}destroy(){this.gpu=null,this._renderer=null}},Qa.extension={type:[G.WebGPUSystem],name:"device"},Qa.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}}),ou,r1=v(()=>{te(),ou=class{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,i,r){let n=this._renderer.pipeline.getPipeline(e,t,i,r);this.setPipeline(n)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;let t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,i){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.textureGC.count);let r=this._renderer.bindGroup.getBindGroup(t,i,e);this.renderPassEncoder.setBindGroup(e,r)}setGeometry(e,t){for(let i in t.attributeData)this._setVertexBuffer(t.attributeData[i].location,e.attributes[i].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(let i in e.groups){let r=e.groups[i];t||this._syncBindGroup(r),this.setBindGroup(i,r,e.gpuProgram)}}_syncBindGroup(e){for(let t in e.resources){let i=e.resources[t];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(e){let{geometry:t,shader:i,state:r,topology:n,size:s,start:a,instanceCount:o,skipSync:l}=e;this.setPipelineFromGeometryProgramAndState(t,i.gpuProgram,r,n),this.setGeometry(t,i.gpuProgram),this._setShaderBindGroups(i,l),t.indexBuffer?this.renderPassEncoder.drawIndexed(s||t.indexBuffer.data.length,o||t.instanceCount,a||0):this.renderPassEncoder.draw(s||t.getSize(),o||t.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);let t=this._boundPipeline,i={...this._boundVertexBuffer},r=this._boundIndexBuffer,n={...this._boundBindGroup};this._clearCache();let s=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(s.x,s.y,s.width,s.height,0,1),this.setPipeline(t);for(let a in i)this._setVertexBuffer(a,i[a]);for(let a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(r)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}},ou.extension={type:[G.WebGPUSystem],name:"encoder",priority:1}}),lu,n1=v(()=>{te(),ln(),lu=class{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Lt.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=e,i.stencilReference=t;let r=this._renderer;r.pipeline.setStencilMode(e),r.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}},lu.extension={type:[G.WebGPUSystem],name:"stencil"}}),hu,Mg=v(()=>{jp(),un(),zr(),hu=class{constructor(e){this._syncFunctionHash=Object.create(null),this._adaptor=e,this._systemCheck()}_systemCheck(){if(!Vp())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(e){let t=this.getUniformGroupData(e);e.buffer||(e.buffer=new wi({data:new Float32Array(t.layout.size/4),usage:tt.UNIFORM|tt.COPY_DST}))}getUniformGroupData(e){return this._syncFunctionHash[e._signature]||this._initUniformGroup(e)}_initUniformGroup(e){let t=e._signature,i=this._syncFunctionHash[t];if(!i){let r=Object.keys(e.uniformStructures).map(a=>e.uniformStructures[a]),n=this._adaptor.createUboElements(r),s=this._generateUboSync(n.uboElements);i=this._syncFunctionHash[t]={layout:n,syncFunction:s}}return this._syncFunctionHash[t]}_generateUboSync(e){return this._adaptor.generateUboSync(e)}syncUniformGroup(e,t,i){let r=this.getUniformGroupData(e);return e.buffer||(e.buffer=new wi({data:new Float32Array(r.layout.size/4),usage:tt.UNIFORM|tt.COPY_DST})),t||(t=e.buffer.data),i||(i=0),r.syncFunction(e.uniforms,t,i),!0}updateUniformGroup(e){if(e.isStatic&&!e._dirtyId)return!1;e._dirtyId=0;let t=this.syncUniformGroup(e);return e.buffer.update(),t}destroy(){this._syncFunctionHash=null}}});function s1(e){let t=e.map(r=>({data:r,offset:0,size:0})),i=0;for(let r=0;r1&&(s=Math.max(s,a)*n.data.size),i=Math.ceil(i/a)*a,n.size=s,n.offset=i,i+=s}return i=Math.ceil(i/16)*16,{uboElements:t,size:i}}var os,Pg=v(()=>{"use strict";os={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{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}}}),Er,Rg=v(()=>{"use strict";Er=[{type:"mat3x3",test:e=>e.value.a!==void 0,ubo:` var matrix = uv[name].toArray(true); data[offset] = matrix[0]; data[offset + 1] = matrix[1]; data[offset + 2] = matrix[2]; data[offset + 4] = matrix[3]; data[offset + 5] = matrix[4]; data[offset + 6] = matrix[5]; data[offset + 8] = matrix[6]; data[offset + 9] = matrix[7]; data[offset + 10] = matrix[8]; `,uniform:` gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true)); `},{type:"vec4",test:e=>e.type==="vec4"&&e.size===1&&e.value.width!==void 0,ubo:` v = uv[name]; data[offset] = v.x; data[offset + 1] = v.y; data[offset + 2] = v.width; data[offset + 3] = v.height; `,uniform:` cv = ud[name].value; v = uv[name]; if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) { cv[0] = v.x; cv[1] = v.y; cv[2] = v.width; cv[3] = v.height; gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height); } `},{type:"vec2",test:e=>e.type==="vec2"&&e.size===1&&e.value.x!==void 0,ubo:` v = uv[name]; data[offset] = v.x; data[offset + 1] = v.y; `,uniform:` cv = ud[name].value; v = uv[name]; if (cv[0] !== v.x || cv[1] !== v.y) { cv[0] = v.x; cv[1] = v.y; gl.uniform2f(ud[name].location, v.x, v.y); } `},{type:"vec4",test:e=>e.type==="vec4"&&e.size===1&&e.value.red!==void 0,ubo:` v = uv[name]; data[offset] = v.red; data[offset + 1] = v.green; data[offset + 2] = v.blue; data[offset + 3] = v.alpha; `,uniform:` cv = ud[name].value; v = uv[name]; if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) { cv[0] = v.red; cv[1] = v.green; cv[2] = v.blue; cv[3] = v.alpha; gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha); } `},{type:"vec3",test:e=>e.type==="vec3"&&e.size===1&&e.value.red!==void 0,ubo:` v = uv[name]; data[offset] = v.red; data[offset + 1] = v.green; data[offset + 2] = v.blue; `,uniform:` cv = ud[name].value; v = uv[name]; if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) { cv[0] = v.red; cv[1] = v.green; cv[2] = v.blue; gl.uniform3f(ud[name].location, v.red, v.green, v.blue); } `}]});function kg(e,t,i,r){let n=[` var v = null; var v2 = null; var t = 0; var index = 0; var name = null; var arrayOffset = null; `],s=0;for(let o=0;o1)d=l.offset/4,n.push(i(l,d-s));else{let p=r[l.data.type];d=l.offset/4,n.push(` v = uv.${h}; offset += ${d-s}; ${p}; `)}s=d}let a=n.join(` `);return new Function("uv","data","offset",a)}var Bg=v(()=>{Rg()});function bn(e,t){return` for (let i = 0; i < ${e*t}; i++) { data[offset + (((i / ${e})|0) * 4) + (i % ${e})] = v[i]; } `}var uu,Ig,Gg=v(()=>{"use strict";uu={f32:` data[offset] = v;`,i32:` data[offset] = v;`,"vec2":` 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];`,"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":bn(3,2),"mat4x2":bn(4,2),"mat2x3":bn(2,3),"mat4x3":bn(4,3),"mat2x4":bn(2,4),"mat3x4":bn(3,4)},Ig={...uu,"mat2x2":` data[offset] = v[0]; data[offset + 1] = v[1]; data[offset + 2] = v[2]; data[offset + 3] = v[3]; `}});function a1(e,t){let{size:i,align:r}=os[e.data.type],n=(r-i)/4;return` v = uv.${e.data.name}; ${t!==0?`offset += ${t};`:""} arrayOffset = offset; t = 0; for(var i=0; i < ${e.data.size*(i/4)}; i++) { for(var j = 0; j < ${i/4}; j++) { data[arrayOffset++] = v[t++]; } ${n!==0?`arrayOffset += ${n};`:""} } `}var o1=v(()=>{Pg()});function l1(e){return kg(e,"uboWgsl",a1,Ig)}var h1=v(()=>{Bg(),Gg(),o1()}),cu,u1=v(()=>{te(),Mg(),Pg(),h1(),cu=class extends hu{constructor(){super({createUboElements:s1,generateUboSync:l1})}},cu.extension={type:[G.WebGPUSystem],name:"ubo"}}),eo,du=v(()=>{xt(),bt(),eo=class extends Je{constructor({buffer:e,offset:t,size:i}){super(),this.uid=at("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=at("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=t|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=at("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}}),Og,c1=v(()=>{"use strict";Og=class{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);let t=this.byteIndex,i=t+e*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,t}addGroup(e){let t=this.addEmptyGroup(e.length);for(let i=0;i{te(),un(),du(),zr(),c1(),Nr(),ar=128,fu=class{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._batchBuffer=new Og({minUniformOffsetAlignment:ar});let t=256/ar;for(let i=0;i{I(),Ra()}),Ar,Dg=v(()=>{ln(),Ar=[],Ar[Lt.NONE]=void 0,Ar[Lt.DISABLED]={stencilWriteMask:0,stencilReadMask:0},Ar[Lt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},Ar[Lt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},Ar[Lt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}}});function p1(e,t,i,r,n){return e<<24|t<<16|i<<10|r<<5|n}function g1(e,t,i,r){return i<<6|e<<3|r<<1|t}var Lg,pu,m1=v(()=>{te(),I(),Fg(),ln(),ca(),Dg(),Lg={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4},pu=class{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=e}contextChange(e){this._gpu=e,this.setStencilMode(Lt.DISABLED),this._updatePipeHash()}setMultisampleCount(e){this._multisampleCount!==e&&(this._multisampleCount=e,this._updatePipeHash())}setRenderTarget(e){this._multisampleCount=e.msaaSamples,this._depthStencilAttachment=e.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=Ar[e],this._updatePipeHash())}setPipeline(e,t,i,r){let n=this.getPipeline(e,t,i);r.setPipeline(n)}getPipeline(e,t,i,r){e._layoutKey||(Ug(e,t.attributeData),this._generateBufferKey(e)),r=r||e.topology;let n=p1(e._layoutKey,t._layoutKey,i.data,i._blendModeId,Lg[r]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(e,t,i,r),this._pipeCache[n])}_createPipeline(e,t,i,r){let n=this._gpu.device,s=this._createVertexBufferLayouts(e,t),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Lt.RENDERING_MASK_ADD?0:this._colorMask;let o=this._renderer.shader.getProgramData(t).pipeline,l={vertex:{module:this._getModule(t.vertex.source),entryPoint:t.vertex.entryPoint,buffers:s},fragment:{module:this._getModule(t.fragment.source),entryPoint:t.fragment.entryPoint,targets:a},primitive:{topology:r,cullMode:i.cullMode},layout:o,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"}),n.createRenderPipeline(l)}_getModule(e){return this._moduleCache[e]||this._createModule(e)}_createModule(e){let t=this._gpu.device;return this._moduleCache[e]=t.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){let t=[],i=0,r=Object.keys(e.attributes).sort();for(let s=0;s{let s={arrayStride:0,stepMode:"vertex",attributes:[]},a=s.attributes;for(let o in t.attributeData){let l=e.attributes[o];(l.divisor??1)!==1&&F(`Attribute ${o} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===n&&(s.arrayStride=l.stride,s.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:t.attributeData[o].location,offset:l.offset,format:l.format}))}a.length&&r.push(s)}),this._bufferLayoutsCache[i]=r,r}_updatePipeHash(){let e=g1(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[e]||(this._pipeStateCaches[e]=Object.create(null)),this._pipeCache=this._pipeStateCaches[e]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}},pu.extension={type:[G.WebGPUSystem],name:"pipeline"}});function _1(e,t,i,r,n,s){let a=s?1:-1;return e.identity(),e.a=1/r*2,e.d=a*(1/n*2),e.tx=-1-t*e.a,e.ty=-a-i*e.d,e}var v1=v(()=>{"use strict"});function y1(e){let t=e.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var x1=v(()=>{"use strict"}),gu,Ng=v(()=>{We(),E(),ns(),v1(),$p(),Vs(),fi(),pt(),Eg(),x1(),Tg(),gu=class{constructor(e){this.rootViewPort=new ot,this.viewport=new ot,this.onRenderTargetChange=new Rh("onRenderTargetChange"),this.projectionMatrix=new ke,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:t,clearColor:i,frame:r}){this._renderTargetStack.length=0,this.push(e,t,i,r),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=y1(this.rootRenderTarget)}bind(e,t=!0,i,r){let n=this.getRenderTarget(e),s=this.renderTarget!==n;this.renderTarget=n,this.renderSurface=e;let a=this.getGpuRenderTarget(n);(n.pixelWidth!==a.width||n.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(n),a.width=n.pixelWidth,a.height=n.pixelHeight);let o=n.colorTexture,l=this.viewport,h=o.pixelWidth,u=o.pixelHeight;if(!r&&e instanceof Re&&(r=e.frame),r){let d=o._resolution;l.x=r.x*d+.5|0,l.y=r.y*d+.5|0,l.width=r.width*d+.5|0,l.height=r.height*d+.5|0}else l.x=0,l.y=0,l.width=h,l.height=u;return _1(this.projectionMatrix,0,0,l.width/o.resolution,l.height/o.resolution,!n.isRoot),this.adaptor.startRenderPass(n,t,i,l),s&&this.onRenderTargetChange.emit(n),n}clear(e,t=li.ALL,i){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=li.ALL,i,r){let n=this.bind(e,t,i,r);return this._renderTargetStack.push({renderTarget:n,frame:r}),n}pop(){this._renderTargetStack.pop();let e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,i,r,n){i.x<0&&(r.width+=i.x,n.x-=i.x,i.x=0),i.y<0&&(r.height+=i.y,n.y-=i.y,i.y=0);let{pixelWidth:s,pixelHeight:a}=e;return r.width=Math.min(r.width,s-i.x),r.height=Math.min(r.height,a-i.y),this.adaptor.copyToTexture(e,t,i,r,n)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,t)=>{e!==t&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return Lr.test(e)&&(e=Sg(e).source),e instanceof Za?t=e:e instanceof Dt&&(t=new Za({colorTextures:[e]}),Lr.test(e.source.resource)&&(t.isRoot=!0),e.once("destroy",()=>{t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);let i=this._gpuRenderTargetHash[t.uid];i&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}}}),Hg,b1=v(()=>{"use strict";Hg=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}}),zg,w1=v(()=>{ns(),Vs(),fi(),b1(),zg=class{init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,i,r,n){let s=this._renderer,a=this._getGpuColorTexture(e),o=s.texture.getGpuSource(t.source);return s.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:o,origin:n},r),t}startRenderPass(e,t=!0,i,r){let n=this._renderTargetSystem.getGpuRenderTarget(e),s=this.getDescriptor(e,t,i);n.descriptor=s,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(r)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);return t.contexts[0]?t.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,t,i){typeof t=="boolean"&&(t=t?li.ALL:li.NONE);let r=this._renderTargetSystem,n=r.getGpuRenderTarget(e),s=e.colorTextures.map((o,l)=>{let h=n.contexts[l],u,d;h?u=h.getCurrentTexture().createView():u=this._renderer.texture.getGpuSource(o).createView({mipLevelCount:1}),n.msaaTextures[l]&&(d=u,u=this._renderer.texture.getTextureView(n.msaaTextures[l]));let p=t&li.COLOR?"clear":"load";return i??(i=r.defaultClearColor),{view:u,resolveTarget:d,clearValue:i,storeOp:"store",loadOp:p}}),a;if((e.stencil||e.depth)&&!e.depthStencilTexture&&(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=n.msaa?4:1),e.depthStencilTexture){let o=t&li.STENCIL?"clear":"load",l=t&li.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:o,depthClearValue:1,depthLoadOp:l,depthStoreOp:"store"}}return{colorAttachments:s,depthStencilAttachment:a}}clear(e,t=!0,i,r){if(!t)return;let{gpu:n,encoder:s}=this._renderer,a=n.device;if(s.commandEncoder===null){let o=a.createCommandEncoder(),l=this.getDescriptor(e,t,i),h=o.beginRenderPass(l);h.setViewport(r.x,r.y,r.width,r.height,0,1),h.end();let u=o.finish();a.queue.submit([u])}else this.startRenderPass(e,t,i,r)}initGpuRenderTarget(e){e.isRoot=!0;let t=new Hg;return e.colorTextures.forEach((i,r)=>{if(Lr.test(i.resource)){let n=i.resource.getContext("webgpu"),s=i.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:s})}catch(a){console.error(a)}t.contexts[r]=n}if(t.msaa=i.source.antialias,i.source.antialias){let n=new Dt({width:0,height:0,sampleCount:4});t.msaaTextures[r]=n}}),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),t}destroyGpuRenderTarget(e){e.contexts.forEach(t=>{t.unconfigure()}),e.msaaTextures.forEach(t=>{t.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&t.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorTextures.forEach((i,r)=>{t.msaaTextures[r]?.resize(i.source.width,i.source.height,i.source._resolution)})}}}),mu,T1=v(()=>{te(),Ng(),w1(),mu=class extends gu{constructor(e){super(e),this.adaptor=new zg,this.adaptor.init(e,this)}},mu.extension={type:[G.WebGPUSystem],name:"renderTarget"}}),_u,S1=v(()=>{te(),_u=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e,this.maxTextures=e.device.limits.maxSampledTexturesPerShaderStage}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){let t=this._gpu.device,i=e.gpuLayout.map(n=>t.createBindGroupLayout({entries:n})),r={bindGroupLayouts:i};return this._gpuProgramData[e._layoutKey]={bindGroups:i,pipeline:t.createPipelineLayout(r)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}},_u.extension={type:[G.WebGPUSystem],name:"shader"}}),ii,E1=v(()=>{"use strict";ii={},ii.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},ii.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},ii.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},ii.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},ii.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},ii.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},ii["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},ii["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},ii["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},ii.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},ii.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},ii.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}}),vu,A1=v(()=>{te(),nr(),E1(),vu=class{constructor(){this.defaultState=new ji,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e){return[{format:"bgra8unorm",writeMask:0,blend:ii[e.blendMode]||ii.normal}]}destroy(){this.gpu=null}},vu.extension={type:[G.WebGPUSystem],name:"state"}}),Wg,C1=v(()=>{"use strict";Wg={type:"image",upload(e,t,i){let r=e.resource,n=(e.pixelWidth|0)*(e.pixelHeight|0),s=r.byteLength/n;i.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:e.pixelHeight,bytesPerRow:e.pixelHeight*s},{width:e.pixelWidth,height:e.pixelHeight,depthOrArrayLayers:1})}}}),yu,Vg,jg,M1=v(()=>{"use strict";yu={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},Vg={blockBytes:4,blockWidth:1,blockHeight:1},jg={type:"compressed",upload(e,t,i){let r=e.pixelWidth,n=e.pixelHeight,s=yu[e.format]||Vg;for(let a=0;a>1,1),n=Math.max(n>>1,1)}}}}),xu,$g=v(()=>{"use strict";xu={type:"image",upload(e,t,i){let r=e.resource;if(!r)return;let n=Math.min(t.width,e.resourceWidth||e.pixelWidth),s=Math.min(t.height,e.resourceHeight||e.pixelHeight),a=e.alphaMode==="premultiply-alpha-on-upload";i.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:a},{width:n,height:s})}}}),Xg,P1=v(()=>{$g(),Xg={type:"video",upload(e,t,i){xu.upload(e,t,i)}}}),Yg,R1=v(()=>{"use strict";Yg=class{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:` var 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); } `})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){let t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=e,r=e.depthOrArrayLayers||1,n=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!n){let o={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:r},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};i=this.device.createTexture(o)}let s=this.device.createCommandEncoder({}),a=t.getBindGroupLayout(0);for(let o=0;o{Ft(),te(),pi(),pa(),Nr(),C1(),M1(),$g(),P1(),R1(),bu=class{constructor(e){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:xu,buffer:Wg,video:Xg,compressed:jg},this._renderer=e}contextChange(e){this._gpu=e}initSource(e){if(e.autoGenerateMipmaps){let o=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(o))+1}let t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;e.uploadMethodId!=="compressed"&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC);let i=yu[e.format]||{blockBytes:4,blockWidth:1,blockHeight:1},r=Math.ceil(e.pixelWidth/i.blockWidth)*i.blockWidth,n=Math.ceil(e.pixelHeight/i.blockHeight)*i.blockHeight,s={label:e.label,size:{width:r,height:n},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},a=this._gpu.device.createTexture(s);return this._gpuSources[e.uid]=a,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,this),e.on("destroy",this.onSourceDestroy,this),e.on("unload",this.onSourceUnload,this),e.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(e)),this.onSourceUpdate(e),a}onSourceUpdate(e){let t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onSourceUnload(e){let t=this._gpuSources[e.uid];t&&(this._gpuSources[e.uid]=null,t.destroy())}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new Yg(this._gpu.device));let t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceDestroy(e){e.off("update",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("destroy",this.onSourceDestroy,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}onSourceResize(e){let t=this._gpuSources[e.uid];t?(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(this._textureViewHash[e.uid]=null,this._bindGroupHash[e.uid]=null,this.onSourceUnload(e),this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return this._gpuSources[e.uid]||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]??this._createTextureBindGroup(e)}_createTextureBindGroup(e){let t=e.source;return this._bindGroupHash[e.uid]=new Vi({0:t,1:t.style,2:new ti({uTextureMatrix:{type:"mat3x3",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){let t=e.source;return this._textureViewHash[t.uid]??this._createTextureView(t)}_createTextureView(e){return this._textureViewHash[e.uid]=this.getGpuSource(e).createView(),this._textureViewHash[e.uid]}generateCanvas(e){let t=this._renderer,i=t.gpu.device.createCommandEncoder(),r=vt.get().createCanvas();r.width=e.source.pixelWidth,r.height=e.source.pixelHeight;let n=r.getContext("webgpu");return n.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:vt.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:r.width,height:r.height}),t.gpu.device.queue.submit([i.finish()]),r}getPixels(e){let t=this.generateCanvas(e),i=$i.getOptimalCanvasAndContext(t.width,t.height),r=i.context;r.drawImage(t,0,0);let{width:n,height:s}=t,a=r.getImageData(0,0,n,s),o=new Uint8ClampedArray(a.data.buffer);return $i.returnCanvasAndContext(i),{pixels:o,width:n,height:s}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null;for(let e of Object.keys(this._bindGroupHash)){let t=Number(e);this._bindGroupHash[t]?.destroy(),this._bindGroupHash[t]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}},bu.extension={type:[G.WebGPUSystem],name:"texture"}}),qg={};ze(qg,{WebGPURenderer:()=>Qg});var Kg,Zg,Jg,wu,Tu,Su,Qg,B1=v(()=>{te(),pb(),gb(),mb(),za(),Cg(),sr(),Qb(),e1(),t1(),i1(),r1(),n1(),u1(),d1(),m1(),T1(),S1(),A1(),k1(),Kg=[...iu,cu,ou,Qa,su,bu,mu,_u,vu,pu,au,lu,nu],Zg=[...ru,fu],Jg=[Gh,Ih,Bh],wu=[],Tu=[],Su=[],pe.handleByNamedList(G.WebGPUSystem,wu),pe.handleByNamedList(G.WebGPUPipes,Tu),pe.handleByNamedList(G.WebGPUPipesAdaptor,Su),pe.add(...Kg,...Zg,...Jg),Qg=class extends ss{constructor(){let e={name:"webgpu",type:Ei.WEBGPU,systems:wu,renderPipes:Tu,renderPipeAdaptors:Su};super(e)}}}),Eu,I1=v(()=>{te(),We(),xr(),Tr(),Zn(),Jn(),ts(),Sr(),oh(),Yi(),pi(),Eu=class{init(){let e=new ti({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new ke,type:"mat3x3"},uRound:{value:0,type:"f32"}}),t=yr(),i=Kn({name:"graphics",bits:[Oa,nh(t),Na,_n]});this.shader=new ki({glProgram:i,resources:{localUniforms:e,batchSamplers:sh(t)}})}execute(e,t){let i=t.context,r=i.customShader||this.shader,n=e.renderer,s=n.graphicsContext,{geometry:a,instructions:o}=s.getContextRenderData(i);r.groups[0]=n.globalUniforms.bindGroup,n.state.set(e.state),n.shader.bind(r),n.geometry.bind(a,r.glProgram);let l=o.instructions;for(let h=0;h{te(),We(),Tr(),ts(),Sr(),Kp(),Yi(),pt(),I(),Au=class{init(){let e=Kn({name:"mesh",bits:[Na,qp,_n]});this._shader=new ki({glProgram:e,resources:{uTexture:Re.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new ke}}}})}execute(e,t){let i=e.renderer,r=t._shader;if(r){if(!r.glProgram){F("Mesh shader has no glProgram",t.shader);return}}else{r=this._shader;let n=t.texture,s=n.source;r.resources.uTexture=s,r.resources.uSampler=s.style,r.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}r.groups[100]=i.globalUniforms.bindGroup,r.groups[101]=e.localUniformsBindGroup,i.encoder.draw({geometry:t._geometry,shader:r,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}},Au.extension={type:[G.WebGLPipesAdaptor],name:"mesh"}}),Cu,O1=v(()=>{te(),Tr(),Zn(),Jn(),Sr(),oh(),Yi(),nr(),xr(),Cu=class{constructor(){this._didUpload=!1,this._tempState=ji.for2d()}init(e){let t=yr(),i=Kn({name:"batch",bits:[Oa,nh(t),_n]});this._shader=new ki({glProgram:i,resources:{batchSamplers:sh(t)}}),e.renderer.runners.contextChange.add(this)}contextChange(){this._didUpload=!1}start(e,t){let i=e.renderer;i.shader.bind(this._shader,this._didUpload),i.shader.updateUniformGroup(i.globalUniforms.uniformGroup),i.geometry.bind(t,this._shader.glProgram)}execute(e,t){let i=e.renderer;this._didUpload=!0,this._tempState.blendMode=t.blendMode,i.state.set(this._tempState);let r=t.textures.textures;for(let n=0;n{"use strict";ls=(e=>(e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e))(ls||{})}),em,F1=v(()=>{"use strict";em=class{constructor(e,t){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=t}}}),Mu,D1=v(()=>{te(),zr(),U1(),F1(),Mu=class{constructor(e){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._renderer=e}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gpuBuffers=Object.create(null),this._gl=this._renderer.gl}getGlBuffer(e){return this._gpuBuffers[e.uid]||this.createGLBuffer(e)}bind(e){let{_gl:t}=this,i=this.getGlBuffer(e);t.bindBuffer(i.type,i.buffer)}bindBufferBase(e,t){let{_gl:i}=this;if(this._boundBufferBases[t]!==e){let r=this.getGlBuffer(e);this._boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,r.buffer)}}bindBufferRange(e,t,i){let{_gl:r}=this;i=i||0;let n=this.getGlBuffer(e);r.bindBufferRange(r.UNIFORM_BUFFER,t||0,n.buffer,i*256,256)}updateBuffer(e){let{_gl:t}=this,i=this.getGlBuffer(e);if(e._updateID===i.updateID)return i;i.updateID=e._updateID,t.bindBuffer(i.type,i.buffer);let r=e.data;if(i.byteLength>=e.data.byteLength)t.bufferSubData(i.type,0,r,0,e._updateSize/r.BYTES_PER_ELEMENT);else{let n=e.descriptor.usage&tt.STATIC?t.STATIC_DRAW:t.DYNAMIC_DRAW;i.byteLength=r.byteLength,t.bufferData(i.type,r,n)}return i}destroyAll(){let e=this._gl;for(let t in this._gpuBuffers)e.deleteBuffer(this._gpuBuffers[t].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(e,t){let i=this._gpuBuffers[e.uid],r=this._gl;t||r.deleteBuffer(i.buffer),this._gpuBuffers[e.uid]=null}createGLBuffer(e){let{_gl:t}=this,i=ls.ARRAY_BUFFER;e.descriptor.usage&tt.INDEX?i=ls.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&tt.UNIFORM&&(i=ls.UNIFORM_BUFFER);let r=new em(t.createBuffer(),i);return this._gpuBuffers[e.uid]=r,e.on("destroy",this.onBufferDestroy,this),r}},Mu.extension={type:[G.WebGLSystem],name:"buffer"}}),to,tm,L1=v(()=>{Ft(),te(),I(),to=class Tv{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){if(t={...Tv.defaultOptions,...t},t.context)this.initFromContext(t.context);else{let i=this._renderer.background.alpha<1,r=t.premultipliedAlpha??!0,n=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:i,premultipliedAlpha:r,antialias:n,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof vt.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let i=this._renderer.view.canvas;i.addEventListener("webglcontextlost",this.handleContextLost,!1),i.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,i){let r,n=this._renderer.view.canvas;if(t===2&&(r=n.getContext("webgl2",i)),!r&&(r=n.getContext("webgl",i),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,i={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...i,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...i,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let i=t.getContextAttributes();i&&!i.stencil&&F("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,n=this.webGLVersion===2,s=this.extensions;r.uint32Indices=n||!!s.uint32ElementIndex,r.uniformBufferObject=n,r.vertexArrayObject=n||!!s.vertexArrayObject,r.srgbTextures=n||!!s.srgb,r.nonPowOf2wrapping=n,r.nonPowOf2mipmaps=n,r.msaa=n,r.uint32Indices||F("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}},to.extension={type:[G.WebGLSystem],name:"context"},to.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2},tm=to}),io,Pu,Qe,im=v(()=>{"use strict";io=(e=>(e[e.RGBA=6408]="RGBA",e[e.RGB=6407]="RGB",e[e.RG=33319]="RG",e[e.RED=6403]="RED",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.ALPHA=6406]="ALPHA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e))(io||{}),Pu=(e=>(e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e))(Pu||{}),Qe=(e=>(e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.BYTE=5120]="BYTE",e[e.SHORT=5122]="SHORT",e[e.INT=5124]="INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.HALF_FLOAT=36193]="HALF_FLOAT",e))(Qe||{})});function N1(e){return Ru[e]??Ru.float32}var Ru,H1=v(()=>{im(),Ru={uint8x2:Qe.UNSIGNED_BYTE,uint8x4:Qe.UNSIGNED_BYTE,sint8x2:Qe.BYTE,sint8x4:Qe.BYTE,unorm8x2:Qe.UNSIGNED_BYTE,unorm8x4:Qe.UNSIGNED_BYTE,snorm8x2:Qe.BYTE,snorm8x4:Qe.BYTE,uint16x2:Qe.UNSIGNED_SHORT,uint16x4:Qe.UNSIGNED_SHORT,sint16x2:Qe.SHORT,sint16x4:Qe.SHORT,unorm16x2:Qe.UNSIGNED_SHORT,unorm16x4:Qe.UNSIGNED_SHORT,snorm16x2:Qe.SHORT,snorm16x4:Qe.SHORT,float16x2:Qe.HALF_FLOAT,float16x4:Qe.HALF_FLOAT,float32:Qe.FLOAT,float32x2:Qe.FLOAT,float32x3:Qe.FLOAT,float32x4:Qe.FLOAT,uint32:Qe.UNSIGNED_INT,uint32x2:Qe.UNSIGNED_INT,uint32x3:Qe.UNSIGNED_INT,uint32x4:Qe.UNSIGNED_INT,sint32:Qe.INT,sint32x2:Qe.INT,sint32x3:Qe.INT,sint32x4:Qe.INT}}),rm,ku,z1=v(()=>{te(),Ra(),Fg(),H1(),rm={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},ku=class{constructor(e){this._geometryVaoHash=Object.create(null),this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0}contextChange(){let e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let t=this._renderer.context.extensions.vertexArrayObject;t&&(e.createVertexArray=()=>t.createVertexArrayOES(),e.bindVertexArray=r=>t.bindVertexArrayOES(r),e.deleteVertexArray=r=>t.deleteVertexArrayOES(r));let i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(e.drawArraysInstanced=(r,n,s,a)=>{i.drawArraysInstancedANGLE(r,n,s,a)},e.drawElementsInstanced=(r,n,s,a,o)=>{i.drawElementsInstancedANGLE(r,n,s,a,o)},e.vertexAttribDivisor=(r,n)=>i.vertexAttribDivisorANGLE(r,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(e,t){let i=this.gl;this._activeGeometry=e;let r=this.getVao(e,t);this._activeVao!==r&&(this._activeVao=r,i.bindVertexArray(r)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let e=this._activeGeometry,t=this._renderer.buffer;for(let i=0;i1?n.drawElementsInstanced(a,t||s.indexBuffer.data.length,l,(i||0)*o,r):n.drawElements(a,t||s.indexBuffer.data.length,l,(i||0)*o)}else r>1?n.drawArraysInstanced(a,i||0,t||s.getSize(),r):n.drawArrays(a,i||0,t||s.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}},ku.extension={type:[G.WebGLSystem],name:"geometry"}}),nm,ro,sm,W1=v(()=>{te(),I(),Zs(),Yi(),nr(),fi(),pt(),$n(),nm=new Un({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),ro=class Sv{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:i,antialias:r}={...Sv.defaultOptions,...t};this.useBackBuffer=i,this._antialias=r,this._renderer.context.supports.msaa||(F("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=ji.for2d();let n=new pn({vertex:` attribute vec2 aPosition; out vec2 vUv; void main() { gl_Position = vec4(aPosition, 0.0, 1.0); vUv = (aPosition + 1.0) / 2.0; // flip dem UVs vUv.y = 1.0 - vUv.y; }`,fragment:` in vec2 vUv; out vec4 finalColor; uniform sampler2D uTexture; void main() { finalColor = texture(uTexture, vUv); }`,name:"big-triangle"});this._bigTriangleShader=new ki({glProgram:n,resources:{uTexture:Re.WHITE.source}})}renderStart(t){let i=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!i.isRoot,this._useBackBufferThisRender){let r=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=r.colorTexture,t.target=this._getBackBufferTexture(r.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:nm,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new Re({source:new Dt({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}},ro.extension={type:[G.WebGLSystem],name:"backBuffer",priority:1},ro.defaultOptions={useBackBuffer:!1},sm=ro}),Bu,V1=v(()=>{te(),Bu=class{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.gl.colorMask(!!(e&8),!!(e&4),!!(e&2),!!(e&1)))}},Bu.extension={type:[G.WebGLSystem],name:"colorMask"}}),Iu,j1=v(()=>{te(),Iu=class{constructor(e){this.commandFinished=Promise.resolve(),this._renderer=e}setGeometry(e,t){this._renderer.geometry.bind(e,t.glProgram)}finishRenderPass(){}draw(e){let t=this._renderer,{geometry:i,shader:r,state:n,skipSync:s,topology:a,size:o,start:l,instanceCount:h}=e;t.shader.bind(r,s),t.geometry.bind(i,t.shader._activeProgram),n&&t.state.set(n),t.geometry.draw(a,o,l,h??i.instanceCount)}destroy(){this._renderer=null}},Iu.extension={type:[G.WebGLSystem],name:"encoder"}}),Gu,$1=v(()=>{te(),Dg(),ln(),Gu=class{constructor(e){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Lt.NONE},this._renderTargetStencilState=Object.create(null),e.renderTarget.onRenderTargetChange.add(this)}contextChange(e){this._gl=e,this._comparisonFuncMapping={always:e.ALWAYS,never:e.NEVER,equal:e.EQUAL,"not-equal":e.NOTEQUAL,less:e.LESS,"less-equal":e.LEQUAL,greater:e.GREATER,"greater-equal":e.GEQUAL},this._stencilOpsMapping={keep:e.KEEP,zero:e.ZERO,replace:e.REPLACE,invert:e.INVERT,"increment-clamp":e.INCR,"decrement-clamp":e.DECR,"increment-wrap":e.INCR_WRAP,"decrement-wrap":e.DECR_WRAP},this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Lt.NONE,this._stencilCache.stencilReference=0}onRenderTargetChange(e){if(this._activeRenderTarget===e)return;this._activeRenderTarget=e;let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Lt.DISABLED,stencilReference:0}),this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){let i=this._renderTargetStencilState[this._activeRenderTarget.uid],r=this._gl,n=Ar[e],s=this._stencilCache;if(i.stencilMode=e,i.stencilReference=t,e===Lt.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,r.disable(r.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,r.enable(r.STENCIL_TEST)),(e!==s.stencilMode||s.stencilReference!==t)&&(s.stencilMode=e,s.stencilReference=t,r.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],t,255),r.stencilOp(r.KEEP,r.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}},Gu.extension={type:[G.WebGLSystem],name:"stencil"}});function X1(e){let t=e.map(s=>({data:s,offset:0,size:0})),i=0,r=0,n=0;for(let s=0;s1&&(i=Math.max(i,16)*a.data.size),a.size=i,r%i!==0&&r<16){let o=r%i%16;r+=o,n+=o}r+i>16?(n=Math.ceil(n/16)*16,a.offset=n,n+=i,r=i):(a.offset=n,r+=i,n+=i)}return n=Math.ceil(n/16)*16,{uboElements:t,size:n}}var Ou,am=v(()=>{"use strict";Ou={f32:4,"vec2":8,"vec3":12,"vec4":16,"mat2x2":32,"mat3x3":48,"mat4x4":64}});function Y1(e,t){let i=Math.max(Ou[e.data.type]/16,1),r=e.data.value.length/e.data.size,n=(4-r%4)%4;return` v = uv.${e.data.name}; offset += ${t}; arrayOffset = offset; t = 0; for(var i=0; i < ${e.data.size*i}; i++) { for(var j = 0; j < ${r}; j++) { data[arrayOffset++] = v[t++]; } ${n!==0?`arrayOffset += ${n};`:""} } `}var q1=v(()=>{am()});function K1(e){return kg(e,"uboStd40",Y1,uu)}var Z1=v(()=>{Bg(),Gg(),q1()}),Uu,J1=v(()=>{te(),Mg(),am(),Z1(),Uu=class extends hu{constructor(){super({createUboElements:X1,generateUboSync:K1})}},Uu.extension={type:[G.WebGLSystem],name:"ubo"}}),om,Q1=v(()=>{"use strict";om=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}}),lm,ew=v(()=>{E(),I(),ns(),Q1(),lm=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new ot}init(e,t){this._renderer=e,this._renderTargetSystem=t,e.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new ot}copyToTexture(e,t,i,r,n){let s=this._renderTargetSystem,a=this._renderer,o=s.getGpuRenderTarget(e),l=a.gl;return this.finishRenderPass(e),l.bindFramebuffer(l.FRAMEBUFFER,o.resolveTargetFramebuffer),a.texture.bind(t,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,n.x,n.y,i.x,i.y,r.width,r.height),t}startRenderPass(e,t=!0,i,r){let n=this._renderTargetSystem,s=e.colorTexture,a=n.getGpuRenderTarget(e),o=r.y;e.isRoot&&(o=s.pixelHeight-r.height),e.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let h=this._viewPortCache;(h.x!==r.x||h.y!==o||h.width!==r.width||h.height!==r.height)&&(h.x=r.x,h.y=o,h.width=r.width,h.height=r.height,l.viewport(r.x,o,r.width,r.height)),!a.depthStencilRenderBuffer&&(e.stencil||e.depth)&&this._initStencil(a),this.clear(e,t,i)}finishRenderPass(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);if(!t.msaa)return;let i=this._renderer.gl;i.bindFramebuffer(i.FRAMEBUFFER,t.resolveTargetFramebuffer),i.bindFramebuffer(i.READ_FRAMEBUFFER,t.framebuffer),i.blitFramebuffer(0,0,t.width,t.height,0,0,t.width,t.height,i.COLOR_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,t.framebuffer)}initGpuRenderTarget(e){let t=this._renderer,i=t.gl,r=new om;return e.colorTexture.resource===t.gl.canvas?(r.framebuffer=null,r):(this._initColor(e,r),i.bindFramebuffer(i.FRAMEBUFFER,null),r)}destroyGpuRenderTarget(e){let t=this._renderer.gl;e.framebuffer&&(t.deleteFramebuffer(e.framebuffer),e.framebuffer=null),e.resolveTargetFramebuffer&&(t.deleteFramebuffer(e.resolveTargetFramebuffer),e.resolveTargetFramebuffer=null),e.depthStencilRenderBuffer&&(t.deleteRenderbuffer(e.depthStencilRenderBuffer),e.depthStencilRenderBuffer=null),e.msaaRenderBuffer.forEach(i=>{t.deleteRenderbuffer(i)}),e.msaaRenderBuffer=null}clear(e,t,i){if(!t)return;let r=this._renderTargetSystem;typeof t=="boolean"&&(t=t?li.ALL:li.NONE);let n=this._renderer.gl;if(t&li.COLOR){i??(i=r.defaultClearColor);let s=this._clearColorCache,a=i;(s[0]!==a[0]||s[1]!==a[1]||s[2]!==a[2]||s[3]!==a[3])&&(s[0]=a[0],s[1]=a[1],s[2]=a[2],s[3]=a[3],n.clearColor(a[0],a[1],a[2],a[3]))}n.clear(t)}resizeGpuRenderTarget(e){if(e.isRoot)return;let t=this._renderTargetSystem.getGpuRenderTarget(e);this._resizeColor(e,t),(e.stencil||e.depth)&&this._resizeStencil(t)}_initColor(e,t){let i=this._renderer,r=i.gl,n=r.createFramebuffer();if(t.resolveTargetFramebuffer=n,r.bindFramebuffer(r.FRAMEBUFFER,n),t.width=e.colorTexture.source.pixelWidth,t.height=e.colorTexture.source.pixelHeight,e.colorTextures.forEach((s,a)=>{let o=s.source;o.antialias&&(i.context.supports.msaa?t.msaa=!0:F("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(o,0);let l=i.texture.getGlSource(o).texture;r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+a,3553,l,0)}),t.msaa){let s=r.createFramebuffer();t.framebuffer=s,r.bindFramebuffer(r.FRAMEBUFFER,s),e.colorTextures.forEach((a,o)=>{let l=r.createRenderbuffer();t.msaaRenderBuffer[o]=l})}else t.framebuffer=n;this._resizeColor(e,t)}_resizeColor(e,t){let i=e.colorTexture.source;if(t.width=i.pixelWidth,t.height=i.pixelHeight,e.colorTextures.forEach((r,n)=>{n!==0&&r.source.resize(i.width,i.height,i._resolution)}),t.msaa){let r=this._renderer,n=r.gl,s=t.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,s),e.colorTextures.forEach((a,o)=>{let l=a.source;r.texture.bindSource(l,0);let h=r.texture.getGlSource(l).internalFormat,u=t.msaaRenderBuffer[o];n.bindRenderbuffer(n.RENDERBUFFER,u),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,h,l.pixelWidth,l.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,n.RENDERBUFFER,u)})}}_initStencil(e){if(e.framebuffer===null)return;let t=this._renderer.gl,i=t.createRenderbuffer();e.depthStencilRenderBuffer=i,t.bindRenderbuffer(t.RENDERBUFFER,i),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,i),this._resizeStencil(e)}_resizeStencil(e){let t=this._renderer.gl;t.bindRenderbuffer(t.RENDERBUFFER,e.depthStencilRenderBuffer),e.msaa?t.renderbufferStorageMultisample(t.RENDERBUFFER,4,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,this._renderer.context.webGLVersion===2?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL,e.width,e.height)}}}),Fu,tw=v(()=>{te(),Ng(),ew(),Fu=class extends gu{constructor(e){super(e),this.adaptor=new lm,this.adaptor.init(e,this)}},Fu.extension={type:[G.WebGLSystem],name:"renderTarget"}});function iw(e,t){let i=[],r=[` var g = s.groups; var sS = r.shader; var p = s.glProgram; var ugS = r.uniformGroup; var resources; `],n=!1,s=0,a=0,o=t._getProgramData(e.glProgram);for(let h in e.groups){let u=e.groups[h];i.push(` resources = g[${h}].resources; `);for(let d in u.resources){let p=u.resources[d];if(p instanceof ti)p.ubo?i.push(` sS.bindUniformBlock( resources[${d}], sS._uniformBindMap[${h}[${d}], ${s++} ); `):i.push(` ugS.updateUniformGroup(resources[${d}], p, sD); `);else if(p instanceof eo)i.push(` sS.bindUniformBlock( resources[${d}], sS._uniformBindMap[${h}[${d}], ${s++} ); `);else if(p instanceof Dt){let f=e._uniformBindMap[h][d],y=o.uniformData[f];y&&(n||(n=!0,r.push(` var tS = r.texture; `)),t._gl.uniform1i(y.location,a),i.push(` tS.bind(resources[${d}], ${a}); `),a++)}}}let l=[...r,...i].join(` `);return new Function("r","s","sD",l)}var rw=v(()=>{du(),pi(),fi()}),hm,nw=v(()=>{"use strict";hm=class{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function um(e,t,i){let r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),r}var sw=v(()=>{"use strict"});function Du(e){let t=new Array(e);for(let i=0;i{"use strict"});function fm(e,t){if(!hs){let i=Object.keys(Lu);hs={};for(let r=0;r{"use strict";hs=null,Lu={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},pm={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function ow(e,t,i=!1){let r={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let a=0;aa>o?1:-1);for(let a=0;a{Ra(),gm()});function hw(e,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let i={},r=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS);for(let n=0;n{"use strict"});function cw(e,t){let i={},r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let n=0;n{dm(),gm()});function mm(e,t){let i=e.getShaderSource(t).split(` `).map((h,u)=>`${u}: ${h}`),r=e.getShaderInfoLog(t),n=r.split(` `),s={},a=n.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!s[h]?(s[h]=!0,!0):!1),o=[""];a.forEach(h=>{i[h-1]=`%c${i[h-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=i.join(` `);o[0]=l,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function fw(e,t,i,r){e.getProgramParameter(t,e.LINK_STATUS)||(e.getShaderParameter(i,e.COMPILE_STATUS)||mm(e,i),e.getShaderParameter(r,e.COMPILE_STATUS)||mm(e,r),console.error("PixiJS Error: Could not initialize shader."),e.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",e.getProgramInfoLog(t)))}var pw=v(()=>{"use strict"});function gw(e,t){let i=um(e,e.VERTEX_SHADER,t.vertex),r=um(e,e.FRAGMENT_SHADER,t.fragment),n=e.createProgram();e.attachShader(n,i),e.attachShader(n,r);let s=t.transformFeedbackVaryings;s&&(typeof e.transformFeedbackVaryings!="function"?F("TransformFeedback is not supported but TransformFeedbackVaryings are given."):e.transformFeedbackVaryings(n,s.names,s.bufferMode==="separate"?e.SEPARATE_ATTRIBS:e.INTERLEAVED_ATTRIBS)),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS)||fw(e,n,i,r),t._attributeData=ow(n,e,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=cw(n,e),t._uniformBlockData=hw(n,e),e.deleteShader(i),e.deleteShader(r);let a={};for(let o in t._uniformData){let l=t._uniformData[o];a[o]={location:e.getUniformLocation(n,o),value:cm(l.type,l.size)}}return new hm(n,a)}var mw=v(()=>{I(),nw(),sw(),dm(),lw(),uw(),dw(),pw()}),us,Nu,_w=v(()=>{te(),xr(),rw(),mw(),us={textureCount:0,blockIndex:0},Nu=class{constructor(e){this._activeProgram=null,this._programDataHash=Object.create(null),this._nextIndex=0,this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=e}contextChange(e){this._gl=e,this._maxBindings=e.MAX_UNIFORM_BUFFER_BINDINGS?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0,this._programDataHash=Object.create(null),this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=yr()}bind(e,t){if(this._setProgram(e.glProgram),t)return;us.textureCount=0,us.blockIndex=0;let i=this._shaderSyncFunctions[e.glProgram._key];i||(i=this._shaderSyncFunctions[e.glProgram._key]=this._generateShaderSync(e,this)),i(this._renderer,e,us)}updateUniformGroup(e){this._renderer.uniformGroup.updateUniformGroup(e,this._activeProgram,us)}bindUniformBlock(e,t,i=0){let r=this._renderer.buffer,n=this._getProgramData(this._activeProgram),s=e._bufferResource;s&&this._renderer.ubo.updateUniformGroup(e),r.updateBuffer(e.buffer);let a=this._boundUniformsIdsToIndexHash[e.uid];if(a===void 0){let h=this._nextIndex++%this._maxBindings,u=this._boundIndexToUniformsHash[h];u&&(this._boundUniformsIdsToIndexHash[u.uid]=void 0),a=this._boundUniformsIdsToIndexHash[e.uid]=h,this._boundIndexToUniformsHash[h]=e,s?r.bindBufferRange(e.buffer,h,e.offset):r.bindBufferBase(e.buffer,h)}let o=this._gl,l=this._activeProgram._uniformBlockData[t].index;n.uniformBlockBindings[i]!==a&&(n.uniformBlockBindings[i]=a,o.uniformBlockBinding(n.program,l,a))}_setProgram(e){if(this._activeProgram===e)return;this._activeProgram=e;let t=this._getProgramData(e);this._gl.useProgram(t.program)}_getProgramData(e){return this._programDataHash[e._key]||this._createProgramData(e)}_createProgramData(e){let t=e._key;return this._programDataHash[t]=gw(this._gl,e),this._programDataHash[t]}destroy(){for(let e of Object.keys(this._programDataHash))this._programDataHash[e].destroy(),this._programDataHash[e]=null;this._programDataHash=null,this._boundUniformsIdsToIndexHash=null}_generateShaderSync(e,t){return iw(e,t)}},Nu.extension={type:[G.WebGLSystem],name:"shader"}}),_m,vm,vw=v(()=>{"use strict";_m={f32:`if (cv !== v) { cu.value = v; gl.uniform1f(location, v); }`,"vec2":`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);"},vm={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 yw(e,t){let i=[` var v = null; var cv = null; var cu = null; var t = 0; var gl = renderer.gl; var name = null; `];for(let r in e.uniforms){if(!t[r]){e.uniforms[r]instanceof ti?e.uniforms[r].ubo?i.push(` renderer.shader.bindUniformBlock(uv.${r}, "${r}"); `):i.push(` renderer.shader.updateUniformGroup(uv.${r}); `):e.uniforms[r]instanceof eo&&i.push(` renderer.shader.bindBufferResource(uv.${r}, "${r}"); `);continue}let n=e.uniformStructures[r],s=!1;for(let a=0;a{du(),pi(),Rg(),vw()}),Hu,bw=v(()=>{te(),xw(),Hu=class{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,t,i){let r=this._renderer.shader._getProgramData(t);(!e.isStatic||e._dirtyId!==r.uniformDirtyGroups[e.uid])&&(r.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,t)(r.uniformData,e.uniforms,this._renderer,i))}_getUniformSyncFunction(e,t){return this._uniformGroupSyncHash[e._signature]?.[t._key]||this._createUniformSyncFunction(e,t)}_createUniformSyncFunction(e,t){let i=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),r=this._getSignature(e,t._uniformData,"u");return this._cache[r]||(this._cache[r]=this._generateUniformsSync(e,t._uniformData)),i[t._key]=this._cache[r],i[t._key]}_generateUniformsSync(e,t){return yw(e,t)}_getSignature(e,t,i){let r=e.uniforms,n=[`${i}-`];for(let s in r)n.push(s),t[s]&&n.push(t[s].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}},Hu.extension={type:[G.WebGLSystem],name:"uniformGroup"}});function ww(e){let t={};if(t.normal=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t.add=[e.ONE,e.ONE],t.multiply=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.screen=[e.ONE,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[e.SRC_ALPHA,e.ONE,e.ONE,e.ONE],t["screen-npm"]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.erase=[e.ZERO,e.ONE_MINUS_SRC_ALPHA],!(e instanceof vt.get().getWebGLRenderingContext()))t.min=[e.ONE,e.ONE,e.ONE,e.ONE,e.MIN,e.MIN],t.max=[e.ONE,e.ONE,e.ONE,e.ONE,e.MAX,e.MAX];else{let i=e.getExtension("EXT_blend_minmax");i&&(t.min=[e.ONE,e.ONE,e.ONE,e.ONE,i.MIN_EXT,i.MIN_EXT],t.max=[e.ONE,e.ONE,e.ONE,e.ONE,i.MAX_EXT,i.MAX_EXT])}return t}var Tw=v(()=>{Ft()}),ym,xm,bm,wm,Tm,Sm,zu,Em,Sw=v(()=>{te(),nr(),Tw(),ym=0,xm=1,bm=2,wm=3,Tm=4,Sm=5,zu=class Mc{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[ym]=this.setBlend,this.map[xm]=this.setOffset,this.map[bm]=this.setCullFace,this.map[wm]=this.setDepthTest,this.map[Tm]=this.setFrontFace,this.map[Sm]=this.setDepthMask,this.checks=[],this.defaultState=ji.for2d()}contextChange(t){this.gl=t,this.blendModesMap=ww(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let i=this.stateId^t.data,r=0;for(;i;)i&1&&this.map[r].call(this,!!(t.data&1<>1,r++;this.stateId=t.data}for(let i=0;i{im(),Am=class{constructor(e){this.target=Pu.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=Qe.UNSIGNED_BYTE,this.internalFormat=io.RGBA,this.format=io.RGBA,this.samplerType=0}}}),Cm,Aw=v(()=>{"use strict";Cm={id:"buffer",upload(e,t,i){t.width===e.width||t.height===e.height?i.texSubImage2D(i.TEXTURE_2D,0,0,0,e.width,e.height,t.format,t.type,e.resource):i.texImage2D(t.target,0,t.internalFormat,e.width,e.height,0,t.format,t.type,e.resource),t.width=e.width,t.height=e.height}}}),Mm,Pm,Cw=v(()=>{"use strict";Mm={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},Pm={id:"compressed",upload(e,t,i){i.pixelStorei(i.UNPACK_ALIGNMENT,4);let r=e.pixelWidth,n=e.pixelHeight,s=!!Mm[e.format];for(let a=0;a>1,1),n=Math.max(n>>1,1)}}}}),Wu,Rm=v(()=>{"use strict";Wu={id:"image",upload(e,t,i,r){let n=e.alphaMode==="premultiply-alpha-on-upload";i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n);let s=t.width,a=t.height,o=e.pixelWidth,l=e.pixelHeight,h=e.resourceWidth,u=e.resourceHeight;h{Rm(),km={id:"video",upload(e,t,i,r){if(!e.isValid){i.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Wu.upload(e,t,i,r)}}}),Vu,Bm,no,Im,Pw=v(()=>{"use strict";Vu={linear:9729,nearest:9728},Bm={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},no={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Im={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Gm(e,t,i,r,n,s,a,o){let l=s;if(!o||e.addressModeU!=="repeat"||e.addressModeV!=="repeat"||e.addressModeW!=="repeat"){let h=no[a?"clamp-to-edge":e.addressModeU],u=no[a?"clamp-to-edge":e.addressModeV],d=no[a?"clamp-to-edge":e.addressModeW];t[n](l,t.TEXTURE_WRAP_S,h),t[n](l,t.TEXTURE_WRAP_T,u),t.TEXTURE_WRAP_R&&t[n](l,t.TEXTURE_WRAP_R,d)}if((!o||e.magFilter!=="linear")&&t[n](l,t.TEXTURE_MAG_FILTER,Vu[e.magFilter]),i){if(!o||e.mipmapFilter!=="linear"){let h=Bm[e.minFilter][e.mipmapFilter];t[n](l,t.TEXTURE_MIN_FILTER,h)}}else t[n](l,t.TEXTURE_MIN_FILTER,Vu[e.minFilter]);if(r&&e.maxAnisotropy>1){let h=Math.min(e.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[n](l,r.TEXTURE_MAX_ANISOTROPY_EXT,h)}e.compare&&t[n](l,t.TEXTURE_COMPARE_FUNC,Im[e.compare])}var Rw=v(()=>{Pw()});function kw(e){return{r8unorm:e.RED,r8snorm:e.RED,r8uint:e.RED,r8sint:e.RED,r16uint:e.RED,r16sint:e.RED,r16float:e.RED,rg8unorm:e.RG,rg8snorm:e.RG,rg8uint:e.RG,rg8sint:e.RG,r32uint:e.RED,r32sint:e.RED,r32float:e.RED,rg16uint:e.RG,rg16sint:e.RG,rg16float:e.RG,rgba8unorm:e.RGBA,"rgba8unorm-srgb":e.RGBA,rgba8snorm:e.RGBA,rgba8uint:e.RGBA,rgba8sint:e.RGBA,bgra8unorm:e.RGBA,"bgra8unorm-srgb":e.RGBA,rgb9e5ufloat:e.RGB,rgb10a2unorm:e.RGBA,rg11b10ufloat:e.RGB,rg32uint:e.RG,rg32sint:e.RG,rg32float:e.RG,rgba16uint:e.RGBA,rgba16sint:e.RGBA,rgba16float:e.RGBA,rgba32uint:e.RGBA,rgba32sint:e.RGBA,rgba32float:e.RGBA,stencil8:e.STENCIL_INDEX8,depth16unorm:e.DEPTH_COMPONENT,depth24plus:e.DEPTH_COMPONENT,"depth24plus-stencil8":e.DEPTH_STENCIL,depth32float:e.DEPTH_COMPONENT,"depth32float-stencil8":e.DEPTH_STENCIL}}var Bw=v(()=>{"use strict"});function Iw(e,t){let i={},r=e.RGBA;return e instanceof vt.get().getWebGLRenderingContext()?t.srgb&&(i={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(i={"rgba8unorm-srgb":e.SRGB8_ALPHA8,"bgra8unorm-srgb":e.SRGB8_ALPHA8},r=e.RGBA8),{r8unorm:e.R8,r8snorm:e.R8_SNORM,r8uint:e.R8UI,r8sint:e.R8I,r16uint:e.R16UI,r16sint:e.R16I,r16float:e.R16F,rg8unorm:e.RG8,rg8snorm:e.RG8_SNORM,rg8uint:e.RG8UI,rg8sint:e.RG8I,r32uint:e.R32UI,r32sint:e.R32I,r32float:e.R32F,rg16uint:e.RG16UI,rg16sint:e.RG16I,rg16float:e.RG16F,rgba8unorm:e.RGBA,...i,rgba8snorm:e.RGBA8_SNORM,rgba8uint:e.RGBA8UI,rgba8sint:e.RGBA8I,bgra8unorm:r,rgb9e5ufloat:e.RGB9_E5,rgb10a2unorm:e.RGB10_A2,rg11b10ufloat:e.R11F_G11F_B10F,rg32uint:e.RG32UI,rg32sint:e.RG32I,rg32float:e.RG32F,rgba16uint:e.RGBA16UI,rgba16sint:e.RGBA16I,rgba16float:e.RGBA16F,rgba32uint:e.RGBA32UI,rgba32sint:e.RGBA32I,rgba32float:e.RGBA32F,stencil8:e.STENCIL_INDEX8,depth16unorm:e.DEPTH_COMPONENT16,depth24plus:e.DEPTH_COMPONENT24,"depth24plus-stencil8":e.DEPTH24_STENCIL8,depth32float:e.DEPTH_COMPONENT32F,"depth32float-stencil8":e.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var Gw=v(()=>{Ft()});function Ow(e){return{r8unorm:e.UNSIGNED_BYTE,r8snorm:e.BYTE,r8uint:e.UNSIGNED_BYTE,r8sint:e.BYTE,r16uint:e.UNSIGNED_SHORT,r16sint:e.SHORT,r16float:e.HALF_FLOAT,rg8unorm:e.UNSIGNED_BYTE,rg8snorm:e.BYTE,rg8uint:e.UNSIGNED_BYTE,rg8sint:e.BYTE,r32uint:e.UNSIGNED_INT,r32sint:e.INT,r32float:e.FLOAT,rg16uint:e.UNSIGNED_SHORT,rg16sint:e.SHORT,rg16float:e.HALF_FLOAT,rgba8unorm:e.UNSIGNED_BYTE,"rgba8unorm-srgb":e.UNSIGNED_BYTE,rgba8snorm:e.BYTE,rgba8uint:e.UNSIGNED_BYTE,rgba8sint:e.BYTE,bgra8unorm:e.UNSIGNED_BYTE,"bgra8unorm-srgb":e.UNSIGNED_BYTE,rgb9e5ufloat:e.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:e.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:e.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:e.UNSIGNED_INT,rg32sint:e.INT,rg32float:e.FLOAT,rgba16uint:e.UNSIGNED_SHORT,rgba16sint:e.SHORT,rgba16float:e.HALF_FLOAT,rgba32uint:e.UNSIGNED_INT,rgba32sint:e.INT,rgba32float:e.FLOAT,stencil8:e.UNSIGNED_BYTE,depth16unorm:e.UNSIGNED_SHORT,depth24plus:e.UNSIGNED_INT,"depth24plus-stencil8":e.UNSIGNED_INT_24_8,depth32float:e.FLOAT,"depth32float-stencil8":e.FLOAT_32_UNSIGNED_INT_24_8_REV}}var Uw=v(()=>{"use strict"}),Om,ju,Fw=v(()=>{Ft(),te(),pt(),Ew(),Aw(),Cw(),Rm(),Mw(),Rw(),Bw(),Gw(),Uw(),Om=4,ju=class{constructor(e){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Wu,buffer:Cm,video:km,compressed:Pm},this._useSeparateSamplers=!1,this._renderer=e}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Iw(e,this._renderer.context.extensions),this._mapFormatToType=Ow(e),this._mapFormatToFormat=kw(e)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let t=0;t<16;t++)this.bind(Re.EMPTY,t)}initSource(e){this.bind(e)}bind(e,t=0){let i=e.source;e?(this.bindSource(i,t),this._useSeparateSamplers&&this._bindSampler(i.style,t)):(this.bindSource(null,t),this._useSeparateSamplers&&this._bindSampler(null,t))}bindSource(e,t=0){let i=this._gl;if(e._touched=this._renderer.textureGC.count,this._boundTextures[t]!==e){this._boundTextures[t]=e,this._activateLocation(t),e=e||Re.EMPTY.source;let r=this.getGlSource(e);i.bindTexture(r.target,r.texture)}}_bindSampler(e,t=0){let i=this._gl;if(!e){this._boundSamplers[t]=null,i.bindSampler(t,null);return}let r=this._getGlSampler(e);this._boundSamplers[t]!==r&&(this._boundSamplers[t]=r,i.bindSampler(t,r))}unbind(e){let t=e.source,i=this._boundTextures,r=this._gl;for(let n=0;n1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,t)}onSourceUnload(e){let t=this._glTextures[e.uid];t&&(this.unbind(e),this._glTextures[e.uid]=null,this._gl.deleteTexture(t.texture))}onSourceUpdate(e){let t=this._gl,i=this.getGlSource(e);t.bindTexture(t.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=e,this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,i,t,this._renderer.context.webGLVersion):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.pixelWidth,e.pixelHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,t=!0){t&&this.bindSource(e,0);let i=this.getGlSource(e);this._gl.generateMipmap(i.target)}onSourceDestroy(e){e.off("destroy",this.onSourceDestroy,this),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}_initSampler(e){let t=this._gl,i=this._gl.createSampler();return this._glSamplers[e._resourceId]=i,Gm(e,t,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return this._glTextures[e.uid]||this._initSource(e)}generateCanvas(e){let{pixels:t,width:i,height:r}=this.getPixels(e),n=vt.get().createCanvas();n.width=i,n.height=r;let s=n.getContext("2d");if(s){let a=s.createImageData(i,r);a.data.set(t),s.putImageData(a,0,0)}return n}getPixels(e){let t=e.source.resolution,i=e.frame,r=Math.max(Math.round(i.width*t),1),n=Math.max(Math.round(i.height*t),1),s=new Uint8Array(Om*r*n),a=this._renderer,o=a.renderTarget.getRenderTarget(e),l=a.renderTarget.getGpuRenderTarget(o),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),h.readPixels(Math.round(i.x*t),Math.round(i.y*t),r,n,h.RGBA,h.UNSIGNED_BYTE,s),{pixels:new Uint8ClampedArray(s.buffer),width:r,height:n}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null,this._renderer=null}},ju.extension={type:[G.WebGLSystem],name:"texture"}}),Um={};ze(Um,{WebGLRenderer:()=>Nm});var Fm,Dm,Lm,$u,Xu,Yu,Nm,Dw=v(()=>{te(),I1(),G1(),O1(),za(),Cg(),sr(),D1(),L1(),z1(),W1(),V1(),j1(),$1(),J1(),tw(),_w(),bw(),Sw(),Fw(),Fm=[...iu,Uu,sm,tm,Mu,ju,Fu,ku,Hu,Nu,Iu,Em,Gu,Bu],Dm=[...ru],Lm=[Cu,Au,Eu],$u=[],Xu=[],Yu=[],pe.handleByNamedList(G.WebGLSystem,$u),pe.handleByNamedList(G.WebGLPipes,Xu),pe.handleByNamedList(G.WebGLPipesAdaptor,Yu),pe.add(...Fm,...Dm,...Lm),Nm=class extends ss{constructor(){let e={name:"webgl",type:Ei.WEBGL,systems:$u,renderPipes:Xu,renderPipeAdaptors:Yu};super(e)}}}),Lw=Ue((e,t)=>{"use strict";t.exports=r;function i(s){return s instanceof Buffer?Buffer.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function r(s){if(s=s||{},s.circles)return n(s);let a=new Map;if(a.set(Date,d=>new Date(d)),a.set(Map,(d,p)=>new Map(l(Array.from(d),p))),a.set(Set,(d,p)=>new Set(l(Array.from(d),p))),s.constructorHandlers)for(let d of s.constructorHandlers)a.set(d[0],d[1]);let o=null;return s.proto?u:h;function l(d,p){let f=Object.keys(d),y=new Array(f.length);for(let b=0;bnew Date(f)),l.set(Map,(f,y)=>new Map(u(Array.from(f),y))),l.set(Set,(f,y)=>new Set(u(Array.from(f),y))),s.constructorHandlers)for(let f of s.constructorHandlers)l.set(f[0],f[1]);let h=null;return s.proto?p:d;function u(f,y){let b=Object.keys(f),_=new Array(b.length);for(let T=0;T{}};function Hm(){for(var e=0,t=arguments.length,i={},r;e=0&&(r=i.slice(n+1),i=i.slice(0,n)),i&&!t.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:r}})}so.prototype=Hm.prototype={constructor:so,on:function(e,t){var i=this._,r=Hw(e+"",i),n,s=-1,a=r.length;if(arguments.length<2){for(;++s0)for(var i=new Array(n),r=0,n,s;r=0&&(t=e.slice(0,i))!=="xmlns"&&(e=e.slice(i+1)),Wm.hasOwnProperty(t)?{space:Wm[t],local:e}:e}function Ww(e){return function(){var t=this.ownerDocument,i=this.namespaceURI;return i===qu&&t.documentElement.namespaceURI===qu?t.createElement(e):t.createElementNS(i,e)}}function Vw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Vm(e){var t=oo(e);return(t.local?Vw:Ww)(t)}function jw(){}function Ku(e){return e==null?jw:function(){return this.querySelector(e)}}function $w(e){typeof e!="function"&&(e=Ku(e));for(var t=this._groups,i=t.length,r=new Array(i),n=0;n=O&&(O=C+1);!(z=_[O])&&++O=0;)(a=r[n])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function _T(e){e||(e=vT);function t(d,p){return d&&p?e(d.__data__,p.__data__):!d-!p}for(var i=this._groups,r=i.length,n=new Array(r),s=0;st?1:e>=t?0:NaN}function yT(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function xT(){return Array.from(this)}function bT(){for(var e=this._groups,t=0,i=e.length;t1?this.each((t==null?BT:typeof t=="function"?GT:IT)(e,t,i??"")):wn(this.node(),e)}function wn(e,t){return e.style.getPropertyValue(t)||qm(e).getComputedStyle(e,null).getPropertyValue(t)}function UT(e){return function(){delete this[e]}}function FT(e,t){return function(){this[e]=t}}function DT(e,t){return function(){var i=t.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function LT(e,t){return arguments.length>1?this.each((t==null?UT:typeof t=="function"?DT:FT)(e,t)):this.node()[e]}function Km(e){return e.trim().split(/^|\s+/)}function Zu(e){return e.classList||new Zm(e)}function Zm(e){this._node=e,this._names=Km(e.getAttribute("class")||"")}Zm.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Jm(e,t){for(var i=Zu(e),r=-1,n=t.length;++r=0&&(i=t.slice(r+1),t=t.slice(0,r)),{type:t,name:i}})}function fS(e){return function(){var t=this.__on;if(t){for(var i=0,r=-1,n=t.length,s;i()=>e;function Qu(e,{sourceEvent:t,subject:i,target:r,identifier:n,active:s,x:a,y:o,dx:l,dy:h,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:n,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:u}})}Qu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function TS(e){return!e.ctrlKey&&!e.button}function SS(){return this.parentNode}function ES(e,t){return t??{x:e.x,y:e.y}}function AS(){return navigator.maxTouchPoints||"ontouchstart"in this}function CS(){var e=TS,t=SS,i=ES,r=AS,n={},s=ao("start","drag","end"),a=0,o,l,h,u,d=0;function p(R){R.on("mousedown.drag",f).filter(r).on("touchstart.drag",_).on("touchmove.drag",T,wS).on("touchend.drag touchcancel.drag",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(R,z){if(!(u||!e.call(this,R,z))){var ee=O(this,t.call(this,R,z),R,z,"mouse");ee&&(Bi(R.view).on("mousemove.drag",y,ds).on("mouseup.drag",b,ds),r_(R.view),Ju(R),h=!1,o=R.clientX,l=R.clientY,ee("start",R))}}function y(R){if(Tn(R),!h){var z=R.clientX-o,ee=R.clientY-l;h=z*z+ee*ee>d}n.mouse("drag",R)}function b(R){Bi(R.view).on("mousemove.drag mouseup.drag",null),n_(R.view,h),Tn(R),n.mouse("end",R)}function _(R,z){if(e.call(this,R,z)){var ee=R.changedTouches,ne=t.call(this,R,z),Q=ee.length,Y,ie;for(Y=0;Y>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):i===8?co(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):i===4?co(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=PS.exec(e))?new hi(t[1],t[2],t[3],1):(t=RS.exec(e))?new hi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=kS.exec(e))?co(t[1],t[2],t[3],t[4]):(t=BS.exec(e))?co(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=IS.exec(e))?d_(t[1],t[2]/100,t[3]/100,1):(t=GS.exec(e))?d_(t[1],t[2]/100,t[3]/100,t[4]):a_.hasOwnProperty(e)?h_(a_[e]):e==="transparent"?new hi(NaN,NaN,NaN,0):null}function h_(e){return new hi(e>>16&255,e>>8&255,e&255,1)}function co(e,t,i,r){return r<=0&&(e=t=i=NaN),new hi(e,t,i,r)}function FS(e){return e instanceof fs||(e=ms(e)),e?(e=e.rgb(),new hi(e.r,e.g,e.b,e.opacity)):new hi}function fo(e,t,i,r){return arguments.length===1?FS(e):new hi(e,t,i,r??1)}function hi(e,t,i,r){this.r=+e,this.g=+t,this.b=+i,this.opacity=+r}ec(hi,fo,s_(fs,{brighter(e){return e=e==null?uo:Math.pow(uo,e),new hi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ps:Math.pow(ps,e),new hi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new hi($r(this.r),$r(this.g),$r(this.b),po(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:u_,formatHex:u_,formatHex8:DS,formatRgb:c_,toString:c_}));function u_(){return`#${Xr(this.r)}${Xr(this.g)}${Xr(this.b)}`}function DS(){return`#${Xr(this.r)}${Xr(this.g)}${Xr(this.b)}${Xr((isNaN(this.opacity)?1:this.opacity)*255)}`}function c_(){let e=po(this.opacity);return`${e===1?"rgb(":"rgba("}${$r(this.r)}, ${$r(this.g)}, ${$r(this.b)}${e===1?")":`, ${e})`}`}function po(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $r(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xr(e){return e=$r(e),(e<16?"0":"")+e.toString(16)}function d_(e,t,i,r){return r<=0?e=t=i=NaN:i<=0||i>=1?e=t=NaN:t<=0&&(e=NaN),new Ii(e,t,i,r)}function f_(e){if(e instanceof Ii)return new Ii(e.h,e.s,e.l,e.opacity);if(e instanceof fs||(e=ms(e)),!e)return new Ii;if(e instanceof Ii)return e;e=e.rgb();var t=e.r/255,i=e.g/255,r=e.b/255,n=Math.min(t,i,r),s=Math.max(t,i,r),a=NaN,o=s-n,l=(s+n)/2;return o?(t===s?a=(i-r)/o+(i0&&l<1?0:a,new Ii(a,o,l,e.opacity)}function LS(e,t,i,r){return arguments.length===1?f_(e):new Ii(e,t,i,r??1)}function Ii(e,t,i,r){this.h=+e,this.s=+t,this.l=+i,this.opacity=+r}ec(Ii,LS,s_(fs,{brighter(e){return e=e==null?uo:Math.pow(uo,e),new Ii(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ps:Math.pow(ps,e),new Ii(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,r=i+(i<.5?i:1-i)*t,n=2*i-r;return new hi(tc(e>=240?e-240:e+120,n,r),tc(e,n,r),tc(e<120?e+240:e-120,n,r),this.opacity)},clamp(){return new Ii(p_(this.h),go(this.s),go(this.l),po(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=po(this.opacity);return`${e===1?"hsl(":"hsla("}${p_(this.h)}, ${go(this.s)*100}%, ${go(this.l)*100}%${e===1?")":`, ${e})`}`}}));function p_(e){return e=(e||0)%360,e<0?e+360:e}function go(e){return Math.max(0,Math.min(1,e||0))}function tc(e,t,i){return(e<60?t+(i-t)*e/60:e<180?i:e<240?t+(i-t)*(240-e)/60:t)*255}function g_(e,t,i,r,n){var s=e*e,a=s*e;return((1-3*e+3*s-a)*t+(4-6*s+3*a)*i+(1+3*e+3*s-3*a)*r+a*n)/6}function NS(e){var t=e.length-1;return function(i){var r=i<=0?i=0:i>=1?(i=1,t-1):Math.floor(i*t),n=e[r],s=e[r+1],a=r>0?e[r-1]:2*n-s,o=r()=>e;function zS(e,t){return function(i){return e+i*t}}function WS(e,t,i){return e=Math.pow(e,i),t=Math.pow(t,i)-e,i=1/i,function(r){return Math.pow(e+r*t,i)}}function VS(e){return(e=+e)==1?__:function(t,i){return i-t?WS(t,i,e):m_(isNaN(t)?i:t)}}function __(e,t){var i=t-e;return i?zS(e,i):m_(isNaN(e)?t:e)}var v_=function e(t){var i=VS(t);function r(n,s){var a=i((n=fo(n)).r,(s=fo(s)).r),o=i(n.g,s.g),l=i(n.b,s.b),h=__(n.opacity,s.opacity);return function(u){return n.r=a(u),n.g=o(u),n.b=l(u),n.opacity=h(u),n+""}}return r.gamma=e,r}(1);function y_(e){return function(t){var i=t.length,r=new Array(i),n=new Array(i),s=new Array(i),a,o;for(a=0;ai&&(s=t.slice(i,s),o[a]?o[a]+=s:o[++a]=s),(r=r[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:Cr(r,n)})),i=rc.lastIndex;return i180?u+=360:u-h>180&&(h+=360),p.push({i:d.push(n(d)+"rotate(",null,r)-2,x:Cr(h,u)})):u&&d.push(n(d)+"rotate("+u+r)}function o(h,u,d,p){h!==u?p.push({i:d.push(n(d)+"skewX(",null,r)-2,x:Cr(h,u)}):u&&d.push(n(d)+"skewX("+u+r)}function l(h,u,d,p,f,y){if(h!==d||u!==p){var b=f.push(n(f)+"scale(",null,",",null,")");y.push({i:b-4,x:Cr(h,d)},{i:b-2,x:Cr(u,p)})}else(d!==1||p!==1)&&f.push(n(f)+"scale("+d+","+p+")")}return function(h,u){var d=[],p=[];return h=e(h),u=e(u),s(h.translateX,h.translateY,u.translateX,u.translateY,d,p),a(h.rotate,u.rotate,d,p),o(h.skewX,u.skewX,d,p),l(h.scaleX,h.scaleY,u.scaleX,u.scaleY,d,p),h=u=null,function(f){for(var y=-1,b=p.length,_;++y=0&&e._call.call(void 0,t),e=e._next;--En}function A_(){Yr=(vo=xs.now())+yo,En=_s=0;try{rE()}finally{En=0,sE(),Yr=0}}function nE(){var e=xs.now(),t=e-vo;t>S_&&(yo-=t,vo=e)}function sE(){for(var e,t=_o,i,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(i=t._next,t._next=null,t=e?e._next=i:_o=i);ys=e,oc(r)}function oc(e){if(!En){_s&&(_s=clearTimeout(_s));var t=e-Yr;t>24?(e<1/0&&(_s=setTimeout(A_,e-xs.now()-yo)),vs&&(vs=clearInterval(vs))):(vs||(vo=xs.now(),vs=setInterval(nE,S_)),En=1,E_(A_))}}function C_(e,t,i){var r=new xo;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,i),r}var aE=ao("start","end","cancel","interrupt"),oE=[],M_=0,P_=1,lc=2,bo=3,R_=4,hc=5,wo=6;function To(e,t,i,r,n,s){var a=e.__transition;if(!a)e.__transition={};else if(i in a)return;lE(e,i,{name:t,index:r,group:n,on:aE,tween:oE,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:M_})}function uc(e,t){var i=Gi(e,t);if(i.state>M_)throw new Error("too late; already scheduled");return i}function Ki(e,t){var i=Gi(e,t);if(i.state>bo)throw new Error("too late; already running");return i}function Gi(e,t){var i=e.__transition;if(!i||!(i=i[t]))throw new Error("transition not found");return i}function lE(e,t,i){var r=e.__transition,n;r[t]=i,i.timer=ac(s,0,i.time);function s(h){i.state=P_,i.timer.restart(a,i.delay,i.time),i.delay<=h&&a(h-i.delay)}function a(h){var u,d,p,f;if(i.state!==P_)return l();for(u in r)if(f=r[u],f.name===i.name){if(f.state===bo)return C_(a);f.state===R_?(f.state=wo,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete r[u]):+ulc&&r.state=0&&(t=t.slice(0,i)),!t||t==="start"})}function DE(e,t,i){var r,n,s=FE(t)?uc:Ki;return function(){var a=s(this,e),o=a.on;o!==r&&(n=(r=o).copy()).on(t,i),a.on=n}}function LE(e,t){var i=this._id;return arguments.length<2?Gi(this.node(),i).on.on(e):this.each(DE(i,e,t))}function NE(e){return function(){var t=this.parentNode;for(var i in this.__transition)if(+i!==e)return;t&&t.removeChild(this)}}function HE(){return this.on("end.remove",NE(this._id))}function zE(e){var t=this._name,i=this._id;typeof e!="function"&&(e=Ku(e));for(var r=this._groups,n=r.length,s=new Array(n),a=0;a=(d=(o+h)/2))?o=d:h=d,(_=i>=(p=(l+u)/2))?l=p:u=p,n=s,!(s=s[T=_<<1|b]))return n[T]=a,e;if(f=+e._x.call(null,s.data),y=+e._y.call(null,s.data),t===f&&i===y)return a.next=s,n?n[T]=a:e._root=a,e;do n=n?n[T]=new Array(4):e._root=new Array(4),(b=t>=(d=(o+h)/2))?o=d:h=d,(_=i>=(p=(l+u)/2))?l=p:u=p;while((T=_<<1|b)===(C=(y>=p)<<1|f>=d));return n[C]=s,n[T]=a,e}function _2(e){var t,i,r=e.length,n,s,a=new Array(r),o=new Array(r),l=1/0,h=1/0,u=-1/0,d=-1/0;for(i=0;iu&&(u=n),sd&&(d=s));if(l>u||h>d)return this;for(this.cover(l,h).cover(u,d),i=0;ie||e>=n||r>t||t>=s;)switch(h=(tu||(o=y.y0)>d||(l=y.x1)=T)<<1|e>=_)&&(y=p[p.length-1],p[p.length-1]=p[p.length-1-b],p[p.length-1-b]=y)}else{var C=e-+this._x.call(null,f.data),O=t-+this._y.call(null,f.data),R=C*C+O*O;if(R=(p=(a+l)/2))?a=p:l=p,(b=d>=(f=(o+h)/2))?o=f:h=f,t=i,!(i=i[_=b<<1|y]))return this;if(!i.length)break;(t[_+1&3]||t[_+2&3]||t[_+3&3])&&(r=t,T=_)}for(;i.data!==e;)if(n=i,!(i=i.next))return this;return(s=i.next)&&delete i.next,n?(s?n.next=s:delete n.next,this):t?(s?t[_]=s:delete t[_],(i=t[0]||t[1]||t[2]||t[3])&&i===(t[3]||t[2]||t[1]||t[0])&&!i.length&&(r?r[T]=i:this._root=i),this):(this._root=s,this)}function T2(e){for(var t=0,i=e.length;tp.index){var Te=f-Q.x-Q.vx,Pe=y-Q.y-Q.vy,ce=Te*Te+Pe*Pe;cef+ie||eey+ie||neh.r&&(h.r=h[u].r)}function l(){if(t){var h,u=t.length,d;for(i=new Array(u),h=0;h[t(z,ee,a),z])),R;for(_=0,o=new Array(T);_(e=(1664525*e+1013904223)%4294967296)/4294967296}function D2(e){return e.x}function L2(e){return e.y}var N2=10,H2=Math.PI*(3-Math.sqrt(5));function z2(e){var t,i=1,r=.001,n=1-Math.pow(r,1/300),s=0,a=.6,o=new Map,l=ac(d),h=ao("tick","end"),u=F2();e==null&&(e=[]);function d(){p(),h.call("tick",t),i1?(_==null?o.delete(b):o.set(b,y(_)),t):o.get(b)},find:function(b,_,T){var C=0,O=e.length,R,z,ee,ne,Q;for(T==null?T=1/0:T*=T,C=0;C1?(h.on(b,_),t):h.on(b)}}}function W2(){var e,t,i,r,n=qr(-30),s,a=1,o=1/0,l=.81;function h(f){var y,b=e.length,_=fc(e,D2,L2).visitAfter(d);for(r=f,y=0;y=o)){(f.data!==t||f.next)&&(T===0&&(T=Mr(i),R+=T*T),C===0&&(C=Mr(i),R+=C*C),R()=>e;function V2(e,{sourceEvent:t,target:i,transform:r,dispatch:n}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:n}})}function ur(e,t,i){this.k=e,this.x=t,this.y=i}ur.prototype={constructor:ur,scale:function(e){return e===1?this:new ur(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ur(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ao=new ur(1,0,0);j2.prototype=ur.prototype;function j2(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ao;return e.__zoom}function gc(e){e.stopImmediatePropagation()}function bs(e){e.preventDefault(),e.stopImmediatePropagation()}function $2(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function X2(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function D_(){return this.__zoom||Ao}function Y2(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function q2(){return navigator.maxTouchPoints||"ontouchstart"in this}function K2(e,t,i){var r=e.invertX(t[0][0])-i[0][0],n=e.invertX(t[1][0])-i[1][0],s=e.invertY(t[0][1])-i[0][1],a=e.invertY(t[1][1])-i[1][1];return e.translate(n>r?(r+n)/2:Math.min(0,r)||Math.max(0,n),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function Z2(){var e=$2,t=X2,i=K2,r=Y2,n=q2,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,l=tE,h=ao("start","zoom","end"),u,d,p,f=500,y=150,b=0,_=10;function T(U){U.property("__zoom",D_).on("wheel.zoom",Q,{passive:!1}).on("mousedown.zoom",Y).on("dblclick.zoom",ie).filter(n).on("touchstart.zoom",Te).on("touchmove.zoom",Pe).on("touchend.zoom touchcancel.zoom",ce).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}T.transform=function(U,ae,K,de){var M=U.selection?U.selection():U;M.property("__zoom",D_),U!==M?z(U,ae,K,de):M.interrupt().each(function(){ee(this,arguments).event(de).start().zoom(null,typeof ae=="function"?ae.apply(this,arguments):ae).end()})},T.scaleBy=function(U,ae,K,de){T.scaleTo(U,function(){var M=this.__zoom.k,P=typeof ae=="function"?ae.apply(this,arguments):ae;return M*P},K,de)},T.scaleTo=function(U,ae,K,de){T.transform(U,function(){var M=t.apply(this,arguments),P=this.__zoom,A=K==null?R(M):typeof K=="function"?K.apply(this,arguments):K,j=P.invert(A),H=typeof ae=="function"?ae.apply(this,arguments):ae;return i(O(C(P,H),A,j),M,a)},K,de)},T.translateBy=function(U,ae,K,de){T.transform(U,function(){return i(this.__zoom.translate(typeof ae=="function"?ae.apply(this,arguments):ae,typeof K=="function"?K.apply(this,arguments):K),t.apply(this,arguments),a)},null,de)},T.translateTo=function(U,ae,K,de,M){T.transform(U,function(){var P=t.apply(this,arguments),A=this.__zoom,j=de==null?R(P):typeof de=="function"?de.apply(this,arguments):de;return i(Ao.translate(j[0],j[1]).scale(A.k).translate(typeof ae=="function"?-ae.apply(this,arguments):-ae,typeof K=="function"?-K.apply(this,arguments):-K),P,a)},de,M)};function C(U,ae){return ae=Math.max(s[0],Math.min(s[1],ae)),ae===U.k?U:new ur(ae,U.x,U.y)}function O(U,ae,K){var de=ae[0]-K[0]*U.k,M=ae[1]-K[1]*U.k;return de===U.x&&M===U.y?U:new ur(U.k,de,M)}function R(U){return[(+U[0][0]+ +U[1][0])/2,(+U[0][1]+ +U[1][1])/2]}function z(U,ae,K,de){U.on("start.zoom",function(){ee(this,arguments).event(de).start()}).on("interrupt.zoom end.zoom",function(){ee(this,arguments).event(de).end()}).tween("zoom",function(){var M=this,P=arguments,A=ee(M,P).event(de),j=t.apply(M,P),H=K==null?R(j):typeof K=="function"?K.apply(M,P):K,J=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Z=M.__zoom,oe=typeof ae=="function"?ae.apply(M,P):ae,be=l(Z.invert(H).concat(J/Z.k),oe.invert(H).concat(J/oe.k));return function(me){if(me===1)me=oe;else{var Oe=be(me),Ne=J/Oe[2];me=new ur(Ne,H[0]-Oe[0]*Ne,H[1]-Oe[1]*Ne)}A.zoom(null,me)}})}function ee(U,ae,K){return!K&&U.__zooming||new ne(U,ae)}function ne(U,ae){this.that=U,this.args=ae,this.active=0,this.sourceEvent=null,this.extent=t.apply(U,ae),this.taps=0}ne.prototype={event:function(U){return U&&(this.sourceEvent=U),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(U,ae){return this.mouse&&U!=="mouse"&&(this.mouse[1]=ae.invert(this.mouse[0])),this.touch0&&U!=="touch"&&(this.touch0[1]=ae.invert(this.touch0[0])),this.touch1&&U!=="touch"&&(this.touch1[1]=ae.invert(this.touch1[0])),this.that.__zoom=ae,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(U){var ae=Bi(this.that).datum();h.call(U,this.that,new V2(U,{sourceEvent:this.sourceEvent,target:T,type:U,transform:this.that.__zoom,dispatch:h}),ae)}};function Q(U,...ae){if(!e.apply(this,arguments))return;var K=ee(this,ae).event(U),de=this.__zoom,M=Math.max(s[0],Math.min(s[1],de.k*Math.pow(2,r.apply(this,arguments)))),P=or(U);if(K.wheel)(K.mouse[0][0]!==P[0]||K.mouse[0][1]!==P[1])&&(K.mouse[1]=de.invert(K.mouse[0]=P)),clearTimeout(K.wheel);else{if(de.k===M)return;K.mouse=[P,de.invert(P)],So(this),K.start()}bs(U),K.wheel=setTimeout(A,y),K.zoom("mouse",i(O(C(de,M),K.mouse[0],K.mouse[1]),K.extent,a));function A(){K.wheel=null,K.end()}}function Y(U,...ae){if(p||!e.apply(this,arguments))return;var K=U.currentTarget,de=ee(this,ae,!0).event(U),M=Bi(U.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",J,!0),P=or(U,K),A=U.clientX,j=U.clientY;r_(U.view),gc(U),de.mouse=[P,this.__zoom.invert(P)],So(this),de.start();function H(Z){if(bs(Z),!de.moved){var oe=Z.clientX-A,be=Z.clientY-j;de.moved=oe*oe+be*be>b}de.event(Z).zoom("mouse",i(O(de.that.__zoom,de.mouse[0]=or(Z,K),de.mouse[1]),de.extent,a))}function J(Z){M.on("mousemove.zoom mouseup.zoom",null),n_(Z.view,de.moved),bs(Z),de.event(Z).end()}}function ie(U,...ae){if(e.apply(this,arguments)){var K=this.__zoom,de=or(U.changedTouches?U.changedTouches[0]:U,this),M=K.invert(de),P=K.k*(U.shiftKey?.5:2),A=i(O(C(K,P),de,M),t.apply(this,ae),a);bs(U),o>0?Bi(this).transition().duration(o).call(z,A,de,U):Bi(this).call(T.transform,A,de,U)}}function Te(U,...ae){if(e.apply(this,arguments)){var K=U.touches,de=K.length,M=ee(this,ae,U.changedTouches.length===de).event(U),P,A,j,H;for(gc(U),A=0;A!0,load:async()=>{await Promise.resolve().then(()=>(lb(),ob))}};te();var Q2={extension:{type:G.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(ub(),hb))}};te(),bl(),fl(),te(),Ft(),za();var mc;function eA(e){return mc!==void 0||(mc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:e??ss.defaultOptions.failIfMajorPerformanceCaveat};try{if(!vt.get().getWebGLRenderingContext())return!1;let i=vt.get().createCanvas().getContext("webgl",t),r=!!i?.getContextAttributes()?.stencil;if(i){let n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,r}catch{return!1}})()),mc}Ft();var _c;async function tA(e={}){return _c!==void 0||(_c=await(async()=>{let t=vt.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(e)).requestDevice(),!0}catch{return!1}})()),_c}za();var L_=["webgl","webgpu","canvas"];async function iA(e){let t=[];e.preference?(t.push(e.preference),L_.forEach(s=>{s!==e.preference&&t.push(s)})):t=L_.slice();let i,r={};for(let s=0;s(B1(),qg));i=o,r={...e,...e.webgpu};break}else if(a==="webgl"&&eA(e.failIfMajorPerformanceCaveat??ss.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:o}=await Promise.resolve().then(()=>(Dw(),Um));i=o,r={...e,...e.webgl};break}else if(a==="canvas")throw r={...e},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!i)throw new Error("No available renderer for the current environment");let n=new i;return await n.init(r),n}zi(),lg(),wt();var N_=class Pc{constructor(...t){this.stage=new Tt,t[0]!==void 0&&Xe(Ve,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await iA(t),Pc._plugins.forEach(i=>{i.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return Xe(Ve,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,i=!1){let r=Pc._plugins.slice(0);r.reverse(),r.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(i),this.stage=null,this.renderer.destroy(t),this.renderer=null}};N_._plugins=[];var H_=N_;pe.handleByList(G.Application,H_._plugins),pe.add(zh),kr(),wt(),gl();var rA=class extends zs{constructor(e,t){let{text:i,resolution:r,style:n,anchor:s,width:a,height:o,roundPixels:l,...h}=e;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=i??"",this.style=n,this.resolution=r??null,this.allowChildren=!1,this._anchor=new $t({_onUpdate:()=>{this.onViewUpdate()}}),s&&(this.anchor=s),this.roundPixels=l??!1,a!==void 0&&(this.width=a),o!==void 0&&(this.height=o)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e=e||{},this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){let i,r;typeof e!="object"?(i=e,r=t??e):(i=e.width,r=e.height??e.width),i!==void 0&&this._setWidth(i,this.bounds.width),r!==void 0&&this._setHeight(r,this.bounds.height)}addBounds(e){let t=this.bounds;e.addFrame(t.minX,t.minY,t.maxX,t.maxY)}containsPoint(e){let t=this.bounds.width,i=this.bounds.height,r=-t*this.anchor.x,n=0;return e.x>=r&&e.x<=r+t&&(n=-i*this.anchor.y,e.y>=n&&e.y<=n+i)}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0,this._didTextUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}};function nA(e,t){let i=e[0]??{};return(typeof i=="string"||e[1])&&(Xe(Ve,`use new ${t}({ text: "hi!", style }) instead`),i={text:i,style:e[1]}),i}Sa(),jn();var sA=class extends rA{constructor(...e){let t=nA(e,"Text");super(t,Xi),this.renderPipeId="text"}_updateBounds(){let e=this._bounds,t=this._anchor,i=Ri.measureText(this._text,this._style),{width:r,height:n}=i;e.minX=-t._x*r,e.maxX=e.minX+r,e.minY=-t._y*n,e.maxY=e.minY+n}};hf(),xd(),zi(),Wf(),xt();var EA=ht(Nd(),1);pe.add(J2,Q2);var ws=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-ws.Bounce.Out(1-e)},Out:function(e){return e<.36363636363636365?7.5625*e*e:e<.7272727272727273?7.5625*(e-=.5454545454545454)*e+.75:e<.9090909090909091?7.5625*(e-=.8181818181818182)*e+.9375:7.5625*(e-=.9545454545454546)*e+.984375},InOut:function(e){return e<.5?ws.Bounce.In(e*2)*.5:ws.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),Ts=function(){return performance.now()},Co=function(){function e(){for(var t=[],i=0;i0;){this._tweensAddedDuringUpdate={};for(var n=0;n1?s(e[i],e[i-1],i-r):s(e[n],e[n+1>i?i:n+1],r-n)},Bezier:function(e,t){for(var i=0,r=e.length-1,n=Math.pow,s=An.Utils.Bernstein,a=0;a<=r;a++)i+=n(1-t,r-a)*n(t,a)*e[a]*s(r,a);return i},CatmullRom:function(e,t){var i=e.length-1,r=i*t,n=Math.floor(r),s=An.Utils.CatmullRom;return e[0]===e[i]?(t<0&&(n=Math.floor(r=i*(1+t))),s(e[(n-1+i)%i],e[n],e[(n+1)%i],e[(n+2)%i],r-n)):t<0?e[0]-(s(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[i]-(s(e[i],e[i],e[i-1],e[i-1],r-i)-e[i]):s(e[n?n-1:0],e[n],e[i1;r--)i*=r;return e[t]=i,i}}(),CatmullRom:function(e,t,i,r,n){var s=(i-e)*.5,a=(r-t)*.5,o=n*n,l=n*o;return(2*t-2*i+s+a)*l+(-3*t+3*i-2*s-a)*o+s*n+t}}},z_=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),vc=new Co,Mo=function(){function e(t,i){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ws.Linear.None,this._interpolationFunction=An.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=z_.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof i=="object"?(this._group=i,i.add(this)):i===!0&&(this._group=vc,vc.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,i){if(i===void 0&&(i=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=i<0?0:i,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,i){if(t===void 0&&(t=Ts()),i===void 0&&(i=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||i){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var s in this._valuesEnd)n[s]=this._valuesEnd[s];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,i)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,i,r,n,s){for(var a in r){var o=t[a],l=Array.isArray(o),h=l?"array":typeof o,u=!l&&Array.isArray(r[a]);if(!(h==="undefined"||h==="function")){if(u){var d=r[a];if(d.length===0)continue;for(var p=[o],f=0,y=d.length;f"u"||s)&&(i[a]=o),l||(i[a]*=1),u?n[a]=r[a].slice().reverse():n[a]=i[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=Ts()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=Ts()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,i=this._chainedTweens.length;tl)return 1;var b=Math.trunc(a/o),_=a-b*o,T=Math.min(_/r._duration,1);return T===0&&a===r._duration?1:T},u=h(),d=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,d),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((a-this._duration)/o)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=o*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var f=0,y=this._chainedTweens.length;fe?.removeEventListener("click",i)),document.addEventListener("keydown",r),window.addCleanup(()=>document.removeEventListener("keydown",r))}function oA(e){for(;e.firstChild;)e.removeChild(e.firstChild)}var BA=Object.hasOwnProperty,lA=ht(Lw(),1),IA=(0,lA.default)();function hA(e){return e.document.body.dataset.slug}function Ss(e){let t=pA(fA(e,"index"),!0);return t.length===0?"/":t}function uA(e){let t=e.split("/").filter(i=>i!=="").slice(0,-1).map(i=>"..").join("/");return t.length===0&&(t="."),t}function W_(e,t){return cA(uA(e),Ss(t))}function cA(...e){return e.filter(t=>t!=="").join("/").replace(/\/\/+/g,"/")}function dA(e,t){return e===t||e.endsWith("/"+t)}function fA(e,t){return dA(e,t)&&(e=e.slice(0,-t.length)),e}function pA(e,t){return e.startsWith("/")&&(e=e.substring(1)),!t&&e.endsWith("/")&&(e=e.slice(0,-1)),e}var V_="graph-visited";function j_(){return new Set(JSON.parse(localStorage.getItem(V_)??"[]"))}function gA(e){let t=j_();t.add(e),localStorage.setItem(V_,JSON.stringify([...t]))}async function yc(e,t){let i=Ss(t),r=j_(),n=document.getElementById(e);if(!n)return;oA(n);let{drag:s,zoom:a,depth:o,scale:l,repelForce:h,centerForce:u,linkDistance:d,fontSize:p,opacityScale:f,removeTags:y,showTags:b,focusOnHover:_}=JSON.parse(n.dataset.cfg),T=new Map(Object.entries(await fetchData).map(([q,le])=>[Ss(q),le])),C=[],O=[],R=new Set(T.keys()),z=new Map;for(let[q,le]of T.entries()){let he=le.links??[];for(let ge of he)R.has(ge)&&C.push({source:q,target:ge});if(b){let ge=le.tags.filter(Mt=>!y.includes(Mt)).map(Mt=>Ss("tags/"+Mt));O.push(...ge.filter(Mt=>!O.includes(Mt)));for(let Mt of ge)C.push({source:q,target:Mt})}}let ee=new Set,ne=[i,"__SENTINEL"];if(o>=0)for(;o>=0&&ne.length>0;){let q=ne.shift();if(q==="__SENTINEL")o--,ne.push("__SENTINEL");else{ee.add(q);let le=C.filter(ge=>ge.source===q),he=C.filter(ge=>ge.target===q);ne.push(...le.map(ge=>ge.target),...he.map(ge=>ge.source))}}else R.forEach(q=>ee.add(q)),b&&O.forEach(q=>ee.add(q));let Q=[...ee].map(q=>{let le=q.startsWith("tags/")?"#"+q.substring(5):T.get(q)?.title??q;return{id:q,text:le,tags:T.get(q)?.tags??[]}}),Y={nodes:Q,links:C.filter(q=>ee.has(q.source)&&ee.has(q.target)).map(q=>({source:Q.find(le=>le.id===q.source),target:Q.find(le=>le.id===q.target)}))},ie=z2(Y.nodes).force("charge",W2().strength(-100*h)).force("center",g2().strength(u)).force("link",U2(Y.links).distance(d)).force("collide",G2(q=>ae(q)).iterations(3)),Te=n.offsetWidth,Pe=Math.max(n.offsetHeight,250),ce=["--secondary","--tertiary","--gray","--light","--lightgray","--dark","--darkgray","--bodyFont"].reduce((q,le)=>(q[le]=getComputedStyle(document.documentElement).getPropertyValue(le),q),{}),U=q=>q.id===i?ce["--secondary"]:r.has(q.id)||q.id.startsWith("tags/")?ce["--tertiary"]:ce["--gray"];function ae(q){let le=Y.links.filter(he=>he.source.id===q.id||he.target.id===q.id).length;return 2+Math.sqrt(le)}let K=null,de=new Set,M=[],P=[];function A(q){if(K=q,q===null){de=new Set;for(let le of P)le.active=!1;for(let le of M)le.active=!1}else{de=new Set;for(let le of M){let he=le.simulationData;(he.source.id===q||he.target.id===q)&&(de.add(he.source.id),de.add(he.target.id)),le.active=he.source.id===q||he.target.id===q}for(let le of P)le.active=de.has(le.simulationData.id)}}let j=0,H=!1;function J(){z.get("link")?.stop();let q=new Co;for(let le of M){let he=1;K&&(he=le.active?1:.2),le.color=le.active?ce["--gray"]:ce["--lightgray"],q.add(new Mo(le).to({alpha:he},200))}q.getAll().forEach(le=>le.start()),z.set("link",{update:q.update.bind(q),stop(){q.getAll().forEach(le=>le.stop())}})}function Z(){z.get("label")?.stop();let q=new Co,le=1/l,he=le*1.1;for(let ge of P){let Mt=ge.simulationData.id;K===Mt?q.add(new Mo(ge.label).to({alpha:1,scale:{x:he,y:he}},100)):q.add(new Mo(ge.label).to({alpha:ge.label.alpha,scale:{x:le,y:le}},100))}q.getAll().forEach(ge=>ge.start()),z.set("label",{update:q.update.bind(q),stop(){q.getAll().forEach(ge=>ge.stop())}})}function oe(){z.get("hover")?.stop();let q=new Co;for(let le of P){let he=1;K!==null&&_&&(he=le.active?1:.2),q.add(new Mo(le.gfx,q).to({alpha:he},200))}q.getAll().forEach(le=>le.start()),z.set("hover",{update:q.update.bind(q),stop(){q.getAll().forEach(le=>le.stop())}})}function be(){oe(),J(),Z()}z.forEach(q=>q.stop()),z.clear();let me=new H_;await me.init({width:Te,height:Pe,antialias:!0,autoStart:!1,autoDensity:!0,backgroundAlpha:0,preference:"webgpu",resolution:window.devicePixelRatio,eventMode:"static"}),n.appendChild(me.canvas);let Oe=me.stage;Oe.interactive=!1;let Ne=new Tt({zIndex:3}),Ye=new Tt({zIndex:2}),St=new Tt({zIndex:1});Oe.addChild(Ye,Ne,St);for(let q of Y.nodes){let le=q.id,he=new sA({interactive:!1,eventMode:"none",text:q.text,alpha:0,anchor:{x:.5,y:1.2},style:{fontSize:p*15,fill:ce["--dark"],fontFamily:ce["--bodyFont"]},resolution:window.devicePixelRatio*4});he.scale.set(1/l);let ge=0,Mt=le.startsWith("tags/"),Es=new Aa({interactive:!0,label:le,eventMode:"static",hitArea:new jl(0,0,ae(q)),cursor:"pointer"}).circle(0,0,ae(q)).fill({color:Mt?ce["--light"]:U(q)}).stroke({width:Mt?2:0,color:U(q)}).on("pointerover",mA=>{A(mA.target.label),ge=he.alpha,H||be()}).on("pointerleave",()=>{A(null),he.alpha=ge,H||be()});Ye.addChild(Es),Ne.addChild(he);let xc={simulationData:q,gfx:Es,label:he,color:U(q),alpha:1,active:!1};P.push(xc)}for(let q of Y.links){let le=new Aa({interactive:!1,eventMode:"none"});St.addChild(le);let he={simulationData:q,gfx:le,color:ce["--lightgray"],alpha:1,active:!1};M.push(he)}let Ze=Ao;if(s)Bi(me.canvas).call(CS().container(()=>me.canvas).subject(()=>Y.nodes.find(q=>q.id===K)).on("start",function(q){q.active||ie.alphaTarget(1).restart(),q.subject.fx=q.subject.x,q.subject.fy=q.subject.y,q.subject.__initialDragPos={x:q.subject.x,y:q.subject.y,fx:q.subject.fx,fy:q.subject.fy},j=Date.now(),H=!0}).on("drag",function(q){let le=q.subject.__initialDragPos;q.subject.fx=le.x+(q.x-le.x)/Ze.k,q.subject.fy=le.y+(q.y-le.y)/Ze.k}).on("end",function(q){if(q.active||ie.alphaTarget(0),q.subject.fx=null,q.subject.fy=null,H=!1,Date.now()-j<500){let le=Y.nodes.find(ge=>ge.id===q.subject.id),he=W_(t,le.id);window.spaNavigate(new URL(he,window.location.toString()))}}));else for(let q of P)q.gfx.on("click",()=>{let le=W_(t,q.simulationData.id);window.spaNavigate(new URL(le,window.location.toString()))});a&&Bi(me.canvas).call(Z2().extent([[0,0],[Te,Pe]]).scaleExtent([.25,4]).on("zoom",({transform:q})=>{Ze=q,Oe.scale.set(q.k,q.k),Oe.position.set(q.x,q.y);let le=q.k*f,he=Math.max((le-1)/3.75,0),ge=P.filter(Mt=>Mt.active).flatMap(Mt=>Mt.label);for(let Mt of Ne.children)ge.includes(Mt)||(Mt.alpha=he)}));function _i(q){for(let le of P){let{x:he,y:ge}=le.simulationData;!he||!ge||(le.gfx.position.set(he+Te/2,ge+Pe/2),le.label&&le.label.position.set(he+Te/2,ge+Pe/2))}for(let le of M){let he=le.simulationData;le.gfx.clear(),le.gfx.moveTo(he.source.x+Te/2,he.source.y+Pe/2),le.gfx.lineTo(he.target.x+Te/2,he.target.y+Pe/2).stroke({alpha:le.alpha,width:1,color:le.color})}z.forEach(le=>le.update(q)),me.renderer.render(Oe),requestAnimationFrame(_i)}let Oi=requestAnimationFrame(_i);window.addCleanup(()=>cancelAnimationFrame(Oi))}document.addEventListener("nav",async e=>{let t=e.detail.url;gA(Ss(t)),await yc("graph-container",t);let i=()=>{yc("graph-container",t)};document.addEventListener("themechange",i),window.addCleanup(()=>{document.removeEventListener("themechange",i)});let r=document.getElementById("global-graph-outer"),n=r?.closest(".sidebar");function s(){let h=hA(window);r?.classList.add("active"),n&&(n.style.zIndex="1"),yc("global-graph-container",h),aA(r,a)}function a(){r?.classList.remove("active"),n&&(n.style.zIndex="unset")}async function o(h){h.key==="g"&&(h.ctrlKey||h.metaKey)&&!h.shiftKey&&(h.preventDefault(),r?.classList.contains("active")?a():s())}let l=document.getElementById("global-graph-icon");l?.addEventListener("click",s),window.addCleanup(()=>l?.removeEventListener("click",s)),document.addEventListener("keydown",o),window.addCleanup(()=>document.removeEventListener("keydown",o))})}(),function(){var gt=new IntersectionObserver(it=>{for(let Et of it){let Bt=Et.target.id,v=document.querySelector(`a[data-for="${Bt}"]`),Ue=Et.rootBounds?.height;Ue&&v&&(Et.boundingClientRect.yit.removeEventListener("click",Pt))}}window.addEventListener("resize",jt),document.addEventListener("nav",()=>{jt(),gt.disconnect(),document.querySelectorAll("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").forEach(it=>gt.observe(it))})}(),function(){var gt=Object.create,Pt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,it=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty,v=(E,c)=>()=>(c||E((c={exports:{}}).exports,c),c.exports),Ue=(E,c,g,m)=>{if(c&&typeof c=="object"||typeof c=="function")for(let x of it(c))!Bt.call(E,x)&&x!==g&&Pt(E,x,{get:()=>c[x],enumerable:!(m=jt(c,x))||m.enumerable});return E},ze=(E,c,g)=>(g=E!=null?gt(Et(E)):{},Ue(c||!E||!E.__esModule?Pt(g,"default",{value:E,enumerable:!0}):g,E)),Rt=v((E,c)=>{"use strict";c.exports=m;function g(w){return w instanceof Buffer?Buffer.from(w):new w.constructor(w.buffer.slice(),w.byteOffset,w.length)}function m(w){if(w=w||{},w.circles)return x(w);let S=new Map;if(S.set(Date,F=>new Date(F)),S.set(Map,(F,V)=>new Map(B(Array.from(F),V))),S.set(Set,(F,V)=>new Set(B(Array.from(F),V))),w.constructorHandlers)for(let F of w.constructorHandlers)S.set(F[0],F[1]);let k=null;return w.proto?X:N;function B(F,V){let L=Object.keys(F),I=new Array(L.length);for(let D=0;Dnew Date(L)),B.set(Map,(L,I)=>new Map(X(Array.from(L),I))),B.set(Set,(L,I)=>new Set(X(Array.from(L),I))),w.constructorHandlers)for(let L of w.constructorHandlers)B.set(L[0],L[1]);let N=null;return w.proto?V:F;function X(L,I){let D=Object.keys(L),$=new Array(D.length);for(let se=0;se({x:E,y:E}),pe={left:"right",right:"left",bottom:"top",top:"bottom"},te={start:"end",end:"start"};function dt(E,c,g){return G(E,ht(c,g))}function Nt(E,c){return typeof E=="function"?E(c):E}function Je(E){return E.split("-")[0]}function xt(E){return E.split("-")[1]}function Ui(E){return E==="x"?"y":"x"}function It(E){return E==="y"?"height":"width"}function rt(E){return["top","bottom"].includes(Je(E))?"y":"x"}function mt(E){return Ui(rt(E))}function nt(E,c,g){g===void 0&&(g=!1);let m=xt(E),x=mt(E),w=It(x),S=x==="x"?m===(g?"end":"start")?"right":"left":m==="start"?"bottom":"top";return c.reference[w]>c.floating[w]&&(S=Gt(S)),[S,Gt(S)]}function Qi(E){let c=Gt(E);return[yi(E),c,yi(c)]}function yi(E){return E.replace(/start|end/g,c=>te[c])}function cr(E,c,g){let m=["left","right"],x=["right","left"],w=["top","bottom"],S=["bottom","top"];switch(E){case"top":case"bottom":return g?c?x:m:c?m:x;case"left":case"right":return c?w:S;default:return[]}}function ui(E,c,g,m){let x=xt(E),w=cr(Je(E),g==="start",m);return x&&(w=w.map(S=>S+"-"+x),c&&(w=w.concat(w.map(yi)))),w}function Gt(E){return E.replace(/left|right|bottom|top/g,c=>pe[c])}function Fi(E){return{top:0,right:0,bottom:0,left:0,...E}}function si(E){return typeof E!="number"?Fi(E):{top:E,right:E,bottom:E,left:E}}function Ot(E){let{x:c,y:g,width:m,height:x}=E;return{width:m,height:x,top:g,left:c,right:c+m,bottom:g+x,x:c,y:g}}function Di(E,c,g){let{reference:m,floating:x}=E,w=rt(c),S=mt(c),k=It(S),B=Je(c),N=w==="y",X=m.x+m.width/2-x.width/2,F=m.y+m.height/2-x.height/2,V=m[k]/2-x[k]/2,L;switch(B){case"top":L={x:X,y:m.y-x.height};break;case"bottom":L={x:X,y:m.y+m.height};break;case"right":L={x:m.x+m.width,y:F};break;case"left":L={x:m.x-x.width,y:F};break;default:L={x:m.x,y:m.y}}switch(xt(c)){case"start":L[S]-=V*(g&&N?-1:1);break;case"end":L[S]+=V*(g&&N?-1:1);break}return L}var Kt=async(E,c,g)=>{let{placement:m="bottom",strategy:x="absolute",middleware:w=[],platform:S}=g,k=w.filter(Boolean),B=await(S.isRTL==null?void 0:S.isRTL(c)),N=await S.getElementRects({reference:E,floating:c,strategy:x}),{x:X,y:F}=Di(N,m,B),V=m,L={},I=0;for(let D=0;DBe<=0)){var di,Ut;let Be=(((di=w.flip)==null?void 0:di.index)||0)+1,He=ct[Be];if(He)return{data:{index:Be,overflows:qt},reset:{placement:He}};let ft=(Ut=qt.filter(et=>et.overflows[0]<=0).sort((et,lt)=>et.overflows[1]-lt.overflows[1])[0])==null?void 0:Ut.placement;if(!ft)switch(L){case"bestFit":{var Ae;let et=(Ae=qt.map(lt=>[lt.placement,lt.overflows.filter(zt=>zt>0).reduce((zt,Ci)=>zt+Ci,0)]).sort((lt,zt)=>lt[1]-zt[1])[0])==null?void 0:Ae[0];et&&(ft=et);break}case"initialPlacement":ft=k;break}if(x!==ft)return{reset:{placement:ft}}}return{}}}};function Ai(E){let c=ht(...E.map(w=>w.left)),g=ht(...E.map(w=>w.top)),m=G(...E.map(w=>w.right)),x=G(...E.map(w=>w.bottom));return{x:c,y:g,width:m-c,height:x-g}}function Xt(E){let c=E.slice().sort((x,w)=>x.y-w.y),g=[],m=null;for(let x=0;xm.height/2?g.push([w]):g[g.length-1].push(w),m=w}return g.map(x=>Ot(Ai(x)))}var Zt=function(E){return E===void 0&&(E={}),{name:"inline",options:E,async fn(c){let{placement:g,elements:m,rects:x,platform:w,strategy:S}=c,{padding:k=2,x:B,y:N}=Nt(E,c),X=Array.from(await(w.getClientRects==null?void 0:w.getClientRects(m.reference))||[]),F=Xt(X),V=Ot(Ai(X)),L=si(k);function I(){if(F.length===2&&F[0].left>F[1].right&&B!=null&&N!=null)return F.find($=>B>$.left-L.left&&B<$.right+L.right&&N>$.top-L.top&&N<$.bottom+L.bottom)||V;if(F.length>=2){if(rt(g)==="y"){let Ut=F[0],Ae=F[F.length-1],Be=Je(g)==="top",He=Ut.top,ft=Ae.bottom,et=Be?Ut.left:Ae.left,lt=Be?Ut.right:Ae.right,zt=lt-et,Ci=ft-He;return{top:He,bottom:ft,left:et,right:lt,width:zt,height:Ci,x:et,y:He}}let $=Je(g)==="left",se=G(...F.map(Ut=>Ut.right)),xe=ht(...F.map(Ut=>Ut.left)),Me=F.filter(Ut=>$?Ut.left===xe:Ut.right===se),Ge=Me[0].top,ct=Me[Me.length-1].bottom,Qt=xe,ei=se,qt=ei-Qt,di=ct-Ge;return{top:Ge,bottom:ct,left:Qt,right:ei,width:qt,height:di,x:Qt,y:Ge}}return V}let D=await w.getElementRects({reference:{getBoundingClientRect:I},floating:m.floating,strategy:S});return x.reference.x!==D.reference.x||x.reference.y!==D.reference.y||x.reference.width!==D.reference.width||x.reference.height!==D.reference.height?{reset:{rects:D}}:{}}}},Yt=function(E){return E===void 0&&(E={}),{name:"shift",options:E,async fn(c){let{x:g,y:m,placement:x}=c,{mainAxis:w=!0,crossAxis:S=!1,limiter:k={fn:$=>{let{x:se,y:xe}=$;return{x:se,y:xe}}},...B}=Nt(E,c),N={x:g,y:m},X=await Li(c,B),F=rt(Je(x)),V=Ui(F),L=N[V],I=N[F];if(w){let $=V==="y"?"top":"left",se=V==="y"?"bottom":"right",xe=L+X[$],Me=L-X[se];L=dt(xe,L,Me)}if(S){let $=F==="y"?"top":"left",se=F==="y"?"bottom":"right",xe=I+X[$],Me=I-X[se];I=dt(xe,I,Me)}let D=k.fn({...c,[V]:L,[F]:I});return{...D,data:{x:D.x-g,y:D.y-m}}}}};function ai(E){return fe(E)?(E.nodeName||"").toLowerCase():"#document"}function W(E){var c;return(E==null||(c=E.ownerDocument)==null?void 0:c.defaultView)||window}function re(E){var c;return(c=(fe(E)?E.ownerDocument:E.document)||window.document)==null?void 0:c.documentElement}function fe(E){return E instanceof Node||E instanceof W(E).Node}function _e(E){return E instanceof Element||E instanceof W(E).Element}function we(E){return E instanceof HTMLElement||E instanceof W(E).HTMLElement}function ye(E){return typeof ShadowRoot>"u"?!1:E instanceof ShadowRoot||E instanceof W(E).ShadowRoot}function Ce(E){let{overflow:c,overflowX:g,overflowY:m,display:x}=ve(E);return/auto|scroll|overlay|hidden|clip/.test(c+m+g)&&!["inline","contents"].includes(x)}function qe(E){return["table","td","th"].includes(ai(E))}function Ke(E){return[":popover-open",":modal"].some(c=>{try{return E.matches(c)}catch{return!1}})}function ut(E){let c=ue(),g=_e(E)?ve(E):E;return g.transform!=="none"||g.perspective!=="none"||(g.containerType?g.containerType!=="normal":!1)||!c&&(g.backdropFilter?g.backdropFilter!=="none":!1)||!c&&(g.filter?g.filter!=="none":!1)||["transform","perspective","filter"].some(m=>(g.willChange||"").includes(m))||["paint","layout","strict","content"].some(m=>(g.contain||"").includes(m))}function _t(E){let c=$e(E);for(;we(c)&&!Ie(c);){if(ut(c))return c;if(Ke(c))return null;c=$e(c)}return null}function ue(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ie(E){return["html","body","#document"].includes(ai(E))}function ve(E){return W(E).getComputedStyle(E)}function Se(E){return _e(E)?{scrollLeft:E.scrollLeft,scrollTop:E.scrollTop}:{scrollLeft:E.scrollX,scrollTop:E.scrollY}}function $e(E){if(ai(E)==="html")return E;let c=E.assignedSlot||E.parentNode||ye(E)&&E.host||re(E);return ye(c)?c.host:c}function Fe(E){let c=$e(E);return Ie(c)?E.ownerDocument?E.ownerDocument.body:E.body:we(c)&&Ce(c)?c:Fe(c)}function st(E,c,g){var m;c===void 0&&(c=[]),g===void 0&&(g=!0);let x=Fe(E),w=x===((m=E.ownerDocument)==null?void 0:m.body),S=W(x);if(w){let k=Jt(S);return c.concat(S,S.visualViewport||[],Ce(x)?x:[],k&&g?st(k):[])}return c.concat(x,st(x,[],g))}function Jt(E){return E.parent&&Object.getPrototypeOf(E.parent)?E.frameElement:null}function De(E){let c=ve(E),g=parseFloat(c.width)||0,m=parseFloat(c.height)||0,x=we(E),w=x?E.offsetWidth:g,S=x?E.offsetHeight:m,k=kt(g)!==w||kt(m)!==S;return k&&(g=w,m=S),{width:g,height:m,$:k}}function ci(E){return _e(E)?E:E.contextElement}function At(E){let c=ci(E);if(!we(c))return je(1);let g=c.getBoundingClientRect(),{width:m,height:x,$:w}=De(c),S=(w?kt(g.width):g.width)/m,k=(w?kt(g.height):g.height)/x;return(!S||!Number.isFinite(S))&&(S=1),(!k||!Number.isFinite(k))&&(k=1),{x:S,y:k}}var ke=je(0);function Pr(E){let c=W(E);return!ue()||!c.visualViewport?ke:{x:c.visualViewport.offsetLeft,y:c.visualViewport.offsetTop}}function Rr(E,c,g){return c===void 0&&(c=!1),!g||c&&g!==W(E)?!1:c}function We(E,c,g,m){c===void 0&&(c=!1),g===void 0&&(g=!1);let x=E.getBoundingClientRect(),w=ci(E),S=je(1);c&&(m?_e(m)&&(S=At(m)):S=At(E));let k=Rr(w,g,m)?Pr(w):je(0),B=(x.left+k.x)/S.x,N=(x.top+k.y)/S.y,X=x.width/S.x,F=x.height/S.y;if(w){let V=W(w),L=m&&_e(m)?W(m):m,I=V,D=Jt(I);for(;D&&m&&L!==I;){let $=At(D),se=D.getBoundingClientRect(),xe=ve(D),Me=se.left+(D.clientLeft+parseFloat(xe.paddingLeft))*$.x,Ge=se.top+(D.clientTop+parseFloat(xe.paddingTop))*$.y;B*=$.x,N*=$.y,X*=$.x,F*=$.y,B+=Me,N+=Ge,I=W(D),D=Jt(I)}}return Ot({width:X,height:F,x:B,y:N})}function $t(E){let{elements:c,rect:g,offsetParent:m,strategy:x}=E,w=x==="fixed",S=re(m),k=c?Ke(c.floating):!1;if(m===S||k&&w)return g;let B={scrollLeft:0,scrollTop:0},N=je(1),X=je(0),F=we(m);if((F||!F&&!w)&&((ai(m)!=="body"||Ce(S))&&(B=Se(m)),we(m))){let V=We(m);N=At(m),X.x=V.x+m.clientLeft,X.y=V.y+m.clientTop}return{width:g.width*N.x,height:g.height*N.y,x:g.x*N.x-B.scrollLeft*N.x+X.x,y:g.y*N.y-B.scrollTop*N.y+X.y}}function kr(E){return Array.from(E.getClientRects())}function at(E){return We(re(E)).left+Se(E).scrollLeft}function dr(E){let c=re(E),g=Se(E),m=E.ownerDocument.body,x=G(c.scrollWidth,c.clientWidth,m.scrollWidth,m.clientWidth),w=G(c.scrollHeight,c.clientHeight,m.scrollHeight,m.clientHeight),S=-g.scrollLeft+at(E),k=-g.scrollTop;return ve(m).direction==="rtl"&&(S+=G(c.clientWidth,m.clientWidth)-x),{width:x,height:w,x:S,y:k}}function bt(E,c){let g=W(E),m=re(E),x=g.visualViewport,w=m.clientWidth,S=m.clientHeight,k=0,B=0;if(x){w=x.width,S=x.height;let N=ue();(!N||N&&c==="fixed")&&(k=x.offsetLeft,B=x.offsetTop)}return{width:w,height:S,x:k,y:B}}function Xe(E,c){let g=We(E,!0,c==="fixed"),m=g.top+E.clientTop,x=g.left+E.clientLeft,w=we(E)?At(E):je(1),S=E.clientWidth*w.x,k=E.clientHeight*w.y,B=x*w.x,N=m*w.y;return{width:S,height:k,x:B,y:N}}function fr(E,c,g){let m;if(c==="viewport")m=bt(E,g);else if(c==="document")m=dr(re(E));else if(_e(c))m=Xe(c,g);else{let x=Pr(E);m={...c,x:c.x-x.x,y:c.y-x.y}}return Ot(m)}function Ve(E,c){let g=$e(E);return g===c||!_e(g)||Ie(g)?!1:ve(g).position==="fixed"||Ve(g,c)}function wt(E,c){let g=c.get(E);if(g)return g;let m=st(E,[],!1).filter(k=>_e(k)&&ai(k)!=="body"),x=null,w=ve(E).position==="fixed",S=w?$e(E):E;for(;_e(S)&&!Ie(S);){let k=ve(S),B=ut(S);!B&&k.position==="fixed"&&(x=null),(w?!B&&!x:!B&&k.position==="static"&&x&&["absolute","fixed"].includes(x.position)||Ce(S)&&!B&&Ve(E,S))?m=m.filter(N=>N!==S):x=k,S=$e(S)}return c.set(E,m),m}function tr(E){let{element:c,boundary:g,rootBoundary:m,strategy:x}=E,w=[...g==="clippingAncestors"?Ke(c)?[]:wt(c,this._c):[].concat(g),m],S=w[0],k=w.reduce((B,N)=>{let X=fr(c,N,x);return B.top=G(X.top,B.top),B.right=ht(X.right,B.right),B.bottom=ht(X.bottom,B.bottom),B.left=G(X.left,B.left),B},fr(c,S,x));return{width:k.right-k.left,height:k.bottom-k.top,x:k.left,y:k.top}}function Kr(E){let{width:c,height:g}=De(E);return{width:c,height:g}}function Zr(E,c,g){let m=we(c),x=re(c),w=g==="fixed",S=We(E,!0,w,c),k={scrollLeft:0,scrollTop:0},B=je(0);if(m||!m&&!w)if((ai(c)!=="body"||Ce(x))&&(k=Se(c)),m){let F=We(c,!0,w,c);B.x=F.x+c.clientLeft,B.y=F.y+c.clientTop}else x&&(B.x=at(x));let N=S.left+k.scrollLeft-B.x,X=S.top+k.scrollTop-B.y;return{x:N,y:X,width:S.width,height:S.height}}function Le(E){return ve(E).position==="static"}function Ht(E,c){return!we(E)||ve(E).position==="fixed"?null:c?c(E):E.offsetParent}function Br(E,c){let g=W(E);if(Ke(E))return g;if(!we(E)){let x=$e(E);for(;x&&!Ie(x);){if(_e(x)&&!Le(x))return x;x=$e(x)}return g}let m=Ht(E,c);for(;m&&qe(m)&&Le(m);)m=Ht(m,c);return m&&Ie(m)&&Le(m)&&!ut(m)?g:m||_t(E)||g}var Jr=async function(E){let c=this.getOffsetParent||Br,g=this.getDimensions,m=await g(E.floating);return{reference:Zr(E.reference,await c(E.floating),E.strategy),floating:{x:0,y:0,width:m.width,height:m.height}}};function Qr(E){return ve(E).direction==="rtl"}var xi={convertOffsetParentRelativeRectToViewportRelativeRect:$t,getDocumentElement:re,getClippingRect:tr,getOffsetParent:Br,getElementRects:Jr,getClientRects:kr,getDimensions:Kr,getScale:At,isElement:_e,isRTL:Qr},Ct=Yt,Ir=er,Ni=Zt,pr=(E,c,g)=>{let m=new Map,x={platform:xi,...g},w={...x.platform,_c:m};return Kt(E,c,{...x,platform:w})},en=Object.hasOwnProperty,ir=ze(Rt(),1),Gr=(0,ir.default)(),Or=(E,c,g)=>{let m=new URL(E.getAttribute(c),g);E.setAttribute(c,m.pathname+m.hash)};function tn(E,c){E.querySelectorAll('[href^="./"], [href^="../"]').forEach(g=>Or(g,"href",c)),E.querySelectorAll('[src^="./"], [src^="../"]').forEach(g=>Or(g,"src",c))}var Hi=new DOMParser;async function ot({clientX:E,clientY:c}){let g=this;if(g.dataset.noPopover==="true")return;async function m(I){let{x:D,y:$}=await pr(g,I,{middleware:[Ni({x:E,y:c}),Ct(),Ir()]});Object.assign(I.style,{left:`${D}px`,top:`${$}px`})}let x=()=>[...g.children].some(I=>I.classList.contains("popover"));if(x())return m(g.lastChild);let w=new URL(document.location.href);w.hash="",w.search="";let S=new URL(g.href),k=decodeURIComponent(S.hash);S.hash="",S.search="";let B=await fetch(`${S}`).catch(I=>{console.error(I)});if(x()||!B)return;let[N]=B.headers.get("Content-Type").split(";"),[X,F]=N.split("/"),V=document.createElement("div");V.classList.add("popover");let L=document.createElement("div");switch(L.classList.add("popover-inner"),V.appendChild(L),L.dataset.contentType=N??void 0,X){case"image":let I=document.createElement("img");I.src=S.toString(),I.alt=S.pathname,L.appendChild(I);break;case"application":switch(F){case"pdf":let xe=document.createElement("iframe");xe.src=S.toString(),L.appendChild(xe);break;default:break}break;default:let D=await B.text(),$=Hi.parseFromString(D,"text/html");tn($,S);let se=[...$.getElementsByClassName("popover-hint")];if(se.length===0)return;se.forEach(xe=>L.appendChild(xe))}if(m(V),g.appendChild(V),k!==""){let I=L.querySelector(k);I&&L.scroll({top:I.offsetTop-12,behavior:"instant"})}}document.addEventListener("nav",()=>{let E=[...document.getElementsByClassName("internal")];for(let c of E)c.addEventListener("mouseenter",ot),window.addCleanup(()=>c.removeEventListener("mouseenter",ot))})}(),function(){const gt=document.createElement("script");gt.src="https://umami.7wate.com//script.js",gt.setAttribute("data-website-id","c061efdc-95dd-4d21-9d04-a1ffda0a85b9"),gt.async=!0,document.head.appendChild(gt)}(),function(){var gt=Object.create,Pt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,it=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty,v=(W,re)=>()=>(re||W((re={exports:{}}).exports,re),re.exports),Ue=(W,re,fe,_e)=>{if(re&&typeof re=="object"||typeof re=="function")for(let we of it(re))!Bt.call(W,we)&&we!==fe&&Pt(W,we,{get:()=>re[we],enumerable:!(_e=jt(re,we))||_e.enumerable});return W},ze=(W,re,fe)=>(fe=W!=null?gt(Et(W)):{},Ue(re||!W||!W.__esModule?Pt(fe,"default",{value:W,enumerable:!0}):fe,W)),Rt=v((W,re)=>{"use strict";re.exports=_e;function fe(ye){return ye instanceof Buffer?Buffer.from(ye):new ye.constructor(ye.buffer.slice(),ye.byteOffset,ye.length)}function _e(ye){if(ye=ye||{},ye.circles)return we(ye);let Ce=new Map;if(Ce.set(Date,ue=>new Date(ue)),Ce.set(Map,(ue,Ie)=>new Map(Ke(Array.from(ue),Ie))),Ce.set(Set,(ue,Ie)=>new Set(Ke(Array.from(ue),Ie))),ye.constructorHandlers)for(let ue of ye.constructorHandlers)Ce.set(ue[0],ue[1]);let qe=null;return ye.proto?_t:ut;function Ke(ue,Ie){let ve=Object.keys(ue),Se=new Array(ve.length);for(let $e=0;$enew Date(ve)),Ke.set(Map,(ve,Se)=>new Map(_t(Array.from(ve),Se))),Ke.set(Set,(ve,Se)=>new Set(_t(Array.from(ve),Se))),ye.constructorHandlers)for(let ve of ye.constructorHandlers)Ke.set(ve[0],ve[1]);let ut=null;return ye.proto?Ie:ue;function _t(ve,Se){let $e=Object.keys(ve),Fe=new Array($e.length);for(let st=0;st<$e.length;st++){let Jt=$e[st],De=ve[Jt];if(typeof De!="object"||De===null)Fe[Jt]=De;else if(De.constructor!==Object&&(ut=Ke.get(De.constructor)))Fe[Jt]=ut(De,Se);else if(ArrayBuffer.isView(De))Fe[Jt]=fe(De);else{let ci=Ce.indexOf(De);ci!==-1?Fe[Jt]=qe[ci]:Fe[Jt]=Se(De)}}return Fe}function ue(ve){if(typeof ve!="object"||ve===null)return ve;if(Array.isArray(ve))return _t(ve,ue);if(ve.constructor!==Object&&(ut=Ke.get(ve.constructor)))return ut(ve,ue);let Se={};Ce.push(ve),qe.push(Se);for(let $e in ve){if(Object.hasOwnProperty.call(ve,$e)===!1)continue;let Fe=ve[$e];if(typeof Fe!="object"||Fe===null)Se[$e]=Fe;else if(Fe.constructor!==Object&&(ut=Ke.get(Fe.constructor)))Se[$e]=ut(Fe,ue);else if(ArrayBuffer.isView(Fe))Se[$e]=fe(Fe);else{let st=Ce.indexOf(Fe);st!==-1?Se[$e]=qe[st]:Se[$e]=ue(Fe)}}return Ce.pop(),qe.pop(),Se}function Ie(ve){if(typeof ve!="object"||ve===null)return ve;if(Array.isArray(ve))return _t(ve,Ie);if(ve.constructor!==Object&&(ut=Ke.get(ve.constructor)))return ut(ve,Ie);let Se={};Ce.push(ve),qe.push(Se);for(let $e in ve){let Fe=ve[$e];if(typeof Fe!="object"||Fe===null)Se[$e]=Fe;else if(Fe.constructor!==Object&&(ut=Ke.get(Fe.constructor)))Se[$e]=ut(Fe,Ie);else if(ArrayBuffer.isView(Fe))Se[$e]=fe(Fe);else{let st=Ce.indexOf(Fe);st!==-1?Se[$e]=qe[st]:Se[$e]=Ie(Fe)}}return Ce.pop(),qe.pop(),Se}}}),ht=W=>(re,fe)=>re[`node${W}`]===fe[`node${W}`],G=ht("Name"),kt=ht("Type"),je=ht("Value");function pe(W,re){if(W.attributes.length===0&&re.attributes.length===0)return[];let fe=[],_e=new Map,we=new Map;for(let ye of W.attributes)_e.set(ye.name,ye.value);for(let ye of re.attributes){let Ce=_e.get(ye.name);ye.value===Ce?_e.delete(ye.name):(typeof Ce<"u"&&_e.delete(ye.name),we.set(ye.name,ye.value))}for(let ye of _e.keys())fe.push({type:5,name:ye});for(let[ye,Ce]of we.entries())fe.push({type:4,name:ye,value:Ce});return fe}function te(W,re=!0){let fe=`${W.localName}`;for(let{name:_e,value:we}of W.attributes)re&&_e.startsWith("data-")||(fe+=`[${_e}=${we}]`);return fe+=W.innerHTML,fe}function dt(W){switch(W.tagName){case"BASE":case"TITLE":return W.localName;case"META":{if(W.hasAttribute("name"))return`meta[name="${W.getAttribute("name")}"]`;if(W.hasAttribute("property"))return`meta[name="${W.getAttribute("property")}"]`;break}case"LINK":{if(W.hasAttribute("rel")&&W.hasAttribute("href"))return`link[rel="${W.getAttribute("rel")}"][href="${W.getAttribute("href")}"]`;if(W.hasAttribute("href"))return`link[href="${W.getAttribute("href")}"]`;break}}return te(W)}function Nt(W){let[re,fe=""]=W.split("?");return`${re}?t=${Date.now()}&${fe.replace(/t=\d+/g,"")}`}function Je(W){if(W.nodeType===1&&W.hasAttribute("data-persist"))return W;if(W.nodeType===1&&W.localName==="script"){let re=document.createElement("script");for(let{name:fe,value:_e}of W.attributes)fe==="src"&&(_e=Nt(_e)),re.setAttribute(fe,_e);return re.innerHTML=W.innerHTML,re}return W.cloneNode(!0)}function xt(W,re){if(W.children.length===0&&re.children.length===0)return[];let fe=[],_e=new Map,we=new Map,ye=new Map;for(let Ce of W.children)_e.set(dt(Ce),Ce);for(let Ce of re.children){let qe=dt(Ce),Ke=_e.get(qe);Ke?te(Ce,!1)!==te(Ke,!1)&&we.set(qe,Je(Ce)):ye.set(qe,Je(Ce)),_e.delete(qe)}for(let Ce of W.childNodes){if(Ce.nodeType===1){let qe=dt(Ce);if(_e.has(qe)){fe.push({type:1});continue}else if(we.has(qe)){let Ke=we.get(qe);fe.push({type:3,attributes:pe(Ce,Ke),children:Ui(Ce,Ke)});continue}}fe.push(void 0)}for(let Ce of ye.values())fe.push({type:0,node:Je(Ce)});return fe}function Ui(W,re){let fe=[],_e=Math.max(W.childNodes.length,re.childNodes.length);for(let we=0;we<_e;we++){let ye=W.childNodes.item(we),Ce=re.childNodes.item(we);fe[we]=It(ye,Ce)}return fe}function It(W,re){if(!W)return{type:0,node:Je(re)};if(!re)return{type:1};if(kt(W,re)){if(W.nodeType===3){let fe=W.nodeValue,_e=re.nodeValue;if(fe.trim().length===0&&_e.trim().length===0)return}if(W.nodeType===1){if(G(W,re)){let fe=W.tagName==="HEAD"?xt:Ui;return{type:3,attributes:pe(W,re),children:fe(W,re)}}return{type:2,node:Je(re)}}else return W.nodeType===9?It(W.documentElement,re.documentElement):je(W,re)?void 0:{type:2,value:re.nodeValue}}return{type:2,node:Je(re)}}function rt(W,re){if(re.length!==0)for(let{type:fe,name:_e,value:we}of re)fe===5?W.removeAttribute(_e):fe===4&&W.setAttribute(_e,we)}async function mt(W,re,fe){if(!re)return;let _e;switch(W.nodeType===9?(W=W.documentElement,_e=W):fe?_e=fe:_e=W,re.type){case 0:{let{node:we}=re;W.appendChild(we);return}case 1:{if(!_e)return;W.removeChild(_e);return}case 2:{if(!_e)return;let{node:we,value:ye}=re;if(typeof ye=="string"){_e.nodeValue=ye;return}_e.replaceWith(we);return}case 3:{if(!_e)return;let{attributes:we,children:ye}=re;rt(_e,we);let Ce=Array.from(_e.childNodes);await Promise.all(ye.map((qe,Ke)=>mt(_e,qe,Ce[Ke])));return}}}function nt(W,re){let fe=It(W,re);return mt(W,fe)}var Qi=Object.hasOwnProperty,yi=ze(Rt(),1),cr=(0,yi.default)();function ui(W){return W.document.body.dataset.slug}var Gt=(W,re,fe)=>{let _e=new URL(W.getAttribute(re),fe);W.setAttribute(re,_e.pathname+_e.hash)};function Fi(W,re){W.querySelectorAll('[href^="./"], [href^="../"]').forEach(fe=>Gt(fe,"href",re)),W.querySelectorAll('[src^="./"], [src^="../"]').forEach(fe=>Gt(fe,"src",re))}var si=1,Ot=document.createElement("route-announcer"),Di=W=>W?.nodeType===si,Kt=W=>{try{let re=new URL(W);if(window.location.origin===re.origin)return!0}catch{}return!1},Li=W=>{let re=W.origin===window.location.origin,fe=W.pathname===window.location.pathname;return re&&fe},er=({target:W})=>{if(!Di(W)||W.attributes.getNamedItem("target")?.value==="_blank")return;let re=W.closest("a");if(!re||"routerIgnore"in re.dataset)return;let{href:fe}=re;if(Kt(fe))return{url:new URL(fe),scroll:"routerNoscroll"in re.dataset?!1:void 0}};function Ai(W){let re=new CustomEvent("nav",{detail:{url:W}});document.dispatchEvent(re)}var Xt=new Set;window.addCleanup=W=>Xt.add(W);var Zt;async function Yt(W,re=!1){Zt=Zt||new DOMParser;let fe=await fetch(`${W}`).then(ye=>{if(ye.headers.get("content-type")?.startsWith("text/html"))return ye.text();window.location.assign(W)}).catch(()=>{window.location.assign(W)});if(!fe)return;Xt.forEach(ye=>ye()),Xt.clear();let _e=Zt.parseFromString(fe,"text/html");Fi(_e,W);let we=_e.querySelector("title")?.textContent;if(we)document.title=we;else{let ye=document.querySelector("h1");we=ye?.innerText??ye?.textContent??W.pathname}Ot.textContent!==we&&(Ot.textContent=we),Ot.dataset.persist="",_e.body.appendChild(Ot),nt(document.body,_e.body),re||(W.hash?document.getElementById(decodeURIComponent(W.hash.substring(1)))?.scrollIntoView():window.scrollTo({top:0})),document.head.querySelectorAll(":not([spa-preserve])").forEach(ye=>ye.remove()),_e.head.querySelectorAll(":not([spa-preserve])").forEach(ye=>document.head.appendChild(ye)),re||history.pushState({},"",W),Ai(ui(window)),delete Ot.dataset.persist}window.spaNavigate=Yt;function ai(){return typeof window<"u"&&(window.addEventListener("click",async W=>{let{url:re}=er(W)??{};if(!(!re||W.ctrlKey||W.metaKey)){if(W.preventDefault(),Li(re)&&re.hash){document.getElementById(decodeURIComponent(re.hash.substring(1)))?.scrollIntoView(),history.pushState({},"",re);return}try{Yt(re,!1)}catch{window.location.assign(re)}}}),window.addEventListener("popstate",W=>{let{url:re}=er(W)??{};if(!(window.location.hash&&window.location.pathname===re?.pathname))try{Yt(new URL(window.location.toString()),!0)}catch{window.location.reload()}})),new class{go(W){let re=new URL(W,window.location.toString());return Yt(re,!1)}back(){return window.history.back()}forward(){return window.history.forward()}}}if(ai(),Ai(ui(window)),!customElements.get("route-announcer")){let W={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};customElements.define("route-announcer",class extends HTMLElement{constructor(){super()}connectedCallback(){for(let[re,fe]of Object.entries(W))this.setAttribute(re,fe)}})}}();