@annotorious/openseadragon 3.4.3 → 3.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,13 +3,13 @@
3
3
  `,dd=r=>48<=r.charCodeAt(0)&&r.charCodeAt(0)<=57;class c1 extends cd{constructor(){super();$t(this,"curNumber","");$t(this,"curCommandType",-1);$t(this,"curCommandRelative",!1);$t(this,"canParseCommandOrComma",!0);$t(this,"curNumberHasExp",!1);$t(this,"curNumberHasExpDigits",!1);$t(this,"curNumberHasDecimal",!1);$t(this,"curArgs",[])}finish(e=[]){if(this.parse(" ",e),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return e}parse(e,i=[]){const s=n=>{i.push(n),this.curArgs.length=0,this.canParseCommandOrComma=!0};for(let n=0;n<e.length;n++){const o=e[n],a=this.curCommandType===$.ARC&&(this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber.length===1&&(this.curNumber==="0"||this.curNumber==="1"),l=dd(o)&&(this.curNumber==="0"&&o==="0"||a);if(dd(o)&&!l){this.curNumber+=o,this.curNumberHasExpDigits=this.curNumberHasExp;continue}if(o==="e"||o==="E"){this.curNumber+=o,this.curNumberHasExp=!0;continue}if((o==="-"||o==="+")&&this.curNumberHasExp&&!this.curNumberHasExpDigits){this.curNumber+=o;continue}if(o==="."&&!this.curNumberHasExp&&!this.curNumberHasDecimal&&!a){this.curNumber+=o,this.curNumberHasDecimal=!0;continue}if(this.curNumber&&this.curCommandType!==-1){const h=Number(this.curNumber);if(isNaN(h))throw new SyntaxError(`Invalid number ending at ${n}`);if(this.curCommandType===$.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>h)throw new SyntaxError(`Expected positive number, got "${h}" at index "${n}"`)}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError(`Expected a flag, got "${this.curNumber}" at index "${n}"`)}this.curArgs.push(h),this.curArgs.length===d1[this.curCommandType]&&($.HORIZ_LINE_TO===this.curCommandType?s({type:$.HORIZ_LINE_TO,relative:this.curCommandRelative,x:h}):$.VERT_LINE_TO===this.curCommandType?s({type:$.VERT_LINE_TO,relative:this.curCommandRelative,y:h}):this.curCommandType===$.MOVE_TO||this.curCommandType===$.LINE_TO||this.curCommandType===$.SMOOTH_QUAD_TO?(s({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),$.MOVE_TO===this.curCommandType&&(this.curCommandType=$.LINE_TO)):this.curCommandType===$.CURVE_TO?s({type:$.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===$.SMOOTH_CURVE_TO?s({type:$.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===$.QUAD_TO?s({type:$.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===$.ARC&&s({type:$.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!u1(o)){if(o===","&&this.canParseCommandOrComma){this.canParseCommandOrComma=!1;continue}if(o==="+"||o==="-"||o==="."){this.curNumber=o,this.curNumberHasDecimal=o===".";continue}if(l){this.curNumber=o,this.curNumberHasDecimal=!1;continue}if(this.curArgs.length!==0)throw new SyntaxError(`Unterminated command at index ${n}.`);if(!this.canParseCommandOrComma)throw new SyntaxError(`Unexpected character "${o}" at index ${n}. Command cannot follow comma`);if(this.canParseCommandOrComma=!1,o==="z"||o==="Z"){i.push({type:$.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1;continue}else if(o==="h"||o==="H")this.curCommandType=$.HORIZ_LINE_TO,this.curCommandRelative=o==="h";else if(o==="v"||o==="V")this.curCommandType=$.VERT_LINE_TO,this.curCommandRelative=o==="v";else if(o==="m"||o==="M")this.curCommandType=$.MOVE_TO,this.curCommandRelative=o==="m";else if(o==="l"||o==="L")this.curCommandType=$.LINE_TO,this.curCommandRelative=o==="l";else if(o==="c"||o==="C")this.curCommandType=$.CURVE_TO,this.curCommandRelative=o==="c";else if(o==="s"||o==="S")this.curCommandType=$.SMOOTH_CURVE_TO,this.curCommandRelative=o==="s";else if(o==="q"||o==="Q")this.curCommandType=$.QUAD_TO,this.curCommandRelative=o==="q";else if(o==="t"||o==="T")this.curCommandType=$.SMOOTH_QUAD_TO,this.curCommandRelative=o==="t";else if(o==="a"||o==="A")this.curCommandType=$.ARC,this.curCommandRelative=o==="a";else throw new SyntaxError(`Unexpected character "${o}" at index ${n}.`)}}return i}transform(e){return Object.create(this,{parse:{value(s,n=[]){const o=Object.getPrototypeOf(this).parse.call(this,s);for(const a of o){const l=e(a);Array.isArray(l)?n.push(...l):n.push(l)}return n}}})}}const Lt=class Lt extends cd{constructor(e){super();$t(this,"commands");typeof e=="string"?this.commands=Lt.parse(e):this.commands=e}encode(){return Lt.encode(this.commands)}getBounds(){const e=oe.CALCULATE_BOUNDS();return this.transform(e),e}transform(e){const i=[];for(const s of this.commands){const n=e(s);Array.isArray(n)?i.push(...n):i.push(n)}return this.commands=i,this}reverse(e=!0){return this.commands=oe.REVERSE_PATH(this.commands,e),this}static encode(e){return Yv(e)}static parse(e){const i=new c1,s=[];return i.parse(e,s),i.finish(s),s}};$t(Lt,"CLOSE_PATH",1),$t(Lt,"MOVE_TO",2),$t(Lt,"HORIZ_LINE_TO",4),$t(Lt,"VERT_LINE_TO",8),$t(Lt,"LINE_TO",16),$t(Lt,"CURVE_TO",32),$t(Lt,"SMOOTH_CURVE_TO",64),$t(Lt,"QUAD_TO",128),$t(Lt,"SMOOTH_QUAD_TO",256),$t(Lt,"ARC",512),$t(Lt,"LINE_COMMANDS",Lt.LINE_TO|Lt.HORIZ_LINE_TO|Lt.VERT_LINE_TO),$t(Lt,"DRAWING_COMMANDS",Lt.HORIZ_LINE_TO|Lt.VERT_LINE_TO|Lt.LINE_TO|Lt.CURVE_TO|Lt.SMOOTH_CURVE_TO|Lt.QUAD_TO|Lt.SMOOTH_QUAD_TO|Lt.ARC);let $=Lt;const d1={[$.MOVE_TO]:2,[$.LINE_TO]:2,[$.HORIZ_LINE_TO]:1,[$.VERT_LINE_TO]:1,[$.CLOSE_PATH]:0,[$.QUAD_TO]:4,[$.SMOOTH_QUAD_TO]:2,[$.CURVE_TO]:6,[$.SMOOTH_CURVE_TO]:4,[$.ARC]:7},Te=[];for(let r=0;r<256;++r)Te.push((r+256).toString(16).slice(1));function f1(r,t=0){return(Te[r[t+0]]+Te[r[t+1]]+Te[r[t+2]]+Te[r[t+3]]+"-"+Te[r[t+4]]+Te[r[t+5]]+"-"+Te[r[t+6]]+Te[r[t+7]]+"-"+Te[r[t+8]]+Te[r[t+9]]+"-"+Te[r[t+10]]+Te[r[t+11]]+Te[r[t+12]]+Te[r[t+13]]+Te[r[t+14]]+Te[r[t+15]]).toLowerCase()}let Ka;const p1=new Uint8Array(16);function m1(){if(!Ka){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ka=crypto.getRandomValues.bind(crypto)}return Ka(p1)}const fd={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function g1(r,t,e){var s;if(fd.randomUUID&&!r)return fd.randomUUID();r=r||{};const i=r.random??((s=r.rng)==null?void 0:s.call(r))??m1();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,f1(i)}const y1=(r,t)=>{const e=typeof t=="function"?t(r):t;if(e){const{fill:i,fillOpacity:s,stroke:n,strokeWidth:o,strokeOpacity:a}=e;let l="";return i&&(l+=`fill:${i};`,l+=`fill-opacity:${s||"0.25"};`),n&&(l+=`stroke:${n};`,l+=`stroke-width:${o||"1"};`,l+=`stroke-opacity:${a||"1"};`),l}},Za=(r,t=0)=>{const{minX:e,minY:i,maxX:s,maxY:n}=r;return{x:e-t,y:i-t,w:s-e+2*t,h:n-i+2*t}},Zr=typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,_1=r=>({}),pd=r=>({grab:r[0]});function v1(r){let t,e,i,s;const n=r[8].default,o=$c(n,r,r[7],pd);return{c(){t=st("g"),o&&o.c(),w(t,"class","a9s-annotation selected")},m(a,l){at(a,t,l),o&&o.m(t,null),e=!0,i||(s=[Pt(t,"pointerup",r[2]),Pt(t,"pointermove",r[1])],i=!0)},p(a,[l]){o&&o.p&&(!e||l&128)&&zc(o,n,a,a[7],e?Vc(n,a[7],l,_1):Yc(a[7]),pd)},i(a){e||(q(o,a),e=!0)},o(a){lt(o,a),e=!1},d(a){a&&nt(t),o&&o.d(a),i=!1,Ye(s)}}}function x1(r,t,e){let{$$slots:i={},$$scope:s}=t;const n=Ki();let{shape:o}=t,{editor:a}=t,{transform:l}=t,{svgEl:h}=t,u,c,d;const f=_=>y=>{if(u=_,h){const{left:g,top:x}=h.getBoundingClientRect(),E=y.clientX-g,M=y.clientY-x;c=l.elementToImage(E,M)}else{const{offsetX:g,offsetY:x}=y;c=l.elementToImage(g,x)}d=o,y.target.setPointerCapture(y.pointerId),n("grab",y)},p=_=>{if(u){const[y,v]=l.elementToImage(_.offsetX,_.offsetY),g=[y-c[0],v-c[1]];e(3,o=a(d,u,g)),n("change",o)}},m=_=>{_.target.releasePointerCapture(_.pointerId),u=void 0,d=o,n("release",_)};return r.$$set=_=>{"shape"in _&&e(3,o=_.shape),"editor"in _&&e(4,a=_.editor),"transform"in _&&e(5,l=_.transform),"svgEl"in _&&e(6,h=_.svgEl),"$$scope"in _&&e(7,s=_.$$scope)},[f,p,m,o,a,l,h,s,i]}class Qa extends se{constructor(t){super(),ie(this,t,x1,v1,qt,{shape:3,editor:4,transform:5,svgEl:6})}}function b1(r){let t,e,i,s,n,o,a,l,h=r[3]&&md(r);return{c(){t=st("g"),e=st("circle"),h&&h.c(),s=st("circle"),w(e,"class","a9s-handle-buffer svelte-160z737"),w(e,"cx",r[0]),w(e,"cy",r[1]),w(e,"r",i=r[5]+6/r[2]),w(s,"class",n=Ln(`a9s-handle-dot${r[3]?" selected":""}`)+" svelte-160z737"),w(s,"cx",r[0]),w(s,"cy",r[1]),w(s,"r",r[5]),w(t,"class",o=Ln(`a9s-handle ${r[8].class||""}`.trim())+" svelte-160z737")},m(u,c){at(u,t,c),Ct(t,e),h&&h.m(t,null),Ct(t,s),a||(l=[Pt(e,"pointerenter",r[11]),Pt(e,"pointerleave",r[12]),Pt(e,"pointerdown",r[13]),Pt(e,"pointerdown",r[6]),Pt(e,"pointerup",r[14]),Pt(e,"pointerup",r[7])],a=!0)},p(u,c){c&1&&w(e,"cx",u[0]),c&2&&w(e,"cy",u[1]),c&36&&i!==(i=u[5]+6/u[2])&&w(e,"r",i),u[3]?h?h.p(u,c):(h=md(u),h.c(),h.m(t,s)):h&&(h.d(1),h=null),c&8&&n!==(n=Ln(`a9s-handle-dot${u[3]?" selected":""}`)+" svelte-160z737")&&w(s,"class",n),c&1&&w(s,"cx",u[0]),c&2&&w(s,"cy",u[1]),c&32&&w(s,"r",u[5]),c&256&&o!==(o=Ln(`a9s-handle ${u[8].class||""}`.trim())+" svelte-160z737")&&w(t,"class",o)},d(u){u&&nt(t),h&&h.d(),a=!1,Ye(l)}}}function E1(r){let t,e,i,s,n,o,a,l,h;return{c(){t=st("g"),e=st("circle"),s=st("circle"),o=st("circle"),w(e,"cx",r[0]),w(e,"cy",r[1]),w(e,"r",i=r[5]*10),w(e,"class","a9s-touch-halo svelte-160z737"),ji(e,"touched",r[4]),w(s,"cx",r[0]),w(s,"cy",r[1]),w(s,"r",n=r[5]+10/r[2]),w(s,"class","a9s-handle-buffer svelte-160z737"),w(o,"class","a9s-handle-dot svelte-160z737"),w(o,"cx",r[0]),w(o,"cy",r[1]),w(o,"r",a=r[5]+2/r[2]),w(t,"class","a9s-touch-handle")},m(u,c){at(u,t,c),Ct(t,e),Ct(t,s),Ct(t,o),l||(h=[Pt(s,"pointerdown",r[9]),Pt(s,"pointerup",r[10]),Pt(s,"pointerdown",r[6]),Pt(s,"pointerup",r[7])],l=!0)},p(u,c){c&1&&w(e,"cx",u[0]),c&2&&w(e,"cy",u[1]),c&32&&i!==(i=u[5]*10)&&w(e,"r",i),c&16&&ji(e,"touched",u[4]),c&1&&w(s,"cx",u[0]),c&2&&w(s,"cy",u[1]),c&36&&n!==(n=u[5]+10/u[2])&&w(s,"r",n),c&1&&w(o,"cx",u[0]),c&2&&w(o,"cy",u[1]),c&36&&a!==(a=u[5]+2/u[2])&&w(o,"r",a)},d(u){u&&nt(t),l=!1,Ye(h)}}}function md(r){let t,e;return{c(){t=st("circle"),w(t,"class","a9s-handle-selected svelte-160z737"),w(t,"cx",r[0]),w(t,"cy",r[1]),w(t,"r",e=r[5]+8/r[2])},m(i,s){at(i,t,s)},p(i,s){s&1&&w(t,"cx",i[0]),s&2&&w(t,"cy",i[1]),s&36&&e!==(e=i[5]+8/i[2])&&w(t,"r",e)},d(i){i&&nt(t)}}}function T1(r){let t;function e(n,o){return Zr?E1:b1}let s=e()(r);return{c(){s.c(),t=Ge()},m(n,o){s.m(n,o),at(n,t,o)},p(n,[o]){s.p(n,o)},i:Qt,o:Qt,d(n){n&&nt(t),s.d(n)}}}function w1(r,t,e){let i,{x:s}=t,{y:n}=t,{scale:o}=t,{selected:a=void 0}=t,l=!1;const h=y=>{y.pointerType==="touch"&&e(4,l=!0)},u=()=>e(4,l=!1);function c(y){Me.call(this,r,y)}function d(y){Me.call(this,r,y)}function f(y){Me.call(this,r,y)}function p(y){Me.call(this,r,y)}function m(y){Me.call(this,r,y)}function _(y){Me.call(this,r,y)}return r.$$set=y=>{e(8,t=Ua(Ua({},t),Wc(y))),"x"in y&&e(0,s=y.x),"y"in y&&e(1,n=y.y),"scale"in y&&e(2,o=y.scale),"selected"in y&&e(3,a=y.selected)},r.$$.update=()=>{r.$$.dirty&4&&e(5,i=4/o)},t=Wc(t),[s,n,o,a,l,i,h,u,t,c,d,f,p,m,_]}class es extends se{constructor(t){super(),ie(this,t,w1,T1,qt,{x:0,y:1,scale:2,selected:3})}}function A1(r){let t,e,i,s,n,o,a;return{c(){t=st("g"),e=st("circle"),s=st("circle"),n=st("circle"),w(e,"class","a9s-polygon-midpoint-buffer svelte-12ykj76"),w(e,"cx",r[0]),w(e,"cy",r[1]),w(e,"r",i=1.75*r[2]),w(s,"class","a9s-polygon-midpoint-outer svelte-12ykj76"),w(s,"cx",r[0]),w(s,"cy",r[1]),w(s,"r",r[2]),w(n,"class","a9s-polygon-midpoint-inner svelte-12ykj76"),w(n,"cx",r[0]),w(n,"cy",r[1]),w(n,"r",r[2]),w(t,"class","a9s-polygon-midpoint svelte-12ykj76")},m(l,h){at(l,t,h),Ct(t,e),Ct(t,s),Ct(t,n),o||(a=[Pt(e,"pointerdown",r[5]),Pt(e,"pointerdown",r[3])],o=!0)},p(l,h){h&1&&w(e,"cx",l[0]),h&2&&w(e,"cy",l[1]),h&4&&i!==(i=1.75*l[2])&&w(e,"r",i),h&1&&w(s,"cx",l[0]),h&2&&w(s,"cy",l[1]),h&4&&w(s,"r",l[2]),h&1&&w(n,"cx",l[0]),h&2&&w(n,"cy",l[1]),h&4&&w(n,"r",l[2])},d(l){l&&nt(t),o=!1,Ye(a)}}}function S1(r){let t;return{c(){t=st("circle"),w(t,"cx",r[0]),w(t,"cy",r[1]),w(t,"r",r[2])},m(e,i){at(e,t,i)},p(e,i){i&1&&w(t,"cx",e[0]),i&2&&w(t,"cy",e[1]),i&4&&w(t,"r",e[2])},d(e){e&&nt(t)}}}function C1(r){let t;function e(n,o){return Zr?S1:A1}let s=e()(r);return{c(){s.c(),t=Ge()},m(n,o){s.m(n,o),at(n,t,o)},p(n,[o]){s.p(n,o)},i:Qt,o:Qt,d(n){n&&nt(t),s.d(n)}}}function I1(r,t,e){let i,{x:s}=t,{y:n}=t,{scale:o}=t;const a=h=>{h.pointerType};function l(h){Me.call(this,r,h)}return r.$$set=h=>{"x"in h&&e(0,s=h.x),"y"in h&&e(1,n=h.y),"scale"in h&&e(4,o=h.scale)},r.$$.update=()=>{r.$$.dirty&16&&e(2,i=4/o)},[s,n,i,a,o,l]}class gd extends se{constructor(t){super(),ie(this,t,I1,C1,qt,{x:0,y:1,scale:4})}}function Ja(r){const t=r.slice(),e=t[10][t[6]];return t[28]=e.point,t}function yd(r,t,e){const i=r.slice();return i[28]=t[e],i[30]=e,i}function tl(r){const t=r.slice(),e=t[10][t[6]];return t[28]=e.point,t}function el(r){const t=r.slice(),e=t[10][t[6]];return t[28]=e.point,t}function _d(r){let t,e,i,s;return{c(){t=st("circle"),w(t,"cx",e=r[28][0]),w(t,"cy",i=r[28][1]),w(t,"r",s=Hs/r[3]),w(t,"class","svelte-1h2slbm")},m(n,o){at(n,t,o)},p(n,o){o[0]&1088&&e!==(e=n[28][0])&&w(t,"cx",e),o[0]&1088&&i!==(i=n[28][1])&&w(t,"cy",i),o[0]&8&&s!==(s=Hs/n[3])&&w(t,"r",s)},d(n){n&&nt(t)}}}function vd(r){let t,e,i,s,n,o,a,l,h,u;return{c(){t=st("mask"),e=st("rect"),a=st("circle"),w(e,"x",i=r[9].x),w(e,"y",s=r[9].y),w(e,"width",n=r[9].w),w(e,"height",o=r[9].h),w(e,"class","svelte-1h2slbm"),w(a,"cx",l=r[28][0]),w(a,"cy",h=r[28][1]),w(a,"r",u=Hs/r[3]),w(a,"class","svelte-1h2slbm"),w(t,"id",`${r[19]}-inner`),w(t,"class","a9s-polygon-editor-mask svelte-1h2slbm")},m(c,d){at(c,t,d),Ct(t,e),Ct(t,a)},p(c,d){d[0]&512&&i!==(i=c[9].x)&&w(e,"x",i),d[0]&512&&s!==(s=c[9].y)&&w(e,"y",s),d[0]&512&&n!==(n=c[9].w)&&w(e,"width",n),d[0]&512&&o!==(o=c[9].h)&&w(e,"height",o),d[0]&1088&&l!==(l=c[28][0])&&w(a,"cx",l),d[0]&1088&&h!==(h=c[28][1])&&w(a,"cy",h),d[0]&8&&u!==(u=Hs/c[3])&&w(a,"r",u)},d(c){c&&nt(t)}}}function xd(r){let t,e;return t=new es({props:{class:"a9s-corner-handle",x:r[28][0],y:r[28][1],scale:r[3],selected:r[8].includes(r[30])}}),t.$on("pointerenter",r[11]),t.$on("pointerleave",r[12]),t.$on("pointerdown",r[15]),t.$on("pointerdown",function(){Jt(r[27](`HANDLE-${r[30]}`))&&r[27](`HANDLE-${r[30]}`).apply(this,arguments)}),t.$on("pointerup",r[16](r[30])),{c(){Ht(t.$$.fragment)},m(i,s){Ft(t,i,s),e=!0},p(i,s){r=i;const n={};s[0]&32&&(n.x=r[28][0]),s[0]&32&&(n.y=r[28][1]),s[0]&8&&(n.scale=r[3]),s[0]&256&&(n.selected=r[8].includes(r[30])),t.$set(n)},i(i){e||(q(t.$$.fragment,i),e=!0)},o(i){lt(t.$$.fragment,i),e=!1},d(i){Ut(t,i)}}}function bd(r){let t,e;return t=new gd({props:{x:r[28][0],y:r[28][1],scale:r[3]}}),t.$on("pointerdown",function(){Jt(r[18](r[6]))&&r[18](r[6]).apply(this,arguments)}),{c(){Ht(t.$$.fragment)},m(i,s){Ft(t,i,s),e=!0},p(i,s){r=i;const n={};s[0]&1088&&(n.x=r[28][0]),s[0]&1088&&(n.y=r[28][1]),s[0]&8&&(n.scale=r[3]),t.$set(n)},i(i){e||(q(t.$$.fragment,i),e=!0)},o(i){lt(t.$$.fragment,i),e=!1},d(i){Ut(t,i)}}}function R1(r){let t,e,i,s,n,o,a,l,h,u,c,d,f,p,m,_,y,v,g,x,E,M=r[6]!==void 0&&!r[7]&&_d(el(r)),S=r[6]!==void 0&&!r[7]&&vd(tl(r)),R=Pe(r[5].points),P=[];for(let I=0;I<R.length;I+=1)P[I]=xd(yd(r,R,I));const F=I=>lt(P[I],1,1,()=>{P[I]=null});let k=r[6]!==void 0&&!r[7]&&bd(Ja(r));return{c(){t=st("defs"),e=st("mask"),i=st("rect"),l=st("polygon"),M&&M.c(),S&&S.c(),u=Le(),c=st("polygon"),f=Le(),p=st("polygon"),_=Le();for(let I=0;I<P.length;I+=1)P[I].c();y=Le(),k&&k.c(),v=Ge(),w(i,"x",s=r[9].x),w(i,"y",n=r[9].y),w(i,"width",o=r[9].w),w(i,"height",a=r[9].h),w(i,"class","svelte-1h2slbm"),w(l,"points",h=r[5].points.map(Ed).join(" ")),w(l,"class","svelte-1h2slbm"),w(e,"id",`${r[19]}-outer`),w(e,"class","a9s-polygon-editor-mask svelte-1h2slbm"),w(c,"class","a9s-outer"),w(c,"mask",`url(#${r[19]}-outer)`),w(c,"points",d=r[5].points.map(Td).join(" ")),w(p,"class","a9s-inner a9s-shape-handle"),w(p,"mask",`url(#${r[19]}-inner)`),w(p,"style",r[1]),w(p,"points",m=r[5].points.map(wd).join(" "))},m(I,A){at(I,t,A),Ct(t,e),Ct(e,i),Ct(e,l),M&&M.m(e,null),S&&S.m(t,null),at(I,u,A),at(I,c,A),at(I,f,A),at(I,p,A),at(I,_,A);for(let T=0;T<P.length;T+=1)P[T]&&P[T].m(I,A);at(I,y,A),k&&k.m(I,A),at(I,v,A),g=!0,x||(E=[Pt(c,"pointerup",r[14]),Pt(c,"pointerdown",function(){Jt(r[27]("SHAPE"))&&r[27]("SHAPE").apply(this,arguments)}),Pt(p,"pointermove",r[13]),Pt(p,"pointerup",r[14]),Pt(p,"pointerdown",function(){Jt(r[27]("SHAPE"))&&r[27]("SHAPE").apply(this,arguments)})],x=!0)},p(I,A){if(r=I,(!g||A[0]&512&&s!==(s=r[9].x))&&w(i,"x",s),(!g||A[0]&512&&n!==(n=r[9].y))&&w(i,"y",n),(!g||A[0]&512&&o!==(o=r[9].w))&&w(i,"width",o),(!g||A[0]&512&&a!==(a=r[9].h))&&w(i,"height",a),(!g||A[0]&32&&h!==(h=r[5].points.map(Ed).join(" ")))&&w(l,"points",h),r[6]!==void 0&&!r[7]?M?M.p(el(r),A):(M=_d(el(r)),M.c(),M.m(e,null)):M&&(M.d(1),M=null),r[6]!==void 0&&!r[7]?S?S.p(tl(r),A):(S=vd(tl(r)),S.c(),S.m(t,null)):S&&(S.d(1),S=null),(!g||A[0]&32&&d!==(d=r[5].points.map(Td).join(" ")))&&w(c,"points",d),(!g||A[0]&2)&&w(p,"style",r[1]),(!g||A[0]&32&&m!==(m=r[5].points.map(wd).join(" ")))&&w(p,"points",m),A[0]&134322472){R=Pe(r[5].points);let T;for(T=0;T<R.length;T+=1){const C=yd(r,R,T);P[T]?(P[T].p(C,A),q(P[T],1)):(P[T]=xd(C),P[T].c(),q(P[T],1),P[T].m(y.parentNode,y))}for(fe(),T=R.length;T<P.length;T+=1)F(T);pe()}r[6]!==void 0&&!r[7]?k?(k.p(Ja(r),A),A[0]&192&&q(k,1)):(k=bd(Ja(r)),k.c(),q(k,1),k.m(v.parentNode,v)):k&&(fe(),lt(k,1,1,()=>{k=null}),pe())},i(I){if(!g){for(let A=0;A<R.length;A+=1)q(P[A]);q(k),g=!0}},o(I){P=P.filter(Boolean);for(let A=0;A<P.length;A+=1)lt(P[A]);lt(k),g=!1},d(I){I&&(nt(t),nt(u),nt(c),nt(f),nt(p),nt(_),nt(y),nt(v)),M&&M.d(),S&&S.d(),Wr(P,I),k&&k.d(I),x=!1,Ye(E)}}}function M1(r){let t,e;return t=new Qa({props:{shape:r[0],transform:r[2],editor:r[17],svgEl:r[4],$$slots:{default:[R1,({grab:i})=>({27:i}),({grab:i})=>[i?134217728:0]]},$$scope:{ctx:r}}}),t.$on("change",r[20]),t.$on("grab",r[21]),t.$on("release",r[22]),{c(){Ht(t.$$.fragment)},m(i,s){Ft(t,i,s),e=!0},p(i,s){const n={};s[0]&1&&(n.shape=i[0]),s[0]&4&&(n.transform=i[2]),s[0]&16&&(n.svgEl=i[4]),s[0]&134219754|s[1]&1&&(n.$$scope={dirty:s,ctx:i}),t.$set(n)},i(i){e||(q(t.$$.fragment,i),e=!0)},o(i){lt(t.$$.fragment,i),e=!1},d(i){Ut(t,i)}}}const P1=250,O1=1e3,N1=12,Hs=4.5,Ed=r=>r.join(","),Td=r=>r.join(","),wd=r=>r.join(",");function D1(r,t,e){let i,s,n;const o=Ki();let{shape:a}=t,{computedStyle:l}=t,{transform:h}=t,{viewportScale:u=1}=t,{svgEl:c}=t,d,f=!1,p,m=[];const _=()=>e(7,f=!0),y=()=>e(7,f=!1),v=T=>{if(m.length>0||!s.some(U=>U.visible)){e(6,d=void 0);return}const[C,L]=h.elementToImage(T.offsetX,T.offsetY),O=U=>Math.pow(U[0]-C,2)+Math.pow(U[1]-L,2),B=i.points.reduce((U,V)=>O(V)<O(U)?V:U),X=s.filter(U=>U.visible).reduce((U,V)=>O(V.point)<O(U.point)?V:U),N=Math.pow(O1/u,2);O(B)<N||O(X.point)<N?e(6,d=s.indexOf(X)):e(6,d=void 0)},g=()=>{document.activeElement!==c&&c.focus()},x=()=>{e(8,m=[]),g()},E=T=>{e(7,f=!0),T.preventDefault(),T.stopPropagation(),p=performance.now()},M=T=>C=>{if(!p||Zr||performance.now()-p>P1)return;const L=m.includes(T);C.metaKey||C.ctrlKey||C.shiftKey?L?e(8,m=m.filter(O=>O!==T)):e(8,m=[...m,T]):L&&m.length>1?e(8,m=[T]):L?e(8,m=[]):e(8,m=[T]),g()},S=(T,C,L)=>{g();let O;const B=T.geometry;m.length>1?O=B.points.map(([N,D],U)=>m.includes(U)?[N+L[0],D+L[1]]:[N,D]):C==="SHAPE"?O=B.points.map(([N,D])=>[N+L[0],D+L[1]]):O=B.points.map(([N,D],U)=>C===`HANDLE-${U}`?[N+L[0],D+L[1]]:[N,D]);const X=dr(O);return{...T,geometry:{points:O,bounds:X}}},R=T=>async C=>{C.stopPropagation();const L=[...i.points.slice(0,T+1),s[T].point,...i.points.slice(T+1)],O=dr(L);o("change",{...a,geometry:{points:L,bounds:O}}),await Qc();const B=[...document.querySelectorAll(".a9s-handle")][T+1];if(B!=null&&B.firstChild){const X=new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,clientX:C.clientX,clientY:C.clientY,pointerId:C.pointerId,pointerType:C.pointerType,isPrimary:C.isPrimary,buttons:C.buttons});B.firstChild.dispatchEvent(X)}},P=()=>{if(i.points.length<4)return;const T=i.points.filter((L,O)=>!m.includes(O)),C=dr(T);o("change",{...a,geometry:{points:T,bounds:C}}),e(8,m=[])};qi(()=>{if(Zr)return;const T=C=>{(C.key==="Delete"||C.key==="Backspace")&&(C.preventDefault(),P())};return c.addEventListener("pointermove",v),c.addEventListener("keydown",T),()=>{c.removeEventListener("pointermove",v),c.removeEventListener("keydown",T)}});const F=`polygon-mask-${Math.random().toString(36).substring(2,12)}`;function k(T){Me.call(this,r,T)}function I(T){Me.call(this,r,T)}function A(T){Me.call(this,r,T)}return r.$$set=T=>{"shape"in T&&e(0,a=T.shape),"computedStyle"in T&&e(1,l=T.computedStyle),"transform"in T&&e(2,h=T.transform),"viewportScale"in T&&e(3,u=T.viewportScale),"svgEl"in T&&e(4,c=T.svgEl)},r.$$.update=()=>{r.$$.dirty[0]&1&&e(5,i=a.geometry),r.$$.dirty[0]&40&&e(10,s=Zr?[]:i.points.map((T,C)=>{const L=C===i.points.length-1?i.points[0]:i.points[C+1],O=(T[0]+L[0])/2,B=(T[1]+L[1])/2,N=Math.sqrt(Math.pow(L[0]-O,2)+Math.pow(L[1]-B,2))>N1/u;return{point:[O,B],visible:N}})),r.$$.dirty[0]&40&&e(9,n=Za(i.bounds,Hs/u))},[a,l,h,u,c,i,d,f,m,n,s,_,y,v,x,E,M,S,R,F,k,I,A]}class L1 extends se{constructor(t){super(),ie(this,t,D1,M1,qt,{shape:0,computedStyle:1,transform:2,viewportScale:3,svgEl:4},null,[-1,-1])}}function B1(r){let t,e,i,s,n,o,a,l,h,u,c,d,f,p,m,_,y,v,g,x,E,M,S,R,P,F,k,I,A,T,C,L,O,B,X,N,D,U,V,W,Q,pt,bt,Y,Et,dt,mt,vt,Mt,Nt,_e,jt,et,Ke,mn;return dt=new es({props:{class:"a9s-corner-handle-topleft",x:r[5].x,y:r[5].y,scale:r[3]}}),dt.$on("pointerdown",function(){Jt(r[12]("TOP_LEFT"))&&r[12]("TOP_LEFT").apply(this,arguments)}),vt=new es({props:{class:"a9s-corner-handle-topright",x:r[5].x+r[5].w,y:r[5].y,scale:r[3]}}),vt.$on("pointerdown",function(){Jt(r[12]("TOP_RIGHT"))&&r[12]("TOP_RIGHT").apply(this,arguments)}),Nt=new es({props:{class:"a9s-corner-handle-bottomright",x:r[5].x+r[5].w,y:r[5].y+r[5].h,scale:r[3]}}),Nt.$on("pointerdown",function(){Jt(r[12]("BOTTOM_RIGHT"))&&r[12]("BOTTOM_RIGHT").apply(this,arguments)}),jt=new es({props:{class:"a9s-corner-handle-bottomleft",x:r[5].x,y:r[5].y+r[5].h,scale:r[3]}}),jt.$on("pointerdown",function(){Jt(r[12]("BOTTOM_LEFT"))&&r[12]("BOTTOM_LEFT").apply(this,arguments)}),{c(){t=st("defs"),e=st("mask"),i=st("rect"),l=st("rect"),f=Le(),p=st("rect"),g=Le(),x=st("rect"),P=Le(),F=st("rect"),T=Le(),C=st("rect"),X=Le(),N=st("rect"),W=Le(),Q=st("rect"),Et=Le(),Ht(dt.$$.fragment),mt=Le(),Ht(vt.$$.fragment),Mt=Le(),Ht(Nt.$$.fragment),_e=Le(),Ht(jt.$$.fragment),w(i,"class","rect-mask-bg svelte-1njczvj"),w(i,"x",s=r[6].x),w(i,"y",n=r[6].y),w(i,"width",o=r[6].w),w(i,"height",a=r[6].h),w(l,"class","rect-mask-fg svelte-1njczvj"),w(l,"x",h=r[5].x),w(l,"y",u=r[5].y),w(l,"width",c=r[5].w),w(l,"height",d=r[5].h),w(e,"id",r[8]),w(e,"class","a9s-rectangle-editor-mask svelte-1njczvj"),w(p,"class","a9s-outer"),w(p,"mask",`url(#${r[8]})`),w(p,"x",m=r[5].x),w(p,"y",_=r[5].y),w(p,"width",y=r[5].w),w(p,"height",v=r[5].h),w(x,"class","a9s-inner a9s-shape-handle"),w(x,"style",r[1]),w(x,"x",E=r[5].x),w(x,"y",M=r[5].y),w(x,"width",S=r[5].w),w(x,"height",R=r[5].h),w(F,"class","a9s-edge-handle a9s-edge-handle-top"),w(F,"x",k=r[5].x),w(F,"y",I=r[5].y),w(F,"height",1),w(F,"width",A=r[5].w),w(C,"class","a9s-edge-handle a9s-edge-handle-right"),w(C,"x",L=r[5].x+r[5].w),w(C,"y",O=r[5].y),w(C,"height",B=r[5].h),w(C,"width",1),w(N,"class","a9s-edge-handle a9s-edge-handle-bottom"),w(N,"x",D=r[5].x),w(N,"y",U=r[5].y+r[5].h),w(N,"height",1),w(N,"width",V=r[5].w),w(Q,"class","a9s-edge-handle a9s-edge-handle-left"),w(Q,"x",pt=r[5].x),w(Q,"y",bt=r[5].y),w(Q,"height",Y=r[5].h),w(Q,"width",1)},m(j,H){at(j,t,H),Ct(t,e),Ct(e,i),Ct(e,l),at(j,f,H),at(j,p,H),at(j,g,H),at(j,x,H),at(j,P,H),at(j,F,H),at(j,T,H),at(j,C,H),at(j,X,H),at(j,N,H),at(j,W,H),at(j,Q,H),at(j,Et,H),Ft(dt,j,H),at(j,mt,H),Ft(vt,j,H),at(j,Mt,H),Ft(Nt,j,H),at(j,_e,H),Ft(jt,j,H),et=!0,Ke||(mn=[Pt(p,"pointerdown",function(){Jt(r[12]("SHAPE"))&&r[12]("SHAPE").apply(this,arguments)}),Pt(x,"pointerdown",function(){Jt(r[12]("SHAPE"))&&r[12]("SHAPE").apply(this,arguments)}),Pt(F,"pointerdown",function(){Jt(r[12]("TOP"))&&r[12]("TOP").apply(this,arguments)}),Pt(C,"pointerdown",function(){Jt(r[12]("RIGHT"))&&r[12]("RIGHT").apply(this,arguments)}),Pt(N,"pointerdown",function(){Jt(r[12]("BOTTOM"))&&r[12]("BOTTOM").apply(this,arguments)}),Pt(Q,"pointerdown",function(){Jt(r[12]("LEFT"))&&r[12]("LEFT").apply(this,arguments)})],Ke=!0)},p(j,H){r=j,(!et||H&64&&s!==(s=r[6].x))&&w(i,"x",s),(!et||H&64&&n!==(n=r[6].y))&&w(i,"y",n),(!et||H&64&&o!==(o=r[6].w))&&w(i,"width",o),(!et||H&64&&a!==(a=r[6].h))&&w(i,"height",a),(!et||H&32&&h!==(h=r[5].x))&&w(l,"x",h),(!et||H&32&&u!==(u=r[5].y))&&w(l,"y",u),(!et||H&32&&c!==(c=r[5].w))&&w(l,"width",c),(!et||H&32&&d!==(d=r[5].h))&&w(l,"height",d),(!et||H&32&&m!==(m=r[5].x))&&w(p,"x",m),(!et||H&32&&_!==(_=r[5].y))&&w(p,"y",_),(!et||H&32&&y!==(y=r[5].w))&&w(p,"width",y),(!et||H&32&&v!==(v=r[5].h))&&w(p,"height",v),(!et||H&2)&&w(x,"style",r[1]),(!et||H&32&&E!==(E=r[5].x))&&w(x,"x",E),(!et||H&32&&M!==(M=r[5].y))&&w(x,"y",M),(!et||H&32&&S!==(S=r[5].w))&&w(x,"width",S),(!et||H&32&&R!==(R=r[5].h))&&w(x,"height",R),(!et||H&32&&k!==(k=r[5].x))&&w(F,"x",k),(!et||H&32&&I!==(I=r[5].y))&&w(F,"y",I),(!et||H&32&&A!==(A=r[5].w))&&w(F,"width",A),(!et||H&32&&L!==(L=r[5].x+r[5].w))&&w(C,"x",L),(!et||H&32&&O!==(O=r[5].y))&&w(C,"y",O),(!et||H&32&&B!==(B=r[5].h))&&w(C,"height",B),(!et||H&32&&D!==(D=r[5].x))&&w(N,"x",D),(!et||H&32&&U!==(U=r[5].y+r[5].h))&&w(N,"y",U),(!et||H&32&&V!==(V=r[5].w))&&w(N,"width",V),(!et||H&32&&pt!==(pt=r[5].x))&&w(Q,"x",pt),(!et||H&32&&bt!==(bt=r[5].y))&&w(Q,"y",bt),(!et||H&32&&Y!==(Y=r[5].h))&&w(Q,"height",Y);const Ur={};H&32&&(Ur.x=r[5].x),H&32&&(Ur.y=r[5].y),H&8&&(Ur.scale=r[3]),dt.$set(Ur);const kr={};H&32&&(kr.x=r[5].x+r[5].w),H&32&&(kr.y=r[5].y),H&8&&(kr.scale=r[3]),vt.$set(kr);const Gr={};H&32&&(Gr.x=r[5].x+r[5].w),H&32&&(Gr.y=r[5].y+r[5].h),H&8&&(Gr.scale=r[3]),Nt.$set(Gr);const Hr={};H&32&&(Hr.x=r[5].x),H&32&&(Hr.y=r[5].y+r[5].h),H&8&&(Hr.scale=r[3]),jt.$set(Hr)},i(j){et||(q(dt.$$.fragment,j),q(vt.$$.fragment,j),q(Nt.$$.fragment,j),q(jt.$$.fragment,j),et=!0)},o(j){lt(dt.$$.fragment,j),lt(vt.$$.fragment,j),lt(Nt.$$.fragment,j),lt(jt.$$.fragment,j),et=!1},d(j){j&&(nt(t),nt(f),nt(p),nt(g),nt(x),nt(P),nt(F),nt(T),nt(C),nt(X),nt(N),nt(W),nt(Q),nt(Et),nt(mt),nt(Mt),nt(_e)),Ut(dt,j),Ut(vt,j),Ut(Nt,j),Ut(jt,j),Ke=!1,Ye(mn)}}}function F1(r){let t,e;return t=new Qa({props:{shape:r[0],transform:r[2],editor:r[7],svgEl:r[4],$$slots:{default:[B1,({grab:i})=>({12:i}),({grab:i})=>i?4096:0]},$$scope:{ctx:r}}}),t.$on("grab",r[9]),t.$on("change",r[10]),t.$on("release",r[11]),{c(){Ht(t.$$.fragment)},m(i,s){Ft(t,i,s),e=!0},p(i,[s]){const n={};s&1&&(n.shape=i[0]),s&4&&(n.transform=i[2]),s&16&&(n.svgEl=i[4]),s&12394&&(n.$$scope={dirty:s,ctx:i}),t.$set(n)},i(i){e||(q(t.$$.fragment,i),e=!0)},o(i){lt(t.$$.fragment,i),e=!1},d(i){Ut(t,i)}}}function U1(r,t,e){let i,s,{shape:n}=t,{computedStyle:o}=t,{transform:a}=t,{viewportScale:l=1}=t,{svgEl:h}=t;const u=(m,_,y)=>{const v=m.geometry.bounds;let[g,x]=[v.minX,v.minY],[E,M]=[v.maxX,v.maxY];const[S,R]=y;if(_==="SHAPE")g+=S,E+=S,x+=R,M+=R;else{switch(_){case"TOP":case"TOP_LEFT":case"TOP_RIGHT":{x+=R;break}case"BOTTOM":case"BOTTOM_LEFT":case"BOTTOM_RIGHT":{M+=R;break}}switch(_){case"LEFT":case"TOP_LEFT":case"BOTTOM_LEFT":{g+=S;break}case"RIGHT":case"TOP_RIGHT":case"BOTTOM_RIGHT":{E+=S;break}}}const P=Math.min(g,E),F=Math.min(x,M),k=Math.abs(E-g),I=Math.abs(M-x);return{...m,geometry:{x:P,y:F,w:k,h:I,bounds:{minX:P,minY:F,maxX:P+k,maxY:F+I}}}},c=`rect-mask-${Math.random().toString(36).substring(2,12)}`;function d(m){Me.call(this,r,m)}function f(m){Me.call(this,r,m)}function p(m){Me.call(this,r,m)}return r.$$set=m=>{"shape"in m&&e(0,n=m.shape),"computedStyle"in m&&e(1,o=m.computedStyle),"transform"in m&&e(2,a=m.transform),"viewportScale"in m&&e(3,l=m.viewportScale),"svgEl"in m&&e(4,h=m.svgEl)},r.$$.update=()=>{r.$$.dirty&1&&e(5,i=n.geometry),r.$$.dirty&40&&e(6,s=Za(i.bounds,2/l))},[n,o,a,l,h,i,s,u,c,d,f,p]}class k1 extends se{constructor(t){super(),ie(this,t,U1,F1,qt,{shape:0,computedStyle:1,transform:2,viewportScale:3,svgEl:4})}}var Ad=Object.prototype.hasOwnProperty;function rl(r,t){var e,i;if(r===t)return!0;if(r&&t&&(e=r.constructor)===t.constructor){if(e===Date)return r.getTime()===t.getTime();if(e===RegExp)return r.toString()===t.toString();if(e===Array){if((i=r.length)===t.length)for(;i--&&rl(r[i],t[i]););return i===-1}if(!e||typeof r=="object"){i=0;for(e in r)if(Ad.call(r,e)&&++i&&!Ad.call(t,e)||!(e in t)||!rl(r[e],t[e]))return!1;return Object.keys(t).length===i}}return r!==r&&t!==t}const G1=12,H1=(r,t)=>r.polygons.reduce((e,i,s)=>{const n=i.rings.reduce((o,a,l)=>{const h=a.points.map((u,c)=>{const d=c===a.points.length-1?a.points[0]:a.points[c+1],f=(u[0]+d[0])/2,p=(u[1]+d[1])/2,_=Math.sqrt(Math.pow(d[0]-f,2)+Math.pow(d[1]-p,2))>G1/t;return{point:[f,p],visible:_,elementIdx:s,ringIdx:l,pointIdx:c}});return[...o,...h]},[]);return[...e,...n]},[]);function il(r){const t=r.slice(),e=t[10][t[6]];return t[29]=e.point,t}function Sd(r,t,e){const i=r.slice();return i[30]=t[e],i[32]=e,i}function Cd(r,t,e){const i=r.slice();return i[33]=t[e],i[35]=e,i}function Id(r,t,e){const i=r.slice();return i[29]=t[e],i[37]=e,i}function sl(r){const t=r.slice(),e=t[10][t[6]];return t[29]=e.point,t}function nl(r){const t=r.slice(),e=t[10][t[6]];return t[29]=e.point,t}function Rd(r){let t,e,i,s;return{c(){t=st("circle"),w(t,"cx",e=r[29][0]),w(t,"cy",i=r[29][1]),w(t,"r",s=$s/r[3]),w(t,"class","svelte-1vxo6dc")},m(n,o){at(n,t,o)},p(n,o){o[0]&1088&&e!==(e=n[29][0])&&w(t,"cx",e),o[0]&1088&&i!==(i=n[29][1])&&w(t,"cy",i),o[0]&8&&s!==(s=$s/n[3])&&w(t,"r",s)},d(n){n&&nt(t)}}}function Md(r){let t,e,i,s,n,o,a,l,h,u;return{c(){t=st("mask"),e=st("rect"),a=st("circle"),w(e,"x",i=r[9].x),w(e,"y",s=r[9].y),w(e,"width",n=r[9].w),w(e,"height",o=r[9].h),w(e,"class","svelte-1vxo6dc"),w(a,"cx",l=r[29][0]),w(a,"cy",h=r[29][1]),w(a,"r",u=$s/r[3]),w(a,"class","svelte-1vxo6dc"),w(t,"id",`${r[18]}-${r[32]}-inner`),w(t,"class","a9s-multipolygon-editor-mask svelte-1vxo6dc")},m(c,d){at(c,t,d),Ct(t,e),Ct(t,a)},p(c,d){d[0]&512&&i!==(i=c[9].x)&&w(e,"x",i),d[0]&512&&s!==(s=c[9].y)&&w(e,"y",s),d[0]&512&&n!==(n=c[9].w)&&w(e,"width",n),d[0]&512&&o!==(o=c[9].h)&&w(e,"height",o),d[0]&1088&&l!==(l=c[29][0])&&w(a,"cx",l),d[0]&1088&&h!==(h=c[29][1])&&w(a,"cy",h),d[0]&8&&u!==(u=$s/c[3])&&w(a,"r",u)},d(c){c&&nt(t)}}}function Pd(r){let t,e;function i(...s){return r[19](r[32],r[35],r[37],...s)}return t=new es({props:{class:"a9s-corner-handle",x:r[29][0],y:r[29][1],scale:r[3],selected:r[8].some(i)}}),t.$on("pointerenter",r[11]),t.$on("pointerleave",r[12]),t.$on("pointerdown",r[14]),t.$on("pointerdown",function(){Jt(r[28](`HANDLE-${r[32]}-${r[35]}-${r[37]}`))&&r[28](`HANDLE-${r[32]}-${r[35]}-${r[37]}`).apply(this,arguments)}),t.$on("pointerup",r[15](r[32],r[35],r[37])),{c(){Ht(t.$$.fragment)},m(s,n){Ft(t,s,n),e=!0},p(s,n){r=s;const o={};n[0]&32&&(o.x=r[29][0]),n[0]&32&&(o.y=r[29][1]),n[0]&8&&(o.scale=r[3]),n[0]&256&&(o.selected=r[8].some(i)),t.$set(o)},i(s){e||(q(t.$$.fragment,s),e=!0)},o(s){lt(t.$$.fragment,s),e=!1},d(s){Ut(t,s)}}}function Od(r){let t,e,i=Pe(r[33].points),s=[];for(let o=0;o<i.length;o+=1)s[o]=Pd(Id(r,i,o));const n=o=>lt(s[o],1,1,()=>{s[o]=null});return{c(){for(let o=0;o<s.length;o+=1)s[o].c();t=Ge()},m(o,a){for(let l=0;l<s.length;l+=1)s[l]&&s[l].m(o,a);at(o,t,a),e=!0},p(o,a){if(a[0]&268491048){i=Pe(o[33].points);let l;for(l=0;l<i.length;l+=1){const h=Id(o,i,l);s[l]?(s[l].p(h,a),q(s[l],1)):(s[l]=Pd(h),s[l].c(),q(s[l],1),s[l].m(t.parentNode,t))}for(fe(),l=i.length;l<s.length;l+=1)n(l);pe()}},i(o){if(!e){for(let a=0;a<i.length;a+=1)q(s[a]);e=!0}},o(o){s=s.filter(Boolean);for(let a=0;a<s.length;a+=1)lt(s[a]);e=!1},d(o){o&&nt(t),Wr(s,o)}}}function Nd(r){let t,e,i,s,n,o,a,l,h,u,c,d,f,p,m,_,y,v=r[6]!==void 0&&!r[7]&&Rd(nl(r)),g=r[6]!==void 0&&!r[7]&&Md(sl(r)),x=Pe(r[30].rings),E=[];for(let S=0;S<x.length;S+=1)E[S]=Od(Cd(r,x,S));const M=S=>lt(E[S],1,1,()=>{E[S]=null});return{c(){t=st("g"),e=st("defs"),i=st("mask"),s=st("rect"),h=st("path"),v&&v.c(),g&&g.c(),c=st("path"),f=st("path");for(let S=0;S<E.length;S+=1)E[S].c();w(s,"x",n=r[9].x),w(s,"y",o=r[9].y),w(s,"width",a=r[9].w),w(s,"height",l=r[9].h),w(s,"class","svelte-1vxo6dc"),w(h,"d",u=ts(r[30])),w(h,"class","svelte-1vxo6dc"),w(i,"id",`${r[18]}-${r[32]}-outer`),w(i,"class","a9s-multipolygon-editor-mask svelte-1vxo6dc"),w(c,"class","a9s-outer"),w(c,"mask",`url(#${r[18]}-${r[32]}-outer)`),w(c,"fill-rule","evenodd"),w(c,"d",d=ts(r[30])),w(f,"class","a9s-inner"),w(f,"mask",`url(#${r[18]}-${r[32]}-inner)`),w(f,"style",r[1]),w(f,"fill-rule","evenodd"),w(f,"d",p=ts(r[30]))},m(S,R){at(S,t,R),Ct(t,e),Ct(e,i),Ct(i,s),Ct(i,h),v&&v.m(i,null),g&&g.m(e,null),Ct(t,c),Ct(t,f);for(let P=0;P<E.length;P+=1)E[P]&&E[P].m(t,null);m=!0,_||(y=[Pt(c,"pointerup",r[13]),Pt(c,"pointerdown",function(){Jt(r[28]("SHAPE"))&&r[28]("SHAPE").apply(this,arguments)}),Pt(f,"pointerup",r[13]),Pt(f,"pointerdown",function(){Jt(r[28]("SHAPE"))&&r[28]("SHAPE").apply(this,arguments)})],_=!0)},p(S,R){if(r=S,(!m||R[0]&512&&n!==(n=r[9].x))&&w(s,"x",n),(!m||R[0]&512&&o!==(o=r[9].y))&&w(s,"y",o),(!m||R[0]&512&&a!==(a=r[9].w))&&w(s,"width",a),(!m||R[0]&512&&l!==(l=r[9].h))&&w(s,"height",l),(!m||R[0]&32&&u!==(u=ts(r[30])))&&w(h,"d",u),r[6]!==void 0&&!r[7]?v?v.p(nl(r),R):(v=Rd(nl(r)),v.c(),v.m(i,null)):v&&(v.d(1),v=null),r[6]!==void 0&&!r[7]?g?g.p(sl(r),R):(g=Md(sl(r)),g.c(),g.m(e,null)):g&&(g.d(1),g=null),(!m||R[0]&32&&d!==(d=ts(r[30])))&&w(c,"d",d),(!m||R[0]&2)&&w(f,"style",r[1]),(!m||R[0]&32&&p!==(p=ts(r[30])))&&w(f,"d",p),R[0]&268491048){x=Pe(r[30].rings);let P;for(P=0;P<x.length;P+=1){const F=Cd(r,x,P);E[P]?(E[P].p(F,R),q(E[P],1)):(E[P]=Od(F),E[P].c(),q(E[P],1),E[P].m(t,null))}for(fe(),P=x.length;P<E.length;P+=1)M(P);pe()}},i(S){if(!m){for(let R=0;R<x.length;R+=1)q(E[R]);m=!0}},o(S){E=E.filter(Boolean);for(let R=0;R<E.length;R+=1)lt(E[R]);m=!1},d(S){S&&nt(t),v&&v.d(),g&&g.d(),Wr(E,S),_=!1,Ye(y)}}}function Dd(r){let t,e;return t=new gd({props:{x:r[29][0],y:r[29][1],scale:r[3]}}),t.$on("pointerdown",function(){Jt(r[17](r[6]))&&r[17](r[6]).apply(this,arguments)}),{c(){Ht(t.$$.fragment)},m(i,s){Ft(t,i,s),e=!0},p(i,s){r=i;const n={};s[0]&1088&&(n.x=r[29][0]),s[0]&1088&&(n.y=r[29][1]),s[0]&8&&(n.scale=r[3]),t.$set(n)},i(i){e||(q(t.$$.fragment,i),e=!0)},o(i){lt(t.$$.fragment,i),e=!1},d(i){Ut(t,i)}}}function $1(r){let t,e,i,s=Pe(r[5].polygons),n=[];for(let l=0;l<s.length;l+=1)n[l]=Nd(Sd(r,s,l));const o=l=>lt(n[l],1,1,()=>{n[l]=null});let a=r[6]!==void 0&&!r[7]&&Dd(il(r));return{c(){for(let l=0;l<n.length;l+=1)n[l].c();t=Le(),a&&a.c(),e=Ge()},m(l,h){for(let u=0;u<n.length;u+=1)n[u]&&n[u].m(l,h);at(l,t,h),a&&a.m(l,h),at(l,e,h),i=!0},p(l,h){if(h[0]&268763114){s=Pe(l[5].polygons);let u;for(u=0;u<s.length;u+=1){const c=Sd(l,s,u);n[u]?(n[u].p(c,h),q(n[u],1)):(n[u]=Nd(c),n[u].c(),q(n[u],1),n[u].m(t.parentNode,t))}for(fe(),u=s.length;u<n.length;u+=1)o(u);pe()}l[6]!==void 0&&!l[7]?a?(a.p(il(l),h),h[0]&192&&q(a,1)):(a=Dd(il(l)),a.c(),q(a,1),a.m(e.parentNode,e)):a&&(fe(),lt(a,1,1,()=>{a=null}),pe())},i(l){if(!i){for(let h=0;h<s.length;h+=1)q(n[h]);q(a),i=!0}},o(l){n=n.filter(Boolean);for(let h=0;h<n.length;h+=1)lt(n[h]);lt(a),i=!1},d(l){l&&(nt(t),nt(e)),Wr(n,l),a&&a.d(l)}}}function X1(r){let t,e;return t=new Qa({props:{shape:r[0],transform:r[2],editor:r[16],svgEl:r[4],$$slots:{default:[$1,({grab:i})=>({28:i}),({grab:i})=>[i?268435456:0]]},$$scope:{ctx:r}}}),t.$on("change",r[20]),t.$on("grab",r[21]),t.$on("release",r[22]),{c(){Ht(t.$$.fragment)},m(i,s){Ft(t,i,s),e=!0},p(i,s){const n={};s[0]&1&&(n.shape=i[0]),s[0]&4&&(n.transform=i[2]),s[0]&16&&(n.svgEl=i[4]),s[0]&268437482|s[1]&128&&(n.$$scope={dirty:s,ctx:i}),t.$set(n)},i(i){e||(q(t.$$.fragment,i),e=!0)},o(i){lt(t.$$.fragment,i),e=!1},d(i){Ut(t,i)}}}const V1=250,z1=1e3,$s=4.5;function Y1(r,t,e){let i,s,n;const o=Ki();let{shape:a}=t,{computedStyle:l}=t,{transform:h}=t,{viewportScale:u=1}=t,{svgEl:c}=t,d,f=!1,p,m=[];const _=()=>e(7,f=!0),y=()=>e(7,f=!1),v=C=>{if(m.length>0||!s.some(V=>V.visible)){e(6,d=void 0);return}const[L,O]=h.elementToImage(C.offsetX,C.offsetY),B=V=>Math.pow(V[0]-L,2)+Math.pow(V[1]-O,2),X=Hv(i).reduce((V,W)=>B(W)<B(V)?W:V),N=s.filter(V=>V.visible).reduce((V,W)=>B(W.point)<B(V.point)?W:V),D=Math.pow(z1/u,2);B(X)<D||B(N.point)<D?e(6,d=s.indexOf(N)):e(6,d=void 0)},g=()=>{document.activeElement!==c&&c.focus()},x=()=>{e(8,m=[]),g()},E=C=>{e(7,f=!0),C.preventDefault(),C.stopPropagation(),p=performance.now()},M=(C,L,O)=>B=>{if(!p||Zr||performance.now()-p>V1)return;const X=D=>D.polygon===C&&D.ring===L&&D.point===O,N=m.some(X);B.metaKey||B.ctrlKey||B.shiftKey?N?e(8,m=m.filter(D=>!X(D))):e(8,m=[...m,{polygon:C,ring:L,point:O}]):N&&m.length>1?e(8,m=[{polygon:C,ring:L,point:O}]):N?e(8,m=[]):e(8,m=[{polygon:C,ring:L,point:O}]),g()},S=(C,L,O)=>{g();const B=C.geometry.polygons;let X;if(L==="SHAPE")X=B.map(N=>{const D=N.rings.map((V,W)=>({points:V.points.map((pt,bt)=>[pt[0]+O[0],pt[1]+O[1]])})),U=dr(D[0].points);return{rings:D,bounds:U}});else{const[N,D,U,V]=L.split("-").map(W=>parseInt(W));X=B.map((W,Q)=>{if(Q===D){const pt=W.rings.map((Y,Et)=>Et===U?{points:Y.points.map((mt,vt)=>vt===V?[mt[0]+O[0],mt[1]+O[1]]:mt)}:Y),bt=dr(pt[0].points);return{rings:pt,bounds:bt}}else return W})}return{...C,geometry:{polygons:X,bounds:kn(X)}}},R=C=>async L=>{L.stopPropagation();const O=s[C],B=i.polygons.map((N,D)=>{if(D===O.elementIdx){const U=N.rings.map((W,Q)=>Q===O.ringIdx?{points:[...W.points.slice(0,O.pointIdx+1),O.point,...W.points.slice(O.pointIdx+1)]}:W),V=dr(U[0].points);return{rings:U,bounds:V}}else return N});o("change",{...a,geometry:{polygons:B,bounds:kn(B)}}),await Qc();const X=[...document.querySelectorAll(".a9s-handle")][C+1];if(X!=null&&X.firstChild){const N=new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,clientX:L.clientX,clientY:L.clientY,pointerId:L.pointerId,pointerType:L.pointerType,isPrimary:L.isPrimary,buttons:L.buttons});X.firstChild.dispatchEvent(N)}},P=()=>{const C=i.polygons.map((O,B)=>{if(m.some(N=>N.polygon===B)){const N=O.rings.map((U,V)=>m.some(Q=>Q.polygon===B&&Q.ring===V)&&U.points.length>3?{points:U.points.filter((pt,bt)=>!m.some(Y=>Y.polygon===B&&Y.ring===V&&Y.point===bt))}:U),D=dr(N[0].points);return{rings:N,bounds:D}}else return O});!rl(i.polygons,C)&&(o("change",{...a,geometry:{polygons:C,bounds:kn(C)}}),e(8,m=[]))};qi(()=>{if(Zr)return;const C=L=>{(L.key==="Delete"||L.key==="Backspace")&&(L.preventDefault(),P())};return c.addEventListener("pointermove",v),c.addEventListener("keydown",C),()=>{c.removeEventListener("pointermove",v),c.removeEventListener("keydown",C)}});const F=`polygon-mask-${Math.random().toString(36).substring(2,12)}`,k=(C,L,O,{polygon:B,ring:X,point:N})=>B===C&&X===L&&N===O;function I(C){Me.call(this,r,C)}function A(C){Me.call(this,r,C)}function T(C){Me.call(this,r,C)}return r.$$set=C=>{"shape"in C&&e(0,a=C.shape),"computedStyle"in C&&e(1,l=C.computedStyle),"transform"in C&&e(2,h=C.transform),"viewportScale"in C&&e(3,u=C.viewportScale),"svgEl"in C&&e(4,c=C.svgEl)},r.$$.update=()=>{r.$$.dirty[0]&1&&e(5,i=a.geometry),r.$$.dirty[0]&40&&e(10,s=Zr?[]:H1(i,u)),r.$$.dirty[0]&40&&e(9,n=Za(i.bounds,$s/u))},[a,l,h,u,c,i,d,f,m,n,s,_,y,x,E,M,S,R,F,k,I,A,T]}class W1 extends se{constructor(t){super(),ie(this,t,Y1,X1,qt,{shape:0,computedStyle:1,transform:2,viewportScale:3,svgEl:4},null,[-1,-1])}}jr.RECTANGLE,jr.POLYGON,jr.MULTIPOLYGLON;function j1(r,t,e){let i;const s=Ki();let{annotation:n}=t,{editor:o}=t,{style:a}=t,{target:l}=t,{transform:h}=t,{viewportScale:u}=t,c;return qi(()=>(e(6,c=new o({target:l,props:{shape:n.target.selector,computedStyle:i,transform:h,viewportScale:u,svgEl:l.closest("svg")}})),c.$on("change",d=>{c.$$set({shape:d.detail}),s("change",d.detail)}),c.$on("grab",d=>s("grab",d.detail)),c.$on("release",d=>s("release",d.detail)),()=>{c.$destroy()})),r.$$set=d=>{"annotation"in d&&e(0,n=d.annotation),"editor"in d&&e(1,o=d.editor),"style"in d&&e(2,a=d.style),"target"in d&&e(3,l=d.target),"transform"in d&&e(4,h=d.transform),"viewportScale"in d&&e(5,u=d.viewportScale)},r.$$.update=()=>{r.$$.dirty&5&&e(7,i=y1(n,a)),r.$$.dirty&65&&n&&(c==null||c.$set({shape:n.target.selector})),r.$$.dirty&80&&c&&c.$set({transform:h}),r.$$.dirty&96&&c&&c.$set({viewportScale:u}),r.$$.dirty&192&&c&&i&&c.$set({computedStyle:i})},[n,o,a,l,h,u,c,i]}class q1 extends se{constructor(t){super(),ie(this,t,j1,null,qt,{annotation:0,editor:1,style:2,target:3,transform:4,viewportScale:5})}}typeof navigator>"u"?!1:navigator.userAgent.indexOf("Mac OS X")!==-1;var xi=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(xi||{}),Ld=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Ld||{}),ol=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(ol||{}),yt=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(yt||{}),fr=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(fr||{}),z=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(z||{}),rs=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(rs||{}),ft=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(ft||{}),J=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(J||{}),Ir=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Ir||{}),Qr=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Qr||{}),pr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(pr||{}),He=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(He||{}),mr=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(mr||{}),al=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(al||{}),We=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(We||{}),he=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(he||{}),ae=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(ae||{}),gr=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(gr||{});const tt={ADAPTER:{createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var ll=/iPhone/i,Bd=/iPod/i,Fd=/iPad/i,Ud=/\biOS-universal(?:.+)Mac\b/i,hl=/\bAndroid(?:.+)Mobile\b/i,kd=/Android/i,is=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Hn=/Silk/i,Rr=/Windows Phone/i,Gd=/\bWindows(?:.+)ARM\b/i,Hd=/BlackBerry/i,$d=/BB10/i,Xd=/Opera Mini/i,Vd=/\b(CriOS|Chrome)(?:.+)Mobile/i,zd=/Mobile(?:.+)Firefox\b/i,Yd=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function K1(r){return function(t){return t.test(r)}}function Wd(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=K1(e),n={apple:{phone:s(ll)&&!s(Rr),ipod:s(Bd),tablet:!s(ll)&&(s(Fd)||Yd(t))&&!s(Rr),universal:s(Ud),device:(s(ll)||s(Bd)||s(Fd)||s(Ud)||Yd(t))&&!s(Rr)},amazon:{phone:s(is),tablet:!s(is)&&s(Hn),device:s(is)||s(Hn)},android:{phone:!s(Rr)&&s(is)||!s(Rr)&&s(hl),tablet:!s(Rr)&&!s(is)&&!s(hl)&&(s(Hn)||s(kd)),device:!s(Rr)&&(s(is)||s(Hn)||s(hl)||s(kd))||s(/\bokhttp\b/i)},windows:{phone:s(Rr),tablet:s(Gd),device:s(Rr)||s(Gd)},other:{blackberry:s(Hd),blackberry10:s($d),opera:s(Xd),firefox:s(zd),chrome:s(Vd),device:s(Hd)||s($d)||s(Xd)||s(zd)||s(Vd)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const Z1=Wd.default??Wd,Mr=Z1(globalThis.navigator);tt.RETINA_PREFIX=/@([0-9\.]+)x/,tt.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var jd={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function s(l,h,u){this.fn=l,this.context=h,this.once=u||!1}function n(l,h,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new s(u,c||l,d),p=e?e+h:h;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],f]:l._events[p].push(f):(l._events[p]=f,l._eventsCount++),l}function o(l,h){--l._eventsCount===0?l._events=new i:delete l._events[h]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var h=[],u,c;if(this._eventsCount===0)return h;for(c in u=this._events)t.call(u,c)&&h.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(u)):h},a.prototype.listeners=function(h){var u=e?e+h:h,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,f=c.length,p=new Array(f);d<f;d++)p[d]=c[d].fn;return p},a.prototype.listenerCount=function(h){var u=e?e+h:h,c=this._events[u];return c?c.fn?1:c.length:0},a.prototype.emit=function(h,u,c,d,f,p){var m=e?e+h:h;if(!this._events[m])return!1;var _=this._events[m],y=arguments.length,v,g;if(_.fn){switch(_.once&&this.removeListener(h,_.fn,void 0,!0),y){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,u),!0;case 3:return _.fn.call(_.context,u,c),!0;case 4:return _.fn.call(_.context,u,c,d),!0;case 5:return _.fn.call(_.context,u,c,d,f),!0;case 6:return _.fn.call(_.context,u,c,d,f,p),!0}for(g=1,v=new Array(y-1);g<y;g++)v[g-1]=arguments[g];_.fn.apply(_.context,v)}else{var x=_.length,E;for(g=0;g<x;g++)switch(_[g].once&&this.removeListener(h,_[g].fn,void 0,!0),y){case 1:_[g].fn.call(_[g].context);break;case 2:_[g].fn.call(_[g].context,u);break;case 3:_[g].fn.call(_[g].context,u,c);break;case 4:_[g].fn.call(_[g].context,u,c,d);break;default:if(!v)for(E=1,v=new Array(y-1);E<y;E++)v[E-1]=arguments[E];_[g].fn.apply(_[g].context,v)}}return!0},a.prototype.on=function(h,u,c){return n(this,h,u,c,!1)},a.prototype.once=function(h,u,c){return n(this,h,u,c,!0)},a.prototype.removeListener=function(h,u,c,d){var f=e?e+h:h;if(!this._events[f])return this;if(!u)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===u&&(!d||p.once)&&(!c||p.context===c)&&o(this,f);else{for(var m=0,_=[],y=p.length;m<y;m++)(p[m].fn!==u||d&&!p[m].once||c&&p[m].context!==c)&&_.push(p[m]);_.length?this._events[f]=_.length===1?_[0]:_:o(this,f)}return this},a.prototype.removeAllListeners=function(h){var u;return h?(u=e?e+h:h,this._events[u]&&o(this,u)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(jd);var Q1=jd.exports;const Xs=Va(Q1);var ul={exports:{}};ul.exports=$n,ul.exports.default=$n;function $n(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=qd(r,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,l,h,u,c,d,f;if(i&&(n=ix(r,t,n,e)),r.length>80*e){a=h=r[0],l=u=r[1];for(var p=e;p<s;p+=e)c=r[p],d=r[p+1],c<a&&(a=c),d<l&&(l=d),c>h&&(h=c),d>u&&(u=d);f=Math.max(h-a,u-l),f=f!==0?32767/f:0}return Vs(n,o,e,a,l,f,0),o}function qd(r,t,e,i,s){var n,o;if(s===fl(r,t,e,i)>0)for(n=t;n<e;n+=i)o=Qd(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=Qd(n,r[n],r[n+1],o);return o&&Xn(o,o.next)&&(Ys(o),o=o.next),o}function bi(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Xn(e,e.next)||zt(e.prev,e,e.next)===0)){if(Ys(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Vs(r,t,e,i,s,n,o){if(r){!o&&n&&lx(r,i,s,n);for(var a=r,l,h;r.prev!==r.next;){if(l=r.prev,h=r.next,n?tx(r,i,s,n):J1(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(h.i/e|0),Ys(r),r=h.next,a=h.next;continue}if(r=h,r===a){o?o===1?(r=ex(bi(r),t,e),Vs(r,t,e,i,s,n,2)):o===2&&rx(r,t,e,i,s,n):Vs(bi(r),t,e,i,s,n,1);break}}}}function J1(r){var t=r.prev,e=r,i=r.next;if(zt(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,o=i.x,a=t.y,l=e.y,h=i.y,u=s<n?s<o?s:o:n<o?n:o,c=a<l?a<h?a:h:l<h?l:h,d=s>n?s>o?s:o:n>o?n:o,f=a>l?a>h?a:h:l>h?l:h,p=i.next;p!==t;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=f&&ss(s,a,n,l,o,h,p.x,p.y)&&zt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function tx(r,t,e,i){var s=r.prev,n=r,o=r.next;if(zt(s,n,o)>=0)return!1;for(var a=s.x,l=n.x,h=o.x,u=s.y,c=n.y,d=o.y,f=a<l?a<h?a:h:l<h?l:h,p=u<c?u<d?u:d:c<d?c:d,m=a>l?a>h?a:h:l>h?l:h,_=u>c?u>d?u:d:c>d?c:d,y=cl(f,p,t,e,i),v=cl(m,_,t,e,i),g=r.prevZ,x=r.nextZ;g&&g.z>=y&&x&&x.z<=v;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=_&&g!==s&&g!==o&&ss(a,u,l,c,h,d,g.x,g.y)&&zt(g.prev,g,g.next)>=0||(g=g.prevZ,x.x>=f&&x.x<=m&&x.y>=p&&x.y<=_&&x!==s&&x!==o&&ss(a,u,l,c,h,d,x.x,x.y)&&zt(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;g&&g.z>=y;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=_&&g!==s&&g!==o&&ss(a,u,l,c,h,d,g.x,g.y)&&zt(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;x&&x.z<=v;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=_&&x!==s&&x!==o&&ss(a,u,l,c,h,d,x.x,x.y)&&zt(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function ex(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!Xn(s,n)&&Kd(s,i,i.next,n)&&zs(s,n)&&zs(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Ys(i),Ys(i.next),i=r=n),i=i.next}while(i!==r);return bi(i)}function rx(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&cx(o,a)){var l=Zd(o,a);o=bi(o,o.next),l=bi(l,l.next),Vs(o,t,e,i,s,n,0),Vs(l,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function ix(r,t,e,i){var s=[],n,o,a,l,h;for(n=0,o=t.length;n<o;n++)a=t[n]*i,l=n<o-1?t[n+1]*i:r.length,h=qd(r,a,l,i,!1),h===h.next&&(h.steiner=!0),s.push(ux(h));for(s.sort(sx),n=0;n<s.length;n++)e=nx(s[n],e);return e}function sx(r,t){return r.x-t.x}function nx(r,t){var e=ox(r,t);if(!e)return t;var i=Zd(e,r);return bi(i,i.next),bi(e,e.next)}function ox(r,t){var e=t,i=r.x,s=r.y,n=-1/0,o;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>n&&(n=a,o=e.x<e.next.x?e:e.next,a===i))return o}e=e.next}while(e!==t);if(!o)return null;var l=o,h=o.x,u=o.y,c=1/0,d;e=o;do i>=e.x&&e.x>=h&&i!==e.x&&ss(s<u?i:n,s,h,u,s<u?n:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),zs(e,r)&&(d<c||d===c&&(e.x>o.x||e.x===o.x&&ax(o,e)))&&(o=e,c=d)),e=e.next;while(e!==l);return o}function ax(r,t){return zt(r.prev,r,t.prev)<0&&zt(t.next,r,r.next)<0}function lx(r,t,e,i){var s=r;do s.z===0&&(s.z=cl(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,hx(s)}function hx(r){var t,e,i,s,n,o,a,l,h=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,i=e,a=0,t=0;t<h&&(a++,i=i.nextZ,!!i);t++);for(l=h;a>0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;e=i}n.nextZ=null,h*=2}while(o>1);return r}function cl(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function ux(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function ss(r,t,e,i,s,n,o,a){return(s-o)*(t-a)>=(r-o)*(n-a)&&(r-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(i-a)}function cx(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!dx(r,t)&&(zs(r,t)&&zs(t,r)&&fx(r,t)&&(zt(r.prev,r,t.prev)||zt(r,t.prev,t))||Xn(r,t)&&zt(r.prev,r,r.next)>0&&zt(t.prev,t,t.next)>0)}function zt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Xn(r,t){return r.x===t.x&&r.y===t.y}function Kd(r,t,e,i){var s=zn(zt(r,t,e)),n=zn(zt(r,t,i)),o=zn(zt(e,i,r)),a=zn(zt(e,i,t));return!!(s!==n&&o!==a||s===0&&Vn(r,e,t)||n===0&&Vn(r,i,t)||o===0&&Vn(e,r,i)||a===0&&Vn(e,t,i))}function Vn(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function zn(r){return r>0?1:r<0?-1:0}function dx(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Kd(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function zs(r,t){return zt(r.prev,r,r.next)<0?zt(r,t,r.next)>=0&&zt(r,r.prev,t)>=0:zt(r,t,r.prev)<0||zt(r,r.next,t)<0}function fx(r,t){var e=r,i=!1,s=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function Zd(r,t){var e=new dl(r.i,r.x,r.y),i=new dl(t.i,t.x,t.y),s=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function Qd(r,t,e,i){var s=new dl(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Ys(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function dl(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}$n.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(fl(r,0,n,e));if(s)for(var a=0,l=t.length;a<l;a++){var h=t[a]*e,u=a<l-1?t[a+1]*e:r.length;o-=Math.abs(fl(r,h,u,e))}var c=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,p=i[a+2]*e;c+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return o===0&&c===0?0:Math.abs((c-o)/o)};function fl(r,t,e,i){for(var s=0,n=t,o=e-i;n<e;n+=i)s+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return s}$n.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var o=0;o<t;o++)e.vertices.push(r[s][n][o]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e};var px=ul.exports;const mx=Va(px);var Yn={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Yn.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof Gs=="object"&&Gs;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,l=36,h=1,u=26,c=38,d=700,f=72,p=128,m="-",_=/^xn--/,y=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=l-h,E=Math.floor,M=String.fromCharCode,S;function R(N){throw new RangeError(g[N])}function P(N,D){for(var U=N.length,V=[];U--;)V[U]=D(N[U]);return V}function F(N,D){var U=N.split("@"),V="";U.length>1&&(V=U[0]+"@",N=U[1]),N=N.replace(v,".");var W=N.split("."),Q=P(W,D).join(".");return V+Q}function k(N){for(var D=[],U=0,V=N.length,W,Q;U<V;)W=N.charCodeAt(U++),W>=55296&&W<=56319&&U<V?(Q=N.charCodeAt(U++),(Q&64512)==56320?D.push(((W&1023)<<10)+(Q&1023)+65536):(D.push(W),U--)):D.push(W);return D}function I(N){return P(N,function(D){var U="";return D>65535&&(D-=65536,U+=M(D>>>10&1023|55296),D=56320|D&1023),U+=M(D),U}).join("")}function A(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:l}function T(N,D){return N+22+75*(N<26)-((D!=0)<<5)}function C(N,D,U){var V=0;for(N=U?E(N/d):N>>1,N+=E(N/D);N>x*u>>1;V+=l)N=E(N/x);return E(V+(x+1)*N/(N+c))}function L(N){var D=[],U=N.length,V,W=0,Q=p,pt=f,bt,Y,Et,dt,mt,vt,Mt,Nt,_e;for(bt=N.lastIndexOf(m),bt<0&&(bt=0),Y=0;Y<bt;++Y)N.charCodeAt(Y)>=128&&R("not-basic"),D.push(N.charCodeAt(Y));for(Et=bt>0?bt+1:0;Et<U;){for(dt=W,mt=1,vt=l;Et>=U&&R("invalid-input"),Mt=A(N.charCodeAt(Et++)),(Mt>=l||Mt>E((a-W)/mt))&&R("overflow"),W+=Mt*mt,Nt=vt<=pt?h:vt>=pt+u?u:vt-pt,!(Mt<Nt);vt+=l)_e=l-Nt,mt>E(a/_e)&&R("overflow"),mt*=_e;V=D.length+1,pt=C(W-dt,V,dt==0),E(W/V)>a-Q&&R("overflow"),Q+=E(W/V),W%=V,D.splice(W++,0,Q)}return I(D)}function O(N){var D,U,V,W,Q,pt,bt,Y,Et,dt,mt,vt=[],Mt,Nt,_e,jt;for(N=k(N),Mt=N.length,D=p,U=0,Q=f,pt=0;pt<Mt;++pt)mt=N[pt],mt<128&&vt.push(M(mt));for(V=W=vt.length,W&&vt.push(m);V<Mt;){for(bt=a,pt=0;pt<Mt;++pt)mt=N[pt],mt>=D&&mt<bt&&(bt=mt);for(Nt=V+1,bt-D>E((a-U)/Nt)&&R("overflow"),U+=(bt-D)*Nt,D=bt,pt=0;pt<Mt;++pt)if(mt=N[pt],mt<D&&++U>a&&R("overflow"),mt==D){for(Y=U,Et=l;dt=Et<=Q?h:Et>=Q+u?u:Et-Q,!(Y<dt);Et+=l)jt=Y-dt,_e=l-dt,vt.push(M(T(dt+jt%_e,0))),Y=E(jt/_e);vt.push(M(T(Y,0))),Q=C(U,Nt,V==W),U=0,++V}++U,++D}return vt.join("")}function B(N){return F(N,function(D){return _.test(D)?L(D.slice(4).toLowerCase()):D})}function X(N){return F(N,function(D){return y.test(D)?"xn--"+O(D):D})}if(o={version:"1.4.1",ucs2:{decode:k,encode:I},decode:L,encode:O,toASCII:X,toUnicode:B},i&&s)if(r.exports==i)s.exports=o;else for(S in o)o.hasOwnProperty(S)&&(i[S]=o[S]);else e.punycode=o})(Gs)}(Yn,Yn.exports);var gx=Yn.exports,ns=TypeError;const yx=Lv(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var pl=typeof Map=="function"&&Map.prototype,ml=Object.getOwnPropertyDescriptor&&pl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Wn=pl&&ml&&typeof ml.get=="function"?ml.get:null,Jd=pl&&Map.prototype.forEach,gl=typeof Set=="function"&&Set.prototype,yl=Object.getOwnPropertyDescriptor&&gl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,jn=gl&&yl&&typeof yl.get=="function"?yl.get:null,tf=gl&&Set.prototype.forEach,_x=typeof WeakMap=="function"&&WeakMap.prototype,Ws=_x?WeakMap.prototype.has:null,vx=typeof WeakSet=="function"&&WeakSet.prototype,js=vx?WeakSet.prototype.has:null,xx=typeof WeakRef=="function"&&WeakRef.prototype,ef=xx?WeakRef.prototype.deref:null,bx=Boolean.prototype.valueOf,Ex=Object.prototype.toString,Tx=Function.prototype.toString,wx=String.prototype.match,_l=String.prototype.slice,Jr=String.prototype.replace,Ax=String.prototype.toUpperCase,rf=String.prototype.toLowerCase,sf=RegExp.prototype.test,nf=Array.prototype.concat,yr=Array.prototype.join,Sx=Array.prototype.slice,of=Math.floor,vl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,xl=Object.getOwnPropertySymbols,bl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,os=typeof Symbol=="function"&&typeof Symbol.iterator=="object",qs=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===os||!0)?Symbol.toStringTag:null,af=Object.prototype.propertyIsEnumerable,lf=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function hf(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||sf.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-of(-r):of(r);if(i!==r){var s=String(i),n=_l.call(t,s.length+1);return Jr.call(s,e,"$&_")+"."+Jr.call(Jr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Jr.call(t,e,"$&_")}var El=yx,uf=El.custom,cf=mf(uf)?uf:null,df={__proto__:null,double:'"',single:"'"},Cx={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},qn=function r(t,e,i,s){var n=e||{};if(Pr(n,"quoteStyle")&&!Pr(df,n.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Pr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=Pr(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Pr(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Pr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=n.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return yf(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?hf(t,l):l}if(typeof t=="bigint"){var h=String(t)+"n";return a?hf(t,h):h}var u=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=u&&u>0&&typeof t=="object")return Tl(t)?"[Array]":"[Object]";var c=zx(n,i);if(typeof s>"u")s=[];else if(gf(s,t)>=0)return"[Circular]";function d(A,T,C){if(T&&(s=Sx.call(s),s.push(T)),C){var L={depth:n.depth};return Pr(n,"quoteStyle")&&(L.quoteStyle=n.quoteStyle),r(A,L,i+1,s)}return r(A,n,i+1,s)}if(typeof t=="function"&&!pf(t)){var f=Bx(t),p=Kn(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+yr.call(p,", ")+" }":"")}if(mf(t)){var m=os?Jr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):bl.call(t);return typeof t=="object"&&!os?Ks(m):m}if($x(t)){for(var _="<"+rf.call(String(t.nodeName)),y=t.attributes||[],v=0;v<y.length;v++)_+=" "+y[v].name+"="+ff(Ix(y[v].value),"double",n);return _+=">",t.childNodes&&t.childNodes.length&&(_+="..."),_+="</"+rf.call(String(t.nodeName))+">",_}if(Tl(t)){if(t.length===0)return"[]";var g=Kn(t,d);return c&&!Vx(g)?"["+Al(g,c)+"]":"[ "+yr.call(g,", ")+" ]"}if(Mx(t)){var x=Kn(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!af.call(t,"cause")?"{ ["+String(t)+"] "+yr.call(nf.call("[cause]: "+d(t.cause),x),", ")+" }":x.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+yr.call(x,", ")+" }"}if(typeof t=="object"&&o){if(cf&&typeof t[cf]=="function"&&El)return El(t,{depth:u-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Fx(t)){var E=[];return Jd&&Jd.call(t,function(A,T){E.push(d(T,t,!0)+" => "+d(A,t))}),_f("Map",Wn.call(t),E,c)}if(Gx(t)){var M=[];return tf&&tf.call(t,function(A){M.push(d(A,t))}),_f("Set",jn.call(t),M,c)}if(Ux(t))return wl("WeakMap");if(Hx(t))return wl("WeakSet");if(kx(t))return wl("WeakRef");if(Ox(t))return Ks(d(Number(t)));if(Dx(t))return Ks(d(vl.call(t)));if(Nx(t))return Ks(bx.call(t));if(Px(t))return Ks(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Gs<"u"&&t===Gs)return"{ [object globalThis] }";if(!Rx(t)&&!pf(t)){var S=Kn(t,d),R=lf?lf(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",F=!R&&qs&&Object(t)===t&&qs in t?_l.call(ti(t),8,-1):P?"Object":"",k=R||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",I=k+(F||P?"["+yr.call(nf.call([],F||[],P||[]),": ")+"] ":"");return S.length===0?I+"{}":c?I+"{"+Al(S,c)+"}":I+"{ "+yr.call(S,", ")+" }"}return String(t)};function ff(r,t,e){var i=e.quoteStyle||t,s=df[i];return s+r+s}function Ix(r){return Jr.call(String(r),/"/g,"&quot;")}function Ei(r){return!qs||!(typeof r=="object"&&(qs in r||typeof r[qs]<"u"))}function Tl(r){return ti(r)==="[object Array]"&&Ei(r)}function Rx(r){return ti(r)==="[object Date]"&&Ei(r)}function pf(r){return ti(r)==="[object RegExp]"&&Ei(r)}function Mx(r){return ti(r)==="[object Error]"&&Ei(r)}function Px(r){return ti(r)==="[object String]"&&Ei(r)}function Ox(r){return ti(r)==="[object Number]"&&Ei(r)}function Nx(r){return ti(r)==="[object Boolean]"&&Ei(r)}function mf(r){if(os)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!bl)return!1;try{return bl.call(r),!0}catch{}return!1}function Dx(r){if(!r||typeof r!="object"||!vl)return!1;try{return vl.call(r),!0}catch{}return!1}var Lx=Object.prototype.hasOwnProperty||function(r){return r in this};function Pr(r,t){return Lx.call(r,t)}function ti(r){return Ex.call(r)}function Bx(r){if(r.name)return r.name;var t=wx.call(Tx.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function gf(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function Fx(r){if(!Wn||!r||typeof r!="object")return!1;try{Wn.call(r);try{jn.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function Ux(r){if(!Ws||!r||typeof r!="object")return!1;try{Ws.call(r,Ws);try{js.call(r,js)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function kx(r){if(!ef||!r||typeof r!="object")return!1;try{return ef.call(r),!0}catch{}return!1}function Gx(r){if(!jn||!r||typeof r!="object")return!1;try{jn.call(r);try{Wn.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function Hx(r){if(!js||!r||typeof r!="object")return!1;try{js.call(r,js);try{Ws.call(r,Ws)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function $x(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function yf(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return yf(_l.call(r,0,t.maxStringLength),t)+i}var s=Cx[t.quoteStyle||"single"];s.lastIndex=0;var n=Jr.call(Jr.call(r,s,"\\$1"),/[\x00-\x1f]/g,Xx);return ff(n,"single",t)}function Xx(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Ax.call(t.toString(16))}function Ks(r){return"Object("+r+")"}function wl(r){return r+" { ? }"}function _f(r,t,e,i){var s=i?Al(e,i):yr.call(e,", ");return r+" ("+t+") {"+s+"}"}function Vx(r){for(var t=0;t<r.length;t++)if(gf(r[t],`
4
4
  `)>=0)return!1;return!0}function zx(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=yr.call(Array(r.indent+1)," ");else return null;return{base:e,prev:yr.call(Array(t+1),e)}}function Al(r,t){if(r.length===0)return"";var e=`
5
5
  `+t.prev+t.base;return e+yr.call(r,","+e)+`
6
- `+t.prev}function Kn(r,t){var e=Tl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=Pr(r,s)?t(r[s],r):""}var n=typeof xl=="function"?xl(r):[],o;if(os){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var l in r)Pr(r,l)&&(e&&String(Number(l))===l&&l<r.length||os&&o["$"+l]instanceof Symbol||(sf.call(/[^\w$]/,l)?i.push(t(l,r)+": "+t(r[l],r)):i.push(l+": "+t(r[l],r))));if(typeof xl=="function")for(var h=0;h<n.length;h++)af.call(r,n[h])&&i.push("["+t(n[h])+"]: "+t(r[n[h]],r));return i}var Yx=qn,Wx=ns,Zn=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},jx=function(r,t){if(r){var e=Zn(r,t);return e&&e.value}},qx=function(r,t,e){var i=Zn(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},Kx=function(r,t){return r?!!Zn(r,t):!1},Zx=function(r,t){if(r)return Zn(r,t,!0)},Qx=function(){var t,e={assert:function(i){if(!e.has(i))throw new Wx("Side channel does not contain "+Yx(i))},delete:function(i){var s=t&&t.next,n=Zx(t,i);return n&&s&&s===n&&(t=void 0),!!n},get:function(i){return jx(t,i)},has:function(i){return Kx(t,i)},set:function(i,s){t||(t={next:void 0}),qx(t,i,s)}};return e},vf=Object,Jx=Error,tb=EvalError,eb=RangeError,rb=ReferenceError,ib=SyntaxError,sb=URIError,nb=Math.abs,ob=Math.floor,ab=Math.max,lb=Math.min,hb=Math.pow,ub=Math.round,cb=Number.isNaN||function(t){return t!==t},db=cb,fb=function(t){return db(t)||t===0?t:t<0?-1:1},pb=Object.getOwnPropertyDescriptor,Qn=pb;if(Qn)try{Qn([],"length")}catch{Qn=null}var xf=Qn,Jn=Object.defineProperty||!1;if(Jn)try{Jn({},"a",{value:1})}catch{Jn=!1}var mb=Jn,Sl,bf;function gb(){return bf||(bf=1,Sl=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var n in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}),Sl}var Cl,Ef;function yb(){if(Ef)return Cl;Ef=1;var r=typeof Symbol<"u"&&Symbol,t=gb();return Cl=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},Cl}var Il,Tf;function wf(){return Tf||(Tf=1,Il=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Il}var Rl,Af;function Sf(){if(Af)return Rl;Af=1;var r=vf;return Rl=r.getPrototypeOf||null,Rl}var _b="Function.prototype.bind called on incompatible ",vb=Object.prototype.toString,xb=Math.max,bb="[object Function]",Cf=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var n=0;n<e.length;n+=1)i[n+t.length]=e[n];return i},Eb=function(t,e){for(var i=[],s=e,n=0;s<t.length;s+=1,n+=1)i[n]=t[s];return i},Tb=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e},wb=function(t){var e=this;if(typeof e!="function"||vb.apply(e)!==bb)throw new TypeError(_b+e);for(var i=Eb(arguments,1),s,n=function(){if(this instanceof s){var u=e.apply(this,Cf(i,arguments));return Object(u)===u?u:this}return e.apply(t,Cf(i,arguments))},o=xb(0,e.length-i.length),a=[],l=0;l<o;l++)a[l]="$"+l;if(s=Function("binder","return function ("+Tb(a,",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var h=function(){};h.prototype=e.prototype,s.prototype=new h,h.prototype=null}return s},Ab=wb,to=Function.prototype.bind||Ab,Ml=Function.prototype.call,If=Function.prototype.apply,Sb=typeof Reflect<"u"&&Reflect&&Reflect.apply,Cb=to,Ib=If,Rb=Ml,Mb=Sb,Pb=Mb||Cb.call(Rb,Ib),Ob=to,Nb=ns,Db=Ml,Lb=Pb,Rf=function(t){if(t.length<1||typeof t[0]!="function")throw new Nb("a function is required");return Lb(Ob,Db,t)},Pl,Mf;function Bb(){if(Mf)return Pl;Mf=1;var r=Rf,t=xf,e;try{e=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var i=!!e&&t&&t(Object.prototype,"__proto__"),s=Object,n=s.getPrototypeOf;return Pl=i&&typeof i.get=="function"?r([i.get]):typeof n=="function"?function(a){return n(a==null?a:s(a))}:!1,Pl}var Ol,Pf;function Fb(){if(Pf)return Ol;Pf=1;var r=wf(),t=Sf(),e=Bb();return Ol=r?function(s){return r(s)}:t?function(s){if(!s||typeof s!="object"&&typeof s!="function")throw new TypeError("getProto: not an object");return t(s)}:e?function(s){return e(s)}:null,Ol}var Nl,Of;function Ub(){if(Of)return Nl;Of=1;var r=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=to;return Nl=e.call(r,t),Nl}var St,kb=vf,Gb=Jx,Hb=tb,$b=eb,Xb=rb,as=ib,ls=ns,Vb=sb,zb=nb,Yb=ob,Wb=ab,jb=lb,qb=hb,Kb=ub,Zb=fb,Nf=Function,Dl=function(r){try{return Nf('"use strict"; return ('+r+").constructor;")()}catch{}},Zs=xf,Qb=mb,Ll=function(){throw new ls},Jb=Zs?function(){try{return arguments.callee,Ll}catch{try{return Zs(arguments,"callee").get}catch{return Ll}}}():Ll,hs=yb()(),me=Fb(),tE=Sf(),eE=wf(),Df=If,Qs=Ml,us={},rE=typeof Uint8Array>"u"||!me?St:me(Uint8Array),Ti={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?St:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?St:ArrayBuffer,"%ArrayIteratorPrototype%":hs&&me?me([][Symbol.iterator]()):St,"%AsyncFromSyncIteratorPrototype%":St,"%AsyncFunction%":us,"%AsyncGenerator%":us,"%AsyncGeneratorFunction%":us,"%AsyncIteratorPrototype%":us,"%Atomics%":typeof Atomics>"u"?St:Atomics,"%BigInt%":typeof BigInt>"u"?St:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?St:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?St:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?St:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Gb,"%eval%":eval,"%EvalError%":Hb,"%Float16Array%":typeof Float16Array>"u"?St:Float16Array,"%Float32Array%":typeof Float32Array>"u"?St:Float32Array,"%Float64Array%":typeof Float64Array>"u"?St:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?St:FinalizationRegistry,"%Function%":Nf,"%GeneratorFunction%":us,"%Int8Array%":typeof Int8Array>"u"?St:Int8Array,"%Int16Array%":typeof Int16Array>"u"?St:Int16Array,"%Int32Array%":typeof Int32Array>"u"?St:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hs&&me?me(me([][Symbol.iterator]())):St,"%JSON%":typeof JSON=="object"?JSON:St,"%Map%":typeof Map>"u"?St:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hs||!me?St:me(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":kb,"%Object.getOwnPropertyDescriptor%":Zs,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?St:Promise,"%Proxy%":typeof Proxy>"u"?St:Proxy,"%RangeError%":$b,"%ReferenceError%":Xb,"%Reflect%":typeof Reflect>"u"?St:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?St:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hs||!me?St:me(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?St:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hs&&me?me(""[Symbol.iterator]()):St,"%Symbol%":hs?Symbol:St,"%SyntaxError%":as,"%ThrowTypeError%":Jb,"%TypedArray%":rE,"%TypeError%":ls,"%Uint8Array%":typeof Uint8Array>"u"?St:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?St:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?St:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?St:Uint32Array,"%URIError%":Vb,"%WeakMap%":typeof WeakMap>"u"?St:WeakMap,"%WeakRef%":typeof WeakRef>"u"?St:WeakRef,"%WeakSet%":typeof WeakSet>"u"?St:WeakSet,"%Function.prototype.call%":Qs,"%Function.prototype.apply%":Df,"%Object.defineProperty%":Qb,"%Object.getPrototypeOf%":tE,"%Math.abs%":zb,"%Math.floor%":Yb,"%Math.max%":Wb,"%Math.min%":jb,"%Math.pow%":qb,"%Math.round%":Kb,"%Math.sign%":Zb,"%Reflect.getPrototypeOf%":eE};if(me)try{null.error}catch(r){var iE=me(me(r));Ti["%Error.prototype%"]=iE}var sE=function r(t){var e;if(t==="%AsyncFunction%")e=Dl("async function () {}");else if(t==="%GeneratorFunction%")e=Dl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Dl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&me&&(e=me(s.prototype))}return Ti[t]=e,e},Lf={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Js=to,eo=Ub(),nE=Js.call(Qs,Array.prototype.concat),oE=Js.call(Df,Array.prototype.splice),Bf=Js.call(Qs,String.prototype.replace),ro=Js.call(Qs,String.prototype.slice),aE=Js.call(Qs,RegExp.prototype.exec),lE=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,hE=/\\(\\)?/g,uE=function(t){var e=ro(t,0,1),i=ro(t,-1);if(e==="%"&&i!=="%")throw new as("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new as("invalid intrinsic syntax, expected opening `%`");var s=[];return Bf(t,lE,function(n,o,a,l){s[s.length]=a?Bf(l,hE,"$1"):o||n}),s},cE=function(t,e){var i=t,s;if(eo(Lf,i)&&(s=Lf[i],i="%"+s[0]+"%"),eo(Ti,i)){var n=Ti[i];if(n===us&&(n=sE(i)),typeof n>"u"&&!e)throw new ls("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new as("intrinsic "+t+" does not exist!")},Bl=function(t,e){if(typeof t!="string"||t.length===0)throw new ls("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new ls('"allowMissing" argument must be a boolean');if(aE(/^%?[^%]*%?$/,t)===null)throw new as("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=uE(t),s=i.length>0?i[0]:"",n=cE("%"+s+"%",e),o=n.name,a=n.value,l=!1,h=n.alias;h&&(s=h[0],oE(i,nE([0,1],h)));for(var u=1,c=!0;u<i.length;u+=1){var d=i[u],f=ro(d,0,1),p=ro(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new as("property names with quotes must have matching quotes");if((d==="constructor"||!c)&&(l=!0),s+="."+d,o="%"+s+"%",eo(Ti,o))a=Ti[o];else if(a!=null){if(!(d in a)){if(!e)throw new ls("base intrinsic for "+t+" exists, but the property is not available.");return}if(Zs&&u+1>=i.length){var m=Zs(a,d);c=!!m,c&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else c=eo(a,d),a=a[d];c&&!l&&(Ti[o]=a)}}return a},Ff=Bl,Uf=Rf,dE=Uf([Ff("%String.prototype.indexOf%")]),kf=function(t,e){var i=Ff(t,!!e);return typeof i=="function"&&dE(t,".prototype.")>-1?Uf([i]):i},fE=Bl,tn=kf,pE=qn,mE=ns,Gf=fE("%Map%",!0),gE=tn("Map.prototype.get",!0),yE=tn("Map.prototype.set",!0),_E=tn("Map.prototype.has",!0),vE=tn("Map.prototype.delete",!0),xE=tn("Map.prototype.size",!0),Hf=!!Gf&&function(){var t,e={assert:function(i){if(!e.has(i))throw new mE("Side channel does not contain "+pE(i))},delete:function(i){if(t){var s=vE(t,i);return xE(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return gE(t,i)},has:function(i){return t?_E(t,i):!1},set:function(i,s){t||(t=new Gf),yE(t,i,s)}};return e},bE=Bl,io=kf,EE=qn,so=Hf,TE=ns,cs=bE("%WeakMap%",!0),wE=io("WeakMap.prototype.get",!0),AE=io("WeakMap.prototype.set",!0),SE=io("WeakMap.prototype.has",!0),CE=io("WeakMap.prototype.delete",!0),IE=cs?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new TE("Side channel does not contain "+EE(s))},delete:function(s){if(cs&&s&&(typeof s=="object"||typeof s=="function")){if(t)return CE(t,s)}else if(so&&e)return e.delete(s);return!1},get:function(s){return cs&&s&&(typeof s=="object"||typeof s=="function")&&t?wE(t,s):e&&e.get(s)},has:function(s){return cs&&s&&(typeof s=="object"||typeof s=="function")&&t?SE(t,s):!!e&&e.has(s)},set:function(s,n){cs&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new cs),AE(t,s,n)):so&&(e||(e=so()),e.set(s,n))}};return i}:so,RE=ns,ME=qn,PE=Qx,OE=Hf,NE=IE,DE=NE||OE||PE,LE=function(){var t,e={assert:function(i){if(!e.has(i))throw new RE("Side channel does not contain "+ME(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,s){t||(t=DE()),t.set(i,s)}};return e},BE=String.prototype.replace,FE=/%20/g,Fl={RFC1738:"RFC1738",RFC3986:"RFC3986"},Ul={default:Fl.RFC3986,formatters:{RFC1738:function(r){return BE.call(r,FE,"+")},RFC3986:function(r){return String(r)}},RFC1738:Fl.RFC1738,RFC3986:Fl.RFC3986},UE=Ul,kl=Object.prototype.hasOwnProperty,wi=Array.isArray,_r=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),kE=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(wi(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},$f=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},GE=function r(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(wi(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!kl.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return wi(t)&&!wi(e)&&(s=$f(t,i)),wi(t)&&wi(e)?(e.forEach(function(n,o){if(kl.call(t,o)){var a=t[o];a&&typeof a=="object"&&n&&typeof n=="object"?t[o]=r(a,n,i):t.push(n)}else t[o]=n}),t):Object.keys(e).reduce(function(n,o){var a=e[o];return kl.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},HE=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},$E=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},Gl=1024,XE=function(t,e,i,s,n){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",l=0;l<o.length;l+=Gl){for(var h=o.length>=Gl?o.slice(l,l+Gl):o,u=[],c=0;c<h.length;++c){var d=h.charCodeAt(c);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||n===UE.RFC1738&&(d===40||d===41)){u[u.length]=h.charAt(c);continue}if(d<128){u[u.length]=_r[d];continue}if(d<2048){u[u.length]=_r[192|d>>6]+_r[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=_r[224|d>>12]+_r[128|d>>6&63]+_r[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|h.charCodeAt(c)&1023),u[u.length]=_r[240|d>>18]+_r[128|d>>12&63]+_r[128|d>>6&63]+_r[128|d&63]}a+=u.join("")}return a},VE=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var n=e[s],o=n.obj[n.prop],a=Object.keys(o),l=0;l<a.length;++l){var h=a[l],u=o[h];typeof u=="object"&&u!==null&&i.indexOf(u)===-1&&(e.push({obj:o,prop:h}),i.push(u))}return kE(e),t},zE=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},YE=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},WE=function(t,e){return[].concat(t,e)},jE=function(t,e){if(wi(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},Xf={arrayToObject:$f,assign:HE,combine:WE,compact:VE,decode:$E,encode:XE,isBuffer:YE,isRegExp:zE,maybeMap:jE,merge:GE},Vf=LE,no=Xf,en=Ul,qE=Object.prototype.hasOwnProperty,zf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},vr=Array.isArray,KE=Array.prototype.push,Yf=function(r,t){KE.apply(r,vr(t)?t:[t])},ZE=Date.prototype.toISOString,Wf=en.default,ue={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:no.encode,encodeValuesOnly:!1,filter:void 0,format:Wf,formatter:en.formatters[Wf],indices:!1,serializeDate:function(t){return ZE.call(t)},skipNulls:!1,strictNullHandling:!1},QE=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Hl={},JE=function r(t,e,i,s,n,o,a,l,h,u,c,d,f,p,m,_,y,v){for(var g=t,x=v,E=0,M=!1;(x=x.get(Hl))!==void 0&&!M;){var S=x.get(t);if(E+=1,typeof S<"u"){if(S===E)throw new RangeError("Cyclic object value");M=!0}typeof x.get(Hl)>"u"&&(E=0)}if(typeof u=="function"?g=u(e,g):g instanceof Date?g=f(g):i==="comma"&&vr(g)&&(g=no.maybeMap(g,function(N){return N instanceof Date?f(N):N})),g===null){if(o)return h&&!_?h(e,ue.encoder,y,"key",p):e;g=""}if(QE(g)||no.isBuffer(g)){if(h){var R=_?e:h(e,ue.encoder,y,"key",p);return[m(R)+"="+m(h(g,ue.encoder,y,"value",p))]}return[m(e)+"="+m(String(g))]}var P=[];if(typeof g>"u")return P;var F;if(i==="comma"&&vr(g))_&&h&&(g=no.maybeMap(g,h)),F=[{value:g.length>0?g.join(",")||null:void 0}];else if(vr(u))F=u;else{var k=Object.keys(g);F=c?k.sort(c):k}var I=l?String(e).replace(/\./g,"%2E"):String(e),A=s&&vr(g)&&g.length===1?I+"[]":I;if(n&&vr(g)&&g.length===0)return A+"[]";for(var T=0;T<F.length;++T){var C=F[T],L=typeof C=="object"&&C&&typeof C.value<"u"?C.value:g[C];if(!(a&&L===null)){var O=d&&l?String(C).replace(/\./g,"%2E"):String(C),B=vr(g)?typeof i=="function"?i(A,O):A:A+(d?"."+O:"["+O+"]");v.set(t,E);var X=Vf();X.set(Hl,v),Yf(P,r(L,B,i,s,n,o,a,l,i==="comma"&&_&&vr(g)?null:h,u,c,d,f,p,m,_,y,X))}}return P},tT=function(t){if(!t)return ue;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=en.default;if(typeof t.format<"u"){if(!qE.call(en.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=en.formatters[i],n=ue.filter;(typeof t.filter=="function"||vr(t.filter))&&(n=t.filter);var o;if(t.arrayFormat in zf?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=ue.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:ue.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ue.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ue.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}},eT=function(r,t){var e=r,i=tT(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):vr(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a=zf[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var h=Vf(),u=0;u<s.length;++u){var c=s[u],d=e[c];i.skipNulls&&d===null||Yf(o,JE(d,c,a,l,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,h))}var f=o.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},Ai=Xf,$l=Object.prototype.hasOwnProperty,jf=Array.isArray,Kt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Ai.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},rT=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},qf=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},iT="utf8=%26%2310003%3B",sT="utf8=%E2%9C%93",nT=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n=e.parameterLimit===1/0?void 0:e.parameterLimit,o=s.split(e.delimiter,e.throwOnLimitExceeded?n+1:n);if(e.throwOnLimitExceeded&&o.length>n)throw new RangeError("Parameter limit exceeded. Only "+n+" parameter"+(n===1?"":"s")+" allowed.");var a=-1,l,h=e.charset;if(e.charsetSentinel)for(l=0;l<o.length;++l)o[l].indexOf("utf8=")===0&&(o[l]===sT?h="utf-8":o[l]===iT&&(h="iso-8859-1"),a=l,l=o.length);for(l=0;l<o.length;++l)if(l!==a){var u=o[l],c=u.indexOf("]="),d=c===-1?u.indexOf("="):c+1,f,p;d===-1?(f=e.decoder(u,Kt.decoder,h,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(u.slice(0,d),Kt.decoder,h,"key"),p=Ai.maybeMap(qf(u.slice(d+1),e,jf(i[f])?i[f].length:0),function(_){return e.decoder(_,Kt.decoder,h,"value")})),p&&e.interpretNumericEntities&&h==="iso-8859-1"&&(p=rT(String(p))),u.indexOf("[]=")>-1&&(p=jf(p)?[p]:p);var m=$l.call(i,f);m&&e.duplicates==="combine"?i[f]=Ai.combine(i[f],p):(!m||e.duplicates==="last")&&(i[f]=p)}return i},oT=function(r,t,e,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var n=r.slice(0,-1).join("");s=Array.isArray(t)&&t[n]?t[n].length:0}for(var o=i?t:qf(t,e,s),a=r.length-1;a>=0;--a){var l,h=r[a];if(h==="[]"&&e.parseArrays)l=e.allowEmptyArrays&&(o===""||e.strictNullHandling&&o===null)?[]:Ai.combine([],o);else{l=e.plainObjects?{__proto__:null}:{};var u=h.charAt(0)==="["&&h.charAt(h.length-1)==="]"?h.slice(1,-1):h,c=e.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(c,10);!e.parseArrays&&c===""?l={0:o}:!isNaN(d)&&h!==c&&String(d)===c&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(l=[],l[d]=o):c!=="__proto__"&&(l[c]=o)}o=l}return o},aT=function(t,e,i,s){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&o.exec(n),h=l?n.slice(0,l.index):n,u=[];if(h){if(!i.plainObjects&&$l.call(Object.prototype,h)&&!i.allowPrototypes)return;u.push(h)}for(var c=0;i.depth>0&&(l=a.exec(n))!==null&&c<i.depth;){if(c+=1,!i.plainObjects&&$l.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;u.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");u.push("["+n.slice(l.index)+"]")}return oT(u,e,i,s)}},lT=function(t){if(!t)return Kt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?Kt.charset:t.charset,i=typeof t.duplicates>"u"?Kt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Kt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Kt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Kt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Kt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Kt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Kt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Kt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Kt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Kt.decoder,delimiter:typeof t.delimiter=="string"||Ai.isRegExp(t.delimiter)?t.delimiter:Kt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Kt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Kt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Kt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Kt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Kt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Kt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}},hT=function(r,t){var e=lT(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?nT(r,e):r,s=e.plainObjects?{__proto__:null}:{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],l=aT(a,i[a],e,typeof r=="string");s=Ai.merge(s,l,e)}return e.allowSparse===!0?s:Ai.compact(s)},uT=eT,cT=hT,dT=Ul,fT={formats:dT,parse:cT,stringify:uT},pT=gx;function Or(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var mT=/^([a-z0-9.+-]+:)/i,gT=/:[0-9]*$/,yT=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,_T=["<",">",'"',"`"," ","\r",`
7
- `," "],vT=["{","}","|","\\","^","`"].concat(_T),Xl=["'"].concat(vT),Kf=["%","/","?",";","#"].concat(Xl),Zf=["/","?","#"],xT=255,Qf=/^[+a-z0-9A-Z_-]{0,63}$/,bT=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ET={javascript:!0,"javascript:":!0},Vl={javascript:!0,"javascript:":!0},ds={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},zl=fT;function TT(r,t,e){if(r&&typeof r=="object"&&r instanceof Or)return r;var i=new Or;return i.parse(r,t,e),i}Or.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",n=r.split(s),o=/\\/g;n[0]=n[0].replace(o,"/"),r=n.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var l=yT.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],t?this.query=zl.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=mT.exec(a);if(h){h=h[0];var u=h.toLowerCase();this.protocol=u,a=a.substr(h.length)}if(e||h||a.match(/^\/\/[^@/]+@[^@/]+/)){var c=a.substr(0,2)==="//";c&&!(h&&Vl[h])&&(a=a.substr(2),this.slashes=!0)}if(!Vl[h]&&(c||h&&!ds[h])){for(var d=-1,f=0;f<Zf.length;f++){var p=a.indexOf(Zf[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,_;d===-1?_=a.lastIndexOf("@"):_=a.lastIndexOf("@",d),_!==-1&&(m=a.slice(0,_),a=a.slice(_+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<Kf.length;f++){var p=a.indexOf(Kf[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var y=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!y)for(var v=this.hostname.split(/\./),f=0,g=v.length;f<g;f++){var x=v[f];if(x&&!x.match(Qf)){for(var E="",M=0,S=x.length;M<S;M++)x.charCodeAt(M)>127?E+="x":E+=x[M];if(!E.match(Qf)){var R=v.slice(0,f),P=v.slice(f+1),F=x.match(bT);F&&(R.push(F[1]),P.unshift(F[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=R.join(".");break}}}this.hostname.length>xT?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=pT.toASCII(this.hostname));var k=this.port?":"+this.port:"",I=this.hostname||"";this.host=I+k,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!ET[u])for(var f=0,g=Xl.length;f<g;f++){var A=Xl[f];if(a.indexOf(A)!==-1){var T=encodeURIComponent(A);T===A&&(T=escape(A)),a=a.split(A).join(T)}}var C=a.indexOf("#");C!==-1&&(this.hash=a.substr(C),a=a.slice(0,C));var L=a.indexOf("?");if(L!==-1?(this.search=a.substr(L),this.query=a.substr(L+1),t&&(this.query=zl.parse(this.query)),a=a.slice(0,L)):t&&(this.search="",this.query={}),a&&(this.pathname=a),ds[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var k=this.pathname||"",O=this.search||"";this.path=k+O}return this.href=this.format(),this},Or.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,n="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=zl.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||ds[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),o&&o.charAt(0)!=="?"&&(o="?"+o),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),t+s+e+o+i},Or.prototype.resolve=function(r){return this.resolveObject(TT(r,!1,!0)).format()},Or.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new Or;t.parse(r,!1,!0),r=t}for(var e=new Or,i=Object.keys(this),s=0;s<i.length;s++){var n=i[s];e[n]=this[n]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var o=Object.keys(r),a=0;a<o.length;a++){var l=o[a];l!=="protocol"&&(e[l]=r[l])}return ds[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!ds[r.protocol]){for(var h=Object.keys(r),u=0;u<h.length;u++){var c=h[u];e[c]=r[c]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!Vl[r.protocol]){for(var g=(r.pathname||"").split("/");g.length&&!(r.host=g.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),e.pathname=g.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",_=m||p||e.host&&r.pathname,y=_,v=e.pathname&&e.pathname.split("/")||[],g=r.pathname&&r.pathname.split("/")||[],x=e.protocol&&!ds[e.protocol];if(x&&(e.hostname="",e.port=null,e.host&&(v[0]===""?v[0]=e.host:v.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(g[0]===""?g[0]=r.host:g.unshift(r.host)),r.host=null),_=_&&(g[0]===""||v[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,v=g;else if(g.length)v||(v=[]),v.pop(),v=v.concat(g),e.search=r.search,e.query=r.query;else if(r.search!=null){if(x){e.host=v.shift(),e.hostname=e.host;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!v.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var M=v.slice(-1)[0],S=(e.host||r.host||v.length>1)&&(M==="."||M==="..")||M==="",R=0,P=v.length;P>=0;P--)M=v[P],M==="."?v.splice(P,1):M===".."?(v.splice(P,1),R++):R&&(v.splice(P,1),R--);if(!_&&!y)for(;R--;R)v.unshift("..");_&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/")&&v.unshift(""),S&&v.join("/").substr(-1)!=="/"&&v.push("");var F=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(x){e.hostname=F?"":v.length?v.shift():"",e.host=e.hostname;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return _=_||e.host&&v.length,_&&!F&&v.unshift(""),v.length>0?e.pathname=v.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},Or.prototype.parseHost=function(){var r=this.host,t=gT.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};const Jf={};function At(r,t,e=3){if(Jf[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
6
+ `+t.prev}function Kn(r,t){var e=Tl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=Pr(r,s)?t(r[s],r):""}var n=typeof xl=="function"?xl(r):[],o;if(os){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var l in r)Pr(r,l)&&(e&&String(Number(l))===l&&l<r.length||os&&o["$"+l]instanceof Symbol||(sf.call(/[^\w$]/,l)?i.push(t(l,r)+": "+t(r[l],r)):i.push(l+": "+t(r[l],r))));if(typeof xl=="function")for(var h=0;h<n.length;h++)af.call(r,n[h])&&i.push("["+t(n[h])+"]: "+t(r[n[h]],r));return i}var Yx=qn,Wx=ns,Zn=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},jx=function(r,t){if(r){var e=Zn(r,t);return e&&e.value}},qx=function(r,t,e){var i=Zn(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},Kx=function(r,t){return r?!!Zn(r,t):!1},Zx=function(r,t){if(r)return Zn(r,t,!0)},Qx=function(){var t,e={assert:function(i){if(!e.has(i))throw new Wx("Side channel does not contain "+Yx(i))},delete:function(i){var s=t&&t.next,n=Zx(t,i);return n&&s&&s===n&&(t=void 0),!!n},get:function(i){return jx(t,i)},has:function(i){return Kx(t,i)},set:function(i,s){t||(t={next:void 0}),qx(t,i,s)}};return e},vf=Object,Jx=Error,tb=EvalError,eb=RangeError,rb=ReferenceError,ib=SyntaxError,sb=URIError,nb=Math.abs,ob=Math.floor,ab=Math.max,lb=Math.min,hb=Math.pow,ub=Math.round,cb=Number.isNaN||function(t){return t!==t},db=cb,fb=function(t){return db(t)||t===0?t:t<0?-1:1},pb=Object.getOwnPropertyDescriptor,Qn=pb;if(Qn)try{Qn([],"length")}catch{Qn=null}var xf=Qn,Jn=Object.defineProperty||!1;if(Jn)try{Jn({},"a",{value:1})}catch{Jn=!1}var mb=Jn,Sl,bf;function gb(){return bf||(bf=1,Sl=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var n in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}),Sl}var Cl,Ef;function yb(){if(Ef)return Cl;Ef=1;var r=typeof Symbol<"u"&&Symbol,t=gb();return Cl=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},Cl}var Il,Tf;function wf(){return Tf||(Tf=1,Il=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Il}var Rl,Af;function Sf(){if(Af)return Rl;Af=1;var r=vf;return Rl=r.getPrototypeOf||null,Rl}var _b="Function.prototype.bind called on incompatible ",vb=Object.prototype.toString,xb=Math.max,bb="[object Function]",Cf=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var n=0;n<e.length;n+=1)i[n+t.length]=e[n];return i},Eb=function(t,e){for(var i=[],s=e,n=0;s<t.length;s+=1,n+=1)i[n]=t[s];return i},Tb=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e},wb=function(t){var e=this;if(typeof e!="function"||vb.apply(e)!==bb)throw new TypeError(_b+e);for(var i=Eb(arguments,1),s,n=function(){if(this instanceof s){var u=e.apply(this,Cf(i,arguments));return Object(u)===u?u:this}return e.apply(t,Cf(i,arguments))},o=xb(0,e.length-i.length),a=[],l=0;l<o;l++)a[l]="$"+l;if(s=Function("binder","return function ("+Tb(a,",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var h=function(){};h.prototype=e.prototype,s.prototype=new h,h.prototype=null}return s},Ab=wb,to=Function.prototype.bind||Ab,Ml=Function.prototype.call,If=Function.prototype.apply,Sb=typeof Reflect<"u"&&Reflect&&Reflect.apply,Cb=to,Ib=If,Rb=Ml,Mb=Sb,Pb=Mb||Cb.call(Rb,Ib),Ob=to,Nb=ns,Db=Ml,Lb=Pb,Rf=function(t){if(t.length<1||typeof t[0]!="function")throw new Nb("a function is required");return Lb(Ob,Db,t)},Pl,Mf;function Bb(){if(Mf)return Pl;Mf=1;var r=Rf,t=xf,e;try{e=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var i=!!e&&t&&t(Object.prototype,"__proto__"),s=Object,n=s.getPrototypeOf;return Pl=i&&typeof i.get=="function"?r([i.get]):typeof n=="function"?function(a){return n(a==null?a:s(a))}:!1,Pl}var Ol,Pf;function Fb(){if(Pf)return Ol;Pf=1;var r=wf(),t=Sf(),e=Bb();return Ol=r?function(s){return r(s)}:t?function(s){if(!s||typeof s!="object"&&typeof s!="function")throw new TypeError("getProto: not an object");return t(s)}:e?function(s){return e(s)}:null,Ol}var Nl,Of;function Ub(){if(Of)return Nl;Of=1;var r=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=to;return Nl=e.call(r,t),Nl}var At,kb=vf,Gb=Jx,Hb=tb,$b=eb,Xb=rb,as=ib,ls=ns,Vb=sb,zb=nb,Yb=ob,Wb=ab,jb=lb,qb=hb,Kb=ub,Zb=fb,Nf=Function,Dl=function(r){try{return Nf('"use strict"; return ('+r+").constructor;")()}catch{}},Zs=xf,Qb=mb,Ll=function(){throw new ls},Jb=Zs?function(){try{return arguments.callee,Ll}catch{try{return Zs(arguments,"callee").get}catch{return Ll}}}():Ll,hs=yb()(),me=Fb(),tE=Sf(),eE=wf(),Df=If,Qs=Ml,us={},rE=typeof Uint8Array>"u"||!me?At:me(Uint8Array),Ti={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?At:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?At:ArrayBuffer,"%ArrayIteratorPrototype%":hs&&me?me([][Symbol.iterator]()):At,"%AsyncFromSyncIteratorPrototype%":At,"%AsyncFunction%":us,"%AsyncGenerator%":us,"%AsyncGeneratorFunction%":us,"%AsyncIteratorPrototype%":us,"%Atomics%":typeof Atomics>"u"?At:Atomics,"%BigInt%":typeof BigInt>"u"?At:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?At:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?At:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?At:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Gb,"%eval%":eval,"%EvalError%":Hb,"%Float16Array%":typeof Float16Array>"u"?At:Float16Array,"%Float32Array%":typeof Float32Array>"u"?At:Float32Array,"%Float64Array%":typeof Float64Array>"u"?At:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?At:FinalizationRegistry,"%Function%":Nf,"%GeneratorFunction%":us,"%Int8Array%":typeof Int8Array>"u"?At:Int8Array,"%Int16Array%":typeof Int16Array>"u"?At:Int16Array,"%Int32Array%":typeof Int32Array>"u"?At:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hs&&me?me(me([][Symbol.iterator]())):At,"%JSON%":typeof JSON=="object"?JSON:At,"%Map%":typeof Map>"u"?At:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hs||!me?At:me(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":kb,"%Object.getOwnPropertyDescriptor%":Zs,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?At:Promise,"%Proxy%":typeof Proxy>"u"?At:Proxy,"%RangeError%":$b,"%ReferenceError%":Xb,"%Reflect%":typeof Reflect>"u"?At:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?At:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hs||!me?At:me(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?At:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hs&&me?me(""[Symbol.iterator]()):At,"%Symbol%":hs?Symbol:At,"%SyntaxError%":as,"%ThrowTypeError%":Jb,"%TypedArray%":rE,"%TypeError%":ls,"%Uint8Array%":typeof Uint8Array>"u"?At:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?At:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?At:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?At:Uint32Array,"%URIError%":Vb,"%WeakMap%":typeof WeakMap>"u"?At:WeakMap,"%WeakRef%":typeof WeakRef>"u"?At:WeakRef,"%WeakSet%":typeof WeakSet>"u"?At:WeakSet,"%Function.prototype.call%":Qs,"%Function.prototype.apply%":Df,"%Object.defineProperty%":Qb,"%Object.getPrototypeOf%":tE,"%Math.abs%":zb,"%Math.floor%":Yb,"%Math.max%":Wb,"%Math.min%":jb,"%Math.pow%":qb,"%Math.round%":Kb,"%Math.sign%":Zb,"%Reflect.getPrototypeOf%":eE};if(me)try{null.error}catch(r){var iE=me(me(r));Ti["%Error.prototype%"]=iE}var sE=function r(t){var e;if(t==="%AsyncFunction%")e=Dl("async function () {}");else if(t==="%GeneratorFunction%")e=Dl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Dl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&me&&(e=me(s.prototype))}return Ti[t]=e,e},Lf={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Js=to,eo=Ub(),nE=Js.call(Qs,Array.prototype.concat),oE=Js.call(Df,Array.prototype.splice),Bf=Js.call(Qs,String.prototype.replace),ro=Js.call(Qs,String.prototype.slice),aE=Js.call(Qs,RegExp.prototype.exec),lE=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,hE=/\\(\\)?/g,uE=function(t){var e=ro(t,0,1),i=ro(t,-1);if(e==="%"&&i!=="%")throw new as("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new as("invalid intrinsic syntax, expected opening `%`");var s=[];return Bf(t,lE,function(n,o,a,l){s[s.length]=a?Bf(l,hE,"$1"):o||n}),s},cE=function(t,e){var i=t,s;if(eo(Lf,i)&&(s=Lf[i],i="%"+s[0]+"%"),eo(Ti,i)){var n=Ti[i];if(n===us&&(n=sE(i)),typeof n>"u"&&!e)throw new ls("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new as("intrinsic "+t+" does not exist!")},Bl=function(t,e){if(typeof t!="string"||t.length===0)throw new ls("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new ls('"allowMissing" argument must be a boolean');if(aE(/^%?[^%]*%?$/,t)===null)throw new as("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=uE(t),s=i.length>0?i[0]:"",n=cE("%"+s+"%",e),o=n.name,a=n.value,l=!1,h=n.alias;h&&(s=h[0],oE(i,nE([0,1],h)));for(var u=1,c=!0;u<i.length;u+=1){var d=i[u],f=ro(d,0,1),p=ro(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new as("property names with quotes must have matching quotes");if((d==="constructor"||!c)&&(l=!0),s+="."+d,o="%"+s+"%",eo(Ti,o))a=Ti[o];else if(a!=null){if(!(d in a)){if(!e)throw new ls("base intrinsic for "+t+" exists, but the property is not available.");return}if(Zs&&u+1>=i.length){var m=Zs(a,d);c=!!m,c&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else c=eo(a,d),a=a[d];c&&!l&&(Ti[o]=a)}}return a},Ff=Bl,Uf=Rf,dE=Uf([Ff("%String.prototype.indexOf%")]),kf=function(t,e){var i=Ff(t,!!e);return typeof i=="function"&&dE(t,".prototype.")>-1?Uf([i]):i},fE=Bl,tn=kf,pE=qn,mE=ns,Gf=fE("%Map%",!0),gE=tn("Map.prototype.get",!0),yE=tn("Map.prototype.set",!0),_E=tn("Map.prototype.has",!0),vE=tn("Map.prototype.delete",!0),xE=tn("Map.prototype.size",!0),Hf=!!Gf&&function(){var t,e={assert:function(i){if(!e.has(i))throw new mE("Side channel does not contain "+pE(i))},delete:function(i){if(t){var s=vE(t,i);return xE(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return gE(t,i)},has:function(i){return t?_E(t,i):!1},set:function(i,s){t||(t=new Gf),yE(t,i,s)}};return e},bE=Bl,io=kf,EE=qn,so=Hf,TE=ns,cs=bE("%WeakMap%",!0),wE=io("WeakMap.prototype.get",!0),AE=io("WeakMap.prototype.set",!0),SE=io("WeakMap.prototype.has",!0),CE=io("WeakMap.prototype.delete",!0),IE=cs?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new TE("Side channel does not contain "+EE(s))},delete:function(s){if(cs&&s&&(typeof s=="object"||typeof s=="function")){if(t)return CE(t,s)}else if(so&&e)return e.delete(s);return!1},get:function(s){return cs&&s&&(typeof s=="object"||typeof s=="function")&&t?wE(t,s):e&&e.get(s)},has:function(s){return cs&&s&&(typeof s=="object"||typeof s=="function")&&t?SE(t,s):!!e&&e.has(s)},set:function(s,n){cs&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new cs),AE(t,s,n)):so&&(e||(e=so()),e.set(s,n))}};return i}:so,RE=ns,ME=qn,PE=Qx,OE=Hf,NE=IE,DE=NE||OE||PE,LE=function(){var t,e={assert:function(i){if(!e.has(i))throw new RE("Side channel does not contain "+ME(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,s){t||(t=DE()),t.set(i,s)}};return e},BE=String.prototype.replace,FE=/%20/g,Fl={RFC1738:"RFC1738",RFC3986:"RFC3986"},Ul={default:Fl.RFC3986,formatters:{RFC1738:function(r){return BE.call(r,FE,"+")},RFC3986:function(r){return String(r)}},RFC1738:Fl.RFC1738,RFC3986:Fl.RFC3986},UE=Ul,kl=Object.prototype.hasOwnProperty,wi=Array.isArray,_r=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),kE=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(wi(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},$f=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},GE=function r(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(wi(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!kl.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return wi(t)&&!wi(e)&&(s=$f(t,i)),wi(t)&&wi(e)?(e.forEach(function(n,o){if(kl.call(t,o)){var a=t[o];a&&typeof a=="object"&&n&&typeof n=="object"?t[o]=r(a,n,i):t.push(n)}else t[o]=n}),t):Object.keys(e).reduce(function(n,o){var a=e[o];return kl.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},HE=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},$E=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},Gl=1024,XE=function(t,e,i,s,n){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",l=0;l<o.length;l+=Gl){for(var h=o.length>=Gl?o.slice(l,l+Gl):o,u=[],c=0;c<h.length;++c){var d=h.charCodeAt(c);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||n===UE.RFC1738&&(d===40||d===41)){u[u.length]=h.charAt(c);continue}if(d<128){u[u.length]=_r[d];continue}if(d<2048){u[u.length]=_r[192|d>>6]+_r[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=_r[224|d>>12]+_r[128|d>>6&63]+_r[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|h.charCodeAt(c)&1023),u[u.length]=_r[240|d>>18]+_r[128|d>>12&63]+_r[128|d>>6&63]+_r[128|d&63]}a+=u.join("")}return a},VE=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var n=e[s],o=n.obj[n.prop],a=Object.keys(o),l=0;l<a.length;++l){var h=a[l],u=o[h];typeof u=="object"&&u!==null&&i.indexOf(u)===-1&&(e.push({obj:o,prop:h}),i.push(u))}return kE(e),t},zE=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},YE=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},WE=function(t,e){return[].concat(t,e)},jE=function(t,e){if(wi(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},Xf={arrayToObject:$f,assign:HE,combine:WE,compact:VE,decode:$E,encode:XE,isBuffer:YE,isRegExp:zE,maybeMap:jE,merge:GE},Vf=LE,no=Xf,en=Ul,qE=Object.prototype.hasOwnProperty,zf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},vr=Array.isArray,KE=Array.prototype.push,Yf=function(r,t){KE.apply(r,vr(t)?t:[t])},ZE=Date.prototype.toISOString,Wf=en.default,ue={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:no.encode,encodeValuesOnly:!1,filter:void 0,format:Wf,formatter:en.formatters[Wf],indices:!1,serializeDate:function(t){return ZE.call(t)},skipNulls:!1,strictNullHandling:!1},QE=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Hl={},JE=function r(t,e,i,s,n,o,a,l,h,u,c,d,f,p,m,_,y,v){for(var g=t,x=v,E=0,M=!1;(x=x.get(Hl))!==void 0&&!M;){var S=x.get(t);if(E+=1,typeof S<"u"){if(S===E)throw new RangeError("Cyclic object value");M=!0}typeof x.get(Hl)>"u"&&(E=0)}if(typeof u=="function"?g=u(e,g):g instanceof Date?g=f(g):i==="comma"&&vr(g)&&(g=no.maybeMap(g,function(N){return N instanceof Date?f(N):N})),g===null){if(o)return h&&!_?h(e,ue.encoder,y,"key",p):e;g=""}if(QE(g)||no.isBuffer(g)){if(h){var R=_?e:h(e,ue.encoder,y,"key",p);return[m(R)+"="+m(h(g,ue.encoder,y,"value",p))]}return[m(e)+"="+m(String(g))]}var P=[];if(typeof g>"u")return P;var F;if(i==="comma"&&vr(g))_&&h&&(g=no.maybeMap(g,h)),F=[{value:g.length>0?g.join(",")||null:void 0}];else if(vr(u))F=u;else{var k=Object.keys(g);F=c?k.sort(c):k}var I=l?String(e).replace(/\./g,"%2E"):String(e),A=s&&vr(g)&&g.length===1?I+"[]":I;if(n&&vr(g)&&g.length===0)return A+"[]";for(var T=0;T<F.length;++T){var C=F[T],L=typeof C=="object"&&C&&typeof C.value<"u"?C.value:g[C];if(!(a&&L===null)){var O=d&&l?String(C).replace(/\./g,"%2E"):String(C),B=vr(g)?typeof i=="function"?i(A,O):A:A+(d?"."+O:"["+O+"]");v.set(t,E);var X=Vf();X.set(Hl,v),Yf(P,r(L,B,i,s,n,o,a,l,i==="comma"&&_&&vr(g)?null:h,u,c,d,f,p,m,_,y,X))}}return P},tT=function(t){if(!t)return ue;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=en.default;if(typeof t.format<"u"){if(!qE.call(en.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=en.formatters[i],n=ue.filter;(typeof t.filter=="function"||vr(t.filter))&&(n=t.filter);var o;if(t.arrayFormat in zf?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=ue.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:ue.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ue.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ue.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}},eT=function(r,t){var e=r,i=tT(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):vr(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a=zf[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var h=Vf(),u=0;u<s.length;++u){var c=s[u],d=e[c];i.skipNulls&&d===null||Yf(o,JE(d,c,a,l,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,h))}var f=o.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},Ai=Xf,$l=Object.prototype.hasOwnProperty,jf=Array.isArray,Kt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Ai.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},rT=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},qf=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},iT="utf8=%26%2310003%3B",sT="utf8=%E2%9C%93",nT=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n=e.parameterLimit===1/0?void 0:e.parameterLimit,o=s.split(e.delimiter,e.throwOnLimitExceeded?n+1:n);if(e.throwOnLimitExceeded&&o.length>n)throw new RangeError("Parameter limit exceeded. Only "+n+" parameter"+(n===1?"":"s")+" allowed.");var a=-1,l,h=e.charset;if(e.charsetSentinel)for(l=0;l<o.length;++l)o[l].indexOf("utf8=")===0&&(o[l]===sT?h="utf-8":o[l]===iT&&(h="iso-8859-1"),a=l,l=o.length);for(l=0;l<o.length;++l)if(l!==a){var u=o[l],c=u.indexOf("]="),d=c===-1?u.indexOf("="):c+1,f,p;d===-1?(f=e.decoder(u,Kt.decoder,h,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(u.slice(0,d),Kt.decoder,h,"key"),p=Ai.maybeMap(qf(u.slice(d+1),e,jf(i[f])?i[f].length:0),function(_){return e.decoder(_,Kt.decoder,h,"value")})),p&&e.interpretNumericEntities&&h==="iso-8859-1"&&(p=rT(String(p))),u.indexOf("[]=")>-1&&(p=jf(p)?[p]:p);var m=$l.call(i,f);m&&e.duplicates==="combine"?i[f]=Ai.combine(i[f],p):(!m||e.duplicates==="last")&&(i[f]=p)}return i},oT=function(r,t,e,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var n=r.slice(0,-1).join("");s=Array.isArray(t)&&t[n]?t[n].length:0}for(var o=i?t:qf(t,e,s),a=r.length-1;a>=0;--a){var l,h=r[a];if(h==="[]"&&e.parseArrays)l=e.allowEmptyArrays&&(o===""||e.strictNullHandling&&o===null)?[]:Ai.combine([],o);else{l=e.plainObjects?{__proto__:null}:{};var u=h.charAt(0)==="["&&h.charAt(h.length-1)==="]"?h.slice(1,-1):h,c=e.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(c,10);!e.parseArrays&&c===""?l={0:o}:!isNaN(d)&&h!==c&&String(d)===c&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(l=[],l[d]=o):c!=="__proto__"&&(l[c]=o)}o=l}return o},aT=function(t,e,i,s){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&o.exec(n),h=l?n.slice(0,l.index):n,u=[];if(h){if(!i.plainObjects&&$l.call(Object.prototype,h)&&!i.allowPrototypes)return;u.push(h)}for(var c=0;i.depth>0&&(l=a.exec(n))!==null&&c<i.depth;){if(c+=1,!i.plainObjects&&$l.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;u.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");u.push("["+n.slice(l.index)+"]")}return oT(u,e,i,s)}},lT=function(t){if(!t)return Kt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?Kt.charset:t.charset,i=typeof t.duplicates>"u"?Kt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Kt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Kt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Kt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Kt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Kt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Kt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Kt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Kt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Kt.decoder,delimiter:typeof t.delimiter=="string"||Ai.isRegExp(t.delimiter)?t.delimiter:Kt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Kt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Kt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Kt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Kt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Kt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Kt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}},hT=function(r,t){var e=lT(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?nT(r,e):r,s=e.plainObjects?{__proto__:null}:{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],l=aT(a,i[a],e,typeof r=="string");s=Ai.merge(s,l,e)}return e.allowSparse===!0?s:Ai.compact(s)},uT=eT,cT=hT,dT=Ul,fT={formats:dT,parse:cT,stringify:uT},pT=gx;function Or(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var mT=/^([a-z0-9.+-]+:)/i,gT=/:[0-9]*$/,yT=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,_T=["<",">",'"',"`"," ","\r",`
7
+ `," "],vT=["{","}","|","\\","^","`"].concat(_T),Xl=["'"].concat(vT),Kf=["%","/","?",";","#"].concat(Xl),Zf=["/","?","#"],xT=255,Qf=/^[+a-z0-9A-Z_-]{0,63}$/,bT=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ET={javascript:!0,"javascript:":!0},Vl={javascript:!0,"javascript:":!0},ds={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},zl=fT;function TT(r,t,e){if(r&&typeof r=="object"&&r instanceof Or)return r;var i=new Or;return i.parse(r,t,e),i}Or.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",n=r.split(s),o=/\\/g;n[0]=n[0].replace(o,"/"),r=n.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var l=yT.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],t?this.query=zl.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=mT.exec(a);if(h){h=h[0];var u=h.toLowerCase();this.protocol=u,a=a.substr(h.length)}if(e||h||a.match(/^\/\/[^@/]+@[^@/]+/)){var c=a.substr(0,2)==="//";c&&!(h&&Vl[h])&&(a=a.substr(2),this.slashes=!0)}if(!Vl[h]&&(c||h&&!ds[h])){for(var d=-1,f=0;f<Zf.length;f++){var p=a.indexOf(Zf[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,_;d===-1?_=a.lastIndexOf("@"):_=a.lastIndexOf("@",d),_!==-1&&(m=a.slice(0,_),a=a.slice(_+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<Kf.length;f++){var p=a.indexOf(Kf[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var y=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!y)for(var v=this.hostname.split(/\./),f=0,g=v.length;f<g;f++){var x=v[f];if(x&&!x.match(Qf)){for(var E="",M=0,S=x.length;M<S;M++)x.charCodeAt(M)>127?E+="x":E+=x[M];if(!E.match(Qf)){var R=v.slice(0,f),P=v.slice(f+1),F=x.match(bT);F&&(R.push(F[1]),P.unshift(F[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=R.join(".");break}}}this.hostname.length>xT?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=pT.toASCII(this.hostname));var k=this.port?":"+this.port:"",I=this.hostname||"";this.host=I+k,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!ET[u])for(var f=0,g=Xl.length;f<g;f++){var A=Xl[f];if(a.indexOf(A)!==-1){var T=encodeURIComponent(A);T===A&&(T=escape(A)),a=a.split(A).join(T)}}var C=a.indexOf("#");C!==-1&&(this.hash=a.substr(C),a=a.slice(0,C));var L=a.indexOf("?");if(L!==-1?(this.search=a.substr(L),this.query=a.substr(L+1),t&&(this.query=zl.parse(this.query)),a=a.slice(0,L)):t&&(this.search="",this.query={}),a&&(this.pathname=a),ds[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var k=this.pathname||"",O=this.search||"";this.path=k+O}return this.href=this.format(),this},Or.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,n="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=zl.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||ds[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),o&&o.charAt(0)!=="?"&&(o="?"+o),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),t+s+e+o+i},Or.prototype.resolve=function(r){return this.resolveObject(TT(r,!1,!0)).format()},Or.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new Or;t.parse(r,!1,!0),r=t}for(var e=new Or,i=Object.keys(this),s=0;s<i.length;s++){var n=i[s];e[n]=this[n]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var o=Object.keys(r),a=0;a<o.length;a++){var l=o[a];l!=="protocol"&&(e[l]=r[l])}return ds[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!ds[r.protocol]){for(var h=Object.keys(r),u=0;u<h.length;u++){var c=h[u];e[c]=r[c]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!Vl[r.protocol]){for(var g=(r.pathname||"").split("/");g.length&&!(r.host=g.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),e.pathname=g.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",_=m||p||e.host&&r.pathname,y=_,v=e.pathname&&e.pathname.split("/")||[],g=r.pathname&&r.pathname.split("/")||[],x=e.protocol&&!ds[e.protocol];if(x&&(e.hostname="",e.port=null,e.host&&(v[0]===""?v[0]=e.host:v.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(g[0]===""?g[0]=r.host:g.unshift(r.host)),r.host=null),_=_&&(g[0]===""||v[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,v=g;else if(g.length)v||(v=[]),v.pop(),v=v.concat(g),e.search=r.search,e.query=r.query;else if(r.search!=null){if(x){e.host=v.shift(),e.hostname=e.host;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!v.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var M=v.slice(-1)[0],S=(e.host||r.host||v.length>1)&&(M==="."||M==="..")||M==="",R=0,P=v.length;P>=0;P--)M=v[P],M==="."?v.splice(P,1):M===".."?(v.splice(P,1),R++):R&&(v.splice(P,1),R--);if(!_&&!y)for(;R--;R)v.unshift("..");_&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/")&&v.unshift(""),S&&v.join("/").substr(-1)!=="/"&&v.push("");var F=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(x){e.hostname=F?"":v.length?v.shift():"",e.host=e.hostname;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return _=_||e.host&&v.length,_&&!F&&v.unshift(""),v.length>0?e.pathname=v.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},Or.prototype.parseHost=function(){var r=this.host,t=gT.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};const Jf={};function St(r,t,e=3){if(Jf[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
8
8
  Deprecated since v${r}`):(i=i.split(`
9
9
  `).splice(e).join(`
10
10
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
11
11
  Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
12
- Deprecated since v${r}`),console.warn(i))),Jf[t]=!0}function rr(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function rn(r){return r.split("?")[0].split("#")[0]}function wT(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function AT(r,t,e){return r.replace(new RegExp(wT(t),"g"),e)}function ST(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),s=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,n=0;continue}}}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const ge={toPosix(r){return AT(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){rr(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(rr(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=rn(this.toPosix(t??tt.ADAPTER.getBaseUrl())),s=rn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?ge.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(rr(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const i=r.endsWith("/");return r=ST(r),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return rr(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){const i=r[e];if(rr(i),i.length>0)if(t===void 0)t=i;else{const s=r[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(rr(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(o)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){rr(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){rr(r),t&&rr(t),r=rn(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const l=r.charCodeAt(n);if(l===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(l===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){rr(r),r=rn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){rr(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=rn(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,o=0,a=-1,l=!0,h=r.length-1,u=0;for(;h>=s;--h){if(e=r.charCodeAt(h),e===47){if(!l){o=h+1;break}continue}a===-1&&(l=!1,a=h+1),e===46?n===-1?n=h:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||a===-1||u===0||u===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=r.slice(1,a):t.base=t.name=r.slice(o,a)):(o===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,a)):(t.name=r.slice(o,n),t.base=r.slice(o,a)),t.ext=r.slice(n,a)),t.dir=this.dirname(r),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let Yl;async function CT(){return Yl??(Yl=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return He.UNPACK;const t=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(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 He.UNPACK;const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);const i=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,i),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t);const s=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,s),r.deleteFramebuffer(i),r.deleteTexture(e),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),s[0]<=s[3]?He.PMA:He.UNPACK})()),Yl}let Wl;function IT(){return typeof Wl>"u"&&(Wl=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:tt.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!tt.ADAPTER.getWebGLRenderingContext())return!1;const e=tt.ADAPTER.createCanvas();let i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch{return!1}}()),Wl}var RT={grad:.9,turn:360,rad:360/(2*Math.PI)},Nr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ye=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},je=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},tp=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},ep=function(r){return{r:je(r.r,0,255),g:je(r.g,0,255),b:je(r.b,0,255),a:je(r.a)}},jl=function(r){return{r:ye(r.r),g:ye(r.g),b:ye(r.b),a:ye(r.a,3)}},MT=/^#([0-9a-f]{3,8})$/i,oo=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},rp=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},ip=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),l=i*(1-(1-t+n)*e),h=n%6;return{r:255*[i,a,o,o,l,i][h],g:255*[l,i,i,a,o,o][h],b:255*[o,o,l,i,i,a][h],a:s}},sp=function(r){return{h:tp(r.h),s:je(r.s,0,100),l:je(r.l,0,100),a:je(r.a)}},np=function(r){return{h:ye(r.h),s:ye(r.s),l:ye(r.l),a:ye(r.a,3)}},op=function(r){return ip((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},sn=function(r){return{h:(t=rp(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},PT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,OT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,NT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,DT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ql={string:[[function(r){var t=MT.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ye(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ye(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=NT.exec(r)||DT.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:ep({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(r){var t=PT.exec(r)||OT.exec(r);if(!t)return null;var e,i,s=sp({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(RT[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return op(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return Nr(t)&&Nr(e)&&Nr(i)?ep({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!Nr(t)||!Nr(e)||!Nr(i))return null;var o=sp({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return op(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Nr(t)||!Nr(e)||!Nr(i))return null;var o=function(a){return{h:tp(a.h),s:je(a.s,0,100),v:je(a.v,0,100),a:je(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return ip(o)},"hsv"]]},ap=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},LT=function(r){return typeof r=="string"?ap(r.trim(),ql.string):typeof r=="object"&&r!==null?ap(r,ql.object):[null,void 0]},Kl=function(r,t){var e=sn(r);return{h:e.h,s:je(e.s+100*t,0,100),l:e.l,a:e.a}},Zl=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},lp=function(r,t){var e=sn(r);return{h:e.h,s:e.s,l:je(e.l+100*t,0,100),a:e.a}},Ql=function(){function r(t){this.parsed=LT(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return ye(Zl(this.rgba),2)},r.prototype.isDark=function(){return Zl(this.rgba)<.5},r.prototype.isLight=function(){return Zl(this.rgba)>=.5},r.prototype.toHex=function(){return t=jl(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?oo(ye(255*n)):"","#"+oo(e)+oo(i)+oo(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return jl(this.rgba)},r.prototype.toRgbString=function(){return t=jl(this.rgba),e=t.r,i=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+s+", "+n+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,n},r.prototype.toHsl=function(){return np(sn(this.rgba))},r.prototype.toHslString=function(){return t=np(sn(this.rgba)),e=t.h,i=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+n+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,n},r.prototype.toHsv=function(){return t=rp(this.rgba),{h:ye(t.h),s:ye(t.s),v:ye(t.v),a:ye(t.a,3)};var t},r.prototype.invert=function(){return xr({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),xr(Kl(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),xr(Kl(this.rgba,-t))},r.prototype.grayscale=function(){return xr(Kl(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),xr(lp(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),xr(lp(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?xr({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ye(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=sn(this.rgba);return typeof t=="number"?xr({h:t,s:e.s,l:e.l,a:e.a}):ye(e.h)},r.prototype.isEqual=function(t){return this.toHex()===xr(t).toHex()},r}(),xr=function(r){return r instanceof Ql?r:new Ql(r)},hp=[],BT=function(r){r.forEach(function(t){hp.indexOf(t)<0&&(t(Ql,ql),hp.push(t))})};function FT(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,h=i[this.toHex()];if(h)return h;if(o!=null&&o.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var p in e){var m=(a=u,l=n[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));m<c&&(c=m,d=p)}return d}},t.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new r(l).toRgb():null},"name"])}BT([FT]);const fs=class Qo{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 Qo)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.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,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,n)=>s===e[n]);if(t!==null&&e!==null){const s=Object.keys(t),n=Object.keys(e);return s.length!==n.length?!1:s.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];const[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,s,n]=Qo.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const 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}round(t){const[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}normalize(t){let e,i,s,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=Qo.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=xr(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};fs.shared=new fs,fs.temp=new fs,fs.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ot=fs;function UT(r){return At("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ot.shared.setValue(r).toHex()}function kT(r){return At("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ot.shared.setValue(r).toNumber()}function GT(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[yt.NORMAL_NPM]=yt.NORMAL,r[yt.ADD_NPM]=yt.ADD,r[yt.SCREEN_NPM]=yt.SCREEN,t[yt.NORMAL]=yt.NORMAL_NPM,t[yt.ADD]=yt.ADD_NPM,t[yt.SCREEN]=yt.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const up=GT();function cp(r,t){return up[t?1:0][r]}function HT(r,t=null){const e=r*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}function dp(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function ao(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function fp(r){return!(r&r-1)&&!!r}function pp(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function ps(r,t,e){const i=r.length;let s;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(s=t;s<n;++s)r[s]=r[s+e];r.length=n}function ei(r){return r===0?0:r<0?-1:1}let $T=0;function Si(){return++$T}const Jl=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Jl.EMPTY=new Jl(0,0,0,0);let mp=Jl;const gp={},br=Object.create(null),ri=Object.create(null);class XT{constructor(t,e,i){this._canvas=tt.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||tt.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function yp(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function _p(r,t,e,i,s){const n=4*t;for(let o=i,a=i*n+4*e;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function VT(r){const{width:t,height:e}=r,i=r.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,t,e).data;let n=0,o=0,a=t-1,l=e-1;for(;o<e&&yp(s,t,o);)++o;if(o===e)return mp.EMPTY;for(;yp(s,t,l);)--l;for(;_p(s,t,n,o,l);)++n;for(;_p(s,t,a,o,l);)--a;return++a,++l,new mp(n,o,a,l)}function zT(r){const t=VT(r),{width:e,height:i}=t;let s=null;if(!t.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");s=n.getImageData(t.left,t.top,e,i)}return{width:e,height:i,data:s}}function YT(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Dr(r,t=1){var i;const e=(i=tt.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var Z=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(Z||{});const th=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},vp=(r,t)=>th(r).priority??t,ht={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(th).forEach(t=>{t.type.forEach(e=>{var i,s;return(s=(i=this._removeHandlers)[e])==null?void 0:s.call(i,t)})}),this},add(...r){return r.map(th).forEach(t=>{t.type.forEach(e=>{var n,o;const i=this._addHandlers,s=this._queue;i[e]?(n=i[e])==null||n.call(i,t):(s[e]=s[e]||[],(o=s[e])==null||o.push(t))})}),this},handle(r,t,e){var o;const i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;const n=this._queue;return n[r]&&((o=n[r])==null||o.forEach(a=>t(a)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>vp(n,e)-vp(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class eh{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}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 uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const WT=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
12
+ Deprecated since v${r}`),console.warn(i))),Jf[t]=!0}function rr(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function rn(r){return r.split("?")[0].split("#")[0]}function wT(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function AT(r,t,e){return r.replace(new RegExp(wT(t),"g"),e)}function ST(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),s=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,n=0;continue}}}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const ge={toPosix(r){return AT(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){rr(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(rr(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=rn(this.toPosix(t??tt.ADAPTER.getBaseUrl())),s=rn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?ge.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(rr(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const i=r.endsWith("/");return r=ST(r),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return rr(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){const i=r[e];if(rr(i),i.length>0)if(t===void 0)t=i;else{const s=r[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(rr(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(o)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){rr(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){rr(r),t&&rr(t),r=rn(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const l=r.charCodeAt(n);if(l===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(l===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){rr(r),r=rn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){rr(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=rn(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,o=0,a=-1,l=!0,h=r.length-1,u=0;for(;h>=s;--h){if(e=r.charCodeAt(h),e===47){if(!l){o=h+1;break}continue}a===-1&&(l=!1,a=h+1),e===46?n===-1?n=h:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||a===-1||u===0||u===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=r.slice(1,a):t.base=t.name=r.slice(o,a)):(o===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,a)):(t.name=r.slice(o,n),t.base=r.slice(o,a)),t.ext=r.slice(n,a)),t.dir=this.dirname(r),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let Yl;async function CT(){return Yl??(Yl=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return He.UNPACK;const t=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(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 He.UNPACK;const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);const i=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,i),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t);const s=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,s),r.deleteFramebuffer(i),r.deleteTexture(e),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),s[0]<=s[3]?He.PMA:He.UNPACK})()),Yl}let Wl;function IT(){return typeof Wl>"u"&&(Wl=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:tt.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!tt.ADAPTER.getWebGLRenderingContext())return!1;const e=tt.ADAPTER.createCanvas();let i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch{return!1}}()),Wl}var RT={grad:.9,turn:360,rad:360/(2*Math.PI)},Nr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ye=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},je=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},tp=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},ep=function(r){return{r:je(r.r,0,255),g:je(r.g,0,255),b:je(r.b,0,255),a:je(r.a)}},jl=function(r){return{r:ye(r.r),g:ye(r.g),b:ye(r.b),a:ye(r.a,3)}},MT=/^#([0-9a-f]{3,8})$/i,oo=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},rp=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},ip=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),l=i*(1-(1-t+n)*e),h=n%6;return{r:255*[i,a,o,o,l,i][h],g:255*[l,i,i,a,o,o][h],b:255*[o,o,l,i,i,a][h],a:s}},sp=function(r){return{h:tp(r.h),s:je(r.s,0,100),l:je(r.l,0,100),a:je(r.a)}},np=function(r){return{h:ye(r.h),s:ye(r.s),l:ye(r.l),a:ye(r.a,3)}},op=function(r){return ip((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},sn=function(r){return{h:(t=rp(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},PT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,OT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,NT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,DT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ql={string:[[function(r){var t=MT.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ye(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ye(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=NT.exec(r)||DT.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:ep({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(r){var t=PT.exec(r)||OT.exec(r);if(!t)return null;var e,i,s=sp({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(RT[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return op(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return Nr(t)&&Nr(e)&&Nr(i)?ep({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!Nr(t)||!Nr(e)||!Nr(i))return null;var o=sp({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return op(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Nr(t)||!Nr(e)||!Nr(i))return null;var o=function(a){return{h:tp(a.h),s:je(a.s,0,100),v:je(a.v,0,100),a:je(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return ip(o)},"hsv"]]},ap=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},LT=function(r){return typeof r=="string"?ap(r.trim(),ql.string):typeof r=="object"&&r!==null?ap(r,ql.object):[null,void 0]},Kl=function(r,t){var e=sn(r);return{h:e.h,s:je(e.s+100*t,0,100),l:e.l,a:e.a}},Zl=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},lp=function(r,t){var e=sn(r);return{h:e.h,s:e.s,l:je(e.l+100*t,0,100),a:e.a}},Ql=function(){function r(t){this.parsed=LT(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return ye(Zl(this.rgba),2)},r.prototype.isDark=function(){return Zl(this.rgba)<.5},r.prototype.isLight=function(){return Zl(this.rgba)>=.5},r.prototype.toHex=function(){return t=jl(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?oo(ye(255*n)):"","#"+oo(e)+oo(i)+oo(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return jl(this.rgba)},r.prototype.toRgbString=function(){return t=jl(this.rgba),e=t.r,i=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+s+", "+n+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,n},r.prototype.toHsl=function(){return np(sn(this.rgba))},r.prototype.toHslString=function(){return t=np(sn(this.rgba)),e=t.h,i=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+n+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,n},r.prototype.toHsv=function(){return t=rp(this.rgba),{h:ye(t.h),s:ye(t.s),v:ye(t.v),a:ye(t.a,3)};var t},r.prototype.invert=function(){return xr({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),xr(Kl(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),xr(Kl(this.rgba,-t))},r.prototype.grayscale=function(){return xr(Kl(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),xr(lp(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),xr(lp(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?xr({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ye(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=sn(this.rgba);return typeof t=="number"?xr({h:t,s:e.s,l:e.l,a:e.a}):ye(e.h)},r.prototype.isEqual=function(t){return this.toHex()===xr(t).toHex()},r}(),xr=function(r){return r instanceof Ql?r:new Ql(r)},hp=[],BT=function(r){r.forEach(function(t){hp.indexOf(t)<0&&(t(Ql,ql),hp.push(t))})};function FT(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,h=i[this.toHex()];if(h)return h;if(o!=null&&o.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var p in e){var m=(a=u,l=n[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));m<c&&(c=m,d=p)}return d}},t.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new r(l).toRgb():null},"name"])}BT([FT]);const fs=class Qo{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 Qo)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.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,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,n)=>s===e[n]);if(t!==null&&e!==null){const s=Object.keys(t),n=Object.keys(e);return s.length!==n.length?!1:s.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];const[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,s,n]=Qo.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const 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}round(t){const[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}normalize(t){let e,i,s,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=Qo.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=xr(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};fs.shared=new fs,fs.temp=new fs,fs.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ot=fs;function UT(r){return St("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ot.shared.setValue(r).toHex()}function kT(r){return St("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ot.shared.setValue(r).toNumber()}function GT(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[yt.NORMAL_NPM]=yt.NORMAL,r[yt.ADD_NPM]=yt.ADD,r[yt.SCREEN_NPM]=yt.SCREEN,t[yt.NORMAL]=yt.NORMAL_NPM,t[yt.ADD]=yt.ADD_NPM,t[yt.SCREEN]=yt.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const up=GT();function cp(r,t){return up[t?1:0][r]}function HT(r,t=null){const e=r*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}function dp(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function ao(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function fp(r){return!(r&r-1)&&!!r}function pp(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function ps(r,t,e){const i=r.length;let s;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(s=t;s<n;++s)r[s]=r[s+e];r.length=n}function ei(r){return r===0?0:r<0?-1:1}let $T=0;function Si(){return++$T}const Jl=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Jl.EMPTY=new Jl(0,0,0,0);let mp=Jl;const gp={},br=Object.create(null),ri=Object.create(null);class XT{constructor(t,e,i){this._canvas=tt.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||tt.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function yp(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function _p(r,t,e,i,s){const n=4*t;for(let o=i,a=i*n+4*e;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function VT(r){const{width:t,height:e}=r,i=r.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,t,e).data;let n=0,o=0,a=t-1,l=e-1;for(;o<e&&yp(s,t,o);)++o;if(o===e)return mp.EMPTY;for(;yp(s,t,l);)--l;for(;_p(s,t,n,o,l);)++n;for(;_p(s,t,a,o,l);)--a;return++a,++l,new mp(n,o,a,l)}function zT(r){const t=VT(r),{width:e,height:i}=t;let s=null;if(!t.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");s=n.getImageData(t.left,t.top,e,i)}return{width:e,height:i,data:s}}function YT(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Dr(r,t=1){var i;const e=(i=tt.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var Z=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(Z||{});const th=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},vp=(r,t)=>th(r).priority??t,ht={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(th).forEach(t=>{t.type.forEach(e=>{var i,s;return(s=(i=this._removeHandlers)[e])==null?void 0:s.call(i,t)})}),this},add(...r){return r.map(th).forEach(t=>{t.type.forEach(e=>{var n,o;const i=this._addHandlers,s=this._queue;i[e]?(n=i[e])==null||n.call(i,t):(s[e]=s[e]||[],(o=s[e])==null||o.push(t))})}),this},handle(r,t,e){var o;const i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;const n=this._queue;return n[r]&&((o=n[r])==null||o.forEach(a=>t(a)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>vp(n,e)-vp(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class eh{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}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 uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const WT=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
13
13
  `);function jT(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
14
14
  else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function qT(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const i=WT.replace(/%forloop%/gi,jT(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const rh=0,ih=1,sh=2,nh=3,oh=4,ah=5;class Er{constructor(){this.data=0,this.blendMode=yt.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<rh)}set blend(t){!!(this.data&1<<rh)!==t&&(this.data^=1<<rh)}get offsets(){return!!(this.data&1<<ih)}set offsets(t){!!(this.data&1<<ih)!==t&&(this.data^=1<<ih)}get culling(){return!!(this.data&1<<sh)}set culling(t){!!(this.data&1<<sh)!==t&&(this.data^=1<<sh)}get depthTest(){return!!(this.data&1<<nh)}set depthTest(t){!!(this.data&1<<nh)!==t&&(this.data^=1<<nh)}get depthMask(){return!!(this.data&1<<ah)}set depthMask(t){!!(this.data&1<<ah)!==t&&(this.data^=1<<ah)}get clockwiseFrontFace(){return!!(this.data&1<<oh)}set clockwiseFrontFace(t){!!(this.data&1<<oh)!==t&&(this.data^=1<<oh)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==yt.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Er;return t.depthTest=!1,t.blend=!0,t}}Er.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const lh=[];function xp(r,t){if(!r)return null;let e="";if(typeof r=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=lh.length-1;i>=0;--i){const s=lh[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ir{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,n,o,a,l){if(arguments.length>8)throw new Error("max arguments reached");const{name:h,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c<d;c++)u[c][h](t,e,i,s,n,o,a,l);return u===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(ir.prototype,{dispatch:{value:ir.prototype.emit},run:{value:ir.prototype.emit}});class nn{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ir("setRealSize"),this.onUpdate=new ir("update"),this.onError=new ir("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class lo extends nn{constructor(t,e){const{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){const s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===He.UNPACK);const n=e.realWidth,o=e.realHeight;return i.width===n&&i.height===o?s.texSubImage2D(e.target,0,0,0,n,o,e.format,i.type,this.data):(i.width=n,i.height=o,s.texImage2D(e.target,0,i.internalFormat,n,o,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}const KT={scaleMode:Ir.NEAREST,alphaMode:He.NPM},hh=class Ss extends Xs{constructor(t=null,e=null){super(),e=Object.assign({},Ss.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:l,wrapMode:h,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof nn)&&(t=xp(t,p),t.internal=!0),this.resolution=f||tt.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=h,this._scaleMode=o,this.format=u,this.type=c,this.target=d,this.alphaMode=i,this.uid=Si(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=fp(this.realWidth)&&fp(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete ri[this.cacheId],delete br[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Ss.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=tt.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Si()}`}n=t._pixiId}let o=ri[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Ss(t,e),o.cacheId=n,Ss.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new lo(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=z.RGBA,a=ft.FLOAT):t instanceof Int32Array?(o=z.RGBA_INTEGER,a=ft.INT):t instanceof Uint32Array?(o=z.RGBA_INTEGER,a=ft.UNSIGNED_INT):t instanceof Int16Array?(o=z.RGBA_INTEGER,a=ft.SHORT):t instanceof Uint16Array?(o=z.RGBA_INTEGER,a=ft.UNSIGNED_SHORT):t instanceof Int8Array?(o=z.RGBA,a=ft.BYTE):(o=z.RGBA,a=ft.UNSIGNED_BYTE),n.internal=!0,new Ss(n,Object.assign({},KT,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),ri[e]&&ri[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),ri[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=ri[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete ri[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete ri[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};hh.defaultOptions={mipmap:pr.POW2,anisotropicLevel:0,scaleMode:Ir.LINEAR,wrapMode:Qr.CLAMP,alphaMode:He.UNPACK,target:rs.TEXTURE_2D,format:z.RGBA,type:ft.UNSIGNED_BYTE},hh._globalBatch=0;let _t=hh;class uh{constructor(){this.texArray=null,this.blend=0,this.type=fr.TRIANGLES,this.start=0,this.size=0,this.data=null}}let ZT=0;class te{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=ZT++,this.disposeRunner=new ir("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?gr.ELEMENT_ARRAY_BUFFER:gr.ARRAY_BUFFER}get index(){return this.type===gr.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new te(t)}}class ho{constructor(t,e=0,i=!1,s=ft.FLOAT,n,o,a,l=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=n,this.start=o,this.instance=a,this.divisor=l}destroy(){this.buffer=null}static from(t,e,i,s,n){return new ho(t,e,i,s,n)}}const QT={Float32Array,Uint32Array,Int32Array,Uint8Array};function JT(r,t){let e=0,i=0;const s={};for(let l=0;l<r.length;l++)i+=t[l],e+=r[l].length;const n=new ArrayBuffer(e*4);let o=null,a=0;for(let l=0;l<r.length;l++){const h=t[l],u=r[l],c=dp(u);s[c]||(s[c]=new QT[c](n)),o=s[c];for(let d=0;d<u.length;d++){const f=(d/h|0)*i+a,p=d%h;o[f+p]=u[d]}a+=h}return new Float32Array(n)}const bp={5126:4,5123:2,5121:1};let tw=0;const ew={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class ii{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=tw++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ir("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,n,o,a,l=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof te||(e instanceof Array&&(e=new Float32Array(e)),e=new te(e));const h=t.split("|");if(h.length>1){for(let c=0;c<h.length;c++)this.addAttribute(h[c],e,i,s,n);return this}let u=this.buffers.indexOf(e);return u===-1&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new ho(u,i,s,n,o,a,l),this.instanced=this.instanced||l,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof te||(t instanceof Array&&(t=new Uint16Array(t)),t=new te(t)),t.type=gr.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],i=new te;let s;for(s in this.attributes){const n=this.attributes[s],o=this.buffers[n.buffer];t.push(o.data),e.push(n.size*bp[n.type]/4),n.buffer=0}for(i.data=JT(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new ii;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new te(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new ho(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=gr.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new ii,i=[],s=[],n=[];let o;for(let a=0;a<t.length;a++){o=t[a];for(let l=0;l<o.buffers.length;l++)s[l]=s[l]||0,s[l]+=o.buffers[l].data.length,n[l]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new ew[dp(o.buffers[a].data)](s[a]),e.buffers[a]=new te(i[a]);for(let a=0;a<t.length;a++){o=t[a];for(let l=0;l<o.buffers.length;l++)i[l].set(o.buffers[l].data,n[l]),n[l]+=o.buffers[l].data.length}if(e.attributes=o.attributes,o.indexBuffer){e.indexBuffer=e.buffers[o.buffers.indexOf(o.indexBuffer)],e.indexBuffer.type=gr.ELEMENT_ARRAY_BUFFER;let a=0,l=0,h=0,u=0;for(let c=0;c<o.buffers.length;c++)if(o.buffers[c]!==o.indexBuffer){u=c;break}for(const c in o.attributes){const d=o.attributes[c];(d.buffer|0)===u&&(l+=d.size*bp[d.type]/4)}for(let c=0;c<t.length;c++){const d=t[c].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+h]+=a;a+=t[c].buffers[u].data.length/l,h+=d.length}}return e}}class Ep extends ii{constructor(t=!1){super(),this._buffer=new te(null,t,!1),this._indexBuffer=new te(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ft.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ft.FLOAT).addAttribute("aColor",this._buffer,4,!0,ft.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ft.FLOAT).addIndex(this._indexBuffer)}}const uo=Math.PI*2,rw=180/Math.PI,iw=Math.PI/180;var we=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(we||{});class It{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new It(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,e=t){return this.x=t,this.y=e,this}}It.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const co=[new It,new It,new It,new It];class xt{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=we.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new xt(0,0,0,0)}clone(){return new xt(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const R=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=R)return!1;const P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=co[0].set(t.left,t.top),l=co[1].set(t.left,t.bottom),h=co[2].set(t.right,t.top),u=co[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(u,u),Math.max(a.x,l.x,h.x,u.x)<=i||Math.min(a.x,l.x,h.x,u.x)>=s||Math.max(a.y,l.y,h.y,u.y)<=n||Math.min(a.y,l.y,h.y,u.y)>=o))return!1;const d=c*(l.y-a.y),f=c*(a.x-l.x),p=d*i+f*n,m=d*s+f*n,_=d*i+f*o,y=d*s+f*o;if(Math.max(p,m,_,y)<=d*a.x+f*a.y||Math.min(p,m,_,y)>=d*u.x+f*u.y)return!1;const v=c*(a.y-h.y),g=c*(h.x-a.x),x=v*i+g*n,E=v*s+g*n,M=v*i+g*o,S=v*s+g*o;return!(Math.max(x,E,M,S)<=v*a.x+g*a.y||Math.min(x,E,M,S)>=v*u.x+g*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=n-s,this}}xt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class fo{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=we.CIRC}clone(){return new fo(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}getBounds(){return new xt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}fo.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class po{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=we.ELIP}clone(){return new po(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new xt(this.x-this.width,this.y-this.height,this.width,this.height)}}po.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Ci{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let s=0,n=e.length;s<n;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=we.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Ci(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const s=this.points.length/2;for(let n=0,o=s-1;n<s;o=n++){const a=this.points[n*2],l=this.points[n*2+1],h=this.points[o*2],u=this.points[o*2+1];l>e!=u>e&&t<(h-a)*((e-l)/(u-l))+a&&(i=!i)}return i}}Ci.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class mo{constructor(t=0,e=0,i=0,s=0,n=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=n,this.type=we.RREC}clone(){return new mo(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(s*s+n*n<=o||(s=t-(this.x+this.width-i),s*s+n*n<=o)||(n=e-(this.y+this.height-i),s*s+n*n<=o)||(s=t-(this.x+i),s*s+n*n<=o))return!0}return!1}}mo.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class kt{constructor(t=1,e=0,i=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o}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,e,i,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new It;const i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new It;const i=1/(this.a*this.d+this.c*-this.b),s=t.x,n=t.y;return e.x=this.d*i*s+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a,n=this.c,o=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,s,n,o,a,l,h){return this.a=Math.cos(a+h)*n,this.b=Math.sin(a+h)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,s=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(uo-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+n*n),t.position.x=this.tx+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,o=t*s-e*i;return this.a=s/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new kt;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}static get IDENTITY(){return new kt}static get TEMP_MATRIX(){return new kt}}kt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const Ii=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ri=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Mi=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Pi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ch=[],Tp=[],go=Math.sign;function sw(){for(let r=0;r<16;r++){const t=[];ch.push(t);for(let e=0;e<16;e++){const i=go(Ii[r]*Ii[e]+Mi[r]*Ri[e]),s=go(Ri[r]*Ii[e]+Pi[r]*Ri[e]),n=go(Ii[r]*Mi[e]+Mi[r]*Pi[e]),o=go(Ri[r]*Mi[e]+Pi[r]*Pi[e]);for(let a=0;a<16;a++)if(Ii[a]===i&&Ri[a]===s&&Mi[a]===n&&Pi[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new kt;t.set(Ii[r],Ri[r],Mi[r],Pi[r],0,0),Tp.push(t)}}sw();const 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:r=>Ii[r],uY:r=>Ri[r],vX:r=>Mi[r],vY:r=>Pi[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>ch[r][t],sub:(r,t)=>ch[r][Yt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Yt.S:Yt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Yt.E:Yt.W:t>0?r>0?Yt.SE:Yt.SW:r>0?Yt.NE:Yt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=Tp[Yt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class Lr{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new Lr(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}Lr.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const dh=class{constructor(){this.worldTransform=new kt,this.localTransform=new kt,this.position=new Lr(this.onChange,this,0,0),this.scale=new Lr(this.onChange,this,1,1),this.pivot=new Lr(this.onChange,this,0,0),this.skew=new Lr(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){const t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){const e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};dh.IDENTITY=new dh;let fh=dh;fh.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var nw=`varying vec2 vTextureCoord;
15
15
 
@@ -344,7 +344,7 @@ void main(void){
344
344
  vTextureId = aTextureId;
345
345
  vColor = aColor * tint;
346
346
  }
347
- `;const an=class ur extends xo{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=Ep,this.vertexSize=6,this.state=Er.for2d(),this.size=ur.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??vw(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??_w(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return At("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return bw}static get defaultFragmentTemplate(){return xw}setShaderGenerator({vertex:t=ur.defaultVertexSrc,fragment:e=ur.defaultFragmentTemplate}={}){this.shaderGenerator=new yw(t,e)}contextChange(){const t=this.renderer.gl;tt.PREFER_ENV===xi.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ur.defaultMaxTextures),this.maxTextures=qT(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=ur,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new uh);for(;e.length<s;)e.push(new gh);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,i=ur._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++_t._globalBatch,l=0,h=i[0],u=0;s.copyBoundTextures(n,e);for(let c=0;c<this._bufferSize;++c){const d=t[c];t[c]=null,d._batchEnabled!==a&&(h.count>=e&&(s.boundArray(h,n,a,e),this.buildDrawCalls(h,u,c),u=c,h=i[++l],++a),d._batchEnabled=a,d.touched=o,h.elements[h.count++]=d)}h.count>0&&(s.boundArray(h,n,a,e),this.buildDrawCalls(h,u,this._bufferSize),++l,++a);for(let c=0;c<n.length;c++)n[c]=null;_t._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,l=ur._drawCallPool;let h=this._dcIndex,u=this._aIndex,c=this._iIndex,d=l[h];d.start=this._iIndex,d.texArray=t;for(let f=e;f<i;++f){const p=s[f],m=p._texture.baseTexture,_=up[m.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&d.blend!==_&&(d.size=c-d.start,e=f,d=l[++h],d.texArray=t,d.start=c),this.packInterleavedGeometry(p,n,o,u,c),u+=p.vertexData.length/2*a,c+=p.indices.length,d.blend=_}e<i&&(d.size=c-d.start,++h),this._dcIndex=h,this._aIndex=u,this._iIndex=c}bindAndClearTexArray(t){const e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:i}=this;ur.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:i}=this.renderer,s=ur._drawCallPool;let n=null;for(let o=0;o<t;o++){const{texArray:a,type:l,size:h,start:u,blend:c}=s[o];n!==a&&(n=a,this.bindAndClearTexArray(a)),this.state.blendMode=c,i.set(this.state),e.drawElements(l,h,e.UNSIGNED_SHORT,u*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),ur.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=ao(Math.ceil(t/8)),i=pp(e),s=e*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._aBuffers[s];return n||(this._aBuffers[s]=n=new eh(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=ao(Math.ceil(t/12)),i=pp(e),s=e*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(s)),n}packInterleavedGeometry(t,e,i,s,n){const{uint32View:o,float32View:a}=e,l=s/this.vertexSize,h=t.uvs,u=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=Ot.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<c.length;m+=2)a[s++]=c[m],a[s++]=c[m+1],a[s++]=h[m],a[s++]=h[m+1],o[s++]=p,a[s++]=d;for(let m=0;m<u.length;m++)i[n++]=l+u[m]}};an.defaultBatchSize=4096,an.extension={name:"batch",type:Z.RendererPlugin},an._drawCallPool=[],an._textureArrayPool=[];let Oi=an;ht.add(Oi);var Ew=`varying vec2 vTextureCoord;
347
+ `;const an=class ur extends xo{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=Ep,this.vertexSize=6,this.state=Er.for2d(),this.size=ur.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??vw(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??_w(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return St("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return bw}static get defaultFragmentTemplate(){return xw}setShaderGenerator({vertex:t=ur.defaultVertexSrc,fragment:e=ur.defaultFragmentTemplate}={}){this.shaderGenerator=new yw(t,e)}contextChange(){const t=this.renderer.gl;tt.PREFER_ENV===xi.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ur.defaultMaxTextures),this.maxTextures=qT(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=ur,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new uh);for(;e.length<s;)e.push(new gh);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,i=ur._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++_t._globalBatch,l=0,h=i[0],u=0;s.copyBoundTextures(n,e);for(let c=0;c<this._bufferSize;++c){const d=t[c];t[c]=null,d._batchEnabled!==a&&(h.count>=e&&(s.boundArray(h,n,a,e),this.buildDrawCalls(h,u,c),u=c,h=i[++l],++a),d._batchEnabled=a,d.touched=o,h.elements[h.count++]=d)}h.count>0&&(s.boundArray(h,n,a,e),this.buildDrawCalls(h,u,this._bufferSize),++l,++a);for(let c=0;c<n.length;c++)n[c]=null;_t._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,l=ur._drawCallPool;let h=this._dcIndex,u=this._aIndex,c=this._iIndex,d=l[h];d.start=this._iIndex,d.texArray=t;for(let f=e;f<i;++f){const p=s[f],m=p._texture.baseTexture,_=up[m.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&d.blend!==_&&(d.size=c-d.start,e=f,d=l[++h],d.texArray=t,d.start=c),this.packInterleavedGeometry(p,n,o,u,c),u+=p.vertexData.length/2*a,c+=p.indices.length,d.blend=_}e<i&&(d.size=c-d.start,++h),this._dcIndex=h,this._aIndex=u,this._iIndex=c}bindAndClearTexArray(t){const e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:i}=this;ur.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:i}=this.renderer,s=ur._drawCallPool;let n=null;for(let o=0;o<t;o++){const{texArray:a,type:l,size:h,start:u,blend:c}=s[o];n!==a&&(n=a,this.bindAndClearTexArray(a)),this.state.blendMode=c,i.set(this.state),e.drawElements(l,h,e.UNSIGNED_SHORT,u*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),ur.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=ao(Math.ceil(t/8)),i=pp(e),s=e*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._aBuffers[s];return n||(this._aBuffers[s]=n=new eh(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=ao(Math.ceil(t/12)),i=pp(e),s=e*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(s)),n}packInterleavedGeometry(t,e,i,s,n){const{uint32View:o,float32View:a}=e,l=s/this.vertexSize,h=t.uvs,u=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=Ot.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<c.length;m+=2)a[s++]=c[m],a[s++]=c[m+1],a[s++]=h[m],a[s++]=h[m+1],o[s++]=p,a[s++]=d;for(let m=0;m<u.length;m++)i[n++]=l+u[m]}};an.defaultBatchSize=4096,an.extension={name:"batch",type:Z.RendererPlugin},an._drawCallPool=[],an._textureArrayPool=[];let Oi=an;ht.add(Oi);var Ew=`varying vec2 vTextureCoord;
348
348
 
349
349
  uniform sampler2D uSampler;
350
350
 
@@ -418,7 +418,7 @@ void main(void)
418
418
  vTextureCoord = aTextureCoord;
419
419
  vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
420
420
  }
421
- `;class Mw extends Be{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||Rw,e||Iw,i),this.maskSprite=s,this.maskMatrix=new kt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){const n=this._maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new Xp(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}}class Pw{constructor(t=null){this.type=he.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Be.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=he.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class Vp{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){const n=this.maskDataPool.pop()||new Pw;n.pooled=!0,n.maskObject=e,i=n}const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==he.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case he.SCISSOR:this.renderer.scissor.push(i);break;case he.STENCIL:this.renderer.stencil.push(i);break;case he.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case he.COLOR:this.pushColorMask(i);break}i.type===he.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case he.SCISSOR:this.renderer.scissor.pop(e);break;case he.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case he.SPRITE:this.popSpriteMask(e);break;case he.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===he.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=he.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=he.SCISSOR:t.type=he.STENCIL:t.type=he.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new Mw])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;const n=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=n,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){const e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}Vp.extension={type:Z.RendererSystem,name:"mask"},ht.add(Vp);class zp{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;const s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Yp=new kt,Wp=[],jp=class Jo extends zp{constructor(t){super(t),this.glConst=tt.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,n=s.renderTexture,o=i.getBounds(!0,Wp.pop()??new xt);this.roundFrameToPixels(o,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:i,c:s,d:n}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Jo.isMatrixRotated(e.worldTransform)||Jo.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,n){Jo.isMatrixRotated(n)||(n=n?Yp.copyFrom(n):Yp.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&Wp.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};jp.extension={type:Z.RendererSystem,name:"scissor"};let Ow=jp;ht.add(Ow);class qp extends zp{constructor(t){super(t),this.glConst=tt.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,i.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}qp.extension={type:Z.RendererSystem,name:"stencil"},ht.add(qp);class Kp{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return At("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return At("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return At("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}Kp.extension={type:[Z.RendererSystem,Z.CanvasRendererSystem],name:"_plugin"},ht.add(Kp);class Zp{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new kt,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){const n=this.projectionMatrix,o=s?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Zp.extension={type:Z.RendererSystem,name:"projection"},ht.add(Zp);const Nw=new fh,Qp=new xt;class Jp{constructor(t){this.renderer=t,this._tempMatrix=new kt}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(Qp))||t.getLocalBounds(Qp,!0),o=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),s.width=n.width,s.height=n.height,s.resolution=o,s.multisample??(s.multisample=this.renderer.multisample);const a=Ni.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const l=t.transform;return t.transform=Nw,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}}Jp.extension={type:[Z.RendererSystem,Z.CanvasRendererSystem],name:"textureGenerator"},ht.add(Jp);const Di=new xt,ln=new xt;class tm{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new xt,this.destinationFrame=new xt,this.viewportFrame=new xt}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){const s=this.renderer;this.current=t;let n,o,a;t?(n=t.baseTexture,a=n.resolution,e||(Di.width=t.frame.width,Di.height=t.frame.height,e=Di),i||(ln.x=t.frame.x,ln.y=t.frame.y,ln.width=e.width,ln.height=e.height,i=ln),o=n.framebuffer):(a=s.resolution,e||(Di.width=s._view.screen.width,Di.height=s._view.screen.height,e=Di),i||(i=Di,i.width=e.width,i.height=e.height));const l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,t||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(o,l),this.renderer.projection.update(i,e,a,!o),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Ot.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:l,y:h,width:u,height:c}=this.viewportFrame;l=Math.round(l),h=Math.round(h),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,h,u,c)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}tm.extension={type:Z.RendererSystem,name:"renderTexture"},ht.add(tm);class Dw{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function Lw(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const n=t.getActiveAttrib(r,s);if(n.name.startsWith("gl_"))continue;const o=Mp(t,n.type),a={type:o,name:n.name,size:Ip(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function Bw(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),l=Mp(t,n.type);e[o]={name:o,index:s,type:l,size:n.size,isArray:a,value:Ap(l,n.size)}}return e}function Fw(r,t){var a;const e=wp(r,r.VERTEX_SHADER,t.vertexSrc),i=wp(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=(a=t.extra)==null?void 0:a.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||dw(r,s,e,i),t.attributeData=Lw(s,r),t.uniformData=Bw(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const l=Object.keys(t.attributeData);l.sort((h,u)=>h>u?1:-1);for(let h=0;h<l.length;h++)t.attributeData[l[h]].location=h,r.bindAttribLocation(s,h,l[h]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);const o={};for(const l in t.uniformData){const h=t.uniformData[l];o[l]={location:r.getUniformLocation(s,l),value:Ap(h.type,h.size)}}return new Dw(s,o)}function Uw(r,t,e,i,s){e.buffer.update(s)}const kw={float:`
421
+ `;class Mw extends Be{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||Rw,e||Iw,i),this.maskSprite=s,this.maskMatrix=new kt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){const n=this._maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new Xp(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}}class Pw{constructor(t=null){this.type=he.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Be.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=he.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class Vp{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){const n=this.maskDataPool.pop()||new Pw;n.pooled=!0,n.maskObject=e,i=n}const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==he.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case he.SCISSOR:this.renderer.scissor.push(i);break;case he.STENCIL:this.renderer.stencil.push(i);break;case he.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case he.COLOR:this.pushColorMask(i);break}i.type===he.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case he.SCISSOR:this.renderer.scissor.pop(e);break;case he.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case he.SPRITE:this.popSpriteMask(e);break;case he.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===he.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=he.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=he.SCISSOR:t.type=he.STENCIL:t.type=he.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new Mw])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;const n=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=n,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){const e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}Vp.extension={type:Z.RendererSystem,name:"mask"},ht.add(Vp);class zp{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;const s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Yp=new kt,Wp=[],jp=class Jo extends zp{constructor(t){super(t),this.glConst=tt.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,n=s.renderTexture,o=i.getBounds(!0,Wp.pop()??new xt);this.roundFrameToPixels(o,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:i,c:s,d:n}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Jo.isMatrixRotated(e.worldTransform)||Jo.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,n){Jo.isMatrixRotated(n)||(n=n?Yp.copyFrom(n):Yp.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&Wp.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};jp.extension={type:Z.RendererSystem,name:"scissor"};let Ow=jp;ht.add(Ow);class qp extends zp{constructor(t){super(t),this.glConst=tt.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,i.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}qp.extension={type:Z.RendererSystem,name:"stencil"},ht.add(qp);class Kp{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return St("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return St("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return St("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}Kp.extension={type:[Z.RendererSystem,Z.CanvasRendererSystem],name:"_plugin"},ht.add(Kp);class Zp{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new kt,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){const n=this.projectionMatrix,o=s?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Zp.extension={type:Z.RendererSystem,name:"projection"},ht.add(Zp);const Nw=new fh,Qp=new xt;class Jp{constructor(t){this.renderer=t,this._tempMatrix=new kt}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(Qp))||t.getLocalBounds(Qp,!0),o=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),s.width=n.width,s.height=n.height,s.resolution=o,s.multisample??(s.multisample=this.renderer.multisample);const a=Ni.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const l=t.transform;return t.transform=Nw,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}}Jp.extension={type:[Z.RendererSystem,Z.CanvasRendererSystem],name:"textureGenerator"},ht.add(Jp);const Di=new xt,ln=new xt;class tm{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new xt,this.destinationFrame=new xt,this.viewportFrame=new xt}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){const s=this.renderer;this.current=t;let n,o,a;t?(n=t.baseTexture,a=n.resolution,e||(Di.width=t.frame.width,Di.height=t.frame.height,e=Di),i||(ln.x=t.frame.x,ln.y=t.frame.y,ln.width=e.width,ln.height=e.height,i=ln),o=n.framebuffer):(a=s.resolution,e||(Di.width=s._view.screen.width,Di.height=s._view.screen.height,e=Di),i||(i=Di,i.width=e.width,i.height=e.height));const l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,t||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(o,l),this.renderer.projection.update(i,e,a,!o),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Ot.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:l,y:h,width:u,height:c}=this.viewportFrame;l=Math.round(l),h=Math.round(h),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,h,u,c)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}tm.extension={type:Z.RendererSystem,name:"renderTexture"},ht.add(tm);class Dw{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function Lw(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const n=t.getActiveAttrib(r,s);if(n.name.startsWith("gl_"))continue;const o=Mp(t,n.type),a={type:o,name:n.name,size:Ip(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function Bw(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),l=Mp(t,n.type);e[o]={name:o,index:s,type:l,size:n.size,isArray:a,value:Ap(l,n.size)}}return e}function Fw(r,t){var a;const e=wp(r,r.VERTEX_SHADER,t.vertexSrc),i=wp(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=(a=t.extra)==null?void 0:a.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||dw(r,s,e,i),t.attributeData=Lw(s,r),t.uniformData=Bw(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const l=Object.keys(t.attributeData);l.sort((h,u)=>h>u?1:-1);for(let h=0;h<l.length;h++)t.attributeData[l[h]].location=h,r.bindAttribLocation(s,h,l[h]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);const o={};for(const l in t.uniformData){const h=t.uniformData[l];o[l]={location:r.getUniformLocation(s,l),value:Ap(h.type,h.size)}}return new Dw(s,o)}function Uw(r,t,e,i,s){e.buffer.update(s)}const kw={float:`
422
422
  data[offset] = v;
423
423
  `,vec2:`
424
424
  data[offset] = v[0];
@@ -488,7 +488,7 @@ void main(void)
488
488
  `)}}return n.push(`
489
489
  renderer.buffer.update(buffer);
490
490
  `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
491
- `))}}let Xw=0;const Ao={textureCount:0,uboCount:0};class rm{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Xw++}systemCheck(){if(!pw())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(Ao.textureCount=0,Ao.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ao)),s}setUniforms(t){const e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=hw(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,Ao,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=$w(t,this.shader.program.uniformData)),t.autoManage){const l=new Float32Array(a.size/4);t.buffer.update(l)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,s=Fw(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}rm.extension={type:Z.RendererSystem,name:"shader"},ht.add(rm);class So{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}So.defaultOptions={hello:!1},So.extension={type:[Z.RendererSystem,Z.CanvasRendererSystem],name:"startup"},ht.add(So);function Vw(r,t=[]){return t[yt.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.ADD]=[r.ONE,r.ONE],t[yt.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.NONE]=[0,0],t[yt.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[yt.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[yt.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[yt.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[yt.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[yt.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[yt.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[yt.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[yt.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[yt.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const zw=0,Yw=1,Ww=2,jw=3,qw=4,Kw=5,im=class iu{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=yt.NONE,this._blendEq=!1,this.map=[],this.map[zw]=this.setBlend,this.map[Yw]=this.setOffset,this.map[Ww]=this.setCullFace,this.map[jw]=this.setDepthTest,this.map[qw]=this.setFrontFace,this.map[Kw]=this.setDepthMask,this.checks=[],this.defaultState=new Er,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Vw(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(iu.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(iu.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};im.extension={type:Z.RendererSystem,name:"state"};let Zw=im;ht.add(Zw);class Qw extends Xs{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(const s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ir(e)})}addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach(s=>{const n=i.find(o=>this._systemsHash[o]===s);s[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const hn=class ta{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=ta.defaultMaxIdle,this.checkCountMax=ta.defaultCheckCountMax,this.mode=ta.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==al.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let i=!1;for(let s=0;s<e.length;s++){const n=e[s];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[s]=null,i=!0)}if(i){let s=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[s++]=e[n]);e.length=s}}unload(t){const e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};hn.defaultMode=al.AUTO,hn.defaultMaxIdle=60*60,hn.defaultCheckCountMax=60*10,hn.extension={type:Z.RendererSystem,name:"textureGC"};let Li=hn;ht.add(Li);class Eh{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=ft.UNSIGNED_BYTE,this.internalFormat=z.RGBA,this.samplerType=0}}function Jw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:J.FLOAT,[r.RGBA]:J.FLOAT,[r.ALPHA]:J.FLOAT,[r.LUMINANCE]:J.FLOAT,[r.LUMINANCE_ALPHA]:J.FLOAT,[r.R8]:J.FLOAT,[r.R8_SNORM]:J.FLOAT,[r.RG8]:J.FLOAT,[r.RG8_SNORM]:J.FLOAT,[r.RGB8]:J.FLOAT,[r.RGB8_SNORM]:J.FLOAT,[r.RGB565]:J.FLOAT,[r.RGBA4]:J.FLOAT,[r.RGB5_A1]:J.FLOAT,[r.RGBA8]:J.FLOAT,[r.RGBA8_SNORM]:J.FLOAT,[r.RGB10_A2]:J.FLOAT,[r.RGB10_A2UI]:J.FLOAT,[r.SRGB8]:J.FLOAT,[r.SRGB8_ALPHA8]:J.FLOAT,[r.R16F]:J.FLOAT,[r.RG16F]:J.FLOAT,[r.RGB16F]:J.FLOAT,[r.RGBA16F]:J.FLOAT,[r.R32F]:J.FLOAT,[r.RG32F]:J.FLOAT,[r.RGB32F]:J.FLOAT,[r.RGBA32F]:J.FLOAT,[r.R11F_G11F_B10F]:J.FLOAT,[r.RGB9_E5]:J.FLOAT,[r.R8I]:J.INT,[r.R8UI]:J.UINT,[r.R16I]:J.INT,[r.R16UI]:J.UINT,[r.R32I]:J.INT,[r.R32UI]:J.UINT,[r.RG8I]:J.INT,[r.RG8UI]:J.UINT,[r.RG16I]:J.INT,[r.RG16UI]:J.UINT,[r.RG32I]:J.INT,[r.RG32UI]:J.UINT,[r.RGB8I]:J.INT,[r.RGB8UI]:J.UINT,[r.RGB16I]:J.INT,[r.RGB16UI]:J.UINT,[r.RGB32I]:J.INT,[r.RGB32UI]:J.UINT,[r.RGBA8I]:J.INT,[r.RGBA8UI]:J.UINT,[r.RGBA16I]:J.INT,[r.RGBA16UI]:J.UINT,[r.RGBA32I]:J.INT,[r.RGBA32UI]:J.UINT,[r.DEPTH_COMPONENT16]:J.FLOAT,[r.DEPTH_COMPONENT24]:J.FLOAT,[r.DEPTH_COMPONENT32F]:J.FLOAT,[r.DEPTH_STENCIL]:J.FLOAT,[r.DEPTH24_STENCIL8]:J.FLOAT,[r.DEPTH32F_STENCIL8]:J.FLOAT}:t={[r.RGB]:J.FLOAT,[r.RGBA]:J.FLOAT,[r.ALPHA]:J.FLOAT,[r.LUMINANCE]:J.FLOAT,[r.LUMINANCE_ALPHA]:J.FLOAT,[r.DEPTH_STENCIL]:J.FLOAT},t}function tA(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[ft.UNSIGNED_BYTE]:{[z.RGBA]:r.RGBA8,[z.RGB]:r.RGB8,[z.RG]:r.RG8,[z.RED]:r.R8,[z.RGBA_INTEGER]:r.RGBA8UI,[z.RGB_INTEGER]:r.RGB8UI,[z.RG_INTEGER]:r.RG8UI,[z.RED_INTEGER]:r.R8UI,[z.ALPHA]:r.ALPHA,[z.LUMINANCE]:r.LUMINANCE,[z.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ft.BYTE]:{[z.RGBA]:r.RGBA8_SNORM,[z.RGB]:r.RGB8_SNORM,[z.RG]:r.RG8_SNORM,[z.RED]:r.R8_SNORM,[z.RGBA_INTEGER]:r.RGBA8I,[z.RGB_INTEGER]:r.RGB8I,[z.RG_INTEGER]:r.RG8I,[z.RED_INTEGER]:r.R8I},[ft.UNSIGNED_SHORT]:{[z.RGBA_INTEGER]:r.RGBA16UI,[z.RGB_INTEGER]:r.RGB16UI,[z.RG_INTEGER]:r.RG16UI,[z.RED_INTEGER]:r.R16UI,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ft.SHORT]:{[z.RGBA_INTEGER]:r.RGBA16I,[z.RGB_INTEGER]:r.RGB16I,[z.RG_INTEGER]:r.RG16I,[z.RED_INTEGER]:r.R16I},[ft.UNSIGNED_INT]:{[z.RGBA_INTEGER]:r.RGBA32UI,[z.RGB_INTEGER]:r.RGB32UI,[z.RG_INTEGER]:r.RG32UI,[z.RED_INTEGER]:r.R32UI,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ft.INT]:{[z.RGBA_INTEGER]:r.RGBA32I,[z.RGB_INTEGER]:r.RGB32I,[z.RG_INTEGER]:r.RG32I,[z.RED_INTEGER]:r.R32I},[ft.FLOAT]:{[z.RGBA]:r.RGBA32F,[z.RGB]:r.RGB32F,[z.RG]:r.RG32F,[z.RED]:r.R32F,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ft.HALF_FLOAT]:{[z.RGBA]:r.RGBA16F,[z.RGB]:r.RGB16F,[z.RG]:r.RG16F,[z.RED]:r.R16F},[ft.UNSIGNED_SHORT_5_6_5]:{[z.RGB]:r.RGB565},[ft.UNSIGNED_SHORT_4_4_4_4]:{[z.RGBA]:r.RGBA4},[ft.UNSIGNED_SHORT_5_5_5_1]:{[z.RGBA]:r.RGB5_A1},[ft.UNSIGNED_INT_2_10_10_10_REV]:{[z.RGBA]:r.RGB10_A2,[z.RGBA_INTEGER]:r.RGB10_A2UI},[ft.UNSIGNED_INT_10F_11F_11F_REV]:{[z.RGB]:r.R11F_G11F_B10F},[ft.UNSIGNED_INT_5_9_9_9_REV]:{[z.RGB]:r.RGB9_E5},[ft.UNSIGNED_INT_24_8]:{[z.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ft.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[z.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[ft.UNSIGNED_BYTE]:{[z.RGBA]:r.RGBA,[z.RGB]:r.RGB,[z.ALPHA]:r.ALPHA,[z.LUMINANCE]:r.LUMINANCE,[z.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ft.UNSIGNED_SHORT_5_6_5]:{[z.RGB]:r.RGB},[ft.UNSIGNED_SHORT_4_4_4_4]:{[z.RGBA]:r.RGBA},[ft.UNSIGNED_SHORT_5_5_5_1]:{[z.RGBA]:r.RGBA}},t}class sm{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new _t,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=tA(t),this.samplerTypes=Jw(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};const i=new Eh(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Eh(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){const{gl:i}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let n=t-1;n>=0;--n){const o=e[n];o&&o._glTextures[s].samplerType!==J.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Eh(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var i;e.internalFormat=((i=this.internalFormats[t.type])==null?void 0:i[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??J.FLOAT,this.webGLVersion===2&&t.type===ft.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var s;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),(s=t.resource)==null?void 0:s.upload(i,t,e))e.samplerType!==J.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(e.width!==n||e.height!==o||e.dirtyId<0)&&(e.width=n,e.height=o,a.texImage2D(t.target,0,e.internalFormat,n,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const s=this.managedTextures.indexOf(t);s!==-1&&ps(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===pr.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Qr.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==pr.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Ir.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Ir.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Ir.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Ir.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}sm.extension={type:Z.RendererSystem,name:"texture"},ht.add(sm);class nm{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:s}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[s]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&n.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}nm.extension={type:Z.RendererSystem,name:"transformFeedback"},ht.add(nm);class Co{constructor(t){this.renderer=t}init(t){this.screen=new xt(0,0,t.width,t.height),this.element=t.view||tt.ADAPTER.createCanvas(),this.resolution=t.resolution||tt.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Co.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Co.extension={type:[Z.RendererSystem,Z.CanvasRendererSystem],name:"_view"},ht.add(Co),tt.PREFER_ENV=xi.WEBGL2,tt.STRICT_TEXTURE_CACHE=!1,tt.RENDER_OPTIONS={...Eo.defaultOptions,...bo.defaultOptions,...Co.defaultOptions,...So.defaultOptions},Object.defineProperties(tt,{WRAP_MODE:{get(){return _t.defaultOptions.wrapMode},set(r){At("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),_t.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return _t.defaultOptions.scaleMode},set(r){At("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),_t.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return _t.defaultOptions.mipmap},set(r){At("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),_t.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return _t.defaultOptions.anisotropicLevel},set(r){At("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),_t.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return At("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Be.defaultResolution},set(r){Be.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return At("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Be.defaultMultisample},set(r){Be.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Oi.defaultMaxTextures},set(r){At("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Oi.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Oi.defaultBatchSize},set(r){At("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Oi.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Oi.canUploadSameBuffer},set(r){At("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Oi.canUploadSameBuffer=r}},GC_MODE:{get(){return Li.defaultMode},set(r){At("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Li.defaultMode=r}},GC_MAX_IDLE:{get(){return Li.defaultMaxIdle},set(r){At("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Li.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Li.defaultCheckCountMax},set(r){At("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Li.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Br.defaultVertexPrecision},set(r){At("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Br.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Br.defaultFragmentPrecision},set(r){At("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Br.defaultFragmentPrecision=r}}});var Bi=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Bi||{});class Th{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const om=class Ve{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 Th(null,null,1/0),this.deltaMS=1/Ve.targetFPMS,this.elapsedMS=1/Ve.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,e,i=Bi.NORMAL){return this._addListener(new Th(t,e,i))}addOnce(t,e,i=Bi.NORMAL){return this._addListener(new Th(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.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 e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ve.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,Ve.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ve._shared){const t=Ve._shared=new Ve;t.autoStart=!0,t._protected=!0}return Ve._shared}static get system(){if(!Ve._system){const t=Ve._system=new Ve;t.autoStart=!0,t._protected=!0}return Ve._system}};om.targetFPMS=.06;let Xe=om;Object.defineProperties(tt,{TARGET_FPMS:{get(){return Xe.targetFPMS},set(r){At("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Xe.targetFPMS=r}}});class am{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Bi.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Xe.shared:new Xe,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}am.extension=Z.Application,ht.add(am);const lm=[];ht.handleByList(Z.Renderer,lm);function hm(r){for(const t of lm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var eA=`attribute vec2 aVertexPosition;
491
+ `))}}let Xw=0;const Ao={textureCount:0,uboCount:0};class rm{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Xw++}systemCheck(){if(!pw())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(Ao.textureCount=0,Ao.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ao)),s}setUniforms(t){const e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=hw(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,Ao,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=$w(t,this.shader.program.uniformData)),t.autoManage){const l=new Float32Array(a.size/4);t.buffer.update(l)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,s=Fw(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}rm.extension={type:Z.RendererSystem,name:"shader"},ht.add(rm);class So{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}So.defaultOptions={hello:!1},So.extension={type:[Z.RendererSystem,Z.CanvasRendererSystem],name:"startup"},ht.add(So);function Vw(r,t=[]){return t[yt.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.ADD]=[r.ONE,r.ONE],t[yt.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.NONE]=[0,0],t[yt.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[yt.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[yt.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[yt.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[yt.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[yt.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[yt.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[yt.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[yt.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[yt.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[yt.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const zw=0,Yw=1,Ww=2,jw=3,qw=4,Kw=5,im=class iu{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=yt.NONE,this._blendEq=!1,this.map=[],this.map[zw]=this.setBlend,this.map[Yw]=this.setOffset,this.map[Ww]=this.setCullFace,this.map[jw]=this.setDepthTest,this.map[qw]=this.setFrontFace,this.map[Kw]=this.setDepthMask,this.checks=[],this.defaultState=new Er,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Vw(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(iu.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(iu.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};im.extension={type:Z.RendererSystem,name:"state"};let Zw=im;ht.add(Zw);class Qw extends Xs{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(const s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ir(e)})}addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach(s=>{const n=i.find(o=>this._systemsHash[o]===s);s[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const hn=class ta{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=ta.defaultMaxIdle,this.checkCountMax=ta.defaultCheckCountMax,this.mode=ta.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==al.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let i=!1;for(let s=0;s<e.length;s++){const n=e[s];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[s]=null,i=!0)}if(i){let s=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[s++]=e[n]);e.length=s}}unload(t){const e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};hn.defaultMode=al.AUTO,hn.defaultMaxIdle=60*60,hn.defaultCheckCountMax=60*10,hn.extension={type:Z.RendererSystem,name:"textureGC"};let Li=hn;ht.add(Li);class Eh{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=ft.UNSIGNED_BYTE,this.internalFormat=z.RGBA,this.samplerType=0}}function Jw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:J.FLOAT,[r.RGBA]:J.FLOAT,[r.ALPHA]:J.FLOAT,[r.LUMINANCE]:J.FLOAT,[r.LUMINANCE_ALPHA]:J.FLOAT,[r.R8]:J.FLOAT,[r.R8_SNORM]:J.FLOAT,[r.RG8]:J.FLOAT,[r.RG8_SNORM]:J.FLOAT,[r.RGB8]:J.FLOAT,[r.RGB8_SNORM]:J.FLOAT,[r.RGB565]:J.FLOAT,[r.RGBA4]:J.FLOAT,[r.RGB5_A1]:J.FLOAT,[r.RGBA8]:J.FLOAT,[r.RGBA8_SNORM]:J.FLOAT,[r.RGB10_A2]:J.FLOAT,[r.RGB10_A2UI]:J.FLOAT,[r.SRGB8]:J.FLOAT,[r.SRGB8_ALPHA8]:J.FLOAT,[r.R16F]:J.FLOAT,[r.RG16F]:J.FLOAT,[r.RGB16F]:J.FLOAT,[r.RGBA16F]:J.FLOAT,[r.R32F]:J.FLOAT,[r.RG32F]:J.FLOAT,[r.RGB32F]:J.FLOAT,[r.RGBA32F]:J.FLOAT,[r.R11F_G11F_B10F]:J.FLOAT,[r.RGB9_E5]:J.FLOAT,[r.R8I]:J.INT,[r.R8UI]:J.UINT,[r.R16I]:J.INT,[r.R16UI]:J.UINT,[r.R32I]:J.INT,[r.R32UI]:J.UINT,[r.RG8I]:J.INT,[r.RG8UI]:J.UINT,[r.RG16I]:J.INT,[r.RG16UI]:J.UINT,[r.RG32I]:J.INT,[r.RG32UI]:J.UINT,[r.RGB8I]:J.INT,[r.RGB8UI]:J.UINT,[r.RGB16I]:J.INT,[r.RGB16UI]:J.UINT,[r.RGB32I]:J.INT,[r.RGB32UI]:J.UINT,[r.RGBA8I]:J.INT,[r.RGBA8UI]:J.UINT,[r.RGBA16I]:J.INT,[r.RGBA16UI]:J.UINT,[r.RGBA32I]:J.INT,[r.RGBA32UI]:J.UINT,[r.DEPTH_COMPONENT16]:J.FLOAT,[r.DEPTH_COMPONENT24]:J.FLOAT,[r.DEPTH_COMPONENT32F]:J.FLOAT,[r.DEPTH_STENCIL]:J.FLOAT,[r.DEPTH24_STENCIL8]:J.FLOAT,[r.DEPTH32F_STENCIL8]:J.FLOAT}:t={[r.RGB]:J.FLOAT,[r.RGBA]:J.FLOAT,[r.ALPHA]:J.FLOAT,[r.LUMINANCE]:J.FLOAT,[r.LUMINANCE_ALPHA]:J.FLOAT,[r.DEPTH_STENCIL]:J.FLOAT},t}function tA(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[ft.UNSIGNED_BYTE]:{[z.RGBA]:r.RGBA8,[z.RGB]:r.RGB8,[z.RG]:r.RG8,[z.RED]:r.R8,[z.RGBA_INTEGER]:r.RGBA8UI,[z.RGB_INTEGER]:r.RGB8UI,[z.RG_INTEGER]:r.RG8UI,[z.RED_INTEGER]:r.R8UI,[z.ALPHA]:r.ALPHA,[z.LUMINANCE]:r.LUMINANCE,[z.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ft.BYTE]:{[z.RGBA]:r.RGBA8_SNORM,[z.RGB]:r.RGB8_SNORM,[z.RG]:r.RG8_SNORM,[z.RED]:r.R8_SNORM,[z.RGBA_INTEGER]:r.RGBA8I,[z.RGB_INTEGER]:r.RGB8I,[z.RG_INTEGER]:r.RG8I,[z.RED_INTEGER]:r.R8I},[ft.UNSIGNED_SHORT]:{[z.RGBA_INTEGER]:r.RGBA16UI,[z.RGB_INTEGER]:r.RGB16UI,[z.RG_INTEGER]:r.RG16UI,[z.RED_INTEGER]:r.R16UI,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ft.SHORT]:{[z.RGBA_INTEGER]:r.RGBA16I,[z.RGB_INTEGER]:r.RGB16I,[z.RG_INTEGER]:r.RG16I,[z.RED_INTEGER]:r.R16I},[ft.UNSIGNED_INT]:{[z.RGBA_INTEGER]:r.RGBA32UI,[z.RGB_INTEGER]:r.RGB32UI,[z.RG_INTEGER]:r.RG32UI,[z.RED_INTEGER]:r.R32UI,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ft.INT]:{[z.RGBA_INTEGER]:r.RGBA32I,[z.RGB_INTEGER]:r.RGB32I,[z.RG_INTEGER]:r.RG32I,[z.RED_INTEGER]:r.R32I},[ft.FLOAT]:{[z.RGBA]:r.RGBA32F,[z.RGB]:r.RGB32F,[z.RG]:r.RG32F,[z.RED]:r.R32F,[z.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ft.HALF_FLOAT]:{[z.RGBA]:r.RGBA16F,[z.RGB]:r.RGB16F,[z.RG]:r.RG16F,[z.RED]:r.R16F},[ft.UNSIGNED_SHORT_5_6_5]:{[z.RGB]:r.RGB565},[ft.UNSIGNED_SHORT_4_4_4_4]:{[z.RGBA]:r.RGBA4},[ft.UNSIGNED_SHORT_5_5_5_1]:{[z.RGBA]:r.RGB5_A1},[ft.UNSIGNED_INT_2_10_10_10_REV]:{[z.RGBA]:r.RGB10_A2,[z.RGBA_INTEGER]:r.RGB10_A2UI},[ft.UNSIGNED_INT_10F_11F_11F_REV]:{[z.RGB]:r.R11F_G11F_B10F},[ft.UNSIGNED_INT_5_9_9_9_REV]:{[z.RGB]:r.RGB9_E5},[ft.UNSIGNED_INT_24_8]:{[z.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ft.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[z.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[ft.UNSIGNED_BYTE]:{[z.RGBA]:r.RGBA,[z.RGB]:r.RGB,[z.ALPHA]:r.ALPHA,[z.LUMINANCE]:r.LUMINANCE,[z.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ft.UNSIGNED_SHORT_5_6_5]:{[z.RGB]:r.RGB},[ft.UNSIGNED_SHORT_4_4_4_4]:{[z.RGBA]:r.RGBA},[ft.UNSIGNED_SHORT_5_5_5_1]:{[z.RGBA]:r.RGBA}},t}class sm{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new _t,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=tA(t),this.samplerTypes=Jw(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};const i=new Eh(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Eh(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){const{gl:i}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let n=t-1;n>=0;--n){const o=e[n];o&&o._glTextures[s].samplerType!==J.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Eh(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var i;e.internalFormat=((i=this.internalFormats[t.type])==null?void 0:i[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??J.FLOAT,this.webGLVersion===2&&t.type===ft.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var s;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),(s=t.resource)==null?void 0:s.upload(i,t,e))e.samplerType!==J.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(e.width!==n||e.height!==o||e.dirtyId<0)&&(e.width=n,e.height=o,a.texImage2D(t.target,0,e.internalFormat,n,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const s=this.managedTextures.indexOf(t);s!==-1&&ps(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===pr.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Qr.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==pr.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Ir.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Ir.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Ir.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Ir.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}sm.extension={type:Z.RendererSystem,name:"texture"},ht.add(sm);class nm{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:s}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[s]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&n.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}nm.extension={type:Z.RendererSystem,name:"transformFeedback"},ht.add(nm);class Co{constructor(t){this.renderer=t}init(t){this.screen=new xt(0,0,t.width,t.height),this.element=t.view||tt.ADAPTER.createCanvas(),this.resolution=t.resolution||tt.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Co.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Co.extension={type:[Z.RendererSystem,Z.CanvasRendererSystem],name:"_view"},ht.add(Co),tt.PREFER_ENV=xi.WEBGL2,tt.STRICT_TEXTURE_CACHE=!1,tt.RENDER_OPTIONS={...Eo.defaultOptions,...bo.defaultOptions,...Co.defaultOptions,...So.defaultOptions},Object.defineProperties(tt,{WRAP_MODE:{get(){return _t.defaultOptions.wrapMode},set(r){St("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),_t.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return _t.defaultOptions.scaleMode},set(r){St("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),_t.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return _t.defaultOptions.mipmap},set(r){St("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),_t.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return _t.defaultOptions.anisotropicLevel},set(r){St("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),_t.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return St("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Be.defaultResolution},set(r){Be.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return St("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Be.defaultMultisample},set(r){Be.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Oi.defaultMaxTextures},set(r){St("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Oi.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Oi.defaultBatchSize},set(r){St("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Oi.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Oi.canUploadSameBuffer},set(r){St("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Oi.canUploadSameBuffer=r}},GC_MODE:{get(){return Li.defaultMode},set(r){St("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Li.defaultMode=r}},GC_MAX_IDLE:{get(){return Li.defaultMaxIdle},set(r){St("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Li.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Li.defaultCheckCountMax},set(r){St("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Li.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Br.defaultVertexPrecision},set(r){St("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Br.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Br.defaultFragmentPrecision},set(r){St("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Br.defaultFragmentPrecision=r}}});var Bi=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Bi||{});class Th{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const om=class Ve{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 Th(null,null,1/0),this.deltaMS=1/Ve.targetFPMS,this.elapsedMS=1/Ve.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,e,i=Bi.NORMAL){return this._addListener(new Th(t,e,i))}addOnce(t,e,i=Bi.NORMAL){return this._addListener(new Th(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.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 e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ve.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,Ve.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ve._shared){const t=Ve._shared=new Ve;t.autoStart=!0,t._protected=!0}return Ve._shared}static get system(){if(!Ve._system){const t=Ve._system=new Ve;t.autoStart=!0,t._protected=!0}return Ve._system}};om.targetFPMS=.06;let Xe=om;Object.defineProperties(tt,{TARGET_FPMS:{get(){return Xe.targetFPMS},set(r){St("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Xe.targetFPMS=r}}});class am{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Bi.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Xe.shared:new Xe,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}am.extension=Z.Application,ht.add(am);const lm=[];ht.handleByList(Z.Renderer,lm);function hm(r){for(const t of lm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var eA=`attribute vec2 aVertexPosition;
492
492
  attribute vec2 aTextureCoord;
493
493
 
494
494
  uniform mat3 projectionMatrix;
@@ -525,7 +525,7 @@ void main(void)
525
525
  gl_Position = filterVertexPosition();
526
526
  vTextureCoord = filterTextureCoord();
527
527
  }
528
- `;const iA=eA,um=rA;class cm{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=ae.HIGH?this.multisample=ae.HIGH:e>=ae.MEDIUM?this.multisample=ae.MEDIUM:e>=ae.LOW?this.multisample=ae.LOW:this.multisample=ae.NONE}destroy(){}}cm.extension={type:Z.RendererSystem,name:"_multisample"},ht.add(cm);class sA{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class dm{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,i){const{gl:s,CONTEXT_UID:n}=this;i=i||0;const o=t._glBuffers[n]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,o.buffer,i*256,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new sA(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}dm.extension={type:Z.RendererSystem,name:"buffer"},ht.add(dm);class fm{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let s,n,o,a;if(e&&(s=e.renderTexture,n=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){const l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}fm.extension={type:Z.RendererSystem,name:"objectRenderer"},ht.add(fm);const Io=class su extends Qw{constructor(t){super(),this.type=Ld.WEBGL,t=Object.assign({},tt.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new sr({projectionMatrix:new kt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:su.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(At("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=su.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:IT()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return At("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return At("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return At("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return At("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){At("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return At("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){At("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return At("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Io.extension={type:Z.Renderer,priority:1},Io.__plugins={},Io.__systems={};let wh=Io;ht.handleByMap(Z.RendererPlugin,wh.__plugins),ht.handleByMap(Z.RendererSystem,wh.__systems),ht.add(wh);class pm extends nn{constructor(t,e){const{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new _t;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof nn?this.addResourceAt(t[i],i):this.addResourceAt(xp(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}}class nA extends pm{constructor(t,e){const{width:i,height:s}=e||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{width:i,height:s}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=rs.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:s,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let l=0;l<s;l++){const h=o[l];n[l]<h.dirtyId&&(n[l]=h.dirtyId,h.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,h.resource.width,h.resource.height,1,e.format,i.type,h.resource.source))}return!0}}class oA extends Fr{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const mm=class yn extends pm{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==yn.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<yn.SIDES;a++)this.items[a].target=rs.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=rs.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=rs.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){const s=this.itemDirtyIds;for(let n=0;n<yn.SIDES;n++){const o=this.items[n];(s[n]<o.dirtyId||i.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,i),s[n]=o.dirtyId):s[n]<-1&&(t.gl.texImage2D(o.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===yn.SIDES}};mm.SIDES=6;let aA=mm;class ys extends Fr{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=ys.EMPTY,s=t,n=!0):(i=t,s=null,n=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const i=await tt.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===He.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return ys._EMPTY=ys._EMPTY??tt.ADAPTER.createCanvas(0,0),ys._EMPTY}}const Ah=class ea extends Fr{constructor(t,e){e=e||{},super(tt.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},ea.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const t=new Image;Fr.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,n=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),n=Math.round(n);const o=this.source;o.width=s,o.height=n,o._pixiId=`canvas_${Si()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=ea.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&ea.SVG_XML.test(t)}};Ah.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Ah.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Sh=Ah;class lA extends Fr{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const Ch=class nu extends Fr{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const s=t[0].src||t[0];Fr.crossOrigin(i,s,e.crossorigin);for(let n=0;n<t.length;++n){const o=document.createElement("source");let{src:a,mime:l}=t[n];if(a=a||t[n],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const h=a.split("?").shift().toLowerCase(),u=h.slice(h.lastIndexOf(".")+1);l=l||nu.MIME_TYPES[u]||`video/${u}`}o.src=a,l&&(o.type=l),i.appendChild(o)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,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._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=Xe.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;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._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;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._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}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.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(Xe.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Xe.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Xe.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||nu.TYPES.includes(e)}};Ch.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ch.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let gm=Ch;lh.push(ys,Lp,oA,gm,lA,Sh,lo,aA,nA);class Ro{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?xt.EMPTY:(t=t||new xt(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:i,b:s,c:n,d:o,tx:a,ty:l}=t,h=i*e.x+n*e.y+a,u=s*e.x+o*e.y+l;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,i=this.minY,s=this.maxX,n=this.maxY,o=t[0],a=t[1];e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[2],a=t[3],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[4],a=t[5],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[6],a=t[7],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,this.minX=e,this.minY=i,this.maxX=s,this.maxY=n}addFrame(t,e,i,s,n){this.addFrameMatrix(t.worldTransform,e,i,s,n)}addFrameMatrix(t,e,i,s,n){const o=t.a,a=t.b,l=t.c,h=t.d,u=t.tx,c=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,_=o*e+l*i+u,y=a*e+h*i+c;d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=o*s+l*i+u,y=a*s+h*i+c,d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=o*e+l*n+u,y=a*e+h*n+c,d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=o*s+l*n+u,y=a*s+h*n+c,d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,i){let s=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let l=e;l<i;l+=2){const h=t[l],u=t[l+1];s=h<s?h:s,n=u<n?u:n,o=h>o?h:o,a=u>a?u:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,e,i,s){this.addVerticesMatrix(t.worldTransform,e,i,s)}addVerticesMatrix(t,e,i,s,n=0,o=n){const a=t.a,l=t.b,h=t.c,u=t.d,c=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,_=this.maxY;for(let y=i;y<s;y+=2){const v=e[y],g=e[y+1],x=a*v+h*g+c,E=u*g+l*v+d;f=Math.min(f,x-n),m=Math.max(m,x+n),p=Math.min(p,E-o),_=Math.max(_,E+o)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=_}addBounds(t){const e=this.minX,i=this.minY,s=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>s?t.maxX:s,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,s=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,o=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&s<=o){const a=this.minX,l=this.minY,h=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<l?s:l,this.maxX=n>h?n:h,this.maxY=o>u?o:u}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=t.minX>e.x?t.minX:e.x,s=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&s<=o){const a=this.minX,l=this.minY,h=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<l?s:l,this.maxX=n>h?n:h,this.maxY=o>u?o:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,s,n,o){t-=n,e-=o,i+=n,s+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>s?this.maxY:s}}class Wt extends Xs{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new fh,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Ro,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const s=e[i];Object.defineProperty(Wt.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new xt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new xt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Ro);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const s=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=s,this._bounds.updateID+=this._boundsID-n,o}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,s){return e&&(t=e.toGlobal(t,i,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,i=1,s=1,n=0,o=0,a=0,l=0,h=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=s||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=l,this.pivot.y=h,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new hA),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*rw}set angle(t){this.transform.rotation=t*iw}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class hA extends Wt{constructor(){super(...arguments),this.sortDirty=null}}Wt.prototype.displayObjectUpdateTransform=Wt.prototype.updateTransform;const uA=new kt;function cA(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const ym=class ou extends Wt{constructor(){super(),this.children=[],this.sortableChildren=ou.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const i=this.getChildIndex(t),s=this.getChildIndex(e);this.children[i]=e,this.children[s]=t,this.onChildrenChange(i<s?i:s)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(t);ps(this.children,i,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],i=this.children.indexOf(e);if(i===-1)return null;e.parent=null,e.transform._parentID=-1,ps(this.children,i,1),this._boundsID++,this.onChildrenChange(i),e.emit("removed",this),this.emit("childRemoved",e,this,i)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,ps(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const i=t,s=e,n=s-i;let o;if(n>0&&n<=s){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,i=this.children.length;e<i;++e){const s=this.children[e];s._lastSortedIndex=e,!t&&s.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(cA),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const i=this.children[t];i.visible&&i.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(!(!e.visible||!e.renderable))if(e.calculateBounds(),e._mask){const i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const i=super.getLocalBounds(t);if(!e)for(let s=0,n=this.children.length;s<n;++s){const o=this.children[s];o.visible&&o.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==ou.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=uA.copyFrom(s),s.prepend(n)):s=n),i&&e.intersects(i,s))this._render(t);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const l=this.children[o],h=l.cullable;l.cullable=h||!this.cullArea,l.render(t),l.cullable=h}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let i=0,s=this.children.length;i<s;++i)this.children[i].render(t)}}renderAdvanced(t){var n,o,a;const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let l=0;l<e.length;l++)e[l].enabled&&this._enabledFilters.push(e[l])}const s=e&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==he.NONE));if(s&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.length)&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let l=0,h=this.children.length;l<h;++l)this.children[l].render(t)}s&&t.batch.flush(),i&&t.mask.pop(this),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,i=this.removeChildren(0,this.children.length);if(e)for(let s=0;s<i.length;++s)i[s].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};ym.defaultSortableChildren=!1;let nr=ym;nr.prototype.containerUpdateTransform=nr.prototype.updateTransform,Object.defineProperties(tt,{SORTABLE_CHILDREN:{get(){return nr.defaultSortableChildren},set(r){At("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),nr.defaultSortableChildren=r}}});const un=new It,dA=new Uint16Array([0,1,2,0,2,3]);class _s extends nr{constructor(t){super(),this._anchor=new Lr(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new Ot(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=yt.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||ut.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=dA,this.pluginName="batch",this.isSprite=!0,this._roundPixels=tt.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=ei(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=ei(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,l=e.ty,h=this.vertexData,u=t.trim,c=t.orig,d=this._anchor;let f=0,p=0,m=0,_=0;if(u?(p=u.x-d._x*c.width,f=p+u.width,_=u.y-d._y*c.height,m=_+u.height):(p=-d._x*c.width,f=p+c.width,_=-d._y*c.height,m=_+c.height),h[0]=i*p+n*_+a,h[1]=o*_+s*p+l,h[2]=i*f+n*_+a,h[3]=o*_+s*f+l,h[4]=i*f+n*m+a,h[5]=o*m+s*f+l,h[6]=i*p+n*m+a,h[7]=o*m+s*p+l,this._roundPixels){const y=tt.RESOLUTION;for(let v=0;v<h.length;++v)h[v]=Math.round(h[v]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,i=t.orig,s=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,l=n.c,h=n.d,u=n.tx,c=n.ty,d=-s._x*i.width,f=d+i.width,p=-s._y*i.height,m=p+i.height;if(e[0]=o*d+l*p+u,e[1]=h*p+a*d+c,e[2]=o*f+l*p+u,e[3]=h*p+a*f+c,e[4]=o*f+l*m+u,e[5]=h*m+a*f+c,e[6]=o*d+l*m+u,e[7]=h*m+a*d+c,this._roundPixels){const _=tt.RESOLUTION;for(let y=0;y<e.length;++y)e[y]=Math.round(e[y]*_)/_}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new Ro),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new xt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,un);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return un.x>=s&&un.x<s+e&&(n=-i*this.anchor.y,un.y>=n&&un.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const i=t instanceof ut?t:ut.from(t,e);return new _s(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=ei(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=ei(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||ut.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const _m=new kt;Wt.prototype._cacheAsBitmap=!1,Wt.prototype._cacheData=null,Wt.prototype._cacheAsBitmapResolution=null,Wt.prototype._cacheAsBitmapMultisample=null;class fA{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(Wt.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let t;r?(this._cacheData||(this._cacheData=new fA),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),Wt.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))},Wt.prototype._initCachedDisplayObject=function(r){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new xt,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const i=this.cacheAsBitmapResolution||r.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const s=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,l=Ni.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),h=`cacheAsBitmap_${Si()}`;this._cacheData.textureCacheId=h,_t.addToCache(l.baseTexture,h),ut.addToCache(l,h);const u=this.transform.localTransform.copyTo(_m).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:l,clear:!0,transform:u,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=a,r.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const c=new _s(l);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(e.x/e.width),c.anchor.y=-(e.y/e.height),c.alpha=t,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},Wt.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))},Wt.prototype._initCachedDisplayObjectCanvas=function(r){var u;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.getLocalBounds(new xt,!0),e=this.alpha;this.alpha=1;const i=r.canvasContext.activeContext,s=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const o=Ni.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${Si()}`;this._cacheData.textureCacheId=a,_t.addToCache(o.baseTexture,a),ut.addToCache(o,a);const l=_m;this.transform.localTransform.copyTo(l),l.invert(),l.tx-=t.x,l.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,clear:!0,transform:l,skipUpdateTransform:!1}),r.canvasContext.activeContext=i,r._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const h=new _s(o);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-(t.x/t.width),h.anchor.y=-(t.y/t.height),h.alpha=e,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)},Wt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Wt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Wt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,_t.removeFromCache(this._cacheData.textureCacheId),ut.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Wt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Wt.prototype.name=null,nr.prototype.getChildByName=function(r,t){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===r)return this.children[e];if(t)for(let e=0,i=this.children.length;e<i;e++){const s=this.children[e];if(!s.getChildByName)continue;const n=s.getChildByName(r,!0);if(n)return n}return null},Wt.prototype.getGlobalPosition=function(r=new It,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var pA=`varying vec2 vTextureCoord;
528
+ `;const iA=eA,um=rA;class cm{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=ae.HIGH?this.multisample=ae.HIGH:e>=ae.MEDIUM?this.multisample=ae.MEDIUM:e>=ae.LOW?this.multisample=ae.LOW:this.multisample=ae.NONE}destroy(){}}cm.extension={type:Z.RendererSystem,name:"_multisample"},ht.add(cm);class sA{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class dm{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,i){const{gl:s,CONTEXT_UID:n}=this;i=i||0;const o=t._glBuffers[n]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,o.buffer,i*256,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new sA(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}dm.extension={type:Z.RendererSystem,name:"buffer"},ht.add(dm);class fm{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let s,n,o,a;if(e&&(s=e.renderTexture,n=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){const l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}fm.extension={type:Z.RendererSystem,name:"objectRenderer"},ht.add(fm);const Io=class su extends Qw{constructor(t){super(),this.type=Ld.WEBGL,t=Object.assign({},tt.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new sr({projectionMatrix:new kt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:su.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(St("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=su.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:IT()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return St("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return St("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return St("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return St("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){St("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return St("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){St("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return St("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Io.extension={type:Z.Renderer,priority:1},Io.__plugins={},Io.__systems={};let wh=Io;ht.handleByMap(Z.RendererPlugin,wh.__plugins),ht.handleByMap(Z.RendererSystem,wh.__systems),ht.add(wh);class pm extends nn{constructor(t,e){const{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new _t;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof nn?this.addResourceAt(t[i],i):this.addResourceAt(xp(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}}class nA extends pm{constructor(t,e){const{width:i,height:s}=e||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{width:i,height:s}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=rs.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:s,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let l=0;l<s;l++){const h=o[l];n[l]<h.dirtyId&&(n[l]=h.dirtyId,h.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,h.resource.width,h.resource.height,1,e.format,i.type,h.resource.source))}return!0}}class oA extends Fr{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const mm=class yn extends pm{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==yn.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<yn.SIDES;a++)this.items[a].target=rs.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=rs.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=rs.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){const s=this.itemDirtyIds;for(let n=0;n<yn.SIDES;n++){const o=this.items[n];(s[n]<o.dirtyId||i.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,i),s[n]=o.dirtyId):s[n]<-1&&(t.gl.texImage2D(o.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===yn.SIDES}};mm.SIDES=6;let aA=mm;class ys extends Fr{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=ys.EMPTY,s=t,n=!0):(i=t,s=null,n=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const i=await tt.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===He.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return ys._EMPTY=ys._EMPTY??tt.ADAPTER.createCanvas(0,0),ys._EMPTY}}const Ah=class ea extends Fr{constructor(t,e){e=e||{},super(tt.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},ea.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const t=new Image;Fr.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,n=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),n=Math.round(n);const o=this.source;o.width=s,o.height=n,o._pixiId=`canvas_${Si()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=ea.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&ea.SVG_XML.test(t)}};Ah.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Ah.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Sh=Ah;class lA extends Fr{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const Ch=class nu extends Fr{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const s=t[0].src||t[0];Fr.crossOrigin(i,s,e.crossorigin);for(let n=0;n<t.length;++n){const o=document.createElement("source");let{src:a,mime:l}=t[n];if(a=a||t[n],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const h=a.split("?").shift().toLowerCase(),u=h.slice(h.lastIndexOf(".")+1);l=l||nu.MIME_TYPES[u]||`video/${u}`}o.src=a,l&&(o.type=l),i.appendChild(o)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,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._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=Xe.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;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._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;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._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}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.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(Xe.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Xe.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Xe.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||nu.TYPES.includes(e)}};Ch.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ch.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let gm=Ch;lh.push(ys,Lp,oA,gm,lA,Sh,lo,aA,nA);class Ro{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?xt.EMPTY:(t=t||new xt(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:i,b:s,c:n,d:o,tx:a,ty:l}=t,h=i*e.x+n*e.y+a,u=s*e.x+o*e.y+l;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,i=this.minY,s=this.maxX,n=this.maxY,o=t[0],a=t[1];e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[2],a=t[3],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[4],a=t[5],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[6],a=t[7],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,this.minX=e,this.minY=i,this.maxX=s,this.maxY=n}addFrame(t,e,i,s,n){this.addFrameMatrix(t.worldTransform,e,i,s,n)}addFrameMatrix(t,e,i,s,n){const o=t.a,a=t.b,l=t.c,h=t.d,u=t.tx,c=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,_=o*e+l*i+u,y=a*e+h*i+c;d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=o*s+l*i+u,y=a*s+h*i+c,d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=o*e+l*n+u,y=a*e+h*n+c,d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=o*s+l*n+u,y=a*s+h*n+c,d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,i){let s=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let l=e;l<i;l+=2){const h=t[l],u=t[l+1];s=h<s?h:s,n=u<n?u:n,o=h>o?h:o,a=u>a?u:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,e,i,s){this.addVerticesMatrix(t.worldTransform,e,i,s)}addVerticesMatrix(t,e,i,s,n=0,o=n){const a=t.a,l=t.b,h=t.c,u=t.d,c=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,_=this.maxY;for(let y=i;y<s;y+=2){const v=e[y],g=e[y+1],x=a*v+h*g+c,E=u*g+l*v+d;f=Math.min(f,x-n),m=Math.max(m,x+n),p=Math.min(p,E-o),_=Math.max(_,E+o)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=_}addBounds(t){const e=this.minX,i=this.minY,s=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>s?t.maxX:s,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,s=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,o=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&s<=o){const a=this.minX,l=this.minY,h=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<l?s:l,this.maxX=n>h?n:h,this.maxY=o>u?o:u}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=t.minX>e.x?t.minX:e.x,s=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&s<=o){const a=this.minX,l=this.minY,h=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<l?s:l,this.maxX=n>h?n:h,this.maxY=o>u?o:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,s,n,o){t-=n,e-=o,i+=n,s+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>s?this.maxY:s}}class Wt extends Xs{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new fh,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Ro,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const s=e[i];Object.defineProperty(Wt.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new xt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new xt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Ro);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const s=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=s,this._bounds.updateID+=this._boundsID-n,o}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,s){return e&&(t=e.toGlobal(t,i,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,i=1,s=1,n=0,o=0,a=0,l=0,h=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=s||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=l,this.pivot.y=h,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new hA),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*rw}set angle(t){this.transform.rotation=t*iw}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class hA extends Wt{constructor(){super(...arguments),this.sortDirty=null}}Wt.prototype.displayObjectUpdateTransform=Wt.prototype.updateTransform;const uA=new kt;function cA(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const ym=class ou extends Wt{constructor(){super(),this.children=[],this.sortableChildren=ou.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const i=this.getChildIndex(t),s=this.getChildIndex(e);this.children[i]=e,this.children[s]=t,this.onChildrenChange(i<s?i:s)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(t);ps(this.children,i,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],i=this.children.indexOf(e);if(i===-1)return null;e.parent=null,e.transform._parentID=-1,ps(this.children,i,1),this._boundsID++,this.onChildrenChange(i),e.emit("removed",this),this.emit("childRemoved",e,this,i)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,ps(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const i=t,s=e,n=s-i;let o;if(n>0&&n<=s){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,i=this.children.length;e<i;++e){const s=this.children[e];s._lastSortedIndex=e,!t&&s.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(cA),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const i=this.children[t];i.visible&&i.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(!(!e.visible||!e.renderable))if(e.calculateBounds(),e._mask){const i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const i=super.getLocalBounds(t);if(!e)for(let s=0,n=this.children.length;s<n;++s){const o=this.children[s];o.visible&&o.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==ou.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=uA.copyFrom(s),s.prepend(n)):s=n),i&&e.intersects(i,s))this._render(t);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const l=this.children[o],h=l.cullable;l.cullable=h||!this.cullArea,l.render(t),l.cullable=h}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let i=0,s=this.children.length;i<s;++i)this.children[i].render(t)}}renderAdvanced(t){var n,o,a;const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let l=0;l<e.length;l++)e[l].enabled&&this._enabledFilters.push(e[l])}const s=e&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==he.NONE));if(s&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.length)&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let l=0,h=this.children.length;l<h;++l)this.children[l].render(t)}s&&t.batch.flush(),i&&t.mask.pop(this),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,i=this.removeChildren(0,this.children.length);if(e)for(let s=0;s<i.length;++s)i[s].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};ym.defaultSortableChildren=!1;let nr=ym;nr.prototype.containerUpdateTransform=nr.prototype.updateTransform,Object.defineProperties(tt,{SORTABLE_CHILDREN:{get(){return nr.defaultSortableChildren},set(r){St("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),nr.defaultSortableChildren=r}}});const un=new It,dA=new Uint16Array([0,1,2,0,2,3]);class _s extends nr{constructor(t){super(),this._anchor=new Lr(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new Ot(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=yt.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||ut.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=dA,this.pluginName="batch",this.isSprite=!0,this._roundPixels=tt.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=ei(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=ei(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,l=e.ty,h=this.vertexData,u=t.trim,c=t.orig,d=this._anchor;let f=0,p=0,m=0,_=0;if(u?(p=u.x-d._x*c.width,f=p+u.width,_=u.y-d._y*c.height,m=_+u.height):(p=-d._x*c.width,f=p+c.width,_=-d._y*c.height,m=_+c.height),h[0]=i*p+n*_+a,h[1]=o*_+s*p+l,h[2]=i*f+n*_+a,h[3]=o*_+s*f+l,h[4]=i*f+n*m+a,h[5]=o*m+s*f+l,h[6]=i*p+n*m+a,h[7]=o*m+s*p+l,this._roundPixels){const y=tt.RESOLUTION;for(let v=0;v<h.length;++v)h[v]=Math.round(h[v]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,i=t.orig,s=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,l=n.c,h=n.d,u=n.tx,c=n.ty,d=-s._x*i.width,f=d+i.width,p=-s._y*i.height,m=p+i.height;if(e[0]=o*d+l*p+u,e[1]=h*p+a*d+c,e[2]=o*f+l*p+u,e[3]=h*p+a*f+c,e[4]=o*f+l*m+u,e[5]=h*m+a*f+c,e[6]=o*d+l*m+u,e[7]=h*m+a*d+c,this._roundPixels){const _=tt.RESOLUTION;for(let y=0;y<e.length;++y)e[y]=Math.round(e[y]*_)/_}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new Ro),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new xt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,un);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return un.x>=s&&un.x<s+e&&(n=-i*this.anchor.y,un.y>=n&&un.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const i=t instanceof ut?t:ut.from(t,e);return new _s(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=ei(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=ei(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||ut.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const _m=new kt;Wt.prototype._cacheAsBitmap=!1,Wt.prototype._cacheData=null,Wt.prototype._cacheAsBitmapResolution=null,Wt.prototype._cacheAsBitmapMultisample=null;class fA{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(Wt.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let t;r?(this._cacheData||(this._cacheData=new fA),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),Wt.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))},Wt.prototype._initCachedDisplayObject=function(r){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new xt,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const i=this.cacheAsBitmapResolution||r.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const s=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,l=Ni.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),h=`cacheAsBitmap_${Si()}`;this._cacheData.textureCacheId=h,_t.addToCache(l.baseTexture,h),ut.addToCache(l,h);const u=this.transform.localTransform.copyTo(_m).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:l,clear:!0,transform:u,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=a,r.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const c=new _s(l);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(e.x/e.width),c.anchor.y=-(e.y/e.height),c.alpha=t,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},Wt.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))},Wt.prototype._initCachedDisplayObjectCanvas=function(r){var u;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.getLocalBounds(new xt,!0),e=this.alpha;this.alpha=1;const i=r.canvasContext.activeContext,s=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const o=Ni.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${Si()}`;this._cacheData.textureCacheId=a,_t.addToCache(o.baseTexture,a),ut.addToCache(o,a);const l=_m;this.transform.localTransform.copyTo(l),l.invert(),l.tx-=t.x,l.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,clear:!0,transform:l,skipUpdateTransform:!1}),r.canvasContext.activeContext=i,r._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const h=new _s(o);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-(t.x/t.width),h.anchor.y=-(t.y/t.height),h.alpha=e,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)},Wt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Wt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Wt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,_t.removeFromCache(this._cacheData.textureCacheId),ut.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Wt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Wt.prototype.name=null,nr.prototype.getChildByName=function(r,t){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===r)return this.children[e];if(t)for(let e=0,i=this.children.length;e<i;e++){const s=this.children[e];if(!s.getChildByName)continue;const n=s.getChildByName(r,!0);if(n)return n}return null},Wt.prototype.getGlobalPosition=function(r=new It,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var pA=`varying vec2 vTextureCoord;
529
529
 
530
530
  uniform sampler2D uSampler;
531
531
  uniform float uAlpha;
@@ -865,7 +865,7 @@ void main()
865
865
 
866
866
  gl_FragColor = color;
867
867
  }
868
- `;class MA extends Be{constructor(t=.5,e=Math.random()){super(um,RA,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const vm={AlphaFilter:mA,BlurFilter:bA,BlurFilterPass:Ih,ColorMatrixFilter:Rh,DisplacementFilter:AA,FXAAFilter:IA,NoiseFilter:MA};Object.entries(vm).forEach(([r,t])=>{Object.defineProperty(vm,r,{get(){return At("7.1.0",`filters.${r} has moved to ${r}`),t}})});class PA{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(Xe.system.add(this.tickerUpdate,this,Bi.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Xe.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}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const si=new PA;class cn{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=cn.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new It,this.page=new It,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,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,n){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}}class Mo extends cn{constructor(){super(...arguments),this.client=new It,this.movement=new It,this.offset=new It,this.global=new It,this.screen=new It}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,n,o,a,l,h,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class or extends Mo{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!")}}class vs extends Mo{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}vs.DOM_DELTA_PIXEL=0,vs.DOM_DELTA_LINE=1,vs.DOM_DELTA_PAGE=2;const OA=2048,NA=new It,Mh=new It;class DA{constructor(t){this.dispatch=new Xs,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i<s;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){si.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,NA.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i<OA&&t!==this.rootTarget;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,n,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(si.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,n,o||n(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const l=this._isInteractive(e),h=t.isInteractive();return l&&h&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:l&&!n(t,i)&&s(t,i)?h?[t]:[]:null}hitTestRecursive(t,e,i,s,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(si.pauseUpdate=!1),t.interactiveChildren&&t.children){const l=t.children;for(let h=l.length-1;h>=0;h--){const u=l[h],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,i,s,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var i;if(t.hitArea&&(t.worldTransform.applyInverse(e,Mh),!t.hitArea.contains(Mh.x,Mh.y)))return!0;if(t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;if(s&&!((i=s.containsPoint)!=null&&i.call(s,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,o;e=e??t.type;const i=`on${e}`;(o=(n=t.currentTarget)[i])==null||o.call(n,t);const s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var l,h;if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.overTargets);if(((l=s.overTargets)==null?void 0:l.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),i&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),i&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(c)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(h=e.target)==null?void 0:h.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const 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),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=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"){const l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){const h=a.button===2;this.dispatchEvent(a,h?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof vs)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const s=this.allocateEvent(or);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){const e=this.allocateEvent(vs);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const i=this.allocateEvent(or);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof or&&e instanceof or&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Mo&&e instanceof Mo&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,n=i.length;s<n&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}const LA=1,BA={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ph=class au{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new DA(null),si.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new or(null),this.rootWheelEvent=new vs(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...au.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!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){const{view:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,au._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&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;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){const n=e[i],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,si.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this.normalizeToPointerData(t);for(let n=0,o=s.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,si.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;si.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;si.removeTickerListener();const t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*n,t.y=(i-s.top)*(this.domElement.height/s.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){const n=t.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=LA),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=BA[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};Ph.extension={name:"events",type:[Z.RendererSystem,Z.CanvasRendererSystem]},Ph.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Oh=Ph;ht.add(Oh);function xm(r){return r==="dynamic"||r==="static"}const FA={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,_internalInteractive:void 0,get interactive(){return this._internalInteractive??xm(Oh.defaultEventMode)},set interactive(r){At("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Oh.defaultEventMode},set eventMode(r){this._internalInteractive=xm(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,o=typeof t=="function"?void 0:t;r=i?`${r}capture`:r;const a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(r,a,o)}),n?l.once(r,a,o):l.on(r,a,o)},removeEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof cn))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};Wt.mixin(FA);const UA={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Wt.mixin(UA);const kA=9,Po=100,GA=0,HA=0,bm=2,Em=1,$A=-1e3,XA=-1e3,VA=2;class Tm{constructor(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,(Mr.tablet||Mr.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Po}px`,e.style.height=`${Po}px`,e.style.position="absolute",e.style.top=`${GA}px`,e.style.left=`${HA}px`,e.style.zIndex=bm.toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width=`${Em}px`,t.style.height=`${Em}px`,t.style.position="absolute",t.style.top=`${$A}px`,t.style.left=`${XA}px`,t.style.zIndex=VA.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}update(){const t=performance.now();if(Mr.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:i,width:s,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:l}=this.renderer,h=s/o*l,u=n/a*l;let c=this.div;c.style.left=`${e}px`,c.style.top=`${i}px`,c.style.width=`${o}px`,c.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,ps(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{c=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(c.style.left=`${(m.tx+p.x*m.a)*h}px`,c.style.top=`${(m.ty+p.y*m.d)*u}px`,c.style.width=`${p.width*m.a*h}px`,c.style.height=`${p.height*m.d*u}px`):(p=f.getBounds(),this.capHitArea(p),c.style.left=`${p.x*h}px`,c.style.top=`${p.y*u}px`,c.style.width=`${p.width*h}px`,c.style.height=`${p.height*u}px`,c.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(c.title=f.accessibleTitle),c.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&c.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==c.title||f.tabIndex!==c.tabIndex)&&(c.title=f.accessibleTitle,c.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(c))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Po}px`,e.style.height=`${Po}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=bm.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:i}=t.target,s=this.renderer.events.rootBoundary,n=Object.assign(new cn(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===kA&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}Tm.extension={name:"accessibility",type:[Z.RendererPlugin,Z.CanvasRendererPlugin]},ht.add(Tm);const wm=class lu{constructor(t){this.stage=new nr,t=Object.assign({forceCanvas:!1},t),this.renderer=hm(t),lu._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const i=lu._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};wm._plugins=[];let zA=wm;ht.handleByList(Z.Application,zA._plugins);class Am{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;e=s,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Am.extension=Z.Application,ht.add(Am);const Sm={loader:Z.LoadParser,resolver:Z.ResolveParser,cache:Z.CacheParser,detection:Z.DetectionParser};ht.handle(Z.Asset,r=>{const t=r.ref;Object.entries(Sm).filter(([e])=>!!t[e]).forEach(([e,i])=>ht.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(Sm).filter(e=>!!t[e]).forEach(e=>ht.remove(t[e]))});class YA{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function xs(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function ni(r,t){const e=r.split("?")[0],i=ge.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ar=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),Nh=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function Cm(r,t,e,i,s){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?Cm(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function WA(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),Cm(r,s,0,e,i)}else i.push(r);return i}const Oo=r=>!Array.isArray(r);class jA{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=ar(t);let s;for(let a=0;a<this.parsers.length;a++){const l=this.parsers[a];if(l.test(e)){s=l.getCacheableAssets(i,e);break}}s||(s={},i.forEach(a=>{s[a]=e}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{const l=s?s[a]:e;this._cache.has(a)&&this._cache.get(a)!==l&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),e instanceof ut){const a=e;i.forEach(l=>{a.baseTexture!==ut.EMPTY.baseTexture&&_t.addToCache(a.baseTexture,l),ut.addToCache(a,l)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const Fi=new jA;class qA{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let s=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];if(h.load&&((o=h.test)!=null&&o.call(h,t,e,this))){n=h;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await n.load(t,e,this),i.parser=n;for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];h.parse&&h.parse&&await((a=h.testParse)==null?void 0:a.call(h,s,e,this))&&(s=await h.parse(s,e,this)||s,i.parser=h)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const s={},n=Oo(t),o=ar(t,h=>({alias:[h],src:h})),a=o.length,l=o.map(async h=>{const u=ge.toAbsolute(h.src);if(!s[h.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,h)),s[h.src]=await this.promiseCache[u].promise,e&&e(++i/a)}catch(c){throw delete this.promiseCache[u],delete s[h.src],new Error(`[Loader.load] Failed to load ${u}.
868
+ `;class MA extends Be{constructor(t=.5,e=Math.random()){super(um,RA,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const vm={AlphaFilter:mA,BlurFilter:bA,BlurFilterPass:Ih,ColorMatrixFilter:Rh,DisplacementFilter:AA,FXAAFilter:IA,NoiseFilter:MA};Object.entries(vm).forEach(([r,t])=>{Object.defineProperty(vm,r,{get(){return St("7.1.0",`filters.${r} has moved to ${r}`),t}})});class PA{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(Xe.system.add(this.tickerUpdate,this,Bi.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Xe.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}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const si=new PA;class cn{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=cn.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new It,this.page=new It,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,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,n){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}}class Mo extends cn{constructor(){super(...arguments),this.client=new It,this.movement=new It,this.offset=new It,this.global=new It,this.screen=new It}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,n,o,a,l,h,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class or extends Mo{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!")}}class vs extends Mo{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}vs.DOM_DELTA_PIXEL=0,vs.DOM_DELTA_LINE=1,vs.DOM_DELTA_PAGE=2;const OA=2048,NA=new It,Mh=new It;class DA{constructor(t){this.dispatch=new Xs,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i<s;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){si.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,NA.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i<OA&&t!==this.rootTarget;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,n,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(si.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,n,o||n(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const l=this._isInteractive(e),h=t.isInteractive();return l&&h&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:l&&!n(t,i)&&s(t,i)?h?[t]:[]:null}hitTestRecursive(t,e,i,s,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(si.pauseUpdate=!1),t.interactiveChildren&&t.children){const l=t.children;for(let h=l.length-1;h>=0;h--){const u=l[h],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,i,s,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var i;if(t.hitArea&&(t.worldTransform.applyInverse(e,Mh),!t.hitArea.contains(Mh.x,Mh.y)))return!0;if(t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;if(s&&!((i=s.containsPoint)!=null&&i.call(s,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,o;e=e??t.type;const i=`on${e}`;(o=(n=t.currentTarget)[i])==null||o.call(n,t);const s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var l,h;if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.overTargets);if(((l=s.overTargets)==null?void 0:l.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),i&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),i&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(c)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(h=e.target)==null?void 0:h.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const 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),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=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"){const l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){const h=a.button===2;this.dispatchEvent(a,h?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof or)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof vs)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const s=this.allocateEvent(or);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){const e=this.allocateEvent(vs);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const i=this.allocateEvent(or);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof or&&e instanceof or&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Mo&&e instanceof Mo&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,n=i.length;s<n&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}const LA=1,BA={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ph=class au{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new DA(null),si.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new or(null),this.rootWheelEvent=new vs(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...au.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!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){const{view:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,au._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&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;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){const n=e[i],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,si.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this.normalizeToPointerData(t);for(let n=0,o=s.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,si.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;si.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;si.removeTickerListener();const t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*n,t.y=(i-s.top)*(this.domElement.height/s.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){const n=t.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=LA),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=BA[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};Ph.extension={name:"events",type:[Z.RendererSystem,Z.CanvasRendererSystem]},Ph.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Oh=Ph;ht.add(Oh);function xm(r){return r==="dynamic"||r==="static"}const FA={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,_internalInteractive:void 0,get interactive(){return this._internalInteractive??xm(Oh.defaultEventMode)},set interactive(r){St("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Oh.defaultEventMode},set eventMode(r){this._internalInteractive=xm(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,o=typeof t=="function"?void 0:t;r=i?`${r}capture`:r;const a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(r,a,o)}),n?l.once(r,a,o):l.on(r,a,o)},removeEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof cn))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};Wt.mixin(FA);const UA={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Wt.mixin(UA);const kA=9,Po=100,GA=0,HA=0,bm=2,Em=1,$A=-1e3,XA=-1e3,VA=2;class Tm{constructor(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,(Mr.tablet||Mr.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Po}px`,e.style.height=`${Po}px`,e.style.position="absolute",e.style.top=`${GA}px`,e.style.left=`${HA}px`,e.style.zIndex=bm.toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width=`${Em}px`,t.style.height=`${Em}px`,t.style.position="absolute",t.style.top=`${$A}px`,t.style.left=`${XA}px`,t.style.zIndex=VA.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}update(){const t=performance.now();if(Mr.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:i,width:s,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:l}=this.renderer,h=s/o*l,u=n/a*l;let c=this.div;c.style.left=`${e}px`,c.style.top=`${i}px`,c.style.width=`${o}px`,c.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,ps(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{c=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(c.style.left=`${(m.tx+p.x*m.a)*h}px`,c.style.top=`${(m.ty+p.y*m.d)*u}px`,c.style.width=`${p.width*m.a*h}px`,c.style.height=`${p.height*m.d*u}px`):(p=f.getBounds(),this.capHitArea(p),c.style.left=`${p.x*h}px`,c.style.top=`${p.y*u}px`,c.style.width=`${p.width*h}px`,c.style.height=`${p.height*u}px`,c.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(c.title=f.accessibleTitle),c.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&c.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==c.title||f.tabIndex!==c.tabIndex)&&(c.title=f.accessibleTitle,c.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(c))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Po}px`,e.style.height=`${Po}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=bm.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:i}=t.target,s=this.renderer.events.rootBoundary,n=Object.assign(new cn(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===kA&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}Tm.extension={name:"accessibility",type:[Z.RendererPlugin,Z.CanvasRendererPlugin]},ht.add(Tm);const wm=class lu{constructor(t){this.stage=new nr,t=Object.assign({forceCanvas:!1},t),this.renderer=hm(t),lu._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const i=lu._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};wm._plugins=[];let zA=wm;ht.handleByList(Z.Application,zA._plugins);class Am{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;e=s,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Am.extension=Z.Application,ht.add(Am);const Sm={loader:Z.LoadParser,resolver:Z.ResolveParser,cache:Z.CacheParser,detection:Z.DetectionParser};ht.handle(Z.Asset,r=>{const t=r.ref;Object.entries(Sm).filter(([e])=>!!t[e]).forEach(([e,i])=>ht.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(Sm).filter(e=>!!t[e]).forEach(e=>ht.remove(t[e]))});class YA{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function xs(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function ni(r,t){const e=r.split("?")[0],i=ge.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ar=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),Nh=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function Cm(r,t,e,i,s){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?Cm(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function WA(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),Cm(r,s,0,e,i)}else i.push(r);return i}const Oo=r=>!Array.isArray(r);class jA{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=ar(t);let s;for(let a=0;a<this.parsers.length;a++){const l=this.parsers[a];if(l.test(e)){s=l.getCacheableAssets(i,e);break}}s||(s={},i.forEach(a=>{s[a]=e}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{const l=s?s[a]:e;this._cache.has(a)&&this._cache.get(a)!==l&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),e instanceof ut){const a=e;i.forEach(l=>{a.baseTexture!==ut.EMPTY.baseTexture&&_t.addToCache(a.baseTexture,l),ut.addToCache(a,l)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const Fi=new jA;class qA{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let s=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];if(h.load&&((o=h.test)!=null&&o.call(h,t,e,this))){n=h;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await n.load(t,e,this),i.parser=n;for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];h.parse&&h.parse&&await((a=h.testParse)==null?void 0:a.call(h,s,e,this))&&(s=await h.parse(s,e,this)||s,i.parser=h)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const s={},n=Oo(t),o=ar(t,h=>({alias:[h],src:h})),a=o.length,l=o.map(async h=>{const u=ge.toAbsolute(h.src);if(!s[h.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,h)),s[h.src]=await this.promiseCache[u].promise,e&&e(++i/a)}catch(c){throw delete this.promiseCache[u],delete s[h.src],new Error(`[Loader.load] Failed to load ${u}.
869
869
  ${c}`)}});return await Promise.all(l),n?s[o[0].src]:s}async unload(t){const e=ar(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=ge.toAbsolute(i.src),n=this.promiseCache[s];if(n){const l=await n.promise;delete this.promiseCache[s],(a=(o=n.parser)==null?void 0:o.unload)==null||a.call(o,l,i,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var lr=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(lr||{});const KA=".json",ZA="application/json",QA={extension:{type:Z.LoadParser,priority:lr.Low},name:"loadJson",test(r){return xs(r,ZA)||ni(r,KA)},async load(r){return await(await tt.ADAPTER.fetch(r)).json()}};ht.add(QA);const JA=".txt",tS="text/plain",eS={name:"loadTxt",extension:{type:Z.LoadParser,priority:lr.Low},test(r){return xs(r,tS)||ni(r,JA)},async load(r){return await(await tt.ADAPTER.fetch(r)).text()}};ht.add(eS);const rS=["normal","bold","100","200","300","400","500","600","700","800","900"],iS=[".ttf",".otf",".woff",".woff2"],sS=["font/ttf","font/otf","font/woff","font/woff2"],nS=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function oS(r){const t=ge.extname(r),e=ge.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let i=e.length>0;for(const n of e)if(!n.match(nS)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const aS=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function lS(r){return aS.test(r)?r:encodeURI(r)}const hS={extension:{type:Z.LoadParser,priority:lr.Low},name:"loadWebFont",test(r){return xs(r,sS)||ni(r,iS)},async load(r,t){var i,s,n;const e=tt.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??oS(r),l=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(u=>rS.includes(u)))??["normal"],h=t.data??{};for(let u=0;u<l.length;u++){const c=l[u],d=new FontFace(a,`url(${lS(r)})`,{...h,weight:c});await d.load(),e.add(d),o.push(d)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>tt.ADAPTER.getFontFaceSet().delete(t))}};ht.add(hS);const uS=`(function() {
870
870
  "use strict";
871
871
  const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
@@ -909,8 +909,8 @@ ${c}`)}});return await Promise.all(l),n?s[o[0].src]:s}async unload(t){const e=ar
909
909
  }
910
910
  };
911
911
  })();
912
- `;let Es=null;class Im{constructor(){Es||(Es=URL.createObjectURL(new Blob([cS],{type:"application/javascript"}))),this.worker=new Worker(Es)}}Im.revokeObjectURL=function(){Es&&(URL.revokeObjectURL(Es),Es=null)};let Rm=0,Lh;class dS{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new Dh;e.addEventListener("message",i=>{e.terminate(),Dh.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Lh===void 0&&(Lh=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Lh&&(this._createdWorkers++,t=new Im().worker,t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const i=new Promise((s,n)=>{this.queue.push({id:t,arguments:e,resolve:s,reject:n})});return this.next(),i}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),i=e.id;this.resolveHash[Rm]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Rm++,id:i})}}const Mm=new dS;function dn(r,t,e){r.resource.internal=!0;const i=new ut(r),s=()=>{delete t.promiseCache[e],Fi.has(e)&&Fi.remove(e)};return i.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),s())}),i.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}const fS=[".jpeg",".jpg",".png",".webp",".avif"],pS=["image/jpeg","image/png","image/webp","image/avif"];async function mS(r){const t=await tt.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const No={name:"loadTextures",extension:{type:Z.LoadParser,priority:lr.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return xs(r,pS)||ni(r,fS)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await Mm.isImageBitmapSupported()?s=await Mm.loadImageBitmap(r):s=await mS(r):s=await new Promise((l,h)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=r,u.complete?l(u):(u.onload=()=>l(u),u.onerror=c=>h(c))});const n={...t.data};n.resolution??(n.resolution=Dr(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new _t(s,n);return o.resource.src=r,dn(o,e,r)},unload(r){r.destroy(!0)}};ht.add(No);const gS=".svg",yS="image/svg+xml",_S={extension:{type:Z.LoadParser,priority:lr.High},name:"loadSVG",test(r){return xs(r,yS)||ni(r,gS)},async testParse(r){return Sh.test(r)},async parse(r,t,e){var n;const i=new Sh(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new _t(i,{resolution:Dr(r),...t==null?void 0:t.data});return s.resource.src=t.src,dn(s,e,t.src)},async load(r,t){return(await tt.ADAPTER.fetch(r)).text()},unload:No.unload};ht.add(_S);const vS=[".mp4",".m4v",".webm",".ogv"],xS=["video/mp4","video/webm","video/ogg"],bS={name:"loadVideo",extension:{type:Z.LoadParser,priority:lr.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(r){return xs(r,xS)||ni(r,vS)},async load(r,t,e){var o;let i;const s=await(await tt.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(s);try{const a={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(o=t==null?void 0:t.data)==null?void 0:o.resourceOptions,autoLoad:!0},l=new gm(n,a);await l.load();const h=new _t(l,{alphaMode:await CT(),resolution:Dr(r),...t==null?void 0:t.data});h.resource.src=r,i=dn(h,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};ht.add(bS);class ES{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,name:i,src:s,srcs:n}=t;return ar(e||i||s||n,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];Array.isArray(e)?e.forEach(s=>{const n=s.src??s.srcs,o=s.alias??s.name;let a;if(typeof o=="string"){const l=this._createBundleAssetId(t,o);i.push(l),a=[o,l]}else{const l=o.map(h=>this._createBundleAssetId(t,h));i.push(...l),a=[...o,...l]}this.add({...s,alias:a,src:n})}):Object.keys(e).forEach(s=>{const n=[s,this._createBundleAssetId(t,s)];if(typeof e[s]=="string")this.add({alias:n,src:e[s]});else if(Array.isArray(e[s]))this.add({alias:n,src:e[s]});else{const o=e[s],a=o.src??o.srcs;this.add({...o,alias:n,src:Array.isArray(a)?a:[a]})}i.push(...n)}),this._bundles[t]=i}add(t,e,i,s,n){const o=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(At("7.2.0",`Assets.add now uses an object instead of individual parameters.
913
- Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:i,format:s,loadParser:n})):Array.isArray(t)?o.push(...t):o.push(t);let a;a=l=>{this.hasKey(l)&&console.warn(`[Resolver] already has key: ${l} overwriting`)},ar(o).forEach(l=>{const{src:h,srcs:u}=l;let{data:c,format:d,loadParser:f}=l;const p=ar(h||u).map(y=>typeof y=="string"?WA(y):Array.isArray(y)?y:[y]),m=this.getAlias(l);Array.isArray(m)?m.forEach(a):a(m);const _=[];p.forEach(y=>{y.forEach(v=>{let g={};if(typeof v!="object"){g.src=v;for(let x=0;x<this._parsers.length;x++){const E=this._parsers[x];if(E.test(v)){g=E.parse(v);break}}}else c=v.data??c,d=v.format??d,f=v.loadParser??f,g={...g,...v};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this.buildResolvedAsset(g,{aliases:m,data:c,format:d,loadParser:f}),_.push(g)})}),m.forEach(y=>{this._assetMap[y]=_})})}resolveBundle(t){const e=Oo(t);t=ar(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const l in o){const h=o[l];a[this._extractAssetIdFromBundle(s,l)]=h}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=Oo(t);t=ar(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(l=>{a.params[l].forEach(h=>{const u=n.filter(c=>c[l]?c[l]===h:!1);u.length&&(n=u)})}),this._resolverHash[s]=n[0]??o}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:i,data:s,loadParser:n,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=ge.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=n??t.loadParser,t.format=o??t.format??ge.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class TS{constructor(){this._detections=[],this._initialized=!1,this.resolver=new ES,this.loader=new qA,this.cache=Fi,this._backgroundLoader=new YA(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,s,n){this.resolver.add(t,e,i,s,n)}async load(t,e){this._initialized||await this.init();const i=Oo(t),s=ar(t).map(a=>{if(typeof a!="string"){const l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,l=0;const h=()=>{e==null||e(++a/l)},u=o.map(c=>{const d=s[c];return l+=Object.keys(d).length,this._mapLoadToResolve(d,h).then(f=>{n[c]=f})});return await Promise.all(u),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Fi.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=Fi.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),s=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const o={};return i.forEach((a,l)=>{const h=n[a.src],u=[a.src];a.alias&&u.push(...a.alias),o[s[l]]=h,Fi.set(u,h)}),o}async unload(t){this._initialized||await this.init();const e=ar(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=ar(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{Fi.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}get preferWorkers(){return No.config.preferWorkers}set preferWorkers(t){At("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const Do=new TS;ht.handleByList(Z.LoadParser,Do.loader.parsers).handleByList(Z.ResolveParser,Do.resolver.parsers).handleByList(Z.CacheParser,Do.cache.parsers).handleByList(Z.DetectionParser,Do.detections);const wS={extension:Z.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof ut),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};ht.add(wS);async function Pm(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const AS={extension:{type:Z.DetectionParser,priority:1},test:async()=>Pm("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};ht.add(AS);const SS={extension:{type:Z.DetectionParser,priority:0},test:async()=>Pm("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};ht.add(SS);const Om=["png","jpg","jpeg"],CS={extension:{type:Z.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Om],remove:async r=>r.filter(t=>!Om.includes(t))};ht.add(CS);const IS="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Bh(r){return IS?!1:document.createElement("video").canPlayType(r)!==""}const RS={extension:{type:Z.DetectionParser,priority:0},test:async()=>Bh("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};ht.add(RS);const MS={extension:{type:Z.DetectionParser,priority:0},test:async()=>Bh("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};ht.add(MS);const PS={extension:{type:Z.DetectionParser,priority:0},test:async()=>Bh("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};ht.add(PS);const OS={extension:Z.ResolveParser,test:No.test,parse:r=>{var t;return{resolution:parseFloat(((t=tt.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:ge.extname(r).slice(1),src:r}}};ht.add(OS);var Ae=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(Ae||{});const Lo={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let wr,Ts;function Nm(){Ts={bptc:wr.getExtension("EXT_texture_compression_bptc"),astc:wr.getExtension("WEBGL_compressed_texture_astc"),etc:wr.getExtension("WEBGL_compressed_texture_etc"),s3tc:wr.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:wr.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:wr.getExtension("WEBGL_compressed_texture_pvrtc")||wr.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:wr.getExtension("WEBGL_compressed_texture_etc1"),atc:wr.getExtension("WEBGL_compressed_texture_atc")}}const NS={extension:{type:Z.DetectionParser,priority:2},test:async()=>{const r=tt.ADAPTER.createCanvas().getContext("webgl");return r?(wr=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{Ts||Nm();const t=[];for(const e in Ts)Ts[e]&&t.push(e);return[...t,...r]},remove:async r=>(Ts||Nm(),r.filter(t=>!(t in Ts)))};ht.add(NS);class DS extends lo{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,s;typeof t=="string"?(i=t,s=new Uint8Array):(i=null,s=t),super(s,e),this.origin=i,this.buffer=s?new eh(s):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new eh(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Ui extends DS{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=Ui._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Ui._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const s=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;s.pixelStorei(s.UNPACK_ALIGNMENT,4);for(let n=0,o=this.levels;n<o;n++){const{levelID:a,levelWidth:l,levelHeight:h,levelBuffer:u}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,l,h,0,u)}return!0}onBlobLoaded(){this._levelBuffers=Ui._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t===36196)return"etc1";if(t===35986||t===35987||t===34798)return"atc";if(t>=36492&&t<=36495)return"bptc";if(t===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,i,s,n,o,a){const l=new Array(i);let h=t.byteOffset,u=o,c=a,d=u+s-1&~(s-1),f=c+n-1&~(n-1),p=d*f*Lo[e];for(let m=0;m<i;m++)l[m]={levelID:m,levelWidth:i>1?u:d,levelHeight:i>1?c:f,levelBuffer:new Uint8Array(t.buffer,h,p)},h+=p,u=u>>1||1,c=c>>1||1,d=u+s-1&~(s-1),f=c+n-1&~(n-1),p=d*f*Lo[e];return l}}const Fh=4,Bo=124,LS=32,Dm=20,BS=542327876,Fo={HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},FS={FOURCC:2},Uo={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},US=1,kS=2,GS=4,HS=64,$S=512,XS=131072,VS=827611204,zS=861165636,YS=894720068,WS=808540228,jS=4,qS={[VS]:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,[zS]:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,[YS]:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT},KS={70:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Ae.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Ae.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Ae.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Ae.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function ZS(r){const t=new Uint32Array(r);if(t[0]!==BS)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Bo/Uint32Array.BYTES_PER_ELEMENT),i=e[Fo.HEIGHT],s=e[Fo.WIDTH],n=e[Fo.MIPMAP_COUNT],o=new Uint32Array(r,Fo.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,LS/Uint32Array.BYTES_PER_ELEMENT),a=o[US];if(a&GS){const l=o[FS.FOURCC];if(l!==WS){const v=qS[l],g=Fh+Bo,x=new Uint8Array(r,g);return[new Ui(x,{format:v,width:s,height:i,levels:n})]}const h=Fh+Bo,u=new Uint32Array(t.buffer,h,Dm/Uint32Array.BYTES_PER_ELEMENT),c=u[Uo.DXGI_FORMAT],d=u[Uo.RESOURCE_DIMENSION],f=u[Uo.MISC_FLAG],p=u[Uo.ARRAY_SIZE],m=KS[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===jS)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const _=new Array,y=Fh+Bo+Dm;if(p===1)_.push(new Uint8Array(r,y));else{const v=Lo[m];let g=0,x=s,E=i;for(let S=0;S<n;S++){const R=Math.max(1,x+3&-4),P=Math.max(1,E+3&-4),F=R*P*v;g+=F,x=x>>>1,E=E>>>1}let M=y;for(let S=0;S<p;S++)_.push(new Uint8Array(r,M,g)),M+=g}return _.map(v=>new Ui(v,{format:m,width:s,height:i,levels:n}))}throw a&HS?new Error("DDSParser does not support uncompressed texture data."):a&$S?new Error("DDSParser does not supported YUV uncompressed texture data."):a&XS?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&kS?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const Lm=[171,75,84,88,32,49,49,187,13,10,26,10],QS=67305985,hr={ENDIANNESS:12,GL_TYPE:16,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},Uh=64,Bm={[ft.UNSIGNED_BYTE]:1,[ft.UNSIGNED_SHORT]:2,[ft.INT]:4,[ft.UNSIGNED_INT]:4,[ft.FLOAT]:4,[ft.HALF_FLOAT]:8},JS={[z.RGBA]:4,[z.RGB]:3,[z.RG]:2,[z.RED]:1,[z.LUMINANCE]:1,[z.LUMINANCE_ALPHA]:2,[z.ALPHA]:1},tC={[ft.UNSIGNED_SHORT_4_4_4_4]:2,[ft.UNSIGNED_SHORT_5_5_5_1]:2,[ft.UNSIGNED_SHORT_5_6_5]:2};function eC(r,t,e=!1){const i=new DataView(t);if(!rC(r,i))return null;const s=i.getUint32(hr.ENDIANNESS,!0)===QS,n=i.getUint32(hr.GL_TYPE,s),o=i.getUint32(hr.GL_FORMAT,s),a=i.getUint32(hr.GL_INTERNAL_FORMAT,s),l=i.getUint32(hr.PIXEL_WIDTH,s),h=i.getUint32(hr.PIXEL_HEIGHT,s)||1,u=i.getUint32(hr.PIXEL_DEPTH,s)||1,c=i.getUint32(hr.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(hr.NUMBER_OF_FACES,s),f=i.getUint32(hr.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(hr.BYTES_OF_KEY_VALUE_DATA,s);if(h===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const m=4,_=4,y=l+3&-4,v=h+3&-4,g=new Array(c);let x=l*h;n===0&&(x=y*v);let E;if(n!==0?Bm[n]?E=Bm[n]*JS[o]:E=tC[n]:E=Lo[a],E===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const M=e?sC(i,p,s):null;let S=x*E,R=l,P=h,F=y,k=v,I=Uh+p;for(let A=0;A<f;A++){const T=i.getUint32(I,s);let C=I+4;for(let L=0;L<c;L++){let O=g[L];O||(O=g[L]=new Array(f)),O[A]={levelID:A,levelWidth:f>1||n!==0?R:F,levelHeight:f>1||n!==0?P:k,levelBuffer:new Uint8Array(t,C,S)},C+=S}I+=T+4,I=I%4!==0?I+4-I%4:I,R=R>>1||1,P=P>>1||1,F=R+m-1&-4,k=P+_-1&-4,S=F*k*E}return n!==0?{uncompressed:g.map(A=>{let T=A[0].levelBuffer,C=!1;return n===ft.FLOAT?T=new Float32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4):n===ft.UNSIGNED_INT?(C=!0,T=new Uint32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)):n===ft.INT&&(C=!0,T=new Int32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)),{resource:new lo(T,{width:A[0].levelWidth,height:A[0].levelHeight}),type:n,format:C?iC(o):o}}),kvData:M}:{compressed:g.map(A=>new Ui(null,{format:a,width:l,height:h,levels:f,levelBuffers:A})),kvData:M}}function rC(r,t){for(let e=0;e<Lm.length;e++)if(t.getUint8(e)!==Lm[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function iC(r){switch(r){case z.RGBA:return z.RGBA_INTEGER;case z.RGB:return z.RGB_INTEGER;case z.RG:return z.RG_INTEGER;case z.RED:return z.RED_INTEGER;default:return r}}function sC(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(Uh+s,e),o=Uh+s+4,a=3-(n+3)%4;if(n===0||n>t-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let l=0;for(;l<n&&r.getUint8(o+l)!==0;l++);if(l===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const h=new TextDecoder().decode(new Uint8Array(r.buffer,o,l)),u=new DataView(r.buffer,o+l+1,n-l-1);i.set(h,u),s+=4+n+a}return i}const nC={extension:{type:Z.LoadParser,priority:lr.High},name:"loadDDS",test(r){return ni(r,".dds")},async load(r,t,e){const i=await(await tt.ADAPTER.fetch(r)).arrayBuffer(),s=ZS(i).map(n=>{const o=new _t(n,{mipmap:pr.OFF,alphaMode:He.NO_PREMULTIPLIED_ALPHA,resolution:Dr(r),...t.data});return dn(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};ht.add(nC);const oC={extension:{type:Z.LoadParser,priority:lr.High},name:"loadKTX",test(r){return ni(r,".ktx")},async load(r,t,e){const i=await(await tt.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=eC(r,i),a=s??n,l={mipmap:pr.OFF,alphaMode:He.NO_PREMULTIPLIED_ALPHA,resolution:Dr(r),...t.data},h=a.map(u=>{a===n&&Object.assign(l,{type:u.type,format:u.format});const c=u.resource??u,d=new _t(c,l);return d.ktxKeyValueData=o,dn(d,e,r)});return h.length===1?h[0]:h},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};ht.add(oC);const aC=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],lC={extension:Z.ResolveParser,test:r=>{const t=ge.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var i,s;const t=r.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(aC.includes(n))return{resolution:parseFloat(((i=tt.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:n,src:r}}return{resolution:parseFloat(((s=tt.RETINA_PREFIX.exec(r))==null?void 0:s[1])??"1"),format:e,src:r}}};ht.add(lC);const ko=new xt,hC=4,Fm=class _n{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,i,s){const n=new Image;return n.src=await this.base64(t,e,i,s),n}async base64(t,e,i,s){const n=this.canvas(t,s);if(n.toBlob!==void 0)return new Promise((o,a)=>{n.toBlob(l=>{if(!l){a(new Error("ICanvas.toBlob failed!"));return}const h=new FileReader;h.onload=()=>o(h.result),h.onerror=a,h.readAsDataURL(l)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:e,quality:i});return new Promise((a,l)=>{const h=new FileReader;h.onload=()=>a(h.result),h.onerror=l,h.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);o&&_n._flipY(i,s,n),a&&_n._unpremultiplyAlpha(i);const l=new XT(s,n,1),h=new ImageData(new Uint8ClampedArray(i.buffer),s,n);return l.context.putImageData(h,0,0),l.canvas}pixels(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);return o&&_n._flipY(i,s,n),a&&_n._unpremultiplyAlpha(i),i}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let s,n=!1,o=!1,a,l=!1;t&&(t instanceof Ni?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),l=!0,e&&(ko.width=e.width,ko.height=e.height,e=ko)));const h=i.gl;if(a){if(s=a.baseTexture.resolution,e=e??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===z.RGBA,!l){i.renderTexture.bind(a);const f=a.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else s=i.resolution,e||(e=ko,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const u=Math.max(Math.round(e.width*s),1),c=Math.max(Math.round(e.height*s),1),d=new Uint8Array(hC*u*c);return h.readPixels(Math.round(e.x*s),Math.round(e.y*s),u,c,h.RGBA,h.UNSIGNED_BYTE,d),l&&(a==null||a.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const s=e<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a<n;a++){const l=a*s,h=(i-a-1)*s;o.set(t.subarray(l,l+s)),t.copyWithin(l,h,h+s),t.set(o,h)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let i=0;i<e;i+=4){const s=t[i+3];if(s!==0){const n=255.001/s;t[i]=t[i]*n+.5,t[i+1]=t[i+1]*n+.5,t[i+2]=t[i+2]*n+.5}}}};Fm.extension={name:"extract",type:Z.RendererSystem};let uC=Fm;ht.add(uC);const Go={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===we.CIRC){const p=r.shape;e=p.x,i=p.y,o=a=p.radius,s=n=0}else if(r.type===we.ELIP){const p=r.shape;e=p.x,i=p.y,o=p.width,a=p.height,s=n=0}else{const p=r.shape,m=p.width/2,_=p.height/2;e=p.x+m,i=p.y+_,o=a=Math.max(0,Math.min(p.radius,Math.min(m,_))),s=m-o,n=_-a}if(!(o>=0&&a>=0&&s>=0&&n>=0)){t.length=0;return}const l=Math.ceil(2.3*Math.sqrt(o+a)),h=l*8+(s?4:0)+(n?4:0);if(t.length=h,h===0)return;if(l===0){t.length=8,t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n;return}let u=0,c=l*4+(s?2:0)+2,d=c,f=h;{const p=s+o,m=n,_=e+p,y=e-p,v=i+m;if(t[u++]=_,t[u++]=v,t[--c]=v,t[--c]=y,n){const g=i-m;t[d++]=y,t[d++]=g,t[--f]=g,t[--f]=_}}for(let p=1;p<l;p++){const m=Math.PI/2*(p/l),_=s+Math.cos(m)*o,y=n+Math.sin(m)*a,v=e+_,g=e-_,x=i+y,E=i-y;t[u++]=v,t[u++]=x,t[--c]=x,t[--c]=g,t[d++]=g,t[d++]=E,t[--f]=E,t[--f]=v}{const p=s,m=n+a,_=e+p,y=e-p,v=i+m,g=i-m;t[u++]=_,t[u++]=v,t[--f]=g,t[--f]=_,s&&(t[u++]=y,t[u++]=v,t[--f]=g,t[--f]=y)}},triangulate(r,t){const e=r.points,i=t.points,s=t.indices;if(e.length===0)return;let n=i.length/2;const o=n;let a,l;if(r.type!==we.RREC){const u=r.shape;a=u.x,l=u.y}else{const u=r.shape;a=u.x+u.width/2,l=u.y+u.height/2}const h=r.matrix;i.push(r.matrix?h.a*a+h.c*l+h.tx:a,r.matrix?h.b*a+h.d*l+h.ty:l),n++,i.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)i.push(e[u],e[u+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function Um(r,t=!1){const e=r.length;if(e<6)return;let i=0;for(let s=0,n=r[e-2],o=r[e-1];s<e;s+=2){const a=r[s],l=r[s+1];i+=(a-n)*(l+o),n=a,o=l}if(!t&&i>0||t&&i<=0){const s=e/2;for(let n=s+s%2;n<e;n+=2){const o=e-n-2,a=e-n-1,l=n,h=n+1;[r[o],r[l]]=[r[l],r[o]],[r[a],r[h]]=[r[h],r[a]]}}}const km={build(r){r.points=r.shape.points.slice()},triangulate(r,t){let e=r.points;const i=r.holes,s=t.points,n=t.indices;if(e.length>=6){Um(e,!1);const o=[];for(let h=0;h<i.length;h++){const u=i[h];Um(u.points,!0),o.push(e.length/2),e=e.concat(u.points)}const a=mx(e,o,2);if(!a)return;const l=s.length/2;for(let h=0;h<a.length;h+=3)n.push(a[h]+l),n.push(a[h+1]+l),n.push(a[h+2]+l);for(let h=0;h<e.length;h++)s.push(e[h])}}},cC={build(r){const t=r.shape,e=t.x,i=t.y,s=t.width,n=t.height,o=r.points;o.length=0,s>=0&&n>=0&&o.push(e,i,e+s,i,e+s,i+n,e,i+n)},triangulate(r,t){const e=r.points,i=t.points;if(e.length===0)return;const s=i.length/2;i.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},dC={build(r){Go.build(r)},triangulate(r,t){Go.triangulate(r,t)}};var qe=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(qe||{}),oi=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(oi||{});const ws={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,t=20){if(!this.adaptive||!r||isNaN(r))return t;let e=Math.ceil(r/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class Gm{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],l=o[o.length-1]-e,h=a-t,u=s-e,c=i-t,d=Math.abs(l*c-h*u);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const f=l*l+h*h,p=u*u+c*c,m=l*u+h*c,_=n*Math.sqrt(f)/d,y=n*Math.sqrt(p)/d,v=_*m/f,g=y*m/p,x=_*c+y*h,E=_*u+y*l,M=h*(y+v),S=l*(y+v),R=c*(_+g),P=u*(_+g),F=Math.atan2(S-E,M-x),k=Math.atan2(P-E,R-x);return{cx:x+t,cy:E+e,radius:n,startAngle:F,endAngle:k,anticlockwise:h*u>c*l}}static arc(t,e,i,s,n,o,a,l,h){const u=a-o,c=ws._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/uo)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),_=c-1,y=_%1/_;for(let v=0;v<=_;++v){const g=v+y*v,x=d+o+f*g,E=Math.cos(x),M=-Math.sin(x);h.push((p*E+m*M)*n+i,(p*-M+m*E)*n+s)}}}class fC{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class kh{static curveLength(t,e,i,s,n,o,a,l){let h=0,u=0,c=0,d=0,f=0,p=0,m=0,_=0,y=0,v=0,g=0,x=t,E=e;for(let M=1;M<=10;++M)u=M/10,c=u*u,d=c*u,f=1-u,p=f*f,m=p*f,_=m*t+3*p*u*i+3*f*c*n+d*a,y=m*e+3*p*u*s+3*f*c*o+d*l,v=x-_,g=E-y,x=_,E=y,h+=Math.sqrt(v*v+g*g);return h}static curveTo(t,e,i,s,n,o,a){const l=a[a.length-2],h=a[a.length-1];a.length-=2;const u=ws._segmentsCount(kh.curveLength(l,h,t,e,i,s,n,o));let c=0,d=0,f=0,p=0,m=0;a.push(l,h);for(let _=1,y=0;_<=u;++_)y=_/u,c=1-y,d=c*c,f=d*c,p=y*y,m=p*y,a.push(f*l+3*d*y*t+3*c*p*i+m*n,f*h+3*d*y*e+3*c*p*s+m*o)}}function Hm(r,t,e,i,s,n,o,a){const l=r-e*s,h=t-i*s,u=r+e*n,c=t+i*n;let d,f;o?(d=i,f=-e):(d=-i,f=e);const p=l+d,m=h+f,_=u+d,y=c+f;return a.push(p,m,_,y),2}function ki(r,t,e,i,s,n,o,a){const l=e-r,h=i-t;let u=Math.atan2(l,h),c=Math.atan2(s-r,n-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(l*l+h*h),_=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/_;if(d+=y,a){o.push(r,t,e,i);for(let v=1,g=d;v<_;v++,g+=y)o.push(r,t,r+Math.sin(g)*m,t+Math.cos(g)*m);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let v=1,g=d;v<_;v++,g+=y)o.push(r+Math.sin(g)*m,t+Math.cos(g)*m,r,t);o.push(s,n,r,t)}return _*2}function pC(r,t){const e=r.shape;let i=r.points||e.points.slice();const s=t.closePointEps;if(i.length===0)return;const n=r.lineStyle,o=new It(i[0],i[1]),a=new It(i[i.length-2],i[i.length-1]),l=e.type!==we.POLY||e.closeStroke,h=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(l){i=i.slice(),h&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const O=(o.x+a.x)*.5,B=(a.y+o.y)*.5;i.unshift(O,B),i.push(O,B)}const u=t.points,c=i.length/2;let d=i.length;const f=u.length/2,p=n.width/2,m=p*p,_=n.miterLimit*n.miterLimit;let y=i[0],v=i[1],g=i[2],x=i[3],E=0,M=0,S=-(v-x),R=y-g,P=0,F=0,k=Math.sqrt(S*S+R*R);S/=k,R/=k,S*=p,R*=p;const I=n.alignment,A=(1-I)*2,T=I*2;l||(n.cap===oi.ROUND?d+=ki(y-S*(A-T)*.5,v-R*(A-T)*.5,y-S*A,v-R*A,y+S*T,v+R*T,u,!0)+2:n.cap===oi.SQUARE&&(d+=Hm(y,v,S,R,A,T,!0,u))),u.push(y-S*A,v-R*A,y+S*T,v+R*T);for(let O=1;O<c-1;++O){y=i[(O-1)*2],v=i[(O-1)*2+1],g=i[O*2],x=i[O*2+1],E=i[(O+1)*2],M=i[(O+1)*2+1],S=-(v-x),R=y-g,k=Math.sqrt(S*S+R*R),S/=k,R/=k,S*=p,R*=p,P=-(x-M),F=g-E,k=Math.sqrt(P*P+F*F),P/=k,F/=k,P*=p,F*=p;const B=g-y,X=v-x,N=g-E,D=M-x,U=B*N+X*D,V=X*N-D*B,W=V<0;if(Math.abs(V)<.001*Math.abs(U)){u.push(g-S*A,x-R*A,g+S*T,x+R*T),U>=0&&(n.join===qe.ROUND?d+=ki(g,x,g-S*A,x-R*A,g-P*A,x-F*A,u,!1)+4:d+=2,u.push(g-P*T,x-F*T,g+P*A,x+F*A));continue}const Q=(-S+y)*(-R+x)-(-S+g)*(-R+v),pt=(-P+E)*(-F+x)-(-P+g)*(-F+M),bt=(B*pt-N*Q)/V,Y=(D*Q-X*pt)/V,Et=(bt-g)*(bt-g)+(Y-x)*(Y-x),dt=g+(bt-g)*A,mt=x+(Y-x)*A,vt=g-(bt-g)*T,Mt=x-(Y-x)*T,Nt=Math.min(B*B+X*X,N*N+D*D),_e=W?A:T,jt=Nt+_e*_e*m,et=Et<=jt;let Ke=n.join;if(Ke===qe.MITER&&Et/m>_&&(Ke=qe.BEVEL),et)switch(Ke){case qe.MITER:{u.push(dt,mt,vt,Mt);break}case qe.BEVEL:{W?u.push(dt,mt,g+S*T,x+R*T,dt,mt,g+P*T,x+F*T):u.push(g-S*A,x-R*A,vt,Mt,g-P*A,x-F*A,vt,Mt),d+=2;break}case qe.ROUND:{W?(u.push(dt,mt,g+S*T,x+R*T),d+=ki(g,x,g+S*T,x+R*T,g+P*T,x+F*T,u,!0)+4,u.push(dt,mt,g+P*T,x+F*T)):(u.push(g-S*A,x-R*A,vt,Mt),d+=ki(g,x,g-S*A,x-R*A,g-P*A,x-F*A,u,!1)+4,u.push(g-P*A,x-F*A,vt,Mt));break}}else{switch(u.push(g-S*A,x-R*A,g+S*T,x+R*T),Ke){case qe.MITER:{W?u.push(vt,Mt,vt,Mt):u.push(dt,mt,dt,mt),d+=2;break}case qe.ROUND:{W?d+=ki(g,x,g+S*T,x+R*T,g+P*T,x+F*T,u,!0)+2:d+=ki(g,x,g-S*A,x-R*A,g-P*A,x-F*A,u,!1)+2;break}}u.push(g-P*A,x-F*A,g+P*T,x+F*T),d+=2}}y=i[(c-2)*2],v=i[(c-2)*2+1],g=i[(c-1)*2],x=i[(c-1)*2+1],S=-(v-x),R=y-g,k=Math.sqrt(S*S+R*R),S/=k,R/=k,S*=p,R*=p,u.push(g-S*A,x-R*A,g+S*T,x+R*T),l||(n.cap===oi.ROUND?d+=ki(g-S*(A-T)*.5,x-R*(A-T)*.5,g-S*A,x-R*A,g+S*T,x+R*T,u,!1)+2:n.cap===oi.SQUARE&&(d+=Hm(g,x,S,R,A,T,!1,u)));const C=t.indices,L=ws.epsilon*ws.epsilon;for(let O=f;O<d+f-2;++O)y=u[O*2],v=u[O*2+1],g=u[(O+1)*2],x=u[(O+1)*2+1],E=u[(O+2)*2],M=u[(O+2)*2+1],!(Math.abs(y*(x-M)+g*(M-v)+E*(v-x))<L)&&C.push(O,O+1,O+2)}function mC(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==we.POLY||i.closeStroke;if(s.length===0)return;const o=t.points,a=t.indices,l=s.length/2,h=o.length/2;let u=h;for(o.push(s[0],s[1]),e=1;e<l;e++)o.push(s[e*2],s[e*2+1]),a.push(u,u+1),u++;n&&a.push(u,h)}function $m(r,t){r.lineStyle.native?mC(r,t):pC(r,t)}class Gh{static curveLength(t,e,i,s,n,o){const a=t-2*i+n,l=e-2*s+o,h=2*i-2*t,u=2*s-2*e,c=4*(a*a+l*l),d=4*(a*h+l*u),f=h*h+u*u,p=2*Math.sqrt(c+d+f),m=Math.sqrt(c),_=2*c*m,y=2*Math.sqrt(f),v=d/m;return(_*p+m*d*(p-y)+(4*f*c-d*d)*Math.log((2*m+v+p)/(v+y)))/(4*_)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],l=ws._segmentsCount(Gh.curveLength(o,a,t,e,i,s));let h=0,u=0;for(let c=1;c<=l;++c){const d=c/l;h=o+(t-o)*d,u=a+(e-a)*d,n.push(h+(t+(i-t)*d-h)*d,u+(e+(s-e)*d-u)*d)}}}const Hh={[we.POLY]:km,[we.CIRC]:Go,[we.ELIP]:Go,[we.RECT]:cC,[we.RREC]:dC},Xm=[],Ho=[];class $o{constructor(t,e=null,i=null,s=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=s,this.type=t.type}clone(){return new $o(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const As=new It,Vm=class Lg extends Ep{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new Ro,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Ho.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Xm.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,i=null,s=null){const n=new $o(t,e,i,s);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new $o(t,null,null,e),s=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=s.lineStyle,s.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let i=0;i<e.length;++i){const s=e[i];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(t,As):As.copyFrom(t),s.shape.contains(As.x,As.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(As.x,As.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let i=null,s=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],s=i.style);for(let l=this.shapeIndex;l<e.length;l++){this.shapeIndex++;const h=e[l],u=h.fillStyle,c=h.lineStyle;Hh[h.type].build(h),h.matrix&&this.transformPoints(h.points,h.matrix),(u.visible||c.visible)&&this.processHoles(h.holes);for(let d=0;d<2;d++){const f=d===0?u:c;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,_=this.points.length/2;p.wrapMode=Qr.REPEAT,d===0?this.processFill(h):this.processLine(h);const y=this.points.length/2-_;y!==0&&(i&&!this._compareStyles(s,f)&&(i.end(m,_),i=null),i||(i=Xm.pop()||new fC,i.begin(f,m,_),this.batches.push(i),s=f),this.addUvs(this.points,t,f.texture,_,y,f.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const i=this.graphicsData[t],s=i.fillStyle,n=i.lineStyle;if(s&&!s.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,i=t.length;e<i;e++){const s=t[e];for(let n=0;n<s.size;n++){const o=s.start+n;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<Lg.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++_t._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Ho.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=Ho.pop();s||(s=new uh,s.texArray=new gh),s.texArray.count=0,s.start=0,s.size=0,s.type=fr.TRIANGLES;let n=0,o=null,a=0,l=!1,h=fr.TRIANGLES,u=0;this.drawCalls.push(s);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],f=8,p=d.style,m=p.texture.baseTexture;l!==!!p.native&&(l=!!p.native,h=l?fr.LINES:fr.TRIANGLES,o=null,n=f,t++),o!==m&&(o=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=Ho.pop(),s||(s=new uh,s.texArray=new gh),this.drawCalls.push(s)),s.start=u,s.size=0,s.texArray.count=0,s.type=h),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Qr.REPEAT,s.texArray.elements[s.texArray.count++]=m,n++)),s.size+=d.size,u+=d.size,a=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}_t._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,i=this.colors,s=this.textureIds,n=new ArrayBuffer(t.length*3*4),o=new Float32Array(n),a=new Uint32Array(n);let l=0;for(let h=0;h<t.length/2;h++)o[l++]=t[h*2],o[l++]=t[h*2+1],o[l++]=e[h*2],o[l++]=e[h*2+1],a[l++]=i[h],o[l++]=s[h];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?km.triangulate(t,this):Hh[t.type].triangulate(t,this)}processLine(t){$m(t,this);for(let e=0;e<t.holes.length;e++)$m(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];Hh[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let i=0;i<t.length/2;i++){const s=t[i*2],n=t[i*2+1];t[i*2]=e.a*s+e.c*n+e.tx,t[i*2+1]=e.b*s+e.d*n+e.ty}}addColors(t,e,i,s,n=0){const o=Ot.shared.setValue(e).toLittleEndianNumber(),a=Ot.shared.setValue(o).toPremultiplied(i);t.length=Math.max(t.length,n+s);for(let l=0;l<s;l++)t[n+l]=a}addTextureIds(t,e,i,s=0){t.length=Math.max(t.length,s+i);for(let n=0;n<i;n++)t[s+n]=e}addUvs(t,e,i,s,n,o=null){let a=0;const l=e.length,h=i.frame;for(;a<n;){let c=t[(s+a)*2],d=t[(s+a)*2+1];if(o){const f=o.a*c+o.c*d+o.tx;d=o.b*c+o.d*d+o.ty,c=f}a++,e.push(c/h.width,d/h.height)}const u=i.baseTexture;(h.width<u.width||h.height<u.height)&&this.adjustUvs(e,i,l,n)}adjustUvs(t,e,i,s){const n=e.baseTexture,o=1e-6,a=i+s*2,l=e.frame,h=l.width/n.width,u=l.height/n.height;let c=l.x/l.width,d=l.y/l.height,f=Math.floor(t[i]+o),p=Math.floor(t[i+1]+o);for(let m=i+2;m<a;m+=2)f=Math.min(f,Math.floor(t[m]+o)),p=Math.min(p,Math.floor(t[m+1]+o));c-=f,d-=p;for(let m=i;m<a;m+=2)t[m]=(t[m]+c)*h,t[m+1]=(t[m+1]+d)*u}};Vm.BATCHABLE_SIZE=100;let gC=Vm;class Xo{constructor(){this.color=16777215,this.alpha=1,this.texture=ut.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Xo;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=ut.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class $h extends Xo{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=oi.BUTT,this.join=qe.MITER,this.miterLimit=10}clone(){const t=new $h;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=oi.BUTT,this.join=qe.MITER,this.miterLimit=10}}const Xh={},Vh=class ra extends nr{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Xo,this._lineStyle=new $h,this._matrix=null,this._holeMode=!1,this.state=Er.for2d(),this._geometry=t||new gC,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Ot(16777215),this.blendMode=yt.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new ra(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,i,s=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:s,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:ut.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:oi.BUTT,join:qe.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Ci,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Ci,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const i=this.currentPath.points,s=i[i.length-2],n=i[i.length-1];return(s!==t||n!==e)&&i.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),Gh.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),kh.curveTo(t,e,i,s,n,o,this.currentPath.points),this}arcTo(t,e,i,s,n){this._initCurve(t,e);const o=this.currentPath.points,a=Gm.curveTo(t,e,i,s,n,o);if(a){const{cx:l,cy:h,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=a;this.arc(l,h,u,c,d,f)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=uo:o&&s<=n&&(s+=uo),n-s===0)return this;const a=t+Math.cos(s)*i,l=e+Math.sin(s)*i,h=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-a),d=Math.abs(u[u.length-1]-l);c<h&&d<h||u.push(a,l)}else this.moveTo(a,l),u=this.currentPath.points;return Gm.arc(a,l,t,e,i,s,n,o,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:ut.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Ot.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:ut.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,s){return this.drawShape(new xt(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new mo(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new fo(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new po(t,e,i,s))}drawPolygon(...t){let e,i=!0;const s=t[0];s.points?(i=s.closeStroke,e=s.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Ci(e);return n.closeStroke=i,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===we.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let s=0;s<i;s++){const n=t.batches[s],o=n.style.color,a=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),l=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),h=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:a,blendMode:e,indices:h,uvs:l,_batchRGB:Ot.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){const s=this.batches[e];s.worldAlpha=this.worldAlpha*s.alpha,t.plugins[this.pluginName].render(s)}}}_renderDirect(t){const e=this._resolveDirectShader(t),i=this._geometry,s=this.worldAlpha,n=e.uniforms,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,Ot.shared.setValue(this._tintColor).premultiply(s).toArray(n.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let a=0,l=o.length;a<l;a++)this._renderDrawCallDirect(t,i.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:i,type:s,size:n,start:o}=e,a=i.count;for(let l=0;l<a;l++)t.texture.bind(i.elements[l],l);t.geometry.draw(s,n,o)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!Xh[i]){const{maxTextures:s}=t.plugins[i],n=new Int32Array(s);for(let l=0;l<s;l++)n[l]=l;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new kt,default:sr.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;Xh[i]=new Tr(a,o)}e=Xh[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:s,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,i,s,n)}containsPoint(t){return this.worldTransform.applyInverse(t,ra._TEMP_POINT),this._geometry.containsPoint(ra._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=Ot.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,l=e.ty,h=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<h.length;d+=2){const f=h[d],p=h[d+1];u[c++]=i*f+n*p+a,u[c++]=o*p+s*f+l}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};Vh.curves=ws,Vh._TEMP_POINT=new It;let fn=Vh;class yC{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const zh=new It,zm=new Ci,Ym=class Bg extends nr{constructor(t,e,i,s=fr.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Er.for2d(),this.drawMode=s,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=tt.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===fr.TRIANGLES&&e.length<Bg.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const s=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[s]),t.plugins[s].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const s=this.transform.worldTransform,n=s.a,o=s.b,a=s.c,l=s.d,h=s.tx,u=s.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const f=e[d*2],p=e[d*2+1];c[d*2]=n*f+a*p+h,c[d*2+1]=o*f+l*p+u}if(this._roundPixels){const d=tt.RESOLUTION;for(let f=0;f<c.length;++f)c[f]=Math.round(c[f]*d)/d}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new yC(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,zh);const e=this.geometry.getBuffer("aVertexPosition").data,i=zm.points,s=this.geometry.getIndex().data,n=s.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const l=s[a]*2,h=s[a+1]*2,u=s[a+2]*2;if(i[0]=e[l],i[1]=e[l+1],i[2]=e[h],i[3]=e[h+1],i[4]=e[u],i[5]=e[u+1],zm.contains(zh.x,zh.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Ym.BATCHABLE_SIZE=100;let Wm=Ym;class _C extends ii{constructor(t,e,i){super();const s=new te(t),n=new te(e,!0),o=new te(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,ft.FLOAT).addAttribute("aTextureCoord",n,2,!1,ft.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var vC=`varying vec2 vTextureCoord;
912
+ `;let Es=null;class Im{constructor(){Es||(Es=URL.createObjectURL(new Blob([cS],{type:"application/javascript"}))),this.worker=new Worker(Es)}}Im.revokeObjectURL=function(){Es&&(URL.revokeObjectURL(Es),Es=null)};let Rm=0,Lh;class dS{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new Dh;e.addEventListener("message",i=>{e.terminate(),Dh.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Lh===void 0&&(Lh=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Lh&&(this._createdWorkers++,t=new Im().worker,t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const i=new Promise((s,n)=>{this.queue.push({id:t,arguments:e,resolve:s,reject:n})});return this.next(),i}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),i=e.id;this.resolveHash[Rm]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Rm++,id:i})}}const Mm=new dS;function dn(r,t,e){r.resource.internal=!0;const i=new ut(r),s=()=>{delete t.promiseCache[e],Fi.has(e)&&Fi.remove(e)};return i.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),s())}),i.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}const fS=[".jpeg",".jpg",".png",".webp",".avif"],pS=["image/jpeg","image/png","image/webp","image/avif"];async function mS(r){const t=await tt.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const No={name:"loadTextures",extension:{type:Z.LoadParser,priority:lr.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return xs(r,pS)||ni(r,fS)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await Mm.isImageBitmapSupported()?s=await Mm.loadImageBitmap(r):s=await mS(r):s=await new Promise((l,h)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=r,u.complete?l(u):(u.onload=()=>l(u),u.onerror=c=>h(c))});const n={...t.data};n.resolution??(n.resolution=Dr(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new _t(s,n);return o.resource.src=r,dn(o,e,r)},unload(r){r.destroy(!0)}};ht.add(No);const gS=".svg",yS="image/svg+xml",_S={extension:{type:Z.LoadParser,priority:lr.High},name:"loadSVG",test(r){return xs(r,yS)||ni(r,gS)},async testParse(r){return Sh.test(r)},async parse(r,t,e){var n;const i=new Sh(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new _t(i,{resolution:Dr(r),...t==null?void 0:t.data});return s.resource.src=t.src,dn(s,e,t.src)},async load(r,t){return(await tt.ADAPTER.fetch(r)).text()},unload:No.unload};ht.add(_S);const vS=[".mp4",".m4v",".webm",".ogv"],xS=["video/mp4","video/webm","video/ogg"],bS={name:"loadVideo",extension:{type:Z.LoadParser,priority:lr.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(r){return xs(r,xS)||ni(r,vS)},async load(r,t,e){var o;let i;const s=await(await tt.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(s);try{const a={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(o=t==null?void 0:t.data)==null?void 0:o.resourceOptions,autoLoad:!0},l=new gm(n,a);await l.load();const h=new _t(l,{alphaMode:await CT(),resolution:Dr(r),...t==null?void 0:t.data});h.resource.src=r,i=dn(h,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};ht.add(bS);class ES{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,name:i,src:s,srcs:n}=t;return ar(e||i||s||n,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];Array.isArray(e)?e.forEach(s=>{const n=s.src??s.srcs,o=s.alias??s.name;let a;if(typeof o=="string"){const l=this._createBundleAssetId(t,o);i.push(l),a=[o,l]}else{const l=o.map(h=>this._createBundleAssetId(t,h));i.push(...l),a=[...o,...l]}this.add({...s,alias:a,src:n})}):Object.keys(e).forEach(s=>{const n=[s,this._createBundleAssetId(t,s)];if(typeof e[s]=="string")this.add({alias:n,src:e[s]});else if(Array.isArray(e[s]))this.add({alias:n,src:e[s]});else{const o=e[s],a=o.src??o.srcs;this.add({...o,alias:n,src:Array.isArray(a)?a:[a]})}i.push(...n)}),this._bundles[t]=i}add(t,e,i,s,n){const o=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(St("7.2.0",`Assets.add now uses an object instead of individual parameters.
913
+ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:i,format:s,loadParser:n})):Array.isArray(t)?o.push(...t):o.push(t);let a;a=l=>{this.hasKey(l)&&console.warn(`[Resolver] already has key: ${l} overwriting`)},ar(o).forEach(l=>{const{src:h,srcs:u}=l;let{data:c,format:d,loadParser:f}=l;const p=ar(h||u).map(y=>typeof y=="string"?WA(y):Array.isArray(y)?y:[y]),m=this.getAlias(l);Array.isArray(m)?m.forEach(a):a(m);const _=[];p.forEach(y=>{y.forEach(v=>{let g={};if(typeof v!="object"){g.src=v;for(let x=0;x<this._parsers.length;x++){const E=this._parsers[x];if(E.test(v)){g=E.parse(v);break}}}else c=v.data??c,d=v.format??d,f=v.loadParser??f,g={...g,...v};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this.buildResolvedAsset(g,{aliases:m,data:c,format:d,loadParser:f}),_.push(g)})}),m.forEach(y=>{this._assetMap[y]=_})})}resolveBundle(t){const e=Oo(t);t=ar(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const l in o){const h=o[l];a[this._extractAssetIdFromBundle(s,l)]=h}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=Oo(t);t=ar(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(l=>{a.params[l].forEach(h=>{const u=n.filter(c=>c[l]?c[l]===h:!1);u.length&&(n=u)})}),this._resolverHash[s]=n[0]??o}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:i,data:s,loadParser:n,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=ge.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=n??t.loadParser,t.format=o??t.format??ge.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class TS{constructor(){this._detections=[],this._initialized=!1,this.resolver=new ES,this.loader=new qA,this.cache=Fi,this._backgroundLoader=new YA(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,s,n){this.resolver.add(t,e,i,s,n)}async load(t,e){this._initialized||await this.init();const i=Oo(t),s=ar(t).map(a=>{if(typeof a!="string"){const l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,l=0;const h=()=>{e==null||e(++a/l)},u=o.map(c=>{const d=s[c];return l+=Object.keys(d).length,this._mapLoadToResolve(d,h).then(f=>{n[c]=f})});return await Promise.all(u),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Fi.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=Fi.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),s=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const o={};return i.forEach((a,l)=>{const h=n[a.src],u=[a.src];a.alias&&u.push(...a.alias),o[s[l]]=h,Fi.set(u,h)}),o}async unload(t){this._initialized||await this.init();const e=ar(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=ar(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{Fi.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}get preferWorkers(){return No.config.preferWorkers}set preferWorkers(t){St("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const Do=new TS;ht.handleByList(Z.LoadParser,Do.loader.parsers).handleByList(Z.ResolveParser,Do.resolver.parsers).handleByList(Z.CacheParser,Do.cache.parsers).handleByList(Z.DetectionParser,Do.detections);const wS={extension:Z.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof ut),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};ht.add(wS);async function Pm(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const AS={extension:{type:Z.DetectionParser,priority:1},test:async()=>Pm("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};ht.add(AS);const SS={extension:{type:Z.DetectionParser,priority:0},test:async()=>Pm("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};ht.add(SS);const Om=["png","jpg","jpeg"],CS={extension:{type:Z.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Om],remove:async r=>r.filter(t=>!Om.includes(t))};ht.add(CS);const IS="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Bh(r){return IS?!1:document.createElement("video").canPlayType(r)!==""}const RS={extension:{type:Z.DetectionParser,priority:0},test:async()=>Bh("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};ht.add(RS);const MS={extension:{type:Z.DetectionParser,priority:0},test:async()=>Bh("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};ht.add(MS);const PS={extension:{type:Z.DetectionParser,priority:0},test:async()=>Bh("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};ht.add(PS);const OS={extension:Z.ResolveParser,test:No.test,parse:r=>{var t;return{resolution:parseFloat(((t=tt.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:ge.extname(r).slice(1),src:r}}};ht.add(OS);var Ae=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(Ae||{});const Lo={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let wr,Ts;function Nm(){Ts={bptc:wr.getExtension("EXT_texture_compression_bptc"),astc:wr.getExtension("WEBGL_compressed_texture_astc"),etc:wr.getExtension("WEBGL_compressed_texture_etc"),s3tc:wr.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:wr.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:wr.getExtension("WEBGL_compressed_texture_pvrtc")||wr.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:wr.getExtension("WEBGL_compressed_texture_etc1"),atc:wr.getExtension("WEBGL_compressed_texture_atc")}}const NS={extension:{type:Z.DetectionParser,priority:2},test:async()=>{const r=tt.ADAPTER.createCanvas().getContext("webgl");return r?(wr=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{Ts||Nm();const t=[];for(const e in Ts)Ts[e]&&t.push(e);return[...t,...r]},remove:async r=>(Ts||Nm(),r.filter(t=>!(t in Ts)))};ht.add(NS);class DS extends lo{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,s;typeof t=="string"?(i=t,s=new Uint8Array):(i=null,s=t),super(s,e),this.origin=i,this.buffer=s?new eh(s):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new eh(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Ui extends DS{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=Ui._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Ui._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const s=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;s.pixelStorei(s.UNPACK_ALIGNMENT,4);for(let n=0,o=this.levels;n<o;n++){const{levelID:a,levelWidth:l,levelHeight:h,levelBuffer:u}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,l,h,0,u)}return!0}onBlobLoaded(){this._levelBuffers=Ui._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t===36196)return"etc1";if(t===35986||t===35987||t===34798)return"atc";if(t>=36492&&t<=36495)return"bptc";if(t===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,i,s,n,o,a){const l=new Array(i);let h=t.byteOffset,u=o,c=a,d=u+s-1&~(s-1),f=c+n-1&~(n-1),p=d*f*Lo[e];for(let m=0;m<i;m++)l[m]={levelID:m,levelWidth:i>1?u:d,levelHeight:i>1?c:f,levelBuffer:new Uint8Array(t.buffer,h,p)},h+=p,u=u>>1||1,c=c>>1||1,d=u+s-1&~(s-1),f=c+n-1&~(n-1),p=d*f*Lo[e];return l}}const Fh=4,Bo=124,LS=32,Dm=20,BS=542327876,Fo={HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},FS={FOURCC:2},Uo={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},US=1,kS=2,GS=4,HS=64,$S=512,XS=131072,VS=827611204,zS=861165636,YS=894720068,WS=808540228,jS=4,qS={[VS]:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,[zS]:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,[YS]:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT},KS={70:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Ae.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Ae.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Ae.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Ae.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function ZS(r){const t=new Uint32Array(r);if(t[0]!==BS)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Bo/Uint32Array.BYTES_PER_ELEMENT),i=e[Fo.HEIGHT],s=e[Fo.WIDTH],n=e[Fo.MIPMAP_COUNT],o=new Uint32Array(r,Fo.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,LS/Uint32Array.BYTES_PER_ELEMENT),a=o[US];if(a&GS){const l=o[FS.FOURCC];if(l!==WS){const v=qS[l],g=Fh+Bo,x=new Uint8Array(r,g);return[new Ui(x,{format:v,width:s,height:i,levels:n})]}const h=Fh+Bo,u=new Uint32Array(t.buffer,h,Dm/Uint32Array.BYTES_PER_ELEMENT),c=u[Uo.DXGI_FORMAT],d=u[Uo.RESOURCE_DIMENSION],f=u[Uo.MISC_FLAG],p=u[Uo.ARRAY_SIZE],m=KS[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===jS)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const _=new Array,y=Fh+Bo+Dm;if(p===1)_.push(new Uint8Array(r,y));else{const v=Lo[m];let g=0,x=s,E=i;for(let S=0;S<n;S++){const R=Math.max(1,x+3&-4),P=Math.max(1,E+3&-4),F=R*P*v;g+=F,x=x>>>1,E=E>>>1}let M=y;for(let S=0;S<p;S++)_.push(new Uint8Array(r,M,g)),M+=g}return _.map(v=>new Ui(v,{format:m,width:s,height:i,levels:n}))}throw a&HS?new Error("DDSParser does not support uncompressed texture data."):a&$S?new Error("DDSParser does not supported YUV uncompressed texture data."):a&XS?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&kS?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const Lm=[171,75,84,88,32,49,49,187,13,10,26,10],QS=67305985,hr={ENDIANNESS:12,GL_TYPE:16,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},Uh=64,Bm={[ft.UNSIGNED_BYTE]:1,[ft.UNSIGNED_SHORT]:2,[ft.INT]:4,[ft.UNSIGNED_INT]:4,[ft.FLOAT]:4,[ft.HALF_FLOAT]:8},JS={[z.RGBA]:4,[z.RGB]:3,[z.RG]:2,[z.RED]:1,[z.LUMINANCE]:1,[z.LUMINANCE_ALPHA]:2,[z.ALPHA]:1},tC={[ft.UNSIGNED_SHORT_4_4_4_4]:2,[ft.UNSIGNED_SHORT_5_5_5_1]:2,[ft.UNSIGNED_SHORT_5_6_5]:2};function eC(r,t,e=!1){const i=new DataView(t);if(!rC(r,i))return null;const s=i.getUint32(hr.ENDIANNESS,!0)===QS,n=i.getUint32(hr.GL_TYPE,s),o=i.getUint32(hr.GL_FORMAT,s),a=i.getUint32(hr.GL_INTERNAL_FORMAT,s),l=i.getUint32(hr.PIXEL_WIDTH,s),h=i.getUint32(hr.PIXEL_HEIGHT,s)||1,u=i.getUint32(hr.PIXEL_DEPTH,s)||1,c=i.getUint32(hr.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(hr.NUMBER_OF_FACES,s),f=i.getUint32(hr.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(hr.BYTES_OF_KEY_VALUE_DATA,s);if(h===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const m=4,_=4,y=l+3&-4,v=h+3&-4,g=new Array(c);let x=l*h;n===0&&(x=y*v);let E;if(n!==0?Bm[n]?E=Bm[n]*JS[o]:E=tC[n]:E=Lo[a],E===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const M=e?sC(i,p,s):null;let S=x*E,R=l,P=h,F=y,k=v,I=Uh+p;for(let A=0;A<f;A++){const T=i.getUint32(I,s);let C=I+4;for(let L=0;L<c;L++){let O=g[L];O||(O=g[L]=new Array(f)),O[A]={levelID:A,levelWidth:f>1||n!==0?R:F,levelHeight:f>1||n!==0?P:k,levelBuffer:new Uint8Array(t,C,S)},C+=S}I+=T+4,I=I%4!==0?I+4-I%4:I,R=R>>1||1,P=P>>1||1,F=R+m-1&-4,k=P+_-1&-4,S=F*k*E}return n!==0?{uncompressed:g.map(A=>{let T=A[0].levelBuffer,C=!1;return n===ft.FLOAT?T=new Float32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4):n===ft.UNSIGNED_INT?(C=!0,T=new Uint32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)):n===ft.INT&&(C=!0,T=new Int32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)),{resource:new lo(T,{width:A[0].levelWidth,height:A[0].levelHeight}),type:n,format:C?iC(o):o}}),kvData:M}:{compressed:g.map(A=>new Ui(null,{format:a,width:l,height:h,levels:f,levelBuffers:A})),kvData:M}}function rC(r,t){for(let e=0;e<Lm.length;e++)if(t.getUint8(e)!==Lm[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function iC(r){switch(r){case z.RGBA:return z.RGBA_INTEGER;case z.RGB:return z.RGB_INTEGER;case z.RG:return z.RG_INTEGER;case z.RED:return z.RED_INTEGER;default:return r}}function sC(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(Uh+s,e),o=Uh+s+4,a=3-(n+3)%4;if(n===0||n>t-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let l=0;for(;l<n&&r.getUint8(o+l)!==0;l++);if(l===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const h=new TextDecoder().decode(new Uint8Array(r.buffer,o,l)),u=new DataView(r.buffer,o+l+1,n-l-1);i.set(h,u),s+=4+n+a}return i}const nC={extension:{type:Z.LoadParser,priority:lr.High},name:"loadDDS",test(r){return ni(r,".dds")},async load(r,t,e){const i=await(await tt.ADAPTER.fetch(r)).arrayBuffer(),s=ZS(i).map(n=>{const o=new _t(n,{mipmap:pr.OFF,alphaMode:He.NO_PREMULTIPLIED_ALPHA,resolution:Dr(r),...t.data});return dn(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};ht.add(nC);const oC={extension:{type:Z.LoadParser,priority:lr.High},name:"loadKTX",test(r){return ni(r,".ktx")},async load(r,t,e){const i=await(await tt.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=eC(r,i),a=s??n,l={mipmap:pr.OFF,alphaMode:He.NO_PREMULTIPLIED_ALPHA,resolution:Dr(r),...t.data},h=a.map(u=>{a===n&&Object.assign(l,{type:u.type,format:u.format});const c=u.resource??u,d=new _t(c,l);return d.ktxKeyValueData=o,dn(d,e,r)});return h.length===1?h[0]:h},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};ht.add(oC);const aC=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],lC={extension:Z.ResolveParser,test:r=>{const t=ge.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var i,s;const t=r.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(aC.includes(n))return{resolution:parseFloat(((i=tt.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:n,src:r}}return{resolution:parseFloat(((s=tt.RETINA_PREFIX.exec(r))==null?void 0:s[1])??"1"),format:e,src:r}}};ht.add(lC);const ko=new xt,hC=4,Fm=class _n{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,i,s){const n=new Image;return n.src=await this.base64(t,e,i,s),n}async base64(t,e,i,s){const n=this.canvas(t,s);if(n.toBlob!==void 0)return new Promise((o,a)=>{n.toBlob(l=>{if(!l){a(new Error("ICanvas.toBlob failed!"));return}const h=new FileReader;h.onload=()=>o(h.result),h.onerror=a,h.readAsDataURL(l)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:e,quality:i});return new Promise((a,l)=>{const h=new FileReader;h.onload=()=>a(h.result),h.onerror=l,h.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);o&&_n._flipY(i,s,n),a&&_n._unpremultiplyAlpha(i);const l=new XT(s,n,1),h=new ImageData(new Uint8ClampedArray(i.buffer),s,n);return l.context.putImageData(h,0,0),l.canvas}pixels(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);return o&&_n._flipY(i,s,n),a&&_n._unpremultiplyAlpha(i),i}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let s,n=!1,o=!1,a,l=!1;t&&(t instanceof Ni?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),l=!0,e&&(ko.width=e.width,ko.height=e.height,e=ko)));const h=i.gl;if(a){if(s=a.baseTexture.resolution,e=e??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===z.RGBA,!l){i.renderTexture.bind(a);const f=a.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else s=i.resolution,e||(e=ko,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const u=Math.max(Math.round(e.width*s),1),c=Math.max(Math.round(e.height*s),1),d=new Uint8Array(hC*u*c);return h.readPixels(Math.round(e.x*s),Math.round(e.y*s),u,c,h.RGBA,h.UNSIGNED_BYTE,d),l&&(a==null||a.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const s=e<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a<n;a++){const l=a*s,h=(i-a-1)*s;o.set(t.subarray(l,l+s)),t.copyWithin(l,h,h+s),t.set(o,h)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let i=0;i<e;i+=4){const s=t[i+3];if(s!==0){const n=255.001/s;t[i]=t[i]*n+.5,t[i+1]=t[i+1]*n+.5,t[i+2]=t[i+2]*n+.5}}}};Fm.extension={name:"extract",type:Z.RendererSystem};let uC=Fm;ht.add(uC);const Go={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===we.CIRC){const p=r.shape;e=p.x,i=p.y,o=a=p.radius,s=n=0}else if(r.type===we.ELIP){const p=r.shape;e=p.x,i=p.y,o=p.width,a=p.height,s=n=0}else{const p=r.shape,m=p.width/2,_=p.height/2;e=p.x+m,i=p.y+_,o=a=Math.max(0,Math.min(p.radius,Math.min(m,_))),s=m-o,n=_-a}if(!(o>=0&&a>=0&&s>=0&&n>=0)){t.length=0;return}const l=Math.ceil(2.3*Math.sqrt(o+a)),h=l*8+(s?4:0)+(n?4:0);if(t.length=h,h===0)return;if(l===0){t.length=8,t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n;return}let u=0,c=l*4+(s?2:0)+2,d=c,f=h;{const p=s+o,m=n,_=e+p,y=e-p,v=i+m;if(t[u++]=_,t[u++]=v,t[--c]=v,t[--c]=y,n){const g=i-m;t[d++]=y,t[d++]=g,t[--f]=g,t[--f]=_}}for(let p=1;p<l;p++){const m=Math.PI/2*(p/l),_=s+Math.cos(m)*o,y=n+Math.sin(m)*a,v=e+_,g=e-_,x=i+y,E=i-y;t[u++]=v,t[u++]=x,t[--c]=x,t[--c]=g,t[d++]=g,t[d++]=E,t[--f]=E,t[--f]=v}{const p=s,m=n+a,_=e+p,y=e-p,v=i+m,g=i-m;t[u++]=_,t[u++]=v,t[--f]=g,t[--f]=_,s&&(t[u++]=y,t[u++]=v,t[--f]=g,t[--f]=y)}},triangulate(r,t){const e=r.points,i=t.points,s=t.indices;if(e.length===0)return;let n=i.length/2;const o=n;let a,l;if(r.type!==we.RREC){const u=r.shape;a=u.x,l=u.y}else{const u=r.shape;a=u.x+u.width/2,l=u.y+u.height/2}const h=r.matrix;i.push(r.matrix?h.a*a+h.c*l+h.tx:a,r.matrix?h.b*a+h.d*l+h.ty:l),n++,i.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)i.push(e[u],e[u+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function Um(r,t=!1){const e=r.length;if(e<6)return;let i=0;for(let s=0,n=r[e-2],o=r[e-1];s<e;s+=2){const a=r[s],l=r[s+1];i+=(a-n)*(l+o),n=a,o=l}if(!t&&i>0||t&&i<=0){const s=e/2;for(let n=s+s%2;n<e;n+=2){const o=e-n-2,a=e-n-1,l=n,h=n+1;[r[o],r[l]]=[r[l],r[o]],[r[a],r[h]]=[r[h],r[a]]}}}const km={build(r){r.points=r.shape.points.slice()},triangulate(r,t){let e=r.points;const i=r.holes,s=t.points,n=t.indices;if(e.length>=6){Um(e,!1);const o=[];for(let h=0;h<i.length;h++){const u=i[h];Um(u.points,!0),o.push(e.length/2),e=e.concat(u.points)}const a=mx(e,o,2);if(!a)return;const l=s.length/2;for(let h=0;h<a.length;h+=3)n.push(a[h]+l),n.push(a[h+1]+l),n.push(a[h+2]+l);for(let h=0;h<e.length;h++)s.push(e[h])}}},cC={build(r){const t=r.shape,e=t.x,i=t.y,s=t.width,n=t.height,o=r.points;o.length=0,s>=0&&n>=0&&o.push(e,i,e+s,i,e+s,i+n,e,i+n)},triangulate(r,t){const e=r.points,i=t.points;if(e.length===0)return;const s=i.length/2;i.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},dC={build(r){Go.build(r)},triangulate(r,t){Go.triangulate(r,t)}};var qe=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(qe||{}),oi=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(oi||{});const ws={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,t=20){if(!this.adaptive||!r||isNaN(r))return t;let e=Math.ceil(r/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class Gm{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],l=o[o.length-1]-e,h=a-t,u=s-e,c=i-t,d=Math.abs(l*c-h*u);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const f=l*l+h*h,p=u*u+c*c,m=l*u+h*c,_=n*Math.sqrt(f)/d,y=n*Math.sqrt(p)/d,v=_*m/f,g=y*m/p,x=_*c+y*h,E=_*u+y*l,M=h*(y+v),S=l*(y+v),R=c*(_+g),P=u*(_+g),F=Math.atan2(S-E,M-x),k=Math.atan2(P-E,R-x);return{cx:x+t,cy:E+e,radius:n,startAngle:F,endAngle:k,anticlockwise:h*u>c*l}}static arc(t,e,i,s,n,o,a,l,h){const u=a-o,c=ws._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/uo)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),_=c-1,y=_%1/_;for(let v=0;v<=_;++v){const g=v+y*v,x=d+o+f*g,E=Math.cos(x),M=-Math.sin(x);h.push((p*E+m*M)*n+i,(p*-M+m*E)*n+s)}}}class fC{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class kh{static curveLength(t,e,i,s,n,o,a,l){let h=0,u=0,c=0,d=0,f=0,p=0,m=0,_=0,y=0,v=0,g=0,x=t,E=e;for(let M=1;M<=10;++M)u=M/10,c=u*u,d=c*u,f=1-u,p=f*f,m=p*f,_=m*t+3*p*u*i+3*f*c*n+d*a,y=m*e+3*p*u*s+3*f*c*o+d*l,v=x-_,g=E-y,x=_,E=y,h+=Math.sqrt(v*v+g*g);return h}static curveTo(t,e,i,s,n,o,a){const l=a[a.length-2],h=a[a.length-1];a.length-=2;const u=ws._segmentsCount(kh.curveLength(l,h,t,e,i,s,n,o));let c=0,d=0,f=0,p=0,m=0;a.push(l,h);for(let _=1,y=0;_<=u;++_)y=_/u,c=1-y,d=c*c,f=d*c,p=y*y,m=p*y,a.push(f*l+3*d*y*t+3*c*p*i+m*n,f*h+3*d*y*e+3*c*p*s+m*o)}}function Hm(r,t,e,i,s,n,o,a){const l=r-e*s,h=t-i*s,u=r+e*n,c=t+i*n;let d,f;o?(d=i,f=-e):(d=-i,f=e);const p=l+d,m=h+f,_=u+d,y=c+f;return a.push(p,m,_,y),2}function ki(r,t,e,i,s,n,o,a){const l=e-r,h=i-t;let u=Math.atan2(l,h),c=Math.atan2(s-r,n-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(l*l+h*h),_=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/_;if(d+=y,a){o.push(r,t,e,i);for(let v=1,g=d;v<_;v++,g+=y)o.push(r,t,r+Math.sin(g)*m,t+Math.cos(g)*m);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let v=1,g=d;v<_;v++,g+=y)o.push(r+Math.sin(g)*m,t+Math.cos(g)*m,r,t);o.push(s,n,r,t)}return _*2}function pC(r,t){const e=r.shape;let i=r.points||e.points.slice();const s=t.closePointEps;if(i.length===0)return;const n=r.lineStyle,o=new It(i[0],i[1]),a=new It(i[i.length-2],i[i.length-1]),l=e.type!==we.POLY||e.closeStroke,h=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(l){i=i.slice(),h&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const O=(o.x+a.x)*.5,B=(a.y+o.y)*.5;i.unshift(O,B),i.push(O,B)}const u=t.points,c=i.length/2;let d=i.length;const f=u.length/2,p=n.width/2,m=p*p,_=n.miterLimit*n.miterLimit;let y=i[0],v=i[1],g=i[2],x=i[3],E=0,M=0,S=-(v-x),R=y-g,P=0,F=0,k=Math.sqrt(S*S+R*R);S/=k,R/=k,S*=p,R*=p;const I=n.alignment,A=(1-I)*2,T=I*2;l||(n.cap===oi.ROUND?d+=ki(y-S*(A-T)*.5,v-R*(A-T)*.5,y-S*A,v-R*A,y+S*T,v+R*T,u,!0)+2:n.cap===oi.SQUARE&&(d+=Hm(y,v,S,R,A,T,!0,u))),u.push(y-S*A,v-R*A,y+S*T,v+R*T);for(let O=1;O<c-1;++O){y=i[(O-1)*2],v=i[(O-1)*2+1],g=i[O*2],x=i[O*2+1],E=i[(O+1)*2],M=i[(O+1)*2+1],S=-(v-x),R=y-g,k=Math.sqrt(S*S+R*R),S/=k,R/=k,S*=p,R*=p,P=-(x-M),F=g-E,k=Math.sqrt(P*P+F*F),P/=k,F/=k,P*=p,F*=p;const B=g-y,X=v-x,N=g-E,D=M-x,U=B*N+X*D,V=X*N-D*B,W=V<0;if(Math.abs(V)<.001*Math.abs(U)){u.push(g-S*A,x-R*A,g+S*T,x+R*T),U>=0&&(n.join===qe.ROUND?d+=ki(g,x,g-S*A,x-R*A,g-P*A,x-F*A,u,!1)+4:d+=2,u.push(g-P*T,x-F*T,g+P*A,x+F*A));continue}const Q=(-S+y)*(-R+x)-(-S+g)*(-R+v),pt=(-P+E)*(-F+x)-(-P+g)*(-F+M),bt=(B*pt-N*Q)/V,Y=(D*Q-X*pt)/V,Et=(bt-g)*(bt-g)+(Y-x)*(Y-x),dt=g+(bt-g)*A,mt=x+(Y-x)*A,vt=g-(bt-g)*T,Mt=x-(Y-x)*T,Nt=Math.min(B*B+X*X,N*N+D*D),_e=W?A:T,jt=Nt+_e*_e*m,et=Et<=jt;let Ke=n.join;if(Ke===qe.MITER&&Et/m>_&&(Ke=qe.BEVEL),et)switch(Ke){case qe.MITER:{u.push(dt,mt,vt,Mt);break}case qe.BEVEL:{W?u.push(dt,mt,g+S*T,x+R*T,dt,mt,g+P*T,x+F*T):u.push(g-S*A,x-R*A,vt,Mt,g-P*A,x-F*A,vt,Mt),d+=2;break}case qe.ROUND:{W?(u.push(dt,mt,g+S*T,x+R*T),d+=ki(g,x,g+S*T,x+R*T,g+P*T,x+F*T,u,!0)+4,u.push(dt,mt,g+P*T,x+F*T)):(u.push(g-S*A,x-R*A,vt,Mt),d+=ki(g,x,g-S*A,x-R*A,g-P*A,x-F*A,u,!1)+4,u.push(g-P*A,x-F*A,vt,Mt));break}}else{switch(u.push(g-S*A,x-R*A,g+S*T,x+R*T),Ke){case qe.MITER:{W?u.push(vt,Mt,vt,Mt):u.push(dt,mt,dt,mt),d+=2;break}case qe.ROUND:{W?d+=ki(g,x,g+S*T,x+R*T,g+P*T,x+F*T,u,!0)+2:d+=ki(g,x,g-S*A,x-R*A,g-P*A,x-F*A,u,!1)+2;break}}u.push(g-P*A,x-F*A,g+P*T,x+F*T),d+=2}}y=i[(c-2)*2],v=i[(c-2)*2+1],g=i[(c-1)*2],x=i[(c-1)*2+1],S=-(v-x),R=y-g,k=Math.sqrt(S*S+R*R),S/=k,R/=k,S*=p,R*=p,u.push(g-S*A,x-R*A,g+S*T,x+R*T),l||(n.cap===oi.ROUND?d+=ki(g-S*(A-T)*.5,x-R*(A-T)*.5,g-S*A,x-R*A,g+S*T,x+R*T,u,!1)+2:n.cap===oi.SQUARE&&(d+=Hm(g,x,S,R,A,T,!1,u)));const C=t.indices,L=ws.epsilon*ws.epsilon;for(let O=f;O<d+f-2;++O)y=u[O*2],v=u[O*2+1],g=u[(O+1)*2],x=u[(O+1)*2+1],E=u[(O+2)*2],M=u[(O+2)*2+1],!(Math.abs(y*(x-M)+g*(M-v)+E*(v-x))<L)&&C.push(O,O+1,O+2)}function mC(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==we.POLY||i.closeStroke;if(s.length===0)return;const o=t.points,a=t.indices,l=s.length/2,h=o.length/2;let u=h;for(o.push(s[0],s[1]),e=1;e<l;e++)o.push(s[e*2],s[e*2+1]),a.push(u,u+1),u++;n&&a.push(u,h)}function $m(r,t){r.lineStyle.native?mC(r,t):pC(r,t)}class Gh{static curveLength(t,e,i,s,n,o){const a=t-2*i+n,l=e-2*s+o,h=2*i-2*t,u=2*s-2*e,c=4*(a*a+l*l),d=4*(a*h+l*u),f=h*h+u*u,p=2*Math.sqrt(c+d+f),m=Math.sqrt(c),_=2*c*m,y=2*Math.sqrt(f),v=d/m;return(_*p+m*d*(p-y)+(4*f*c-d*d)*Math.log((2*m+v+p)/(v+y)))/(4*_)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],l=ws._segmentsCount(Gh.curveLength(o,a,t,e,i,s));let h=0,u=0;for(let c=1;c<=l;++c){const d=c/l;h=o+(t-o)*d,u=a+(e-a)*d,n.push(h+(t+(i-t)*d-h)*d,u+(e+(s-e)*d-u)*d)}}}const Hh={[we.POLY]:km,[we.CIRC]:Go,[we.ELIP]:Go,[we.RECT]:cC,[we.RREC]:dC},Xm=[],Ho=[];class $o{constructor(t,e=null,i=null,s=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=s,this.type=t.type}clone(){return new $o(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const As=new It,Vm=class Lg extends Ep{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new Ro,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Ho.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Xm.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,i=null,s=null){const n=new $o(t,e,i,s);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new $o(t,null,null,e),s=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=s.lineStyle,s.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let i=0;i<e.length;++i){const s=e[i];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(t,As):As.copyFrom(t),s.shape.contains(As.x,As.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(As.x,As.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let i=null,s=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],s=i.style);for(let l=this.shapeIndex;l<e.length;l++){this.shapeIndex++;const h=e[l],u=h.fillStyle,c=h.lineStyle;Hh[h.type].build(h),h.matrix&&this.transformPoints(h.points,h.matrix),(u.visible||c.visible)&&this.processHoles(h.holes);for(let d=0;d<2;d++){const f=d===0?u:c;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,_=this.points.length/2;p.wrapMode=Qr.REPEAT,d===0?this.processFill(h):this.processLine(h);const y=this.points.length/2-_;y!==0&&(i&&!this._compareStyles(s,f)&&(i.end(m,_),i=null),i||(i=Xm.pop()||new fC,i.begin(f,m,_),this.batches.push(i),s=f),this.addUvs(this.points,t,f.texture,_,y,f.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const i=this.graphicsData[t],s=i.fillStyle,n=i.lineStyle;if(s&&!s.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,i=t.length;e<i;e++){const s=t[e];for(let n=0;n<s.size;n++){const o=s.start+n;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<Lg.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++_t._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Ho.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=Ho.pop();s||(s=new uh,s.texArray=new gh),s.texArray.count=0,s.start=0,s.size=0,s.type=fr.TRIANGLES;let n=0,o=null,a=0,l=!1,h=fr.TRIANGLES,u=0;this.drawCalls.push(s);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],f=8,p=d.style,m=p.texture.baseTexture;l!==!!p.native&&(l=!!p.native,h=l?fr.LINES:fr.TRIANGLES,o=null,n=f,t++),o!==m&&(o=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=Ho.pop(),s||(s=new uh,s.texArray=new gh),this.drawCalls.push(s)),s.start=u,s.size=0,s.texArray.count=0,s.type=h),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Qr.REPEAT,s.texArray.elements[s.texArray.count++]=m,n++)),s.size+=d.size,u+=d.size,a=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}_t._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,i=this.colors,s=this.textureIds,n=new ArrayBuffer(t.length*3*4),o=new Float32Array(n),a=new Uint32Array(n);let l=0;for(let h=0;h<t.length/2;h++)o[l++]=t[h*2],o[l++]=t[h*2+1],o[l++]=e[h*2],o[l++]=e[h*2+1],a[l++]=i[h],o[l++]=s[h];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?km.triangulate(t,this):Hh[t.type].triangulate(t,this)}processLine(t){$m(t,this);for(let e=0;e<t.holes.length;e++)$m(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];Hh[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let i=0;i<t.length/2;i++){const s=t[i*2],n=t[i*2+1];t[i*2]=e.a*s+e.c*n+e.tx,t[i*2+1]=e.b*s+e.d*n+e.ty}}addColors(t,e,i,s,n=0){const o=Ot.shared.setValue(e).toLittleEndianNumber(),a=Ot.shared.setValue(o).toPremultiplied(i);t.length=Math.max(t.length,n+s);for(let l=0;l<s;l++)t[n+l]=a}addTextureIds(t,e,i,s=0){t.length=Math.max(t.length,s+i);for(let n=0;n<i;n++)t[s+n]=e}addUvs(t,e,i,s,n,o=null){let a=0;const l=e.length,h=i.frame;for(;a<n;){let c=t[(s+a)*2],d=t[(s+a)*2+1];if(o){const f=o.a*c+o.c*d+o.tx;d=o.b*c+o.d*d+o.ty,c=f}a++,e.push(c/h.width,d/h.height)}const u=i.baseTexture;(h.width<u.width||h.height<u.height)&&this.adjustUvs(e,i,l,n)}adjustUvs(t,e,i,s){const n=e.baseTexture,o=1e-6,a=i+s*2,l=e.frame,h=l.width/n.width,u=l.height/n.height;let c=l.x/l.width,d=l.y/l.height,f=Math.floor(t[i]+o),p=Math.floor(t[i+1]+o);for(let m=i+2;m<a;m+=2)f=Math.min(f,Math.floor(t[m]+o)),p=Math.min(p,Math.floor(t[m+1]+o));c-=f,d-=p;for(let m=i;m<a;m+=2)t[m]=(t[m]+c)*h,t[m+1]=(t[m+1]+d)*u}};Vm.BATCHABLE_SIZE=100;let gC=Vm;class Xo{constructor(){this.color=16777215,this.alpha=1,this.texture=ut.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Xo;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=ut.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class $h extends Xo{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=oi.BUTT,this.join=qe.MITER,this.miterLimit=10}clone(){const t=new $h;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=oi.BUTT,this.join=qe.MITER,this.miterLimit=10}}const Xh={},Vh=class ra extends nr{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Xo,this._lineStyle=new $h,this._matrix=null,this._holeMode=!1,this.state=Er.for2d(),this._geometry=t||new gC,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Ot(16777215),this.blendMode=yt.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new ra(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,i,s=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:s,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:ut.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:oi.BUTT,join:qe.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Ci,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Ci,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const i=this.currentPath.points,s=i[i.length-2],n=i[i.length-1];return(s!==t||n!==e)&&i.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),Gh.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),kh.curveTo(t,e,i,s,n,o,this.currentPath.points),this}arcTo(t,e,i,s,n){this._initCurve(t,e);const o=this.currentPath.points,a=Gm.curveTo(t,e,i,s,n,o);if(a){const{cx:l,cy:h,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=a;this.arc(l,h,u,c,d,f)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=uo:o&&s<=n&&(s+=uo),n-s===0)return this;const a=t+Math.cos(s)*i,l=e+Math.sin(s)*i,h=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-a),d=Math.abs(u[u.length-1]-l);c<h&&d<h||u.push(a,l)}else this.moveTo(a,l),u=this.currentPath.points;return Gm.arc(a,l,t,e,i,s,n,o,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:ut.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Ot.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:ut.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,s){return this.drawShape(new xt(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new mo(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new fo(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new po(t,e,i,s))}drawPolygon(...t){let e,i=!0;const s=t[0];s.points?(i=s.closeStroke,e=s.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Ci(e);return n.closeStroke=i,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===we.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let s=0;s<i;s++){const n=t.batches[s],o=n.style.color,a=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),l=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),h=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:a,blendMode:e,indices:h,uvs:l,_batchRGB:Ot.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){const s=this.batches[e];s.worldAlpha=this.worldAlpha*s.alpha,t.plugins[this.pluginName].render(s)}}}_renderDirect(t){const e=this._resolveDirectShader(t),i=this._geometry,s=this.worldAlpha,n=e.uniforms,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,Ot.shared.setValue(this._tintColor).premultiply(s).toArray(n.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let a=0,l=o.length;a<l;a++)this._renderDrawCallDirect(t,i.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:i,type:s,size:n,start:o}=e,a=i.count;for(let l=0;l<a;l++)t.texture.bind(i.elements[l],l);t.geometry.draw(s,n,o)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!Xh[i]){const{maxTextures:s}=t.plugins[i],n=new Int32Array(s);for(let l=0;l<s;l++)n[l]=l;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new kt,default:sr.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;Xh[i]=new Tr(a,o)}e=Xh[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:s,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,i,s,n)}containsPoint(t){return this.worldTransform.applyInverse(t,ra._TEMP_POINT),this._geometry.containsPoint(ra._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=Ot.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,l=e.ty,h=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<h.length;d+=2){const f=h[d],p=h[d+1];u[c++]=i*f+n*p+a,u[c++]=o*p+s*f+l}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};Vh.curves=ws,Vh._TEMP_POINT=new It;let fn=Vh;class yC{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const zh=new It,zm=new Ci,Ym=class Bg extends nr{constructor(t,e,i,s=fr.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Er.for2d(),this.drawMode=s,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=tt.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===fr.TRIANGLES&&e.length<Bg.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const s=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[s]),t.plugins[s].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const s=this.transform.worldTransform,n=s.a,o=s.b,a=s.c,l=s.d,h=s.tx,u=s.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const f=e[d*2],p=e[d*2+1];c[d*2]=n*f+a*p+h,c[d*2+1]=o*f+l*p+u}if(this._roundPixels){const d=tt.RESOLUTION;for(let f=0;f<c.length;++f)c[f]=Math.round(c[f]*d)/d}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new yC(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,zh);const e=this.geometry.getBuffer("aVertexPosition").data,i=zm.points,s=this.geometry.getIndex().data,n=s.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const l=s[a]*2,h=s[a+1]*2,u=s[a+2]*2;if(i[0]=e[l],i[1]=e[l+1],i[2]=e[h],i[3]=e[h+1],i[4]=e[u],i[5]=e[u+1],zm.contains(zh.x,zh.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Ym.BATCHABLE_SIZE=100;let Wm=Ym;class _C extends ii{constructor(t,e,i){super();const s=new te(t),n=new te(e,!0),o=new te(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,ft.FLOAT).addAttribute("aTextureCoord",n,2,!1,ft.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var vC=`varying vec2 vTextureCoord;
914
914
  uniform vec4 uColor;
915
915
 
916
916
  uniform sampler2D uSampler;
@@ -968,7 +968,7 @@ void main(void){
968
968
  vColor = aColor * uColor;
969
969
  }
970
970
  `;class Km extends xo{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new kt,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:ft.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Tr.from(EC,bC,{}),this.state=Er.for2d()}render(t){const e=t.children,i=t._maxSize,s=t._batchSize,n=this.renderer;let o=e.length;if(o===0)return;o>i&&!t.autoResize&&(o=i);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));const l=e[0]._texture.baseTexture,h=l.alphaMode>0;this.state.blendMode=cp(t.blendMode,h),n.state.set(this.state);const u=n.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=Ot.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,h).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=l,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;f<o;f+=s,p+=1){let m=o-f;m>s&&(m=s),p>=a.length&&a.push(this._generateOneMoreBuffer(t));const _=a[p];_.uploadDynamic(e,f,m);const y=t._bufferUpdateIDs[p]||0;d=d||_._updateID<y,d&&(_._updateID=t._updateID,_.uploadStatic(e,f,m)),n.geometry.bind(_.geometry),u.drawElements(u.TRIANGLES,m*6,u.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],i=t._maxSize,s=t._batchSize,n=t._properties;for(let o=0;o<i;o+=s)e.push(new qm(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new qm(this.properties,i,e)}uploadVertices(t,e,i,s,n,o){let a=0,l=0,h=0,u=0;for(let c=0;c<i;++c){const d=t[e+c],f=d._texture,p=d.scale.x,m=d.scale.y,_=f.trim,y=f.orig;_?(l=_.x-d.anchor.x*y.width,a=l+_.width,u=_.y-d.anchor.y*y.height,h=u+_.height):(a=y.width*(1-d.anchor.x),l=y.width*-d.anchor.x,h=y.height*(1-d.anchor.y),u=y.height*-d.anchor.y),s[o]=l*p,s[o+1]=u*m,s[o+n]=a*p,s[o+n+1]=u*m,s[o+n*2]=a*p,s[o+n*2+1]=h*m,s[o+n*3]=l*p,s[o+n*3+1]=h*m,o+=n*4}}uploadPosition(t,e,i,s,n,o){for(let a=0;a<i;a++){const l=t[e+a].position;s[o]=l.x,s[o+1]=l.y,s[o+n]=l.x,s[o+n+1]=l.y,s[o+n*2]=l.x,s[o+n*2+1]=l.y,s[o+n*3]=l.x,s[o+n*3+1]=l.y,o+=n*4}}uploadRotation(t,e,i,s,n,o){for(let a=0;a<i;a++){const l=t[e+a].rotation;s[o]=l,s[o+n]=l,s[o+n*2]=l,s[o+n*3]=l,o+=n*4}}uploadUvs(t,e,i,s,n,o){for(let a=0;a<i;++a){const l=t[e+a]._texture._uvs;l?(s[o]=l.x0,s[o+1]=l.y0,s[o+n]=l.x1,s[o+n+1]=l.y1,s[o+n*2]=l.x2,s[o+n*2+1]=l.y2,s[o+n*3]=l.x3,s[o+n*3+1]=l.y3,o+=n*4):(s[o]=0,s[o+1]=0,s[o+n]=0,s[o+n+1]=0,s[o+n*2]=0,s[o+n*2+1]=0,s[o+n*3]=0,s[o+n*3+1]=0,o+=n*4)}}uploadTint(t,e,i,s,n,o){for(let a=0;a<i;++a){const l=t[e+a],h=Ot.shared.setValue(l._tintRGB).toPremultiplied(l.alpha,l.texture.baseTexture.alphaMode>0);s[o]=h,s[o+n]=h,s[o+n*2]=h,s[o+n*3]=h,o+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Km.extension={name:"particle",type:Z.RendererPlugin},ht.add(Km);var Vo=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Vo||{});const zo={willReadFrequently:!0},Ar=class ct{static get experimentalLetterSpacingSupported(){let t=ct._experimentalLetterSpacingSupported;if(t!==void 0){const e=tt.ADAPTER.getCanvasRenderingContext2D().prototype;t=ct._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,o,a,l,h){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h}static measureText(t,e,i,s=ct._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=ct.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",zo);a.font=n;const l=(i?ct.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),h=new Array(l.length);let u=0;for(let p=0;p<l.length;p++){const m=ct._measureText(l[p],e.letterSpacing,a);h[p]=m,u=Math.max(u,m)}let c=u+e.strokeThickness;e.dropShadow&&(c+=e.dropShadowDistance);const d=e.lineHeight||o.fontSize+e.strokeThickness;let f=Math.max(d,o.fontSize+e.strokeThickness*2)+e.leading+(l.length-1)*(d+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new ct(t,e,c,f,l,h,d+e.leading,u,o)}static _measureText(t,e,i){let s=!1;ct.experimentalLetterSpacingSupported&&(ct.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(t).width;return n>0&&(s?n-=e:n+=(ct.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=ct._canvas){const s=i.getContext("2d",zo);let n=0,o="",a="";const l=Object.create(null),{letterSpacing:h,whiteSpace:u}=e,c=ct.collapseSpaces(u),d=ct.collapseNewlines(u);let f=!c;const p=e.wordWrapWidth+h,m=ct.tokenize(t);for(let _=0;_<m.length;_++){let y=m[_];if(ct.isNewline(y)){if(!d){a+=ct.addLine(o),f=!c,o="",n=0;continue}y=" "}if(c){const g=ct.isBreakingSpace(y),x=ct.isBreakingSpace(o[o.length-1]);if(g&&x)continue}const v=ct.getFromCache(y,h,l,s);if(v>p)if(o!==""&&(a+=ct.addLine(o),o="",n=0),ct.canBreakWords(y,e.breakWords)){const g=ct.wordWrapSplit(y);for(let x=0;x<g.length;x++){let E=g[x],M=E,S=1;for(;g[x+S];){const P=g[x+S];if(!ct.canBreakChars(M,P,y,x,e.breakWords))E+=P;else break;M=P,S++}x+=S-1;const R=ct.getFromCache(E,h,l,s);R+n>p&&(a+=ct.addLine(o),f=!1,o="",n=0),o+=E,n+=R}}else{o.length>0&&(a+=ct.addLine(o),o="",n=0);const g=_===m.length-1;a+=ct.addLine(y,!g),f=!1,o="",n=0}else v+n>p&&(f=!1,a+=ct.addLine(o),o="",n=0),(o.length>0||!ct.isBreakingSpace(y)||f)&&(o+=y,n+=v)}return a+=ct.addLine(o,!1),a}static addLine(t,e=!0){return t=ct.trimRight(t),t=e?`${t}
971
- `:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=ct._measureText(t,e,s)+e,i[t]=n),n}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 e=t.length-1;e>=0;e--){const i=t[e];if(!ct.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:ct._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:ct._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(ct.isBreakingSpace(n,o)||ct.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return ct.graphemeSegmenter(t)}static measureFont(t){if(ct._fonts[t])return ct._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=ct._canvas,s=ct._context;s.font=t;const n=ct.METRICS_STRING+ct.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(ct.BASELINE_SYMBOL).width);const l=Math.ceil(ct.HEIGHT_MULTIPLIER*a);if(a=a*ct.BASELINE_MULTIPLIER|0,o===0||l===0)return ct._fonts[t]=e,e;i.width=o,i.height=l,s.fillStyle="#f00",s.fillRect(0,0,o,l),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const h=s.getImageData(0,0,o,l).data,u=h.length,c=o*4;let d=0,f=0,p=!1;for(d=0;d<a;++d){for(let m=0;m<c;m+=4)if(h[f+m]!==255){p=!0;break}if(!p)f+=c;else break}for(e.ascent=a-d,f=u-c,p=!1,d=l;d>a;--d){for(let m=0;m<c;m+=4)if(h[f+m]!==255){p=!0;break}if(!p)f-=c;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,ct._fonts[t]=e,e}static clearMetrics(t=""){t?delete ct._fonts[t]:ct._fonts={}}static get _canvas(){var t;if(!ct.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",zo))!=null&&t.measureText)return ct.__canvas=i,i;e=tt.ADAPTER.createCanvas()}catch{e=tt.ADAPTER.createCanvas()}e.width=e.height=10,ct.__canvas=e}return ct.__canvas}static get _context(){return ct.__context||(ct.__context=ct._canvas.getContext("2d",zo)),ct.__context}};Ar.METRICS_STRING="|ÉqÅ",Ar.BASELINE_SYMBOL="M",Ar.BASELINE_MULTIPLIER=1.4,Ar.HEIGHT_MULTIPLIER=2,Ar.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Ar.experimentalLetterSpacing=!1,Ar._fonts={},Ar._newlines=[10,13],Ar._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let ai=Ar;const TC=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Zm=class vn{constructor(t){this.styleID=0,this.reset(),Wh(this,t,t)}clone(){const t={};return Wh(t,this,vn.defaultStyle),new vn(t)}reset(){Wh(this,vn.defaultStyle,vn.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=Yh(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){const e=Yh(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){wC(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=Yh(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!TC.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Zm.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Vo.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let li=Zm;function Yh(r){const t=Ot.shared,e=i=>{const s=t.setValue(i);return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function wC(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function Wh(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const AC={texture:!0,children:!1,baseTexture:!0},Qm=class hu extends _s{constructor(t,e,i){let s=!1;i||(i=tt.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=ut.from(i);n.orig=new xt,n.trim=new xt,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=hu.defaultResolution??tt.RESOLUTION,this._autoResolution=hu.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return ai.experimentalLetterSpacing}static set experimentalLetterSpacing(t){At("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),ai.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const i=this.context,s=ai.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,o=s.height,a=s.lines,l=s.lineHeight,h=s.lineWidths,u=s.maxLineWidth,c=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+e.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;let d,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const _=e.dropShadow&&m===0,y=_?Math.ceil(Math.max(1,o)+e.padding*2):0,v=y*this._resolution;if(_){i.fillStyle="black",i.strokeStyle="black";const x=e.dropShadowColor,E=e.dropShadowBlur*this._resolution,M=e.dropShadowDistance*this._resolution;i.shadowColor=Ot.shared.setValue(x).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=E,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*M,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*M+v}else i.fillStyle=this._generateFillStyle(e,a,s),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let g=(l-c.fontSize)/2;l-c.fontSize<0&&(g=0);for(let x=0;x<a.length;x++)d=e.strokeThickness/2,f=e.strokeThickness/2+x*l+c.ascent+g,e.align==="right"?d+=u-h[x]:e.align==="center"&&(d+=(u-h[x])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[x],d+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[x],d+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(ai.experimentalLetterSpacingSupported&&(ai.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){s?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let a=e;const l=ai.graphemeSegmenter(t);let h=this.context.measureText(t).width,u=0;for(let c=0;c<l.length;++c){const d=l[c];s?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let f="";for(let p=c+1;p<l.length;++p)f+=l[p];u=this.context.measureText(f).width,a+=h-u+n,h=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=zT(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.data,0,0))}const e=this._texture,i=this._style,s=i.trim?0:i.padding,n=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-s,e.trim.y=-s,e.orig.width=e._frame.width-s*2,e.orig.height=e._frame.height-s*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),this._textureID===-1&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,i){const s=t.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;let n;const o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,l=this.canvas.width/this._resolution-o-a*2,h=this.canvas.height/this._resolution-o-a*2,u=s.slice(),c=t.fillGradientStops.slice();if(!c.length){const d=u.length+1;for(let f=1;f<d;++f)c.push(f/d)}if(u.unshift(s[0]),c.unshift(0),u.push(s[s.length-1]),c.push(1),t.fillGradientType===Vo.LINEAR_VERTICAL){n=this.context.createLinearGradient(l/2,a,l/2,h+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=i.lineHeight*(f-1)+d,m=i.lineHeight*f;let _=m;f>0&&p>m&&(_=(m+p)/2);const y=m+d,v=i.lineHeight*(f+1);let g=y;f+1<e.length&&v<y&&(g=(y+v)/2);const x=(g-_)/h;for(let E=0;E<u.length;E++){let M=0;typeof c[E]=="number"?M=c[E]:M=E/u.length;let S=Math.min(1,Math.max(0,_/h+M*x));S=Number(S.toFixed(5)),n.addColorStop(S,u[E])}}}else{n=this.context.createLinearGradient(a,h/2,l+a,h/2);const d=u.length+1;let f=1;for(let p=0;p<u.length;p++){let m;typeof c[p]=="number"?m=c[p]:m=f/d,n.addColorStop(m,u[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},AC,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=ei(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=ei(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},t instanceof li?this._style=t:this._style=new li(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};Qm.defaultAutoResolution=!0;let Jm=Qm;class SC{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function CC(r,t){var i;let e=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof ut){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function IC(r,t){if(r.baseTexture instanceof _t){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function RC(r,t){if(r._texture&&r._texture instanceof ut){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function MC(r,t){return t instanceof Jm?(t.updateText(!0),!0):!1}function PC(r,t){if(t instanceof li){const e=t.toFontString();return ai.measureFont(e),!0}return!1}function OC(r,t){if(r instanceof Jm){t.includes(r.style)||t.push(r.style),t.includes(r)||t.push(r);const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function NC(r,t){return r instanceof li?(t.includes(r)||t.push(r),!0):!1}const tg=class Fg{constructor(t){this.limiter=new SC(Fg.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(OC),this.registerFindHook(NC),this.registerFindHook(CC),this.registerFindHook(IC),this.registerFindHook(RC),this.registerUploadHook(MC),this.registerUploadHook(PC)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,Xe.system.addOnce(this.tick,this,Bi.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let i=0,s=this.uploadHooks.length;i<s;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)Xe.system.addOnce(this.tick,this,Bi.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof nr)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&Xe.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};tg.uploadsPerFrame=4;let jh=tg;Object.defineProperties(tt,{UPLOADS_PER_FRAME:{get(){return jh.uploadsPerFrame},set(r){At("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),jh.uploadsPerFrame=r}}});function eg(r,t){return t instanceof _t?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function DC(r,t){if(!(t instanceof fn))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let s=0;s<i.length;s++){const{texture:n}=i[s].style;n&&eg(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function LC(r,t){return r instanceof fn?(t.push(r),!0):!1}class rg extends jh{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(LC),this.registerUploadHook(eg),this.registerUploadHook(DC)}}rg.extension={name:"prepare",type:Z.RendererSystem},ht.add(rg);var BC=`#version 300 es
971
+ `:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=ct._measureText(t,e,s)+e,i[t]=n),n}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 e=t.length-1;e>=0;e--){const i=t[e];if(!ct.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:ct._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:ct._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(ct.isBreakingSpace(n,o)||ct.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return ct.graphemeSegmenter(t)}static measureFont(t){if(ct._fonts[t])return ct._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=ct._canvas,s=ct._context;s.font=t;const n=ct.METRICS_STRING+ct.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(ct.BASELINE_SYMBOL).width);const l=Math.ceil(ct.HEIGHT_MULTIPLIER*a);if(a=a*ct.BASELINE_MULTIPLIER|0,o===0||l===0)return ct._fonts[t]=e,e;i.width=o,i.height=l,s.fillStyle="#f00",s.fillRect(0,0,o,l),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const h=s.getImageData(0,0,o,l).data,u=h.length,c=o*4;let d=0,f=0,p=!1;for(d=0;d<a;++d){for(let m=0;m<c;m+=4)if(h[f+m]!==255){p=!0;break}if(!p)f+=c;else break}for(e.ascent=a-d,f=u-c,p=!1,d=l;d>a;--d){for(let m=0;m<c;m+=4)if(h[f+m]!==255){p=!0;break}if(!p)f-=c;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,ct._fonts[t]=e,e}static clearMetrics(t=""){t?delete ct._fonts[t]:ct._fonts={}}static get _canvas(){var t;if(!ct.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",zo))!=null&&t.measureText)return ct.__canvas=i,i;e=tt.ADAPTER.createCanvas()}catch{e=tt.ADAPTER.createCanvas()}e.width=e.height=10,ct.__canvas=e}return ct.__canvas}static get _context(){return ct.__context||(ct.__context=ct._canvas.getContext("2d",zo)),ct.__context}};Ar.METRICS_STRING="|ÉqÅ",Ar.BASELINE_SYMBOL="M",Ar.BASELINE_MULTIPLIER=1.4,Ar.HEIGHT_MULTIPLIER=2,Ar.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Ar.experimentalLetterSpacing=!1,Ar._fonts={},Ar._newlines=[10,13],Ar._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let ai=Ar;const TC=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Zm=class vn{constructor(t){this.styleID=0,this.reset(),Wh(this,t,t)}clone(){const t={};return Wh(t,this,vn.defaultStyle),new vn(t)}reset(){Wh(this,vn.defaultStyle,vn.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=Yh(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){const e=Yh(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){wC(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=Yh(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!TC.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Zm.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Vo.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let li=Zm;function Yh(r){const t=Ot.shared,e=i=>{const s=t.setValue(i);return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function wC(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function Wh(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const AC={texture:!0,children:!1,baseTexture:!0},Qm=class hu extends _s{constructor(t,e,i){let s=!1;i||(i=tt.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=ut.from(i);n.orig=new xt,n.trim=new xt,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=hu.defaultResolution??tt.RESOLUTION,this._autoResolution=hu.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return ai.experimentalLetterSpacing}static set experimentalLetterSpacing(t){St("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),ai.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const i=this.context,s=ai.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,o=s.height,a=s.lines,l=s.lineHeight,h=s.lineWidths,u=s.maxLineWidth,c=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+e.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;let d,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const _=e.dropShadow&&m===0,y=_?Math.ceil(Math.max(1,o)+e.padding*2):0,v=y*this._resolution;if(_){i.fillStyle="black",i.strokeStyle="black";const x=e.dropShadowColor,E=e.dropShadowBlur*this._resolution,M=e.dropShadowDistance*this._resolution;i.shadowColor=Ot.shared.setValue(x).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=E,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*M,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*M+v}else i.fillStyle=this._generateFillStyle(e,a,s),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let g=(l-c.fontSize)/2;l-c.fontSize<0&&(g=0);for(let x=0;x<a.length;x++)d=e.strokeThickness/2,f=e.strokeThickness/2+x*l+c.ascent+g,e.align==="right"?d+=u-h[x]:e.align==="center"&&(d+=(u-h[x])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[x],d+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[x],d+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(ai.experimentalLetterSpacingSupported&&(ai.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){s?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let a=e;const l=ai.graphemeSegmenter(t);let h=this.context.measureText(t).width,u=0;for(let c=0;c<l.length;++c){const d=l[c];s?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let f="";for(let p=c+1;p<l.length;++p)f+=l[p];u=this.context.measureText(f).width,a+=h-u+n,h=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=zT(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.data,0,0))}const e=this._texture,i=this._style,s=i.trim?0:i.padding,n=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-s,e.trim.y=-s,e.orig.width=e._frame.width-s*2,e.orig.height=e._frame.height-s*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),this._textureID===-1&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,i){const s=t.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;let n;const o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,l=this.canvas.width/this._resolution-o-a*2,h=this.canvas.height/this._resolution-o-a*2,u=s.slice(),c=t.fillGradientStops.slice();if(!c.length){const d=u.length+1;for(let f=1;f<d;++f)c.push(f/d)}if(u.unshift(s[0]),c.unshift(0),u.push(s[s.length-1]),c.push(1),t.fillGradientType===Vo.LINEAR_VERTICAL){n=this.context.createLinearGradient(l/2,a,l/2,h+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=i.lineHeight*(f-1)+d,m=i.lineHeight*f;let _=m;f>0&&p>m&&(_=(m+p)/2);const y=m+d,v=i.lineHeight*(f+1);let g=y;f+1<e.length&&v<y&&(g=(y+v)/2);const x=(g-_)/h;for(let E=0;E<u.length;E++){let M=0;typeof c[E]=="number"?M=c[E]:M=E/u.length;let S=Math.min(1,Math.max(0,_/h+M*x));S=Number(S.toFixed(5)),n.addColorStop(S,u[E])}}}else{n=this.context.createLinearGradient(a,h/2,l+a,h/2);const d=u.length+1;let f=1;for(let p=0;p<u.length;p++){let m;typeof c[p]=="number"?m=c[p]:m=f/d,n.addColorStop(m,u[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},AC,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=ei(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=ei(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},t instanceof li?this._style=t:this._style=new li(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};Qm.defaultAutoResolution=!0;let Jm=Qm;class SC{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function CC(r,t){var i;let e=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof ut){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function IC(r,t){if(r.baseTexture instanceof _t){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function RC(r,t){if(r._texture&&r._texture instanceof ut){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function MC(r,t){return t instanceof Jm?(t.updateText(!0),!0):!1}function PC(r,t){if(t instanceof li){const e=t.toFontString();return ai.measureFont(e),!0}return!1}function OC(r,t){if(r instanceof Jm){t.includes(r.style)||t.push(r.style),t.includes(r)||t.push(r);const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function NC(r,t){return r instanceof li?(t.includes(r)||t.push(r),!0):!1}const tg=class Fg{constructor(t){this.limiter=new SC(Fg.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(OC),this.registerFindHook(NC),this.registerFindHook(CC),this.registerFindHook(IC),this.registerFindHook(RC),this.registerUploadHook(MC),this.registerUploadHook(PC)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,Xe.system.addOnce(this.tick,this,Bi.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let i=0,s=this.uploadHooks.length;i<s;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)Xe.system.addOnce(this.tick,this,Bi.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof nr)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&Xe.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};tg.uploadsPerFrame=4;let jh=tg;Object.defineProperties(tt,{UPLOADS_PER_FRAME:{get(){return jh.uploadsPerFrame},set(r){St("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),jh.uploadsPerFrame=r}}});function eg(r,t){return t instanceof _t?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function DC(r,t){if(!(t instanceof fn))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let s=0;s<i.length;s++){const{texture:n}=i[s].style;n&&eg(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function LC(r,t){return r instanceof fn?(t.push(r),!0):!1}class rg extends jh{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(LC),this.registerUploadHook(eg),this.registerUploadHook(DC)}}rg.extension={name:"prepare",type:Z.RendererSystem},ht.add(rg);var BC=`#version 300 es
972
972
  #define SHADER_NAME Tiling-Sprite-100
973
973
 
974
974
  precision lowp float;