@drincs/pixi-vn 1.2.13 → 1.2.15
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.
- package/dist/canvas/index.cjs +140 -140
- package/dist/canvas/index.mjs +140 -140
- package/dist/canvas/tickers/index.cjs +144 -144
- package/dist/canvas/tickers/index.mjs +144 -144
- package/dist/character/index.cjs +51 -51
- package/dist/character/index.mjs +51 -51
- package/dist/classes/index.cjs +1 -1
- package/dist/classes/index.d.cts +2 -2
- package/dist/classes/index.d.ts +2 -2
- package/dist/classes/index.mjs +1 -1
- package/dist/history/index.cjs +2 -2
- package/dist/history/index.mjs +2 -2
- package/dist/index.cjs +158 -158
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +158 -158
- package/dist/narration/index.cjs +52 -52
- package/dist/narration/index.mjs +52 -52
- package/dist/sound/index.cjs +50 -50
- package/dist/sound/index.mjs +50 -50
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.mjs +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.mjs +1 -1
- package/package.json +1 -1
package/dist/sound/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
'use strict';var Om=Object.create;var Eo=Object.defineProperty;var zm=Object.getOwnPropertyDescriptor;var Hm=Object.getOwnPropertyNames;var Wm=Object.getPrototypeOf,Vm=Object.prototype.hasOwnProperty;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var Bo=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Nm=(i,t)=>{for(var e in t)Eo(i,e,{get:t[e],enumerable:true});},$m=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Hm(t))!Vm.call(i,s)&&s!==e&&Eo(i,s,{get:()=>t[s],enumerable:!(r=zm(t,s))||r.enumerable});return i};var Oi=(i,t,e)=>(e=i!=null?Om(Wm(i)):{},$m(Eo(e,"default",{value:i,enumerable:true}),i));var S,ko,Gr,R,k=p(()=>{S=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(S||{}),ko=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i};}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Gr=(i,t)=>ko(i).priority??t,R={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(ko).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t));}),this},add(...i){return i.map(ko).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t));});}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref);},e=>{e.name&&delete t[e.name];})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>Gr(n.value,e)-Gr(o.value,e)));},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1);})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>Gr(o,e)-Gr(s,e)));},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1);})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e));}};});var Ch=Bo((j_,Fo)=>{var Ym=Object.prototype.hasOwnProperty,St="~";function Rr(){}Object.create&&(Rr.prototype=Object.create(null),new Rr().__proto__||(St=false));function Xm(i,t,e){this.fn=i,this.context=t,this.once=e||false;}function Mh(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new Xm(e,r||i,s),n=St?St+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function Yi(i,t){--i._eventsCount===0?i._events=new Rr:delete i._events[t];}function yt(){this._events=new Rr,this._eventsCount=0;}yt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)Ym.call(e,r)&&t.push(St?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};yt.prototype.listeners=function(t){var e=St?St+t:t,r=this._events[e];if(!r)return [];if(r.fn)return [r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};yt.prototype.listenerCount=function(t){var e=St?St+t:t,r=this._events[e];return r?r.fn?1:r.length:0};yt.prototype.emit=function(t,e,r,s,o,n){var a=St?St+t:t;if(!this._events[a])return false;var h=this._events[a],l=arguments.length,u,c;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,true),l){case 1:return h.fn.call(h.context),true;case 2:return h.fn.call(h.context,e),true;case 3:return h.fn.call(h.context,e,r),true;case 4:return h.fn.call(h.context,e,r,s),true;case 5:return h.fn.call(h.context,e,r,s,o),true;case 6:return h.fn.call(h.context,e,r,s,o,n),true}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];h.fn.apply(h.context,u);}else {var f=h.length,d;for(c=0;c<f;c++)switch(h[c].once&&this.removeListener(t,h[c].fn,void 0,true),l){case 1:h[c].fn.call(h[c].context);break;case 2:h[c].fn.call(h[c].context,e);break;case 3:h[c].fn.call(h[c].context,e,r);break;case 4:h[c].fn.call(h[c].context,e,r,s);break;default:if(!u)for(d=1,u=new Array(l-1);d<l;d++)u[d-1]=arguments[d];h[c].fn.apply(h[c].context,u);}}return true};yt.prototype.on=function(t,e,r){return Mh(this,t,e,r,false)};yt.prototype.once=function(t,e,r){return Mh(this,t,e,r,true)};yt.prototype.removeListener=function(t,e,r,s){var o=St?St+t:t;if(!this._events[o])return this;if(!e)return Yi(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&Yi(this,o);else {for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:Yi(this,o);}return this};yt.prototype.removeAllListeners=function(t){var e;return t?(e=St?St+t:t,this._events[e]&&Yi(this,e)):(this._events=new Rr,this._eventsCount=0),this};yt.prototype.off=yt.prototype.removeListener;yt.prototype.addListener=yt.prototype.on;yt.prefixed=St;yt.EventEmitter=yt;typeof Fo<"u"&&(Fo.exports=yt);});var Ah,X,Bt=p(()=>{Ah=Oi(Ch()),X=Ah.default;});var jm,oe,pt,Dt,Uh,Eh,Go,Km,Xi,Dh,Lh,Bh,kh,Fh,Ir,qm,Zm,Qm,Jm,Uo,Gh,tg,Ro,Io,Rh,Do,Ht,Ih,Oh,zh=p(()=>{jm={grad:.9,turn:360,rad:360/(2*Math.PI)},oe=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},pt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},Dt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Uh=function(i){return (i=isFinite(i)?i%360:0)>0?i:i+360},Eh=function(i){return {r:Dt(i.r,0,255),g:Dt(i.g,0,255),b:Dt(i.b,0,255),a:Dt(i.a)}},Go=function(i){return {r:pt(i.r),g:pt(i.g),b:pt(i.b),a:pt(i.a,3)}},Km=/^#([0-9a-f]{3,8})$/i,Xi=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Dh=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-t)/n:4+(t-e)/n:0;return {h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},Lh=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),h=r*(1-(1-t+o)*e),l=o%6;return {r:255*[r,a,n,n,h,r][l],g:255*[h,r,r,a,n,n][l],b:255*[n,n,h,r,r,a][l],a:s}},Bh=function(i){return {h:Uh(i.h),s:Dt(i.s,0,100),l:Dt(i.l,0,100),a:Dt(i.a)}},kh=function(i){return {h:pt(i.h),s:pt(i.s),l:pt(i.l),a:pt(i.a,3)}},Fh=function(i){return Lh((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r;},Ir=function(i){return {h:(t=Dh(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s;},qm=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zm=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qm=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jm=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Uo={string:[[function(i){var t=Km.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?pt(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?pt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Qm.exec(i)||Jm.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Eh({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(i){var t=qm.exec(i)||Zm.exec(i);if(!t)return null;var e,r,s=Bh({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(jm[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Fh(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return oe(t)&&oe(e)&&oe(r)?Eh({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!oe(t)||!oe(e)||!oe(r))return null;var n=Bh({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Fh(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!oe(t)||!oe(e)||!oe(r))return null;var n=function(a){return {h:Uh(a.h),s:Dt(a.s,0,100),v:Dt(a.v,0,100),a:Dt(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Lh(n)},"hsv"]]},Gh=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return [r,t[e][1]]}return [null,void 0]},tg=function(i){return typeof i=="string"?Gh(i.trim(),Uo.string):typeof i=="object"&&i!==null?Gh(i,Uo.object):[null,void 0]},Ro=function(i,t){var e=Ir(i);return {h:e.h,s:Dt(e.s+100*t,0,100),l:e.l,a:e.a}},Io=function(i){return (299*i.r+587*i.g+114*i.b)/1e3/255},Rh=function(i,t){var e=Ir(i);return {h:e.h,s:e.s,l:Dt(e.l+100*t,0,100),a:e.a}},Do=function(){function i(t){this.parsed=tg(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1};}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return pt(Io(this.rgba),2)},i.prototype.isDark=function(){return Io(this.rgba)<.5},i.prototype.isLight=function(){return Io(this.rgba)>=.5},i.prototype.toHex=function(){return t=Go(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?Xi(pt(255*o)):"","#"+Xi(e)+Xi(r)+Xi(s)+n;var t,e,r,s,o,n;},i.prototype.toRgb=function(){return Go(this.rgba)},i.prototype.toRgbString=function(){return t=Go(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o;},i.prototype.toHsl=function(){return kh(Ir(this.rgba))},i.prototype.toHslString=function(){return t=kh(Ir(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o;},i.prototype.toHsv=function(){return t=Dh(this.rgba),{h:pt(t.h),s:pt(t.s),v:pt(t.v),a:pt(t.a,3)};var t;},i.prototype.invert=function(){return Ht({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t;},i.prototype.saturate=function(t){return t===void 0&&(t=.1),Ht(Ro(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ht(Ro(this.rgba,-t))},i.prototype.grayscale=function(){return Ht(Ro(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Ht(Rh(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Ht(Rh(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?Ht({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):pt(this.rgba.a,3);var e;},i.prototype.hue=function(t){var e=Ir(this.rgba);return typeof t=="number"?Ht({h:t,s:e.s,l:e.l,a:e.a}):pt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Ht(t).toHex()},i}(),Ht=function(i){return i instanceof Do?i:new Do(i)},Ih=[],Oh=function(i){i.forEach(function(t){Ih.indexOf(t)<0&&(t(Do,Uo),Ih.push(t));});};});function Hh(i,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"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return "transparent";var a,h,l=r[this.toHex()];if(l)return l;if(n?.closest){var u=this.toRgb(),c=1/0,f="black";if(!o.length)for(var d in e)o[d]=new i(e[d]).toRgb();for(var m in e){var x=(a=u,h=o[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));x<c&&(c=x,f=m);}return f}},t.string.push([function(n){var a=n.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new i(h).toRgb():null},"name"]);}var Wh=p(()=>{});var Ye,V,Ct=p(()=>{zh();Wh();Oh([Hh]);Ye=class Ur{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 Ur)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else {if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value));}}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){let r=typeof t;if(r!==typeof e)return false;if(r==="number"||r==="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?false:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?false:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,r,s]=this._components;return {r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return {r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return `rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return (r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return (t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=Ur._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=true){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=true){if(t===1)return (255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return `#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1;}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=Ur.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`);}let n=Ht(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255);}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0);}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r);}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Ur||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Ye.shared=new Ye;Ye._temp=new Ye;Ye.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;V=Ye;});var Vh,Nh=p(()=>{Vh={cullArea:null,cullable:false,cullableChildren:true};});var $h,Yh,Xh,Lo=p(()=>{$h=Math.PI*2,Yh=180/Math.PI,Xh=Math.PI/180;});var N,Oo,Wt=p(()=>{N=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e;}clone(){return new i(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}toString(){return `[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Oo.x=0,Oo.y=0,Oo}},Oo=new N;});var M,eg,rg,tt=p(()=>{Lo();Wt();M=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n;}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,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new N;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new N;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,h=this.ty,l=1/(r*n+o*-s),u=t.x,c=t.y;return e.x=n*l*u+-o*l*c+(h*o-a*n)*l,e.y=r*l*c+-s*l*u+(-h*r+a*s)*l,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){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,h=t.ty,l=e.a,u=e.b,c=e.c,f=e.d;return this.a=r*l+s*c,this.b=r*u+s*f,this.c=o*l+n*c,this.d=o*u+n*f,this.tx=a*l+h*c+e.tx,this.ty=a*u+h*f+e.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*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){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs($h-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return `[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return rg.identity()}static get shared(){return eg.identity()}},eg=new M,rg=new M;});var Tt,zo=p(()=>{Tt=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t;}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return (this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return (this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return `[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this));}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this));}};});function $(i="default"){return Ho[i]===void 0&&(Ho[i]=-1),++Ho[i]}var Ho,wt=p(()=>{Ho={default:-1};});function I(i,t,e=3){if(jh[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1
|
+
'use strict';var Hm=Object.create;var Hi=Object.defineProperty;var Wm=Object.getOwnPropertyDescriptor;var Vm=Object.getOwnPropertyNames;var Nm=Object.getPrototypeOf,$m=Object.prototype.hasOwnProperty;var Ym=(i,t,e)=>t in i?Hi(i,t,{enumerable:true,configurable:true,writable:true,value:e}):i[t]=e;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var Fo=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Xm=(i,t)=>{for(var e in t)Hi(i,e,{get:t[e],enumerable:true});},jm=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Vm(t))!$m.call(i,s)&&s!==e&&Hi(i,s,{get:()=>t[s],enumerable:!(r=Wm(t,s))||r.enumerable});return i};var Wi=(i,t,e)=>(e=i!=null?Hm(Nm(i)):{},jm(Hi(e,"default",{value:i,enumerable:true}),i));var it=(i,t,e)=>Ym(i,typeof t!="symbol"?t+"":t,e);var S,Ro,Ir,G,k=p(()=>{S=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(S||{}),Ro=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i};}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Ir=(i,t)=>Ro(i).priority??t,G={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Ro).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t));}),this},add(...i){return i.map(Ro).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t));});}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref);},e=>{e.name&&delete t[e.name];})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>Ir(n.value,e)-Ir(o.value,e)));},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1);})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>Ir(o,e)-Ir(s,e)));},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1);})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e));}};});var Eh=Fo((Z_,Go)=>{var Km=Object.prototype.hasOwnProperty,wt="~";function Dr(){}Object.create&&(Dr.prototype=Object.create(null),new Dr().__proto__||(wt=false));function qm(i,t,e){this.fn=i,this.context=t,this.once=e||false;}function Ah(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new qm(e,r||i,s),n=wt?wt+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function Ki(i,t){--i._eventsCount===0?i._events=new Dr:delete i._events[t];}function vt(){this._events=new Dr,this._eventsCount=0;}vt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)Km.call(e,r)&&t.push(wt?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};vt.prototype.listeners=function(t){var e=wt?wt+t:t,r=this._events[e];if(!r)return [];if(r.fn)return [r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};vt.prototype.listenerCount=function(t){var e=wt?wt+t:t,r=this._events[e];return r?r.fn?1:r.length:0};vt.prototype.emit=function(t,e,r,s,o,n){var a=wt?wt+t:t;if(!this._events[a])return false;var h=this._events[a],l=arguments.length,u,c;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,true),l){case 1:return h.fn.call(h.context),true;case 2:return h.fn.call(h.context,e),true;case 3:return h.fn.call(h.context,e,r),true;case 4:return h.fn.call(h.context,e,r,s),true;case 5:return h.fn.call(h.context,e,r,s,o),true;case 6:return h.fn.call(h.context,e,r,s,o,n),true}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];h.fn.apply(h.context,u);}else {var f=h.length,d;for(c=0;c<f;c++)switch(h[c].once&&this.removeListener(t,h[c].fn,void 0,true),l){case 1:h[c].fn.call(h[c].context);break;case 2:h[c].fn.call(h[c].context,e);break;case 3:h[c].fn.call(h[c].context,e,r);break;case 4:h[c].fn.call(h[c].context,e,r,s);break;default:if(!u)for(d=1,u=new Array(l-1);d<l;d++)u[d-1]=arguments[d];h[c].fn.apply(h[c].context,u);}}return true};vt.prototype.on=function(t,e,r){return Ah(this,t,e,r,false)};vt.prototype.once=function(t,e,r){return Ah(this,t,e,r,true)};vt.prototype.removeListener=function(t,e,r,s){var o=wt?wt+t:t;if(!this._events[o])return this;if(!e)return Ki(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&Ki(this,o);else {for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:Ki(this,o);}return this};vt.prototype.removeAllListeners=function(t){var e;return t?(e=wt?wt+t:t,this._events[e]&&Ki(this,e)):(this._events=new Dr,this._eventsCount=0),this};vt.prototype.off=vt.prototype.removeListener;vt.prototype.addListener=vt.prototype.on;vt.prefixed=wt;vt.EventEmitter=vt;typeof Go<"u"&&(Go.exports=vt);});var Bh,j,Ft=p(()=>{Bh=Wi(Eh()),j=Bh.default;});var Zm,ae,gt,Ot,Lh,kh,Io,Qm,qi,Oh,zh,Fh,Rh,Gh,Ur,Jm,tg,eg,rg,Lo,Ih,ig,Do,Uo,Dh,Oo,Vt,Uh,Hh,Wh=p(()=>{Zm={grad:.9,turn:360,rad:360/(2*Math.PI)},ae=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},gt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},Ot=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Lh=function(i){return (i=isFinite(i)?i%360:0)>0?i:i+360},kh=function(i){return {r:Ot(i.r,0,255),g:Ot(i.g,0,255),b:Ot(i.b,0,255),a:Ot(i.a)}},Io=function(i){return {r:gt(i.r),g:gt(i.g),b:gt(i.b),a:gt(i.a,3)}},Qm=/^#([0-9a-f]{3,8})$/i,qi=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Oh=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-t)/n:4+(t-e)/n:0;return {h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},zh=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),h=r*(1-(1-t+o)*e),l=o%6;return {r:255*[r,a,n,n,h,r][l],g:255*[h,r,r,a,n,n][l],b:255*[n,n,h,r,r,a][l],a:s}},Fh=function(i){return {h:Lh(i.h),s:Ot(i.s,0,100),l:Ot(i.l,0,100),a:Ot(i.a)}},Rh=function(i){return {h:gt(i.h),s:gt(i.s),l:gt(i.l),a:gt(i.a,3)}},Gh=function(i){return zh((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r;},Ur=function(i){return {h:(t=Oh(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s;},Jm=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tg=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,eg=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rg=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Lo={string:[[function(i){var t=Qm.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?gt(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?gt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=eg.exec(i)||rg.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:kh({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(i){var t=Jm.exec(i)||tg.exec(i);if(!t)return null;var e,r,s=Fh({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(Zm[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Gh(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return ae(t)&&ae(e)&&ae(r)?kh({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!ae(t)||!ae(e)||!ae(r))return null;var n=Fh({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Gh(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!ae(t)||!ae(e)||!ae(r))return null;var n=function(a){return {h:Lh(a.h),s:Ot(a.s,0,100),v:Ot(a.v,0,100),a:Ot(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return zh(n)},"hsv"]]},Ih=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return [r,t[e][1]]}return [null,void 0]},ig=function(i){return typeof i=="string"?Ih(i.trim(),Lo.string):typeof i=="object"&&i!==null?Ih(i,Lo.object):[null,void 0]},Do=function(i,t){var e=Ur(i);return {h:e.h,s:Ot(e.s+100*t,0,100),l:e.l,a:e.a}},Uo=function(i){return (299*i.r+587*i.g+114*i.b)/1e3/255},Dh=function(i,t){var e=Ur(i);return {h:e.h,s:e.s,l:Ot(e.l+100*t,0,100),a:e.a}},Oo=function(){function i(t){this.parsed=ig(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1};}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return gt(Uo(this.rgba),2)},i.prototype.isDark=function(){return Uo(this.rgba)<.5},i.prototype.isLight=function(){return Uo(this.rgba)>=.5},i.prototype.toHex=function(){return t=Io(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?qi(gt(255*o)):"","#"+qi(e)+qi(r)+qi(s)+n;var t,e,r,s,o,n;},i.prototype.toRgb=function(){return Io(this.rgba)},i.prototype.toRgbString=function(){return t=Io(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o;},i.prototype.toHsl=function(){return Rh(Ur(this.rgba))},i.prototype.toHslString=function(){return t=Rh(Ur(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o;},i.prototype.toHsv=function(){return t=Oh(this.rgba),{h:gt(t.h),s:gt(t.s),v:gt(t.v),a:gt(t.a,3)};var t;},i.prototype.invert=function(){return Vt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t;},i.prototype.saturate=function(t){return t===void 0&&(t=.1),Vt(Do(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Vt(Do(this.rgba,-t))},i.prototype.grayscale=function(){return Vt(Do(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Vt(Dh(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Vt(Dh(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?Vt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):gt(this.rgba.a,3);var e;},i.prototype.hue=function(t){var e=Ur(this.rgba);return typeof t=="number"?Vt({h:t,s:e.s,l:e.l,a:e.a}):gt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Vt(t).toHex()},i}(),Vt=function(i){return i instanceof Oo?i:new Oo(i)},Uh=[],Hh=function(i){i.forEach(function(t){Uh.indexOf(t)<0&&(t(Oo,Lo),Uh.push(t));});};});function Vh(i,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"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return "transparent";var a,h,l=r[this.toHex()];if(l)return l;if(n?.closest){var u=this.toRgb(),c=1/0,f="black";if(!o.length)for(var d in e)o[d]=new i(e[d]).toRgb();for(var m in e){var x=(a=u,h=o[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));x<c&&(c=x,f=m);}return f}},t.string.push([function(n){var a=n.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new i(h).toRgb():null},"name"]);}var Nh=p(()=>{});var je,N,Et=p(()=>{Wh();Nh();Hh([Vh]);je=class Lr{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 Lr)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else {if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value));}}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){let r=typeof t;if(r!==typeof e)return false;if(r==="number"||r==="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?false:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?false:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,r,s]=this._components;return {r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return {r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return `rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return (r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return (t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=Lr._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=true){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=true){if(t===1)return (255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return `#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1;}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=Lr.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`);}let n=Vt(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255);}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0);}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r);}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Lr||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};je.shared=new je;je._temp=new je;je.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;N=je;});var $h,Yh=p(()=>{$h={cullArea:null,cullable:false,cullableChildren:true};});var Xh,jh,Kh,zo=p(()=>{Xh=Math.PI*2,jh=180/Math.PI,Kh=Math.PI/180;});var $,Ho,Nt=p(()=>{$=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e;}clone(){return new i(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}toString(){return `[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Ho.x=0,Ho.y=0,Ho}},Ho=new $;});var M,sg,og,et=p(()=>{zo();Nt();M=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n;}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,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new $;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new $;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,h=this.ty,l=1/(r*n+o*-s),u=t.x,c=t.y;return e.x=n*l*u+-o*l*c+(h*o-a*n)*l,e.y=r*l*c+-s*l*u+(-h*r+a*s)*l,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){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,h=t.ty,l=e.a,u=e.b,c=e.c,f=e.d;return this.a=r*l+s*c,this.b=r*u+s*f,this.c=o*l+n*c,this.d=o*u+n*f,this.tx=a*l+h*c+e.tx,this.ty=a*u+h*f+e.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*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){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Xh-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return `[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return og.identity()}static get shared(){return sg.identity()}},sg=new M,og=new M;});var Pt,Wo=p(()=>{Pt=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t;}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return (this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return (this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return `[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this));}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this));}};});function Y(i="default"){return Vo[i]===void 0&&(Vo[i]=-1),++Vo[i]}var Vo,Mt=p(()=>{Vo={default:-1};});function I(i,t,e=3){if(qh[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
2
2
|
Deprecated since v${i}`):(r=r.split(`
|
|
3
3
|
`).splice(e).join(`
|
|
4
4
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
5
5
|
Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
6
|
-
Deprecated since v${i}`),console.warn(r))),jh[t]=true;}var jh,H,Kh,dt=p(()=>{jh={},H="8.0.0",Kh="8.3.4";});var Ce,Wo=p(()=>{Ce=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e);}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t;}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t;}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0;}};});var Vo,W,Lt=p(()=>{Wo();Vo=class{constructor(){this._poolsByClass=new Map;}prepopulate(t,e){this.getPool(t).prepopulate(e);}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t);}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new Ce(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize};}),t}},W=new Vo;});var qh,Zh=p(()=>{dt();qh={get isCachedAsTexture(){return !!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===false?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===true?{}:i));},updateCacheTexture(){this.renderGroup?.updateCacheTexture();},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){I("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i);}};});function ji(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o;}var No=p(()=>{});var Qh,Jh=p(()=>{No();dt();Qh={allowChildren:true,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null);}ji(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this);}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t);},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||I(H,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1);}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=true,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=true),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=true),this._didContainerChangeTick++;},removeFromParent(){this.parent?.removeChild(this);},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}};});var tl,el=p(()=>{tl={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e));},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e);},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i);}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i);}}};});var Dr,rl=p(()=>{Dr=class{constructor(){this.pipe="filter",this.priority=1;}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null;}};});var $o,Ki,il=p(()=>{k();Lt();$o=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=false;}init(){this._initialized||(this._initialized=true,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t});}));}add(t){this._tests.push(t);}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return W.get(r.maskClass,t)}return t}returnMaskEffect(t){W.return(t);}},Ki=new $o;R.handleByList(S.MaskEffect,Ki._effectClasses);});var sl,ol=p(()=>{rl();il();sl={_maskEffect:null,_maskOptions:{inverse:false},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=true);},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple());},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple());},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),Ki.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=Ki.getMaskEffect(i),this.addEffect(this._maskEffect)));},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged();},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Dr);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null));},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Dr),this._filterEffect.filterArea=i;},get filterArea(){return this._filterEffect?.filterArea}};});var nl,al=p(()=>{dt();nl={label:null,get name(){return I(H,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){I(H,"Container.name property has been removed, use Container.label instead"),this.label=i;},getChildByName(i,t=false){return this.getChildByLabel(i,t)},getChildByLabel(i,t=false){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,true);if(o)return o}return null},getChildrenByLabel(i,t=false,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o);}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,true,e);return e}};});var qi,q,kt=p(()=>{Wt();qi=[new N,new N,new N,new N],q=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s);}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?false:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return false;let a=this.x,h=this.y,l=r*(1-s),u=r-l,c=a-l,f=a+o+l,d=h-l,m=h+n+l,x=a+u,g=a+o-u,_=h+u,y=h+n-u;return t>=c&&t<=f&&e>=d&&e<=m&&!(t>x&&t<g&&e>_&&e<y)}intersects(t,e){if(!e){let E=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=E)return false;let A=this.y<t.y?t.y:this.y;return (this.bottom>t.bottom?t.bottom:this.bottom)>A}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return false;let a=qi[0].set(t.left,t.top),h=qi[1].set(t.left,t.bottom),l=qi[2].set(t.right,t.top),u=qi[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return false;let c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(a.x,h.x,l.x,u.x)<=r||Math.min(a.x,h.x,l.x,u.x)>=s||Math.max(a.y,h.y,l.y,u.y)<=o||Math.min(a.y,h.y,l.y,u.y)>=n))return false;let f=c*(h.y-a.y),d=c*(a.x-h.x),m=f*r+d*o,x=f*s+d*o,g=f*r+d*n,_=f*s+d*n;if(Math.max(m,x,g,_)<=f*a.x+d*a.y||Math.min(m,x,g,_)>=f*u.x+d*u.y)return false;let y=c*(a.y-l.y),b=c*(l.x-a.x),v=y*r+b*o,P=y*s+b*o,T=y*r+b*n,w=y*s+b*n;return !(Math.max(v,P,T,w)<=y*a.x+b*a.y||Math.min(v,P,T,w)>=y*u.x+b*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){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=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=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return false;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return `[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}};});var hl,st,Vt=p(()=>{tt();kt();hl=new M,st=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=hl,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s;}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new q);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=hl,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s;}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,h=o.c,l=o.d,u=o.tx,c=o.ty,f=this.minX,d=this.minY,m=this.maxX,x=this.maxY,g=n*t+h*e+u,_=a*t+l*e+c;g<f&&(f=g),_<d&&(d=_),g>m&&(m=g),_>x&&(x=_),g=n*r+h*e+u,_=a*r+l*e+c,g<f&&(f=g),_<d&&(d=_),g>m&&(m=g),_>x&&(x=_),g=n*t+h*s+u,_=a*t+l*s+c,g<f&&(f=g),_<d&&(d=_),g>m&&(m=g),_>x&&(x=_),g=n*r+h*s+u,_=a*r+l*s+c,g<f&&(f=g),_<d&&(d=_),g>m&&(m=g),_>x&&(x=_),this.minX=f,this.minY=d,this.maxX=m,this.maxY=x;}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e);}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e);}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY;}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:h,d:l,tx:u,ty:c}=t,f=n*e+h*r+u,d=a*e+l*r+c;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=n*s+h*r+u,d=a*s+l*r+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=n*e+h*o+u,d=a*e+l*o+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=n*s+h*o+u,d=a*s+l*o+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY;}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new i(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e;}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e;}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t;}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t;}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,r,s){let o=this.minX,n=this.minY,a=this.maxX,h=this.maxY;s||(s=this.matrix);let l=s.a,u=s.b,c=s.c,f=s.d,d=s.tx,m=s.ty;for(let x=e;x<r;x+=2){let g=t[x],_=t[x+1],y=l*g+c*_+d,b=u*g+f*_+m;o=y<o?y:o,n=b<n?b:n,a=y>a?y:a,h=b>h?b:h;}this.minX=o,this.minY=n,this.maxX=a,this.maxY=h;}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return `[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}};});var ht,Ft,Ae=p(()=>{tt();Wo();Vt();ht=new Ce(M),Ft=new Ce(st);});var ig,ll,ul=p(()=>{tt();Vt();Ae();ig=new M,ll={getFastGlobalBounds(i,t){t||(t=new st),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=Ft.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else {if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform);}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e);}if(s){let o=false,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=true,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,true));o&&(r.applyMatrix(n.worldTransform.copyTo(ig).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),Ft.return(r);}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Ft.return(r));}};});function Zi(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=ht.get().identity(),r=Qi(i,s)):r=M.IDENTITY,cl(i,e,r,t),s&&ht.return(s),e.isValid||e.set(0,0,0,0),e}function cl(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=ht.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=Ft.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else {i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)cl(i.children[a],t,s,r);}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,M.IDENTITY),Ft.return(t);}r||ht.return(s);}function Qi(i,t){let e=i.parent;return e&&(Qi(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var Ji=p(()=>{tt();Ae();});function ts(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,h=e*o/255|0,l=r*n/255|0,u=s*a/255|0;return (h<<16)+(l<<8)+u}var Yo=p(()=>{});function Xo(i,t){return i===dl?t:t===dl?i:ts(i,t)}var dl,fl=p(()=>{Yo();dl=16777215;});function Lr(i){return ((i&255)<<16)+(i&65280)+(i>>16&255)}var pl,ml=p(()=>{Ji();Ae();fl();pl={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=Qi(this,ht.get().identity());return i.appendFrom(this.localTransform,e),ht.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?Lr(this.renderGroup.worldColor):this.parentRenderGroup?Lr(Xo(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Xo(t,e.localColor),e=e.parent;return Lr(t)}};});function O(...i){jo!==gl&&(jo++,jo===gl?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i));}var jo,gl,bt=p(()=>{jo=0,gl=500;});function es(i,t,e){return t.clear(),e||(e=M.IDENTITY),xl(i,t,e,i,true),t.isValid||t.set(0,0,0,0),t}function xl(i,t,e,r,s){let o;if(s)o=ht.get(),o=e.copyTo(o);else {if(!i.visible||!i.measurable)return;i.updateLocalTransform();let h=i.localTransform;o=ht.get(),o.appendFrom(h,e);}let n=t,a=!!i.effects.length;if(a&&(t=Ft.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else {i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let h=i.children;for(let l=0;l<h.length;l++)xl(h[l],t,o,r,false);}if(a){for(let h=0;h<i.effects.length;h++)i.effects[h].addLocalBounds?.(t,r);n.addBounds(t,M.IDENTITY),Ft.return(t);}ht.return(o);}var Ko=p(()=>{tt();Ae();});function qo(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=true),t.index=a+2,s.children.length&&qo(s,t);}return t.didChange}var _l=p(()=>{});var sg,yl,bl=p(()=>{tt();Vt();Ji();Ko();_l();sg=new M,yl={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e;},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e;},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:false,localBounds:new st});let i=this._localBoundsCacheData;return i.index=1,i.didChange=false,i.data[0]!==this._didViewChangeTick&&(i.didChange=true,i.data[0]=this._didViewChangeTick),qo(this,i),i.didChange&&es(this,i.localBounds,sg),i.localBounds},getBounds(i,t){return Zi(this,i,t||new st)}};});var vl,Sl=p(()=>{vl={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i;},get onRender(){return this._onRender}};});function og(i,t){return i._zIndex-t._zIndex}var Tl,wl=p(()=>{Tl={_zIndex:0,sortDirty:false,sortableChildren:false,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified());},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=true,this.parent.sortDirty=true),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true);},sortChildren(){this.sortDirty&&(this.sortDirty=false,this.children.sort(og));}};});var Pl,Ml=p(()=>{Wt();Ae();Pl={getGlobalPosition(i=new N,t=false){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=false){let r=this.getGlobalTransform(ht.get(),e);return t=r.apply(i,t),ht.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(ht.get(),r);return e=s.applyInverse(i,e),ht.return(s),e}};});var Xe,Zo=p(()=>{wt();Xe=class{constructor(){this.uid=$("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0;}reset(){this.instructionSize=0;}add(t){this.instructions[this.instructionSize++]=t;}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"]);}};});function ne(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Qo(i){return !(i&i-1)&&!!i}var Or=p(()=>{});function rs(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var Jo=p(()=>{});function ng(i){let t=Cl[i];return t===void 0&&(Cl[i]=$("resource")),t}var Cl,Al,is,tn=p(()=>{Bt();wt();dt();Cl=Object.create(null);Al=class El extends X{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=false,t={...El.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1;}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t;}get addressMode(){return this.addressModeU}set wrapMode(t){I(H,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t;}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t;}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear");}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null;}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=ng(t),this._resourceId}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners();}};Al.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};is=Al;});var Bl,gt,fe=p(()=>{Bt();Or();Jo();wt();tn();Bl=class kl extends X{constructor(t={}){super(),this.options=t,this.uid=$("textureSource"),this._resourceType="textureSource",this._resourceId=$("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=false,this.format="rgba8unorm",this.dimension="2d",this.antialias=false,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...kl.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new is(rs(t)),this.destroyed=false,this._refreshPOT();}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange());}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t;}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t;}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t;}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t;}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t;}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t;}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t;}_onStyleChange(){this.emit("styleChange",this);}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this);}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners();}unload(){this._resourceId=$("resource"),this.emit("change",this),this.emit("unload",this);}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t);}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?false:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=$("resource"),this.emit("change",this),true)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this);}set wrapMode(t){this._style.wrapMode=t;}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t;}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Qo(this.pixelWidth)&&Qo(this.pixelHeight);}static test(t){throw new Error("Unimplemented")}};Bl.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:false,sampleCount:1,antialias:false,autoGarbageCollect:false};gt=Bl;});function ag(){for(let i=0;i<16;i++){let t=[];en.push(t);for(let e=0;e<16;e++){let r=ss(Ee[i]*Ee[e]+ke[i]*Be[e]),s=ss(Be[i]*Ee[e]+Fe[i]*Be[e]),o=ss(Ee[i]*ke[e]+ke[i]*Fe[e]),n=ss(Be[i]*ke[e]+Fe[i]*Fe[e]);for(let a=0;a<16;a++)if(Ee[a]===r&&Be[a]===s&&ke[a]===o&&Fe[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new M;t.set(Ee[i],Be[i],ke[i],Fe[i],0,0),Fl.push(t);}}var Ee,Be,ke,Fe,en,Fl,ss,et,Gl=p(()=>{tt();Ee=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Be=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ke=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Fe=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],en=[],Fl=[],ss=Math.sign;ag();et={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:i=>Ee[i],uY:i=>Be[i],vX:i=>ke[i],vY:i=>Fe[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>en[i][t],sub:(i,t)=>en[i][et.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?et.S:et.N:Math.abs(t)*2<=Math.abs(i)?i>0?et.E:et.W:t>0?i>0?et.SE:et.SW:i>0?et.NE:et.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Fl[et.inv(t)];s.tx=e,s.ty=r,i.append(s);}};});var rn,Rl=p(()=>{rn=()=>{};});var Ge,sn=p(()=>{k();fe();Ge=class extends gt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(r="bgra8unorm")),super({...t,resource:e,format:r}),this.uploadMethodId="buffer";}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};Ge.extension=S.TextureSource;});var Il,os,Ul=p(()=>{tt();Il=new M,os=class{constructor(t,e){this.mapCoord=new M,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=false,this.texture=t;}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update());}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty;}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(Il.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Il));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,h=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+h)/o.width,n[1]=(t.frame.y+a+h)/o.height,n[2]=(t.frame.x+t.frame.width-a+h)/o.width,n[3]=(t.frame.y+t.frame.height-a+h)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&t.rotate===0,true}};});var F,xt=p(()=>{Bt();Gl();kt();wt();dt();Rl();sn();fe();Ul();F=class extends X{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=$("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new q,this.noFrame=false,this.dynamic=false,this.isTexture=true,this.label=e,this.source=t?.source??new gt,this.noFrame=!r,r)this.frame.copyFrom(r);else {let{width:u,height:c}=this._source;this.frame.width=u,this.frame.height=c;}this.orig=s||this.frame,this.trim=o,this.rotate=h??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=false,this.dynamic=l||false,this.updateUvs();}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this);}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new os(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,h=e.height/s,l=this.rotate;if(l){let u=a/2,c=h/2,f=o+u,d=n+c;l=et.add(l,et.NW),t.x0=f+u*et.uX(l),t.y0=d+c*et.uY(l),l=et.add(l,2),t.x1=f+u*et.uX(l),t.y1=d+c*et.uY(l),l=et.add(l,2),t.x2=f+u*et.uX(l),t.y2=d+c*et.uY(l),l=et.add(l,2),t.x3=f+u*et.uX(l),t.y3=d+c*et.uY(l);}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+h,t.x3=o,t.y3=n+h;}destroy(t=false){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=true,this.emit("destroy",this),this.removeAllListeners();}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this);}get baseTexture(){return I(H,"Texture.baseTexture is now Texture.source"),this._source}};F.EMPTY=new F({label:"EMPTY",source:new gt({label:"EMPTY"})});F.EMPTY.destroy=rn;F.WHITE=new F({source:new Ge({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});F.WHITE.destroy=rn;});var hg,on,vt,je=p(()=>{Or();fe();xt();hg=0,on=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=false;}createTexture(t,e,r){let s=new gt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:false});return new F({source:s,label:`texturePool_${hg++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=ne(o),n=ne(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let h=this._texturePool[a].pop();return h||(h=this.createTexture(o,n,s)),h.source._resolution=r,h.source.width=o/r,h.source.height=n/r,h.source.pixelWidth=o,h.source.pixelHeight=n,h.frame.x=0,h.frame.y=0,h.frame.width=t,h.frame.height=e,h.updateUvs(),this._poolKeyHash[h.uid]=a,h}getSameSizeTexture(t,e=false){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t);}clear(t){if(t=t!==false,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(true);}this._texturePool={};}},vt=new on;});var ns,Dl=p(()=>{tt();Zo();je();ns=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=false,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new M,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=true,this.instructionSet=new Xe,this._onRenderContainers=[],this.textureNeedsUpdate=true,this.isCachedAsTexture=false,this._matrixDirty=7;}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=true;let e=t.children;for(let r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s);}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=true,this.textureNeedsUpdate=true;}disableCacheAsTexture(){this.isCachedAsTexture=false,this.texture&&(vt.returnTexture(this.texture),this.texture=null);}updateCacheTexture(){this.textureNeedsUpdate=true;}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0;}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=true,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture();}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t);}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null;}addChild(t){if(this.structureDidChange=true,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=true,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r]);}removeChild(t){if(this.structureDidChange=true,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r]);}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e]);}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t;}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=false);}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t;}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t);}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1);}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t);}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null;}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7;}get inverseWorldTransform(){return (this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new M),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return (this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new M),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new M),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}};});function Ll(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r]);}var Ol=p(()=>{});var nn,an,hn,zl,lg,ln,Nt,zr=p(()=>{Bt();Ct();Nh();k();tt();Lo();zo();wt();dt();Lt();Zh();Jh();el();ol();al();ul();ml();bl();Sl();wl();Ml();Dl();Ol();nn=new Tt(null),an=new Tt(null),hn=new Tt(null,1,1),zl=1,lg=2,ln=4,Nt=class i extends X{constructor(t={}){super(),this.uid=$("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=false,this.didViewUpdate=false,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=true,this.measurable=true,this.isSimple=true,this.updateTick=-1,this.localTransform=new M,this.relativeGroupTransform=new M,this.groupTransform=this.relativeGroupTransform,this.destroyed=false,this._position=new Tt(this,0,0),this._scale=hn,this._pivot=an,this._skew=nn,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],Ll(this,t,{children:true,parent:true,effects:true}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this);}static mixin(t){I("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),R.mixin(i,t);}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095;}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||I(H,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=true),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=true),e.parent=this,e.didChange=true,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,r),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=true,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this));}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup());}get isRenderGroup(){return !!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=W.get(ns,this),this.groupTransform=M.IDENTITY,t?.addChild(this),this._updateIsSimple();}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),W.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple();}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0;}get worldTransform(){return this._worldTransform||(this._worldTransform=new M),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t;}get y(){return this._position.y}set y(t){this._position.y=t;}get position(){return this._position}set position(t){this._position.copyFrom(t);}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew));}get angle(){return this.rotation*Yh}set angle(t){this.rotation=t*Xh;}get pivot(){return this._pivot===an&&(this._pivot=new Tt(this,0,0)),this._pivot}set pivot(t){this._pivot===an&&(this._pivot=new Tt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t);}get skew(){return this._skew===nn&&(this._skew=new Tt(this,0,0)),this._skew}set skew(t){this._skew===nn&&(this._skew=new Tt(this,0,0)),this._skew.copyFrom(t);}get scale(){return this._scale===hn&&(this._scale=new Tt(this,1,1)),this._scale}set scale(t){this._scale===hn&&(this._scale=new Tt(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t);}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e);}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e);}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height);}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x);}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this);}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,h=s._x,l=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(h*e.a+l*e.c),e.ty=o._y-(h*e.b+l*e.d);}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=zl,this._onUpdate());}get alpha(){return this.localAlpha}set tint(t){let r=V.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=zl,this._onUpdate());}get tint(){return Lr(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._updateFlags|=lg,this.localBlendMode=t,this._onUpdate());}get blendMode(){return this.localBlendMode}get visible(){return !!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._updateFlags|=ln,this.localDisplayStatus^=2,this._onUpdate());}get culled(){return !(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._updateFlags|=ln,this.localDisplayStatus^=4,this._onUpdate());}get renderable(){return !!(this.localDisplayStatus&1)}set renderable(t){let e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=ln,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._onUpdate());}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=false){if(this.destroyed)return;this.destroyed=true;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null;}};R.mixin(Nt,Qh,ll,Pl,vl,yl,sl,nl,Tl,Vh,qh,pl,tl);});var pe,as=p(()=>{Wt();pe=class i{constructor(t){this.bubbles=true,this.cancelBubble=true,this.cancelable=false,this.composed=false,this.defaultPrevented=false,this.eventPhase=i.prototype.NONE,this.propagationStopped=false,this.propagationImmediatelyStopped=false,this.layer=new N,this.page=new N,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,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,s,o){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=true;}stopImmediatePropagation(){this.propagationImmediatelyStopped=true;}stopPropagation(){this.propagationStopped=true;}};});function ug(i){return function(t){return t.test(i)}}function Hr(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=ug(e),o={apple:{phone:s(un)&&!s(ae),ipod:s(Hl),tablet:!s(un)&&(s(Wl)||Zl(t))&&!s(ae),universal:s(Vl),device:(s(un)||s(Hl)||s(Wl)||s(Vl)||Zl(t))&&!s(ae)},amazon:{phone:s(Ke),tablet:!s(Ke)&&s(hs),device:s(Ke)||s(hs)},android:{phone:!s(ae)&&s(Ke)||!s(ae)&&s(cn),tablet:!s(ae)&&!s(Ke)&&!s(cn)&&(s(hs)||s(Nl)),device:!s(ae)&&(s(Ke)||s(hs)||s(cn)||s(Nl))||s(/\bokhttp\b/i)},windows:{phone:s(ae),tablet:s($l),device:s(ae)||s($l)},other:{blackberry:s(Yl),blackberry10:s(Xl),opera:s(jl),firefox:s(ql),chrome:s(Kl),device:s(Yl)||s(Xl)||s(jl)||s(ql)||s(Kl)},any:false,phone:false,tablet:false};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var un,Hl,Wl,Vl,cn,Nl,Ke,hs,ae,$l,Yl,Xl,jl,Kl,ql,Zl,dn=p(()=>{un=/iPhone/i,Hl=/iPod/i,Wl=/iPad/i,Vl=/\biOS-universal(?:.+)Mac\b/i,cn=/\bAndroid(?:.+)Mobile\b/i,Nl=/Android/i,Ke=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,hs=/Silk/i,ae=/Windows Phone/i,$l=/\bWindows(?:.+)ARM\b/i,Yl=/BlackBerry/i,Xl=/BB10/i,jl=/Opera Mini/i,Kl=/\b(CriOS|Chrome)(?:.+)Mobile/i,ql=/Mobile(?:.+)Firefox\b/i,Zl=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};});var Ql=p(()=>{dn();dn();});var cg,Jl,tu=p(()=>{Ql();cg=Hr.default??Hr,Jl=cg(globalThis.navigator);});var dg,ls,fg,pg,eu,ru,mg,gg,xg,fn,su,ou=p(()=>{as();k();tu();No();dg=9,ls=100,fg=0,pg=0,eu=2,ru=1,mg=-1e3,gg=-1e3,xg=2,fn=class iu{constructor(t,e=Jl){this._mobileInfo=e,this.debug=false,this._activateOnTab=true,this._deactivateOnMouseMove=true,this._isActive=false,this._isMobileAccessibility=false,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t;}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let t=document.createElement("button");t.style.width=`${ru}px`,t.style.height=`${ru}px`,t.style.position="absolute",t.style.top=`${mg}px`,t.style.left=`${gg}px`,t.style.zIndex=xg.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=true,this._activate(),this._destroyTouchHook();}),document.body.appendChild(t),this._hookDiv=t;}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null);}_activate(){if(this._isActive)return;this._isActive=true,this._div||(this._div=document.createElement("div"),this._div.style.width=`${ls}px`,this._div.style.height=`${ls}px`,this._div.style.position="absolute",this._div.style.top=`${fg}px`,this._div.style.left=`${pg}px`,this._div.style.zIndex=eu.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,false)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,true));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else {let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup());});e.observe(document.body,{childList:true,subtree:true});}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered);}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=false,globalThis.document.removeEventListener("mousemove",this._onMouseMove,true),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,false),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=false;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t);}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[];}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let r=0;r<e.length;r++)this._updateAccessibleObjects(e[r]);}init(t){let r={accessibilityOptions:{...iu.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,false)),this._renderer.runners.postrender.remove(this);}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r));}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=false,ji(this._children,r,1));}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`;}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,h=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*h}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*h}px`,o.style.height=`${n.height*a.d*l}px`;}else {this._capHitArea(n);let a=this._renderer.resolution,h=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*h}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*h}px`;}}this._renderId++;}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`;}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y);}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
|
|
6
|
+
Deprecated since v${i}`),console.warn(r))),qh[t]=true;}var qh,W,Zh,pt=p(()=>{qh={},W="8.0.0",Zh="8.3.4";});var Ee,No=p(()=>{Ee=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e);}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t;}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t;}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0;}};});var $o,V,zt=p(()=>{No();$o=class{constructor(){this._poolsByClass=new Map;}prepopulate(t,e){this.getPool(t).prepopulate(e);}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t);}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new Ee(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize};}),t}},V=new $o;});var Qh,Jh=p(()=>{pt();Qh={get isCachedAsTexture(){return !!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===false?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===true?{}:i));},updateCacheTexture(){this.renderGroup?.updateCacheTexture();},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){I("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i);}};});function Zi(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o;}var Yo=p(()=>{});var tl,el=p(()=>{Yo();pt();tl={allowChildren:true,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null);}Zi(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this);}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t);},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||I(W,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1);}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=true,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=true),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=true),this._didContainerChangeTick++;},removeFromParent(){this.parent?.removeChild(this);},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}};});var rl,il=p(()=>{rl={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e));},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e);},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i);}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i);}}};});var Or,sl=p(()=>{Or=class{constructor(){this.pipe="filter",this.priority=1;}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null;}};});var Xo,Qi,ol=p(()=>{k();zt();Xo=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=false;}init(){this._initialized||(this._initialized=true,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t});}));}add(t){this._tests.push(t);}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return V.get(r.maskClass,t)}return t}returnMaskEffect(t){V.return(t);}},Qi=new Xo;G.handleByList(S.MaskEffect,Qi._effectClasses);});var nl,al=p(()=>{sl();ol();nl={_maskEffect:null,_maskOptions:{inverse:false},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=true);},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple());},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple());},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),Qi.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=Qi.getMaskEffect(i),this.addEffect(this._maskEffect)));},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged();},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Or);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null));},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Or),this._filterEffect.filterArea=i;},get filterArea(){return this._filterEffect?.filterArea}};});var hl,ll=p(()=>{pt();hl={label:null,get name(){return I(W,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){I(W,"Container.name property has been removed, use Container.label instead"),this.label=i;},getChildByName(i,t=false){return this.getChildByLabel(i,t)},getChildByLabel(i,t=false){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,true);if(o)return o}return null},getChildrenByLabel(i,t=false,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o);}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,true,e);return e}};});var Ji,Z,Rt=p(()=>{Nt();Ji=[new $,new $,new $,new $],Z=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s);}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?false:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return false;let a=this.x,h=this.y,l=r*(1-s),u=r-l,c=a-l,f=a+o+l,d=h-l,m=h+n+l,x=a+u,g=a+o-u,_=h+u,y=h+n-u;return t>=c&&t<=f&&e>=d&&e<=m&&!(t>x&&t<g&&e>_&&e<y)}intersects(t,e){if(!e){let E=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=E)return false;let A=this.y<t.y?t.y:this.y;return (this.bottom>t.bottom?t.bottom:this.bottom)>A}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return false;let a=Ji[0].set(t.left,t.top),h=Ji[1].set(t.left,t.bottom),l=Ji[2].set(t.right,t.top),u=Ji[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return false;let c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(a.x,h.x,l.x,u.x)<=r||Math.min(a.x,h.x,l.x,u.x)>=s||Math.max(a.y,h.y,l.y,u.y)<=o||Math.min(a.y,h.y,l.y,u.y)>=n))return false;let f=c*(h.y-a.y),d=c*(a.x-h.x),m=f*r+d*o,x=f*s+d*o,g=f*r+d*n,_=f*s+d*n;if(Math.max(m,x,g,_)<=f*a.x+d*a.y||Math.min(m,x,g,_)>=f*u.x+d*u.y)return false;let y=c*(a.y-l.y),b=c*(l.x-a.x),v=y*r+b*o,P=y*s+b*o,T=y*r+b*n,w=y*s+b*n;return !(Math.max(v,P,T,w)<=y*a.x+b*a.y||Math.min(v,P,T,w)>=y*u.x+b*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){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=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=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return false;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return `[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}};});var ul,nt,$t=p(()=>{et();Rt();ul=new M,nt=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=ul,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s;}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Z);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=ul,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s;}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,h=o.c,l=o.d,u=o.tx,c=o.ty,f=this.minX,d=this.minY,m=this.maxX,x=this.maxY,g=n*t+h*e+u,_=a*t+l*e+c;g<f&&(f=g),_<d&&(d=_),g>m&&(m=g),_>x&&(x=_),g=n*r+h*e+u,_=a*r+l*e+c,g<f&&(f=g),_<d&&(d=_),g>m&&(m=g),_>x&&(x=_),g=n*t+h*s+u,_=a*t+l*s+c,g<f&&(f=g),_<d&&(d=_),g>m&&(m=g),_>x&&(x=_),g=n*r+h*s+u,_=a*r+l*s+c,g<f&&(f=g),_<d&&(d=_),g>m&&(m=g),_>x&&(x=_),this.minX=f,this.minY=d,this.maxX=m,this.maxY=x;}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e);}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e);}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY;}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:h,d:l,tx:u,ty:c}=t,f=n*e+h*r+u,d=a*e+l*r+c;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=n*s+h*r+u,d=a*s+l*r+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=n*e+h*o+u,d=a*e+l*o+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=n*s+h*o+u,d=a*s+l*o+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY;}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new i(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e;}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e;}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t;}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t;}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,r,s){let o=this.minX,n=this.minY,a=this.maxX,h=this.maxY;s||(s=this.matrix);let l=s.a,u=s.b,c=s.c,f=s.d,d=s.tx,m=s.ty;for(let x=e;x<r;x+=2){let g=t[x],_=t[x+1],y=l*g+c*_+d,b=u*g+f*_+m;o=y<o?y:o,n=b<n?b:n,a=y>a?y:a,h=b>h?b:h;}this.minX=o,this.minY=n,this.maxX=a,this.maxY=h;}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return `[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}};});var ut,Gt,Be=p(()=>{et();No();$t();ut=new Ee(M),Gt=new Ee(nt);});var ng,cl,dl=p(()=>{et();$t();Be();ng=new M,cl={getFastGlobalBounds(i,t){t||(t=new nt),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=Gt.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else {if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform);}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e);}if(s){let o=false,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=true,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,true));o&&(r.applyMatrix(n.worldTransform.copyTo(ng).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),Gt.return(r);}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Gt.return(r));}};});function ts(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=ut.get().identity(),r=es(i,s)):r=M.IDENTITY,fl(i,e,r,t),s&&ut.return(s),e.isValid||e.set(0,0,0,0),e}function fl(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=ut.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=Gt.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else {i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)fl(i.children[a],t,s,r);}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,M.IDENTITY),Gt.return(t);}r||ut.return(s);}function es(i,t){let e=i.parent;return e&&(es(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var rs=p(()=>{et();Be();});function is(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,h=e*o/255|0,l=r*n/255|0,u=s*a/255|0;return (h<<16)+(l<<8)+u}var jo=p(()=>{});function Ko(i,t){return i===pl?t:t===pl?i:is(i,t)}var pl,ml=p(()=>{jo();pl=16777215;});function zr(i){return ((i&255)<<16)+(i&65280)+(i>>16&255)}var gl,xl=p(()=>{rs();Be();ml();gl={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=es(this,ut.get().identity());return i.appendFrom(this.localTransform,e),ut.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?zr(this.renderGroup.worldColor):this.parentRenderGroup?zr(Ko(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Ko(t,e.localColor),e=e.parent;return zr(t)}};});function z(...i){qo!==_l&&(qo++,qo===_l?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i));}var qo,_l,St=p(()=>{qo=0,_l=500;});function ss(i,t,e){return t.clear(),e||(e=M.IDENTITY),yl(i,t,e,i,true),t.isValid||t.set(0,0,0,0),t}function yl(i,t,e,r,s){let o;if(s)o=ut.get(),o=e.copyTo(o);else {if(!i.visible||!i.measurable)return;i.updateLocalTransform();let h=i.localTransform;o=ut.get(),o.appendFrom(h,e);}let n=t,a=!!i.effects.length;if(a&&(t=Gt.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else {i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let h=i.children;for(let l=0;l<h.length;l++)yl(h[l],t,o,r,false);}if(a){for(let h=0;h<i.effects.length;h++)i.effects[h].addLocalBounds?.(t,r);n.addBounds(t,M.IDENTITY),Gt.return(t);}ut.return(o);}var Zo=p(()=>{et();Be();});function Qo(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=true),t.index=a+2,s.children.length&&Qo(s,t);}return t.didChange}var bl=p(()=>{});var ag,vl,Sl=p(()=>{et();$t();rs();Zo();bl();ag=new M,vl={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e;},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e;},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:false,localBounds:new nt});let i=this._localBoundsCacheData;return i.index=1,i.didChange=false,i.data[0]!==this._didViewChangeTick&&(i.didChange=true,i.data[0]=this._didViewChangeTick),Qo(this,i),i.didChange&&ss(this,i.localBounds,ag),i.localBounds},getBounds(i,t){return ts(this,i,t||new nt)}};});var Tl,wl=p(()=>{Tl={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i;},get onRender(){return this._onRender}};});function hg(i,t){return i._zIndex-t._zIndex}var Pl,Ml=p(()=>{Pl={_zIndex:0,sortDirty:false,sortableChildren:false,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified());},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=true,this.parent.sortDirty=true),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true);},sortChildren(){this.sortDirty&&(this.sortDirty=false,this.children.sort(hg));}};});var Cl,Al=p(()=>{Nt();Be();Cl={getGlobalPosition(i=new $,t=false){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=false){let r=this.getGlobalTransform(ut.get(),e);return t=r.apply(i,t),ut.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(ut.get(),r);return e=s.applyInverse(i,e),ut.return(s),e}};});var Ke,Jo=p(()=>{Mt();Ke=class{constructor(){this.uid=Y("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0;}reset(){this.instructionSize=0;}add(t){this.instructions[this.instructionSize++]=t;}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"]);}};});function he(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function tn(i){return !(i&i-1)&&!!i}var Hr=p(()=>{});function os(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var en=p(()=>{});function lg(i){let t=El[i];return t===void 0&&(El[i]=Y("resource")),t}var El,Bl,ns,rn=p(()=>{Ft();Mt();pt();El=Object.create(null);Bl=class kl extends j{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=false,t={...kl.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1;}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t;}get addressMode(){return this.addressModeU}set wrapMode(t){I(W,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t;}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t;}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear");}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null;}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=lg(t),this._resourceId}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners();}};Bl.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};ns=Bl;});var Fl,_t,me=p(()=>{Ft();Hr();en();Mt();rn();Fl=class Rl extends j{constructor(t={}){super(),this.options=t,this.uid=Y("textureSource"),this._resourceType="textureSource",this._resourceId=Y("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=false,this.format="rgba8unorm",this.dimension="2d",this.antialias=false,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...Rl.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new ns(os(t)),this.destroyed=false,this._refreshPOT();}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange());}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t;}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t;}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t;}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t;}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t;}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t;}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t;}_onStyleChange(){this.emit("styleChange",this);}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this);}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners();}unload(){this._resourceId=Y("resource"),this.emit("change",this),this.emit("unload",this);}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t);}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?false:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=Y("resource"),this.emit("change",this),true)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this);}set wrapMode(t){this._style.wrapMode=t;}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t;}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=tn(this.pixelWidth)&&tn(this.pixelHeight);}static test(t){throw new Error("Unimplemented")}};Fl.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:false,sampleCount:1,antialias:false,autoGarbageCollect:false};_t=Fl;});function ug(){for(let i=0;i<16;i++){let t=[];sn.push(t);for(let e=0;e<16;e++){let r=as(ke[i]*ke[e]+Re[i]*Fe[e]),s=as(Fe[i]*ke[e]+Ge[i]*Fe[e]),o=as(ke[i]*Re[e]+Re[i]*Ge[e]),n=as(Fe[i]*Re[e]+Ge[i]*Ge[e]);for(let a=0;a<16;a++)if(ke[a]===r&&Fe[a]===s&&Re[a]===o&&Ge[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new M;t.set(ke[i],Fe[i],Re[i],Ge[i],0,0),Gl.push(t);}}var ke,Fe,Re,Ge,sn,Gl,as,st,Il=p(()=>{et();ke=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Fe=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Re=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ge=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],sn=[],Gl=[],as=Math.sign;ug();st={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:i=>ke[i],uY:i=>Fe[i],vX:i=>Re[i],vY:i=>Ge[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>sn[i][t],sub:(i,t)=>sn[i][st.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?st.S:st.N:Math.abs(t)*2<=Math.abs(i)?i>0?st.E:st.W:t>0?i>0?st.SE:st.SW:i>0?st.NE:st.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Gl[st.inv(t)];s.tx=e,s.ty=r,i.append(s);}};});var on,Dl=p(()=>{on=()=>{};});var Ie,nn=p(()=>{k();me();Ie=class extends _t{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(r="bgra8unorm")),super({...t,resource:e,format:r}),this.uploadMethodId="buffer";}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};Ie.extension=S.TextureSource;});var Ul,hs,Ll=p(()=>{et();Ul=new M,hs=class{constructor(t,e){this.mapCoord=new M,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=false,this.texture=t;}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update());}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty;}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(Ul.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Ul));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,h=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+h)/o.width,n[1]=(t.frame.y+a+h)/o.height,n[2]=(t.frame.x+t.frame.width-a+h)/o.width,n[3]=(t.frame.y+t.frame.height-a+h)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&t.rotate===0,true}};});var F,yt=p(()=>{Ft();Il();Rt();Mt();pt();Dl();nn();me();Ll();F=class extends j{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=Y("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Z,this.noFrame=false,this.dynamic=false,this.isTexture=true,this.label=e,this.source=t?.source??new _t,this.noFrame=!r,r)this.frame.copyFrom(r);else {let{width:u,height:c}=this._source;this.frame.width=u,this.frame.height=c;}this.orig=s||this.frame,this.trim=o,this.rotate=h??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=false,this.dynamic=l||false,this.updateUvs();}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this);}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new hs(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,h=e.height/s,l=this.rotate;if(l){let u=a/2,c=h/2,f=o+u,d=n+c;l=st.add(l,st.NW),t.x0=f+u*st.uX(l),t.y0=d+c*st.uY(l),l=st.add(l,2),t.x1=f+u*st.uX(l),t.y1=d+c*st.uY(l),l=st.add(l,2),t.x2=f+u*st.uX(l),t.y2=d+c*st.uY(l),l=st.add(l,2),t.x3=f+u*st.uX(l),t.y3=d+c*st.uY(l);}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+h,t.x3=o,t.y3=n+h;}destroy(t=false){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=true,this.emit("destroy",this),this.removeAllListeners();}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this);}get baseTexture(){return I(W,"Texture.baseTexture is now Texture.source"),this._source}};F.EMPTY=new F({label:"EMPTY",source:new _t({label:"EMPTY"})});F.EMPTY.destroy=on;F.WHITE=new F({source:new Ie({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});F.WHITE.destroy=on;});var cg,an,Tt,qe=p(()=>{Hr();me();yt();cg=0,an=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=false;}createTexture(t,e,r){let s=new _t({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:false});return new F({source:s,label:`texturePool_${cg++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=he(o),n=he(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let h=this._texturePool[a].pop();return h||(h=this.createTexture(o,n,s)),h.source._resolution=r,h.source.width=o/r,h.source.height=n/r,h.source.pixelWidth=o,h.source.pixelHeight=n,h.frame.x=0,h.frame.y=0,h.frame.width=t,h.frame.height=e,h.updateUvs(),this._poolKeyHash[h.uid]=a,h}getSameSizeTexture(t,e=false){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t);}clear(t){if(t=t!==false,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(true);}this._texturePool={};}},Tt=new an;});var ls,Ol=p(()=>{et();Jo();qe();ls=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=false,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new M,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=true,this.instructionSet=new Ke,this._onRenderContainers=[],this.textureNeedsUpdate=true,this.isCachedAsTexture=false,this._matrixDirty=7;}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=true;let e=t.children;for(let r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s);}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=true,this.textureNeedsUpdate=true;}disableCacheAsTexture(){this.isCachedAsTexture=false,this.texture&&(Tt.returnTexture(this.texture),this.texture=null);}updateCacheTexture(){this.textureNeedsUpdate=true;}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0;}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=true,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture();}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t);}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null;}addChild(t){if(this.structureDidChange=true,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=true,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r]);}removeChild(t){if(this.structureDidChange=true,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r]);}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e]);}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t;}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=false);}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t;}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t);}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1);}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t);}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null;}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7;}get inverseWorldTransform(){return (this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new M),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return (this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new M),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new M),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}};});function zl(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r]);}var Hl=p(()=>{});var hn,ln,un,Wl,dg,cn,Yt,Wr=p(()=>{Ft();Et();Yh();k();et();zo();Wo();Mt();pt();zt();Jh();el();il();al();ll();dl();xl();Sl();wl();Ml();Al();Ol();Hl();hn=new Pt(null),ln=new Pt(null),un=new Pt(null,1,1),Wl=1,dg=2,cn=4,Yt=class i extends j{constructor(t={}){super(),this.uid=Y("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=false,this.didViewUpdate=false,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=true,this.measurable=true,this.isSimple=true,this.updateTick=-1,this.localTransform=new M,this.relativeGroupTransform=new M,this.groupTransform=this.relativeGroupTransform,this.destroyed=false,this._position=new Pt(this,0,0),this._scale=un,this._pivot=ln,this._skew=hn,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],zl(this,t,{children:true,parent:true,effects:true}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this);}static mixin(t){I("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),G.mixin(i,t);}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095;}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||I(W,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=true),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=true),e.parent=this,e.didChange=true,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,r),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=true,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this));}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup());}get isRenderGroup(){return !!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=V.get(ls,this),this.groupTransform=M.IDENTITY,t?.addChild(this),this._updateIsSimple();}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),V.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple();}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0;}get worldTransform(){return this._worldTransform||(this._worldTransform=new M),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t;}get y(){return this._position.y}set y(t){this._position.y=t;}get position(){return this._position}set position(t){this._position.copyFrom(t);}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew));}get angle(){return this.rotation*jh}set angle(t){this.rotation=t*Kh;}get pivot(){return this._pivot===ln&&(this._pivot=new Pt(this,0,0)),this._pivot}set pivot(t){this._pivot===ln&&(this._pivot=new Pt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t);}get skew(){return this._skew===hn&&(this._skew=new Pt(this,0,0)),this._skew}set skew(t){this._skew===hn&&(this._skew=new Pt(this,0,0)),this._skew.copyFrom(t);}get scale(){return this._scale===un&&(this._scale=new Pt(this,1,1)),this._scale}set scale(t){this._scale===un&&(this._scale=new Pt(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t);}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e);}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e);}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height);}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x);}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this);}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,h=s._x,l=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(h*e.a+l*e.c),e.ty=o._y-(h*e.b+l*e.d);}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Wl,this._onUpdate());}get alpha(){return this.localAlpha}set tint(t){let r=N.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Wl,this._onUpdate());}get tint(){return zr(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._updateFlags|=dg,this.localBlendMode=t,this._onUpdate());}get blendMode(){return this.localBlendMode}get visible(){return !!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._updateFlags|=cn,this.localDisplayStatus^=2,this._onUpdate());}get culled(){return !(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._updateFlags|=cn,this.localDisplayStatus^=4,this._onUpdate());}get renderable(){return !!(this.localDisplayStatus&1)}set renderable(t){let e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=cn,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._onUpdate());}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=false){if(this.destroyed)return;this.destroyed=true;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null;}};G.mixin(Yt,tl,cl,Cl,Tl,vl,nl,hl,Pl,$h,Qh,gl,rl);});var ge,us=p(()=>{Nt();ge=class i{constructor(t){this.bubbles=true,this.cancelBubble=true,this.cancelable=false,this.composed=false,this.defaultPrevented=false,this.eventPhase=i.prototype.NONE,this.propagationStopped=false,this.propagationImmediatelyStopped=false,this.layer=new $,this.page=new $,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,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,s,o){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=true;}stopImmediatePropagation(){this.propagationImmediatelyStopped=true;}stopPropagation(){this.propagationStopped=true;}};});function fg(i){return function(t){return t.test(i)}}function Vr(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=fg(e),o={apple:{phone:s(dn)&&!s(le),ipod:s(Vl),tablet:!s(dn)&&(s(Nl)||Jl(t))&&!s(le),universal:s($l),device:(s(dn)||s(Vl)||s(Nl)||s($l)||Jl(t))&&!s(le)},amazon:{phone:s(Ze),tablet:!s(Ze)&&s(cs),device:s(Ze)||s(cs)},android:{phone:!s(le)&&s(Ze)||!s(le)&&s(fn),tablet:!s(le)&&!s(Ze)&&!s(fn)&&(s(cs)||s(Yl)),device:!s(le)&&(s(Ze)||s(cs)||s(fn)||s(Yl))||s(/\bokhttp\b/i)},windows:{phone:s(le),tablet:s(Xl),device:s(le)||s(Xl)},other:{blackberry:s(jl),blackberry10:s(Kl),opera:s(ql),firefox:s(Ql),chrome:s(Zl),device:s(jl)||s(Kl)||s(ql)||s(Ql)||s(Zl)},any:false,phone:false,tablet:false};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var dn,Vl,Nl,$l,fn,Yl,Ze,cs,le,Xl,jl,Kl,ql,Zl,Ql,Jl,pn=p(()=>{dn=/iPhone/i,Vl=/iPod/i,Nl=/iPad/i,$l=/\biOS-universal(?:.+)Mac\b/i,fn=/\bAndroid(?:.+)Mobile\b/i,Yl=/Android/i,Ze=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,cs=/Silk/i,le=/Windows Phone/i,Xl=/\bWindows(?:.+)ARM\b/i,jl=/BlackBerry/i,Kl=/BB10/i,ql=/Opera Mini/i,Zl=/\b(CriOS|Chrome)(?:.+)Mobile/i,Ql=/Mobile(?:.+)Firefox\b/i,Jl=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};});var tu=p(()=>{pn();pn();});var pg,eu,ru=p(()=>{tu();pg=Vr.default??Vr,eu=pg(globalThis.navigator);});var mg,ds,gg,xg,iu,su,_g,yg,bg,mn,nu,au=p(()=>{us();k();ru();Yo();mg=9,ds=100,gg=0,xg=0,iu=2,su=1,_g=-1e3,yg=-1e3,bg=2,mn=class ou{constructor(t,e=eu){this._mobileInfo=e,this.debug=false,this._activateOnTab=true,this._deactivateOnMouseMove=true,this._isActive=false,this._isMobileAccessibility=false,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t;}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let t=document.createElement("button");t.style.width=`${su}px`,t.style.height=`${su}px`,t.style.position="absolute",t.style.top=`${_g}px`,t.style.left=`${yg}px`,t.style.zIndex=bg.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=true,this._activate(),this._destroyTouchHook();}),document.body.appendChild(t),this._hookDiv=t;}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null);}_activate(){if(this._isActive)return;this._isActive=true,this._div||(this._div=document.createElement("div"),this._div.style.width=`${ds}px`,this._div.style.height=`${ds}px`,this._div.style.position="absolute",this._div.style.top=`${gg}px`,this._div.style.left=`${xg}px`,this._div.style.zIndex=iu.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,false)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,true));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else {let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup());});e.observe(document.body,{childList:true,subtree:true});}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered);}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=false,globalThis.document.removeEventListener("mousemove",this._onMouseMove,true),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,false),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=false;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t);}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[];}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let r=0;r<e.length;r++)this._updateAccessibleObjects(e[r]);}init(t){let r={accessibilityOptions:{...ou.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,false)),this._renderer.runners.postrender.remove(this);}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r));}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=false,Zi(this._children,r,1));}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`;}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,h=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*h}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*h}px`,o.style.height=`${n.height*a.d*l}px`;}else {this._capHitArea(n);let a=this._renderer.resolution,h=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*h}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*h}px`;}}this._renderId++;}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`;}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y);}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
|
|
7
7
|
color: transparent;
|
|
8
8
|
pointer-events: none;
|
|
9
9
|
padding: 0;
|
|
@@ -16,9 +16,9 @@ Deprecated since v${i}`),console.warn(r))),jh[t]=true;}var jh,H,Kh,dt=p(()=>{jh=
|
|
|
16
16
|
-webkit-user-select: none;
|
|
17
17
|
-moz-user-select: none;
|
|
18
18
|
-ms-user-select: none;
|
|
19
|
-
`,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${ls}px`,e.style.height=`${ls}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=eu.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=true,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex);}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new pe(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n));}_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!==dg||!this._activateOnTab||this._activate();}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate();}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown);}setAccessibilityEnabled(t){t?this._activate():this._deactivate();}};fn.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"accessibility"};fn.defaultOptions={enabledByDefault:false,debug:false,activateOnTab:true,deactivateOnMouseMove:true};su=fn;});var nu,au=p(()=>{nu={accessible:false,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:false,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:true,_renderId:-1};});var hu=p(()=>{k();zr();ou();au();R.add(su);R.mixin(Nt,nu);});var Wr,lu=p(()=>{k();Wr=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize());},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()));},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null);},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else {let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o;}this.renderer.resize(e,r),this.render();},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null;}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null;}};Wr.extension=S.Application;});var me,us=p(()=>{me=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(me||{});});var qe,uu=p(()=>{qe=class{constructor(t,e=null,r=0,s=false){this.next=null,this.previous=null,this._destroyed=false,this._fn=t,this._context=e,this.priority=r,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));let e=this.next;return this._once&&this.destroy(true),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=false){this._destroyed=true,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};});var cu,ft,Vr=p(()=>{us();uu();cu=class Gt{constructor(){this.autoStart=false,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=false,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=false,this._lastFrame=-1,this._head=new qe(null,null,1/0),this.deltaMS=1/Gt.targetFPMS,this.elapsedMS=1/Gt.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,r=me.NORMAL){return this._addListener(new qe(t,e,r))}addOnce(t,e,r=me.NORMAL){return this._addListener(new qe(t,e,r,true))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else {for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next;}t.previous||t.connect(r);}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.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=true,this._requestIfNeeded());}stop(){this.started&&(this.started=false,this._cancelIfNeeded());}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(true);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){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS;}this.deltaMS=e,this.deltaTime=this.deltaMS*Gt.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded();}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t;}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Gt.targetFPMS);this._maxElapsedMS=1/r;}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else {let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3);}}static get shared(){if(!Gt._shared){let t=Gt._shared=new Gt;t.autoStart=true,t._protected=true;}return Gt._shared}static get system(){if(!Gt._system){let t=Gt._system=new Gt;t.autoStart=true,t._protected=true;}return Gt._system}};cu.targetFPMS=.06;ft=cu;});var Nr,du=p(()=>{k();us();Vr();Nr=class{static init(t){t=Object.assign({autoStart:true,sharedTicker:false},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,me.LOW);},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop();},this.start=()=>{this._ticker.start();},this._ticker=null,this.ticker=t.sharedTicker?ft.shared:new ft,t.autoStart&&this.start();}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy();}}};Nr.extension=S.Application;});var pn=p(()=>{k();lu();du();R.add(Wr);R.add(Nr);});var mn,Kt,gn=p(()=>{us();Vr();mn=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t;}addTickerListener(){this._tickerAdded||!this.domElement||(ft.system.add(this._tickerUpdate,this,me.INTERACTION),this._tickerAdded=true);}removeTickerListener(){this._tickerAdded&&(ft.system.remove(this._tickerUpdate,this),this._tickerAdded=false);}pointerMoved(){this._didMove=true;}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=false;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}));}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update());}},Kt=new mn;});var he,cs=p(()=>{Wt();as();he=class extends pe{constructor(){super(...arguments),this.client=new N,this.movement=new N,this.offset=new N,this.global=new N,this.screen=new N;}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return "getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,h,l,u,c,f,d,m,x){throw new Error("Method not implemented.")}};});var Pt,xn=p(()=>{cs();Pt=class extends he{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=false;}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}};});var qt,_n=p(()=>{cs();qt=class extends he{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2;}};qt.DOM_DELTA_PIXEL=0;qt.DOM_DELTA_LINE=1;qt.DOM_DELTA_PAGE=2;});var _g,yg,$r,ds,fu=p(()=>{Bt();Wt();bt();gn();cs();xn();_n();_g=2048,yg=new N,$r=new N,ds=class{constructor(t){this.dispatch=new X,this.moveOnAll=false,this.enableGlobalMoveEvents=true,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=false,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel);}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority);}dispatchEvent(t,e){t.propagationStopped=false,t.propagationImmediatelyStopped=false,this.propagate(t,e),this.dispatch.emit(e||t.type,t);}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else O(`[EventBoundary]: Event mapping not defined for ${t.type}`);}hitTest(t,e){Kt.pauseUpdate=true;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,yg.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[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=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n);});}propagationPath(t){let e=[t];for(let r=0;r<_g&&t!==this.rootTarget&&t.parent;r++){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,r,s,o,n=false){let a=false;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Kt.pauseUpdate=false),t.interactiveChildren&&t.children){let u=t.children;for(let c=u.length-1;c>=0;c--){let f=u[c],d=this.hitTestMoveRecursive(f,this._isInteractive(e)?e:f.eventMode,r,s,o,n||o(t,r));if(d){if(d.length>0&&!d[d.length-1].parent)continue;let m=t.isInteractive();(d.length>0||m)&&(m&&this._allInteractiveElements.push(t),d.push(t)),this._hitElements.length===0&&(this._hitElements=d),a=true;}}}let h=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:h&&!o(t,r)&&s(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Kt.pauseUpdate=false),t.interactiveChildren&&t.children){let h=t.children,l=r;for(let u=h.length-1;u>=0;u--){let c=h[u],f=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,l,s,o);if(f){if(f.length>0&&!f[f.length-1].parent)continue;let d=t.isInteractive();return (f.length>0||d)&&f.push(t),f}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return !t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,$r),!t.hitArea.contains($r.x,$r.y)))return true;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return true}return false}hitTestFn(t,e){return t.hitArea?true:t?.containsPoint?(t.worldTransform.applyInverse(e,$r),t.containsPoint($r)):false}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let 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 Pt)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown");}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e);}mapPointerMove(t){if(!(t instanceof Pt)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=true;let e=this.createPointerEvent(t);this._isPointerMoveEvent=false;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let h=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,h,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(o)){let u=this.createPointerEvent(t,"pointerleave",o);for(u.eventPhase=u.AT_TARGET;u.target&&!e.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),r&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u);}this.freeEvent(l);}if(o!==e.target){let h=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,h);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let u=o?.parent;for(;u&&u!==this.rootTarget.parent&&u!==e.target;)u=u.parent;if(!u||u===this.rootTarget.parent){let f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==o&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),r&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f);}this.freeEvent(l);}let n=[],a=this.enableGlobalMoveEvents??true;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e);}mapPointerOver(t){if(!(t instanceof Pt)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o);}mapPointerOut(t){if(!(t instanceof Pt)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n);}this.cursor=null;}mapPointerUp(t){if(!(t instanceof Pt)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup");}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let h=r.button===2;this.notifyTarget(r,h?"rightupoutside":"mouseupoutside");}a=a.parent;}delete s.pressTargetsByButton[t.button],n=a;}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click");}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a);}this.freeEvent(r);}mapPointerUpOutside(t){if(!(t instanceof Pt)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,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"),o=o.parent;delete e.pressTargetsByButton[t.button];}this.freeEvent(s);}mapWheel(t){if(!(t instanceof qt)){O("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e);}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Pt);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(qt);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Pt);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;}copyPointerData(t,e){t instanceof Pt&&e instanceof Pt&&(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 he&&e instanceof he&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global));}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page);}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=false,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t);}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,true),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,true),r[s].fn.call(r[s].context,t);}};});var bg,vg,bn,fs,vn=p(()=>{k();fu();gn();xn();_n();bg=1,vg={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},bn=class yn{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new ds(null),Kt.init(this),this.autoPreventDefault=true,this._eventsAdded=false,this._rootPointerEvent=new Pt(null),this._rootWheelEvent=new qt(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...yn.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,true)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this);}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,yn._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove;}resolutionChange(t){this.resolution=t;}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null;}setCursor(t){t||(t="default");let e=true;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=false),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case "string":e&&(this.domElement.style.cursor=r);break;case "function":r(t);break;case "object":e&&Object.assign(this.domElement.style,r);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;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n);}this.setCursor(this.rootBoundary.cursor);}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Kt.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o);}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]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a);}this.setCursor(this.rootBoundary.cursor);}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o);}this.setCursor(this.rootBoundary.cursor);}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e);}setTargetElement(t){this._removeEvents(),this.domElement=t,Kt.domElement=t,this._addEvents();}_addEvents(){if(this._eventsAdded||!this.domElement)return;Kt.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,true),this.domElement.addEventListener("pointerdown",this._onPointerDown,true),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,true),this.domElement.addEventListener("pointerover",this._onPointerOverOut,true),globalThis.addEventListener("pointerup",this._onPointerUp,true)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,true),this.domElement.addEventListener("mousedown",this._onPointerDown,true),this.domElement.addEventListener("mouseout",this._onPointerOverOut,true),this.domElement.addEventListener("mouseover",this._onPointerOverOut,true),globalThis.addEventListener("mouseup",this._onPointerUp,true),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,true),this.domElement.addEventListener("touchend",this._onPointerUp,true),this.domElement.addEventListener("touchmove",this._onPointerMove,true))),this.domElement.addEventListener("wheel",this.onWheel,{passive:true,capture:true}),this._eventsAdded=true;}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Kt.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,true),this.domElement.removeEventListener("pointerdown",this._onPointerDown,true),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,true),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,true),globalThis.removeEventListener("pointerup",this._onPointerUp,true)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,true),this.domElement.removeEventListener("mousedown",this._onPointerDown,true),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,true),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,true),globalThis.removeEventListener("mouseup",this._onPointerUp,true),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,true),this.domElement.removeEventListener("touchend",this._onPointerUp,true),this.domElement.removeEventListener("touchmove",this._onPointerMove,true))),this.domElement.removeEventListener("wheel",this.onWheel,true),this.domElement=null,this._eventsAdded=false;}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o;}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=true,o.type=t.type,e.push(o);}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=true),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=bg),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=true,e.push(r);}else e.push(t);return e}normalizeWheelEvent(t){let 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=vg[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;}};bn.extension={name:"events",type:[S.WebGLSystem,S.CanvasSystem,S.WebGPUSystem],priority:-1};bn.defaultEventFeatures={move:true,globalMove:true,click:true,wheel:true};fs=bn;});var pu,mu=p(()=>{vn();as();pu={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive";},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??fs.defaultEventMode},set eventMode(i){this._internalEventMode=i;},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:true,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===true:false,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(i,a,n);}),o?h.once(i,a,n):h.on(i,a,n);},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s);},dispatchEvent(i){if(!(i instanceof pe))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=false,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};});var gu=p(()=>{k();zr();vn();mu();R.add(fs);R.mixin(Nt,pu);});var Yr,xu=p(()=>{k();Yr=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000";}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound));}updateRenderable(t){}validateRenderable(t){return true}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound);}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else {this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,h=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${h}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-h}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString();}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove();}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null;}};Yr.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"dom"};});var Ze,Sn=p(()=>{Vt();zr();Ze=class extends Nt{constructor(t){super(t),this.canBundle=true,this.allowChildren=false,this._roundPixels=0,this._lastUsed=-1,this._bounds=new st(0,1,0,0),this._boundsDirty=true;}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=false,this._bounds):this._bounds}get roundPixels(){return !!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0;}containsPoint(t){let e=this.bounds,{x:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=true,this.didViewUpdate)return;this.didViewUpdate=true;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this);}destroy(t){super.destroy(t),this._bounds=null;}collectRenderablesSimple(t,e,r){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=false;let a=this.children,h=a.length;for(let l=0;l<h;l++)a[l].collectRenderables(t,e,r);}};});var _u=p(()=>{k();xu();R.add(Yr);});var Qe,Tn=p(()=>{Qe=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Qe||{});});var yu,bu=p(()=>{yu={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};});var vu,ot,$t=p(()=>{bu();vu=yu,ot={get(){return vu},set(i){vu=i;}};});function Yt(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Xr(i){return i.split("?")[0].split("#")[0]}function Sg(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Tg(i,t,e){return i.replace(new RegExp(Sg(t),"g"),e)}function wg(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else {if(n===47)break;n=47;}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",r=0):(e=e.slice(0,h),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0;}else n===46&&o!==-1?++o:o=-1;}return e}var At,ps=p(()=>{$t();At={toPosix(i){return Tg(i,"\\","/")},isUrl(i){return /^https?:/.test(this.toPosix(i))},isDataUrl(i){return /^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return /^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){Yt(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(Yt(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=Xr(this.toPosix(t??ot.get().getBaseUrl())),s=Xr(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?At.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(Yt(i),i.length===0)return ".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=wg(i),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return Yt(i),i=this.toPosix(i),this.hasProtocol(i)?true:i.startsWith("/")},join(...i){if(i.length===0)return ".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(Yt(r),r.length>0)if(t===void 0)t=r;else {let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`;}}return t===void 0?".":this.normalize(t)},dirname(i){if(Yt(i),i.length===0)return ".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=true,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=false;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){Yt(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/");}return t},basename(i,t){Yt(i),t&&Yt(t),i=Xr(this.toPosix(i));let e=0,r=-1,s=true,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return "";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let h=i.charCodeAt(o);if(h===47){if(!s){e=o+1;break}}else a===-1&&(s=false,a=o+1),n>=0&&(h===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a));}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=false,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){Yt(i),i=Xr(this.toPosix(i));let t=-1,e=0,r=-1,s=true,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=false,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1);}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){Yt(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Xr(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s;t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,h=-1,l=true,u=i.length-1,c=0;for(;u>=s;--u){if(e=i.charCodeAt(u),e===47){if(!l){a=u+1;break}continue}h===-1&&(l=false,h=u+1),e===46?n===-1?n=u:c!==1&&(c=1):n!==-1&&(c=-1);}return n===-1||h===-1||c===0||c===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&r?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),t},sep:"/",delimiter:":",joinExtensions:[".html"]};});var ge,wn=p(()=>{ge=(i,t,e=false)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i);});function Su(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?Su(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a));}}function Tu(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n);}),Su(i,s,0,e,r);}else r.push(i);return r}var wu=p(()=>{});var Pn,Pu=p(()=>{Pn=i=>!Array.isArray(i);});function Pg(i){return i.split(".").pop().split("?").shift().split("#").shift()}var jr,Mu=p(()=>{bt();ps();wn();wu();Pu();jr=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={};}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params));}),this._resolverHash={};}set basePath(t){this._basePath=t;}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t;}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null;}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else {let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&");}}getAlias(t){let{alias:e,src:r}=t;return ge(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,true)}addManifest(t){this._manifest&&O("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets);});}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,h;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),h=[a,l];}else {let l=a.map(u=>this._createBundleAssetId(t,u));r.push(...l),h=[...a,...l];}this.add({...o,alias:h,src:n});}),this._bundles[t]=r;}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&O(`[Resolver] already has key: ${o} overwriting`);},ge(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l}=o,u=ge(n).map(d=>typeof d=="string"?Tu(d):Array.isArray(d)?d:[d]),c=this.getAlias(o);Array.isArray(c)?c.forEach(r):r(c);let f=[];u.forEach(d=>{d.forEach(m=>{let x={};if(typeof m!="object"){x.src=m;for(let g=0;g<this._parsers.length;g++){let _=this._parsers[g];if(_.test(m)){x=_.parse(m);break}}}else a=m.data??a,h=m.format??h,l=m.loadParser??l,x={...x,...m};if(!c)throw new Error(`[Resolver] alias is undefined for this asset: ${x.src}`);x=this._buildResolvedAsset(x,{aliases:c,data:a,format:h,loadParser:l}),f.push(x);});}),c.forEach(d=>{this._assetMap[d]=f;});});}resolveBundle(t){let e=Pn(t);t=ge(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let h in n){let l=n[h];a[this._extractAssetIdFromBundle(s,h)]=l;}r[s]=a;}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=Pn(t);t=ge(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(h=>{let l=o.filter(u=>u[a]?u[a]===h:false);l.length&&(o=l);});}),this._resolverHash[s]=o[0];}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s];}),e?r[t[0]]:r}hasKey(t){return !!this._assetMap[t]}hasBundle(t){return !!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return `${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return (this._basePath||this._rootPath)&&(t.src=At.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??Pg(t.src),t}};jr.RETINA_PREFIX=/@([0-9\.]+)x/;});var Mn,Cu=p(()=>{Mn=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i};});var Au,Cn,Eu=p(()=>{kt();xt();Au=class Kr{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof F?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null;}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Kr.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch();})}_processFrames(t){let e=t,r=Kr.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,h=null,l=o.trimmed!==false&&o.sourceSize?o.sourceSize:o.frame,u=new q(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new q(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new q(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==false&&o.spriteSourceSize&&(h=new q(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new F({source:this.textureSource,frame:a,orig:u,trim:h,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()});}e++;}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s]);}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures);}_nextBatch(){this._processFrames(this._batchIndex*Kr.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Kr.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete());},0);}destroy(t=false){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[];}};Au.BATCH_SIZE=1e3;Cn=Au;});function Bu(i,t,e){let r={};if(i.forEach(s=>{r[s]=t;}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s];}),!e){let s=At.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Bu([`${s}/${t.data.meta.related_multi_packs[n]}`],o,true);Object.assign(r,a);});}return r}var Mg,ku,Fu=p(()=>{Tn();Mu();Cu();k();xt();ps();Eu();Mg=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];ku={extension:S.Asset,cache:{test:i=>i instanceof Cn,getCacheableAssets:(i,t)=>Bu(i,t,false)},resolver:{extension:{type:S.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&Mg.includes(s)},parse:i=>{let t=i.split(".");return {resolution:parseFloat(jr.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:S.LoadParser,priority:Qe.Normal,name:"spritesheetLoader"},async testParse(i,t){return At.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=At.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof F)a=r;else {let u=Mn(n+(s??i.meta.image),t.src);a=(await e.load([{src:u,data:o}]))[u];}let h=new Cn(a.source,i);await h.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let u=[];for(let f of l){if(typeof f!="string")continue;let d=n+f;t.data?.ignoreMultiPack||(d=Mn(d,t.src),u.push(e.load({src:d,data:{textureOptions:o,ignoreMultiPack:true}})));}let c=await Promise.all(u);h.linkedSheets=c,c.forEach(f=>{f.linkedSheets=[h].concat(h.linkedSheets.filter(d=>d!==f));});}return h},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(false);}}};});var ms=p(()=>{k();Fu();R.add(ku);});function gs(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a;}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s;}var An=p(()=>{});var qr,Gu=p(()=>{zo();xt();An();dt();Sn();qr=class i extends Ze{constructor(t=F.EMPTY){t instanceof F&&(t={texture:t});let{texture:e=F.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=true,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Tt({_onUpdate:()=>{this.onViewUpdate();}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=false,this.roundPixels=s??false,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n);}static from(t,e=false){return t instanceof F?new i(t):new i(F.from(t,e))}set texture(t){t||(t=F.EMPTY);let e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate());}get texture(){return this._texture}get visualBounds(){return gs(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return I("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o;}destroy(t=false){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r);}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null;}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t);}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t;}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t;}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height);}};});function xs(i,t,e){let r=Cg;i.measurable=true,Zi(i,e,r),t.addBoundsMask(r),i.measurable=false;}var Cg,En=p(()=>{Vt();Ji();Cg=new st;});function _s(i,t,e){let r=Ft.get();i.measurable=true;let s=ht.get().identity(),o=Ru(i,e,s);es(i,r,o),i.measurable=false,t.addBoundsMask(r),ht.return(s),Ft.return(r);}function Ru(i,t,e){return i?(i!==t&&(Ru(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(O("Mask bounds, renderable is not inside the root container"),e)}var Bn=p(()=>{Ko();Ae();bt();});var Zr,Iu=p(()=>{k();Gu();En();Bn();Zr=class{constructor(t){this.priority=0,this.inverse=false,this.pipe="alphaMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof qr),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=false;}reset(){this.mask.measurable=true,this.mask=null;}addBounds(t,e){this.inverse||xs(this.mask,t,e);}addLocalBounds(t,e){_s(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof qr}};Zr.extension=S.MaskEffect;});var Qr,Uu=p(()=>{k();Qr=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t;}destroy(){}static test(t){return typeof t=="number"}};Qr.extension=S.MaskEffect;});var Jr,Du=p(()=>{k();zr();En();Bn();Jr=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t,this.mask.includeInBuild=false,this.mask.measurable=false;}reset(){this.mask.measurable=true,this.mask.includeInBuild=true,this.mask=null;}addBounds(t,e){xs(this.mask,t,e);}addLocalBounds(t,e){_s(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof Nt}};Jr.extension=S.MaskEffect;});var Je,Lu=p(()=>{$t();k();fe();Je=class extends gt{constructor(t){t.resource||(t.resource=ot.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent;}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight);}resize(t=this.width,e=this.height,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Je.extension=S.TextureSource;});var Zt,ys=p(()=>{$t();k();bt();fe();Zt=class extends gt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=ot.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,O("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.");}super(t),this.uploadMethodId="image",this.autoGarbageCollect=true;}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Zt.extension=S.TextureSource;});async function Ou(){return kn??(kn=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return "premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=false,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load();});if(!e)return "premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,false),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),kn}var kn,zu=p(()=>{});var bs,Wu,Vu=p(()=>{k();Vr();zu();fe();bs=class Hu extends gt{constructor(t){super(t),this.isReady=false,this.uploadMethodId="video",t={...Hu.defaultOptions,...t},this._autoUpdate=true,this._isConnectedToTicker=false,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==false,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==false&&this.load();}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=ft.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t);}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update();}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback);}get isValid(){return !!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return (t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=true),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,true)),this.alphaMode=await Ou(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`));})),t.load());}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,true),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null);}_isSourcePlaying(){let t=this.resource;return !t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate();}_onPlayStop(){this._configureAutoUpdate();}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0);}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady();}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady();}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=true,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play();}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,true),t.pause(),t.src="",t.load()),super.destroy();}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate());}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate());}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(ft.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ft.shared.add(this.updateFrame,this),this._isConnectedToTicker=true,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ft.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0));}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};bs.extension=S.TextureSource;bs.defaultOptions={...gt.defaultOptions,autoLoad:true,autoPlay:true,updateFPS:0,crossorigin:true,loop:false,muted:true,playsinline:true,preload:false};bs.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Wu=bs;});var Fn,lt,ti=p(()=>{bt();wn();Fn=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map;}reset(){this._cacheMap.clear(),this._cache.clear();}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||O(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=ge(t),s;for(let h=0;h<this.parsers.length;h++){let l=this.parsers[h];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(h=>{o.set(h,e);});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(h=>{this._cacheMap.set(h,a);}),n.forEach(h=>{let l=s?s[h]:e;this._cache.has(h)&&this._cache.get(h)!==l&&O("[Cache] already has key:",h),this._cache.set(h,o.get(h));});}remove(t){if(!this._cacheMap.has(t)){O(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s);}),e.keys.forEach(s=>{this._cacheMap.delete(s);});}get parsers(){return this._parsers}},lt=new Fn;});function Nu(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Gn.length;s++){let o=Gn[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function $u(i={},t=false){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&<.has(r))return lt.get(r);let o=new F({source:Nu(s)});return o.on("destroy",()=>{lt.has(r)&<.remove(r);}),t||lt.set(r,o),o}function Yu(i,t=false){return typeof i=="string"?lt.get(i):i instanceof gt?new F({source:i}):$u(i,t)}var Gn,Rn=p(()=>{ti();k();fe();xt();Gn=[];R.handleByList(S.TextureSource,Gn);F.from=Yu;gt.from=Nu;});var vs=p(()=>{k();Iu();Uu();Du();sn();Lu();ys();Vu();Rn();R.add(Zr,Qr,Jr,Wu,Zt,Je,Ge);});var Ot,ei=p(()=>{Ot=class{constructor(t){this.resources=Object.create(null),this._dirty=true;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++);}this._updateKey();}_updateKey(){if(!this._dirty)return;this._dirty=false;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|");}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=true);}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t;}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null;}onResourceChange(t){if(this._dirty=true,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null);}else this._updateKey();}};});function Ts(){return (!Ss||Ss?.isContextLost())&&(Ss=ot.get().createCanvas().getContext("webgl",{})),Ss}var Ss,In=p(()=>{$t();});function Eg(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
20
|
-
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function
|
|
21
|
-
`);});function er(){if(tr)return tr;let i=Ts();return tr=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),tr=Xu(tr,i),i.getExtension("WEBGL_lose_context")?.loseContext(),tr}var tr,ws=p(()=>{In();ju();tr=null;});function qu(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return Ku[e]||Bg(i,t,e)}function Bg(i,t,e){let r={},s=0;Un||(Un=er());for(let n=0;n<Un;n++){let a=n<t?i[n]:F.EMPTY.source;r[s++]=a.source,r[s++]=a.style;}let o=new Ot(r);return Ku[e]=o,o}var Ku,Un,Zu=p(()=>{ei();xt();ws();Ku={};Un=0;});var Qt,Dn=p(()=>{Qt=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength;}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null;}static sizeOf(t){switch(t){case "int8":case "uint8":return 1;case "int16":case "uint16":return 2;case "int32":case "uint32":case "float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};});function Ln(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n);}}var Qu=p(()=>{});var Ju,tc=p(()=>{Ju={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};});function le(i,t){return t.alphaMode==="no-premultiply-alpha"&&Ju[i]||i}var ri=p(()=>{tc();});var Ps,ec=p(()=>{Ps=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0;}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null;}this.count=0;}};});function rc(){return zn>0?sc[--zn]:new On}function ic(i){sc[zn++]=i;}var On,sc,zn,ii,oc,nc,ac=p(()=>{wt();Dn();Qu();ri();ws();ec();On=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ps,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=true;}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null;}},sc=[],zn=0;ii=0,oc=class Ms{constructor(t={}){this.uid=$("batcher"),this.dirty=true,this.batchIndex=0,this.batches=[],this._elements=[],Ms.defaultOptions.maxTextures=Ms.defaultOptions.maxTextures??er(),t={...Ms.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Qt(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e;}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)ic(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=true;}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize;}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return !r&&r!==0?false:(t._textureId=r,t.texture=e,true)}updateElement(t){this.dirty=true;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId);}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=rc(),s=r.textures;s.clear();let o=e[this.elementStart],n=le(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,u=this.indexBuffer,c=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",m=this.maxTextures;for(let x=this.elementStart;x<this.elementSize;++x){let g=e[x];e[x]=null;let y=g.texture._source,b=le(g.blendMode,y),v=n!==b||a!==g.topology;if(y._batchTick===ii&&!v){g._textureId=y._textureBindLocation,c+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(u,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,u,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=r;continue}y._batchTick=ii,(s.count>=m||v)&&(this._finishBatch(r,f,c-f,s,n,a,t,d),d="renderBatch",f=c,n=b,a=g.topology,r=rc(),s=r.textures,s.clear(),++ii),g._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,g._batch=r,c+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(u,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,u,g._indexStart,g._attributeStart/this.vertexSize));}s.count>0&&(this._finishBatch(r,f,c-f,s,n,a,t,d),f=c,++ii),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=c;}_finishBatch(t,e,r,s,o,n,a,h){t.gpuBindGroup=null,t.bindGroup=null,t.action=h,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++ii,this.batches[this.batchIndex++]=t,a.add(t);}finish(t){this.break(t);}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4);}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t);}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Qt(e);Ln(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r;}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else Ln(e.buffer,s.buffer);this.indexBuffer=s;}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3;}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-h;}destroy(){for(let t=0;t<this.batches.length;t++)ic(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null;}};oc.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};nc=oc;});var Q,rr=p(()=>{Q=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(Q||{});});var _t,ir=p(()=>{Bt();wt();rr();_t=class extends X{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=$("buffer"),this._resourceType="buffer",this._resourceId=$("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=true,this.destroyed=false,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??true;}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,true);}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return !!(this.descriptor.usage&Q.STATIC)}set static(t){t?this.descriptor.usage|=Q.STATIC:this.descriptor.usage&=~Q.STATIC;}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=$("resource"),this.emit("change",this));return}r&&this.emit("update",this);}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this);}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners();}};});function Hn(i,t){if(!(i instanceof _t)){let e=t?Q.INDEX:Q.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=Q.INDEX|Q.COPY_DST):(i=new Float32Array(i),e=Q.VERTEX|Q.COPY_DST)),i=new _t({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e});}return i}var hc=p(()=>{ir();rr();});function lc(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,h=-1/0,l=s.BYTES_PER_ELEMENT,u=(r.offset||0)/l,c=(r.stride||2*4)/l;for(let f=u;f<s.length;f+=c){let d=s[f],m=s[f+1];d>a&&(a=d),m>h&&(h=m),d<o&&(o=d),m<n&&(n=m);}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=h,e}var uc=p(()=>{});function kg(i){return (i instanceof _t||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Hn(i.buffer,false),i}var Jt,si=p(()=>{Bt();Vt();wt();ir();hc();uc();Jt=class extends X{constructor(t={}){super(),this.uid=$("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new st,this._boundsDirty=true;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list";}onBufferUpdate(){this._boundsDirty=true,this.emit("update",this);}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=kg(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r;}addIndex(t){this.indexBuffer=Hn(t,true),this.buffers.push(this.indexBuffer);}get bounds(){return this._boundsDirty?(this._boundsDirty=false,lc(this,"aPosition",this._bounds)):this._bounds}destroy(t=false){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null;}};});var Fg,Gg,Cs,cc=p(()=>{ir();rr();si();Fg=new Float32Array(1),Gg=new Uint32Array(1),Cs=class extends Jt{constructor(){let e=new _t({data:Fg,label:"attribute-batch-buffer",usage:Q.VERTEX|Q.COPY_DST,shrinkToFit:false}),r=new _t({data:Gg,label:"index-batch-buffer",usage:Q.INDEX|Q.COPY_DST,shrinkToFit:false}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r});}};});function sr(i,t){let e=dc[i];return e===void 0&&(Wn[t]===void 0&&(Wn[t]=1),dc[i]=e=Wn[t]++),e}var Wn,dc,As=p(()=>{Wn=Object.create(null),dc=Object.create(null);});function fc(){if(!Es){Es="mediump";let i=Ts();i&&i.getShaderPrecisionFormat&&(Es=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump");}return Es}var Es,pc=p(()=>{In();});function mc(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
|
|
19
|
+
`,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${ds}px`,e.style.height=`${ds}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=iu.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=true,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex);}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new ge(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n));}_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!==mg||!this._activateOnTab||this._activate();}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate();}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown);}setAccessibilityEnabled(t){t?this._activate():this._deactivate();}};mn.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"accessibility"};mn.defaultOptions={enabledByDefault:false,debug:false,activateOnTab:true,deactivateOnMouseMove:true};nu=mn;});var hu,lu=p(()=>{hu={accessible:false,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:false,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:true,_renderId:-1};});var uu=p(()=>{k();Wr();au();lu();G.add(nu);G.mixin(Yt,hu);});var Nr,cu=p(()=>{k();Nr=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize());},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()));},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null);},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else {let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o;}this.renderer.resize(e,r),this.render();},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null;}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null;}};Nr.extension=S.Application;});var xe,fs=p(()=>{xe=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(xe||{});});var Qe,du=p(()=>{Qe=class{constructor(t,e=null,r=0,s=false){this.next=null,this.previous=null,this._destroyed=false,this._fn=t,this._context=e,this.priority=r,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));let e=this.next;return this._once&&this.destroy(true),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=false){this._destroyed=true,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};});var fu,mt,$r=p(()=>{fs();du();fu=class It{constructor(){this.autoStart=false,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=false,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=false,this._lastFrame=-1,this._head=new Qe(null,null,1/0),this.deltaMS=1/It.targetFPMS,this.elapsedMS=1/It.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,r=xe.NORMAL){return this._addListener(new Qe(t,e,r))}addOnce(t,e,r=xe.NORMAL){return this._addListener(new Qe(t,e,r,true))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else {for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next;}t.previous||t.connect(r);}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.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=true,this._requestIfNeeded());}stop(){this.started&&(this.started=false,this._cancelIfNeeded());}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(true);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){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS;}this.deltaMS=e,this.deltaTime=this.deltaMS*It.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded();}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t;}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,It.targetFPMS);this._maxElapsedMS=1/r;}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else {let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3);}}static get shared(){if(!It._shared){let t=It._shared=new It;t.autoStart=true,t._protected=true;}return It._shared}static get system(){if(!It._system){let t=It._system=new It;t.autoStart=true,t._protected=true;}return It._system}};fu.targetFPMS=.06;mt=fu;});var Yr,pu=p(()=>{k();fs();$r();Yr=class{static init(t){t=Object.assign({autoStart:true,sharedTicker:false},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,xe.LOW);},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop();},this.start=()=>{this._ticker.start();},this._ticker=null,this.ticker=t.sharedTicker?mt.shared:new mt,t.autoStart&&this.start();}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy();}}};Yr.extension=S.Application;});var gn=p(()=>{k();cu();pu();G.add(Nr);G.add(Yr);});var xn,Zt,_n=p(()=>{fs();$r();xn=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t;}addTickerListener(){this._tickerAdded||!this.domElement||(mt.system.add(this._tickerUpdate,this,xe.INTERACTION),this._tickerAdded=true);}removeTickerListener(){this._tickerAdded&&(mt.system.remove(this._tickerUpdate,this),this._tickerAdded=false);}pointerMoved(){this._didMove=true;}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=false;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}));}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update());}},Zt=new xn;});var ue,ps=p(()=>{Nt();us();ue=class extends ge{constructor(){super(...arguments),this.client=new $,this.movement=new $,this.offset=new $,this.global=new $,this.screen=new $;}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return "getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,h,l,u,c,f,d,m,x){throw new Error("Method not implemented.")}};});var Ct,yn=p(()=>{ps();Ct=class extends ue{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=false;}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}};});var Qt,bn=p(()=>{ps();Qt=class extends ue{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2;}};Qt.DOM_DELTA_PIXEL=0;Qt.DOM_DELTA_LINE=1;Qt.DOM_DELTA_PAGE=2;});var vg,Sg,Xr,ms,mu=p(()=>{Ft();Nt();St();_n();ps();yn();bn();vg=2048,Sg=new $,Xr=new $,ms=class{constructor(t){this.dispatch=new j,this.moveOnAll=false,this.enableGlobalMoveEvents=true,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=false,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel);}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority);}dispatchEvent(t,e){t.propagationStopped=false,t.propagationImmediatelyStopped=false,this.propagate(t,e),this.dispatch.emit(e||t.type,t);}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else z(`[EventBoundary]: Event mapping not defined for ${t.type}`);}hitTest(t,e){Zt.pauseUpdate=true;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,Sg.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[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=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n);});}propagationPath(t){let e=[t];for(let r=0;r<vg&&t!==this.rootTarget&&t.parent;r++){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,r,s,o,n=false){let a=false;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Zt.pauseUpdate=false),t.interactiveChildren&&t.children){let u=t.children;for(let c=u.length-1;c>=0;c--){let f=u[c],d=this.hitTestMoveRecursive(f,this._isInteractive(e)?e:f.eventMode,r,s,o,n||o(t,r));if(d){if(d.length>0&&!d[d.length-1].parent)continue;let m=t.isInteractive();(d.length>0||m)&&(m&&this._allInteractiveElements.push(t),d.push(t)),this._hitElements.length===0&&(this._hitElements=d),a=true;}}}let h=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:h&&!o(t,r)&&s(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Zt.pauseUpdate=false),t.interactiveChildren&&t.children){let h=t.children,l=r;for(let u=h.length-1;u>=0;u--){let c=h[u],f=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,l,s,o);if(f){if(f.length>0&&!f[f.length-1].parent)continue;let d=t.isInteractive();return (f.length>0||d)&&f.push(t),f}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return !t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,Xr),!t.hitArea.contains(Xr.x,Xr.y)))return true;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return true}return false}hitTestFn(t,e){return t.hitArea?true:t?.containsPoint?(t.worldTransform.applyInverse(e,Xr),t.containsPoint(Xr)):false}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let 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 Ct)){z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown");}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e);}mapPointerMove(t){if(!(t instanceof Ct)){z("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=true;let e=this.createPointerEvent(t);this._isPointerMoveEvent=false;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let h=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,h,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(o)){let u=this.createPointerEvent(t,"pointerleave",o);for(u.eventPhase=u.AT_TARGET;u.target&&!e.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),r&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u);}this.freeEvent(l);}if(o!==e.target){let h=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,h);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let u=o?.parent;for(;u&&u!==this.rootTarget.parent&&u!==e.target;)u=u.parent;if(!u||u===this.rootTarget.parent){let f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==o&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),r&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f);}this.freeEvent(l);}let n=[],a=this.enableGlobalMoveEvents??true;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e);}mapPointerOver(t){if(!(t instanceof Ct)){z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o);}mapPointerOut(t){if(!(t instanceof Ct)){z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n);}this.cursor=null;}mapPointerUp(t){if(!(t instanceof Ct)){z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup");}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let h=r.button===2;this.notifyTarget(r,h?"rightupoutside":"mouseupoutside");}a=a.parent;}delete s.pressTargetsByButton[t.button],n=a;}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click");}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a);}this.freeEvent(r);}mapPointerUpOutside(t){if(!(t instanceof Ct)){z("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,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"),o=o.parent;delete e.pressTargetsByButton[t.button];}this.freeEvent(s);}mapWheel(t){if(!(t instanceof Qt)){z("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e);}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Ct);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Qt);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Ct);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;}copyPointerData(t,e){t instanceof Ct&&e instanceof Ct&&(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 ue&&e instanceof ue&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global));}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page);}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=false,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t);}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,true),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,true),r[s].fn.call(r[s].context,t);}};});var Tg,wg,Sn,gs,Tn=p(()=>{k();mu();_n();yn();bn();Tg=1,wg={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Sn=class vn{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new ms(null),Zt.init(this),this.autoPreventDefault=true,this._eventsAdded=false,this._rootPointerEvent=new Ct(null),this._rootWheelEvent=new Qt(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...vn.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,true)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this);}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,vn._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove;}resolutionChange(t){this.resolution=t;}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null;}setCursor(t){t||(t="default");let e=true;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=false),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case "string":e&&(this.domElement.style.cursor=r);break;case "function":r(t);break;case "object":e&&Object.assign(this.domElement.style,r);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;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n);}this.setCursor(this.rootBoundary.cursor);}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Zt.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o);}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]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a);}this.setCursor(this.rootBoundary.cursor);}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o);}this.setCursor(this.rootBoundary.cursor);}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e);}setTargetElement(t){this._removeEvents(),this.domElement=t,Zt.domElement=t,this._addEvents();}_addEvents(){if(this._eventsAdded||!this.domElement)return;Zt.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,true),this.domElement.addEventListener("pointerdown",this._onPointerDown,true),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,true),this.domElement.addEventListener("pointerover",this._onPointerOverOut,true),globalThis.addEventListener("pointerup",this._onPointerUp,true)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,true),this.domElement.addEventListener("mousedown",this._onPointerDown,true),this.domElement.addEventListener("mouseout",this._onPointerOverOut,true),this.domElement.addEventListener("mouseover",this._onPointerOverOut,true),globalThis.addEventListener("mouseup",this._onPointerUp,true),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,true),this.domElement.addEventListener("touchend",this._onPointerUp,true),this.domElement.addEventListener("touchmove",this._onPointerMove,true))),this.domElement.addEventListener("wheel",this.onWheel,{passive:true,capture:true}),this._eventsAdded=true;}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Zt.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,true),this.domElement.removeEventListener("pointerdown",this._onPointerDown,true),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,true),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,true),globalThis.removeEventListener("pointerup",this._onPointerUp,true)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,true),this.domElement.removeEventListener("mousedown",this._onPointerDown,true),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,true),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,true),globalThis.removeEventListener("mouseup",this._onPointerUp,true),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,true),this.domElement.removeEventListener("touchend",this._onPointerUp,true),this.domElement.removeEventListener("touchmove",this._onPointerMove,true))),this.domElement.removeEventListener("wheel",this.onWheel,true),this.domElement=null,this._eventsAdded=false;}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o;}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=true,o.type=t.type,e.push(o);}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=true),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=Tg),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=true,e.push(r);}else e.push(t);return e}normalizeWheelEvent(t){let 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=wg[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;}};Sn.extension={name:"events",type:[S.WebGLSystem,S.CanvasSystem,S.WebGPUSystem],priority:-1};Sn.defaultEventFeatures={move:true,globalMove:true,click:true,wheel:true};gs=Sn;});var gu,xu=p(()=>{Tn();us();gu={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive";},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??gs.defaultEventMode},set eventMode(i){this._internalEventMode=i;},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:true,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===true:false,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(i,a,n);}),o?h.once(i,a,n):h.on(i,a,n);},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s);},dispatchEvent(i){if(!(i instanceof ge))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=false,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};});var _u=p(()=>{k();Wr();Tn();xu();G.add(gs);G.mixin(Yt,gu);});var jr,yu=p(()=>{k();jr=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000";}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound));}updateRenderable(t){}validateRenderable(t){return true}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound);}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else {this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,h=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${h}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-h}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString();}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove();}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null;}};jr.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"dom"};});var Je,wn=p(()=>{$t();Wr();Je=class extends Yt{constructor(t){super(t),this.canBundle=true,this.allowChildren=false,this._roundPixels=0,this._lastUsed=-1,this._bounds=new nt(0,1,0,0),this._boundsDirty=true;}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=false,this._bounds):this._bounds}get roundPixels(){return !!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0;}containsPoint(t){let e=this.bounds,{x:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=true,this.didViewUpdate)return;this.didViewUpdate=true;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this);}destroy(t){super.destroy(t),this._bounds=null;}collectRenderablesSimple(t,e,r){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=false;let a=this.children,h=a.length;for(let l=0;l<h;l++)a[l].collectRenderables(t,e,r);}};});var bu=p(()=>{k();yu();G.add(jr);});var tr,Pn=p(()=>{tr=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(tr||{});});var vu,Su=p(()=>{vu={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};});var Tu,at,Xt=p(()=>{Su();Tu=vu,at={get(){return Tu},set(i){Tu=i;}};});function jt(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Kr(i){return i.split("?")[0].split("#")[0]}function Pg(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Mg(i,t,e){return i.replace(new RegExp(Pg(t),"g"),e)}function Cg(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else {if(n===47)break;n=47;}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",r=0):(e=e.slice(0,h),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0;}else n===46&&o!==-1?++o:o=-1;}return e}var Bt,xs=p(()=>{Xt();Bt={toPosix(i){return Mg(i,"\\","/")},isUrl(i){return /^https?:/.test(this.toPosix(i))},isDataUrl(i){return /^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return /^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){jt(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(jt(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=Kr(this.toPosix(t??at.get().getBaseUrl())),s=Kr(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?Bt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(jt(i),i.length===0)return ".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=Cg(i),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return jt(i),i=this.toPosix(i),this.hasProtocol(i)?true:i.startsWith("/")},join(...i){if(i.length===0)return ".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(jt(r),r.length>0)if(t===void 0)t=r;else {let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`;}}return t===void 0?".":this.normalize(t)},dirname(i){if(jt(i),i.length===0)return ".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=true,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=false;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){jt(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/");}return t},basename(i,t){jt(i),t&&jt(t),i=Kr(this.toPosix(i));let e=0,r=-1,s=true,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return "";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let h=i.charCodeAt(o);if(h===47){if(!s){e=o+1;break}}else a===-1&&(s=false,a=o+1),n>=0&&(h===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a));}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=false,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){jt(i),i=Kr(this.toPosix(i));let t=-1,e=0,r=-1,s=true,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=false,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1);}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){jt(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Kr(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s;t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,h=-1,l=true,u=i.length-1,c=0;for(;u>=s;--u){if(e=i.charCodeAt(u),e===47){if(!l){a=u+1;break}continue}h===-1&&(l=false,h=u+1),e===46?n===-1?n=u:c!==1&&(c=1):n!==-1&&(c=-1);}return n===-1||h===-1||c===0||c===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&r?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),t},sep:"/",delimiter:":",joinExtensions:[".html"]};});var _e,Mn=p(()=>{_e=(i,t,e=false)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i);});function wu(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?wu(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a));}}function Pu(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n);}),wu(i,s,0,e,r);}else r.push(i);return r}var Mu=p(()=>{});var Cn,Cu=p(()=>{Cn=i=>!Array.isArray(i);});function Ag(i){return i.split(".").pop().split("?").shift().split("#").shift()}var qr,Au=p(()=>{St();xs();Mn();Mu();Cu();qr=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={};}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params));}),this._resolverHash={};}set basePath(t){this._basePath=t;}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t;}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null;}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else {let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&");}}getAlias(t){let{alias:e,src:r}=t;return _e(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,true)}addManifest(t){this._manifest&&z("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets);});}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,h;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),h=[a,l];}else {let l=a.map(u=>this._createBundleAssetId(t,u));r.push(...l),h=[...a,...l];}this.add({...o,alias:h,src:n});}),this._bundles[t]=r;}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&z(`[Resolver] already has key: ${o} overwriting`);},_e(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l}=o,u=_e(n).map(d=>typeof d=="string"?Pu(d):Array.isArray(d)?d:[d]),c=this.getAlias(o);Array.isArray(c)?c.forEach(r):r(c);let f=[];u.forEach(d=>{d.forEach(m=>{let x={};if(typeof m!="object"){x.src=m;for(let g=0;g<this._parsers.length;g++){let _=this._parsers[g];if(_.test(m)){x=_.parse(m);break}}}else a=m.data??a,h=m.format??h,l=m.loadParser??l,x={...x,...m};if(!c)throw new Error(`[Resolver] alias is undefined for this asset: ${x.src}`);x=this._buildResolvedAsset(x,{aliases:c,data:a,format:h,loadParser:l}),f.push(x);});}),c.forEach(d=>{this._assetMap[d]=f;});});}resolveBundle(t){let e=Cn(t);t=_e(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let h in n){let l=n[h];a[this._extractAssetIdFromBundle(s,h)]=l;}r[s]=a;}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=Cn(t);t=_e(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(h=>{let l=o.filter(u=>u[a]?u[a]===h:false);l.length&&(o=l);});}),this._resolverHash[s]=o[0];}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s];}),e?r[t[0]]:r}hasKey(t){return !!this._assetMap[t]}hasBundle(t){return !!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return `${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return (this._basePath||this._rootPath)&&(t.src=Bt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??Ag(t.src),t}};qr.RETINA_PREFIX=/@([0-9\.]+)x/;});var An,Eu=p(()=>{An=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i};});var Bu,En,ku=p(()=>{Rt();yt();Bu=class Zr{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof F?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null;}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Zr.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch();})}_processFrames(t){let e=t,r=Zr.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,h=null,l=o.trimmed!==false&&o.sourceSize?o.sourceSize:o.frame,u=new Z(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new Z(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new Z(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==false&&o.spriteSourceSize&&(h=new Z(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new F({source:this.textureSource,frame:a,orig:u,trim:h,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()});}e++;}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s]);}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures);}_nextBatch(){this._processFrames(this._batchIndex*Zr.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Zr.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete());},0);}destroy(t=false){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[];}};Bu.BATCH_SIZE=1e3;En=Bu;});function Fu(i,t,e){let r={};if(i.forEach(s=>{r[s]=t;}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s];}),!e){let s=Bt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Fu([`${s}/${t.data.meta.related_multi_packs[n]}`],o,true);Object.assign(r,a);});}return r}var Eg,Ru,Gu=p(()=>{Pn();Au();Eu();k();yt();xs();ku();Eg=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Ru={extension:S.Asset,cache:{test:i=>i instanceof En,getCacheableAssets:(i,t)=>Fu(i,t,false)},resolver:{extension:{type:S.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&Eg.includes(s)},parse:i=>{let t=i.split(".");return {resolution:parseFloat(qr.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:S.LoadParser,priority:tr.Normal,name:"spritesheetLoader"},async testParse(i,t){return Bt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=Bt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof F)a=r;else {let u=An(n+(s??i.meta.image),t.src);a=(await e.load([{src:u,data:o}]))[u];}let h=new En(a.source,i);await h.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let u=[];for(let f of l){if(typeof f!="string")continue;let d=n+f;t.data?.ignoreMultiPack||(d=An(d,t.src),u.push(e.load({src:d,data:{textureOptions:o,ignoreMultiPack:true}})));}let c=await Promise.all(u);h.linkedSheets=c,c.forEach(f=>{f.linkedSheets=[h].concat(h.linkedSheets.filter(d=>d!==f));});}return h},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(false);}}};});var _s=p(()=>{k();Gu();G.add(Ru);});function ys(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a;}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s;}var Bn=p(()=>{});var Qr,Iu=p(()=>{Wo();yt();Bn();pt();wn();Qr=class i extends Je{constructor(t=F.EMPTY){t instanceof F&&(t={texture:t});let{texture:e=F.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=true,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Pt({_onUpdate:()=>{this.onViewUpdate();}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=false,this.roundPixels=s??false,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n);}static from(t,e=false){return t instanceof F?new i(t):new i(F.from(t,e))}set texture(t){t||(t=F.EMPTY);let e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate());}get texture(){return this._texture}get visualBounds(){return ys(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return I("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o;}destroy(t=false){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r);}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null;}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t);}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t;}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t;}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height);}};});function bs(i,t,e){let r=Bg;i.measurable=true,ts(i,e,r),t.addBoundsMask(r),i.measurable=false;}var Bg,kn=p(()=>{$t();rs();Bg=new nt;});function vs(i,t,e){let r=Gt.get();i.measurable=true;let s=ut.get().identity(),o=Du(i,e,s);ss(i,r,o),i.measurable=false,t.addBoundsMask(r),ut.return(s),Gt.return(r);}function Du(i,t,e){return i?(i!==t&&(Du(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(z("Mask bounds, renderable is not inside the root container"),e)}var Fn=p(()=>{Zo();Be();St();});var Jr,Uu=p(()=>{k();Iu();kn();Fn();Jr=class{constructor(t){this.priority=0,this.inverse=false,this.pipe="alphaMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Qr),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=false;}reset(){this.mask.measurable=true,this.mask=null;}addBounds(t,e){this.inverse||bs(this.mask,t,e);}addLocalBounds(t,e){vs(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof Qr}};Jr.extension=S.MaskEffect;});var ti,Lu=p(()=>{k();ti=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t;}destroy(){}static test(t){return typeof t=="number"}};ti.extension=S.MaskEffect;});var ei,Ou=p(()=>{k();Wr();kn();Fn();ei=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t,this.mask.includeInBuild=false,this.mask.measurable=false;}reset(){this.mask.measurable=true,this.mask.includeInBuild=true,this.mask=null;}addBounds(t,e){bs(this.mask,t,e);}addLocalBounds(t,e){vs(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof Yt}};ei.extension=S.MaskEffect;});var er,zu=p(()=>{Xt();k();me();er=class extends _t{constructor(t){t.resource||(t.resource=at.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent;}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight);}resize(t=this.width,e=this.height,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};er.extension=S.TextureSource;});var Jt,Ss=p(()=>{Xt();k();St();me();Jt=class extends _t{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=at.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,z("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.");}super(t),this.uploadMethodId="image",this.autoGarbageCollect=true;}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Jt.extension=S.TextureSource;});async function Hu(){return Rn??(Rn=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return "premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=false,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load();});if(!e)return "premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,false),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Rn}var Rn,Wu=p(()=>{});var Ts,Nu,$u=p(()=>{k();$r();Wu();me();Ts=class Vu extends _t{constructor(t){super(t),this.isReady=false,this.uploadMethodId="video",t={...Vu.defaultOptions,...t},this._autoUpdate=true,this._isConnectedToTicker=false,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==false,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==false&&this.load();}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=mt.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t);}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update();}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback);}get isValid(){return !!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return (t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=true),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,true)),this.alphaMode=await Hu(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`));})),t.load());}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,true),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null);}_isSourcePlaying(){let t=this.resource;return !t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate();}_onPlayStop(){this._configureAutoUpdate();}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0);}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady();}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady();}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=true,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play();}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,true),t.pause(),t.src="",t.load()),super.destroy();}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate());}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate());}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(mt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(mt.shared.add(this.updateFrame,this),this._isConnectedToTicker=true,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(mt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0));}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Ts.extension=S.TextureSource;Ts.defaultOptions={..._t.defaultOptions,autoLoad:true,autoPlay:true,updateFPS:0,crossorigin:true,loop:false,muted:true,playsinline:true,preload:false};Ts.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Nu=Ts;});var Gn,ct,ri=p(()=>{St();Mn();Gn=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map;}reset(){this._cacheMap.clear(),this._cache.clear();}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||z(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=_e(t),s;for(let h=0;h<this.parsers.length;h++){let l=this.parsers[h];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(h=>{o.set(h,e);});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(h=>{this._cacheMap.set(h,a);}),n.forEach(h=>{let l=s?s[h]:e;this._cache.has(h)&&this._cache.get(h)!==l&&z("[Cache] already has key:",h),this._cache.set(h,o.get(h));});}remove(t){if(!this._cacheMap.has(t)){z(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s);}),e.keys.forEach(s=>{this._cacheMap.delete(s);});}get parsers(){return this._parsers}},ct=new Gn;});function Yu(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<In.length;s++){let o=In[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function Xu(i={},t=false){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&ct.has(r))return ct.get(r);let o=new F({source:Yu(s)});return o.on("destroy",()=>{ct.has(r)&&ct.remove(r);}),t||ct.set(r,o),o}function ju(i,t=false){return typeof i=="string"?ct.get(i):i instanceof _t?new F({source:i}):Xu(i,t)}var In,Dn=p(()=>{ri();k();me();yt();In=[];G.handleByList(S.TextureSource,In);F.from=ju;_t.from=Yu;});var ws=p(()=>{k();Uu();Lu();Ou();nn();zu();Ss();$u();Dn();G.add(Jr,ti,ei,Nu,Jt,er,Ie);});var Ht,ii=p(()=>{Ht=class{constructor(t){this.resources=Object.create(null),this._dirty=true;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++);}this._updateKey();}_updateKey(){if(!this._dirty)return;this._dirty=false;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|");}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=true);}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t;}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null;}onResourceChange(t){if(this._dirty=true,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null);}else this._updateKey();}};});function Ms(){return (!Ps||Ps?.isContextLost())&&(Ps=at.get().createCanvas().getContext("webgl",{})),Ps}var Ps,Un=p(()=>{Xt();});function Fg(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
20
|
+
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Ku(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=kg.replace(/%forloop%/gi,Fg(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}}finally{t.deleteShader(e);}return i}var kg,qu=p(()=>{kg=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
21
|
+
`);});function ir(){if(rr)return rr;let i=Ms();return rr=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),rr=Ku(rr,i),i.getExtension("WEBGL_lose_context")?.loseContext(),rr}var rr,Cs=p(()=>{Un();qu();rr=null;});function Qu(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return Zu[e]||Rg(i,t,e)}function Rg(i,t,e){let r={},s=0;Ln||(Ln=ir());for(let n=0;n<Ln;n++){let a=n<t?i[n]:F.EMPTY.source;r[s++]=a.source,r[s++]=a.style;}let o=new Ht(r);return Zu[e]=o,o}var Zu,Ln,Ju=p(()=>{ii();yt();Cs();Zu={};Ln=0;});var te,On=p(()=>{te=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength;}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null;}static sizeOf(t){switch(t){case "int8":case "uint8":return 1;case "int16":case "uint16":return 2;case "int32":case "uint32":case "float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};});function zn(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n);}}var tc=p(()=>{});var ec,rc=p(()=>{ec={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};});function ce(i,t){return t.alphaMode==="no-premultiply-alpha"&&ec[i]||i}var si=p(()=>{rc();});var As,ic=p(()=>{As=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0;}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null;}this.count=0;}};});function sc(){return Wn>0?nc[--Wn]:new Hn}function oc(i){nc[Wn++]=i;}var Hn,nc,Wn,oi,ac,hc,lc=p(()=>{Mt();On();tc();si();Cs();ic();Hn=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new As,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=true;}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null;}},nc=[],Wn=0;oi=0,ac=class Es{constructor(t={}){this.uid=Y("batcher"),this.dirty=true,this.batchIndex=0,this.batches=[],this._elements=[],Es.defaultOptions.maxTextures=Es.defaultOptions.maxTextures??ir(),t={...Es.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new te(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e;}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)oc(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=true;}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize;}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return !r&&r!==0?false:(t._textureId=r,t.texture=e,true)}updateElement(t){this.dirty=true;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId);}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=sc(),s=r.textures;s.clear();let o=e[this.elementStart],n=ce(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,u=this.indexBuffer,c=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",m=this.maxTextures;for(let x=this.elementStart;x<this.elementSize;++x){let g=e[x];e[x]=null;let y=g.texture._source,b=ce(g.blendMode,y),v=n!==b||a!==g.topology;if(y._batchTick===oi&&!v){g._textureId=y._textureBindLocation,c+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(u,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,u,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=r;continue}y._batchTick=oi,(s.count>=m||v)&&(this._finishBatch(r,f,c-f,s,n,a,t,d),d="renderBatch",f=c,n=b,a=g.topology,r=sc(),s=r.textures,s.clear(),++oi),g._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,g._batch=r,c+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(u,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,u,g._indexStart,g._attributeStart/this.vertexSize));}s.count>0&&(this._finishBatch(r,f,c-f,s,n,a,t,d),f=c,++oi),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=c;}_finishBatch(t,e,r,s,o,n,a,h){t.gpuBindGroup=null,t.bindGroup=null,t.action=h,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++oi,this.batches[this.batchIndex++]=t,a.add(t);}finish(t){this.break(t);}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4);}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t);}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new te(e);zn(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r;}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else zn(e.buffer,s.buffer);this.indexBuffer=s;}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3;}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-h;}destroy(){for(let t=0;t<this.batches.length;t++)oc(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null;}};ac.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};hc=ac;});var J,sr=p(()=>{J=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(J||{});});var bt,or=p(()=>{Ft();Mt();sr();bt=class extends j{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=Y("buffer"),this._resourceType="buffer",this._resourceId=Y("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=true,this.destroyed=false,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??true;}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,true);}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return !!(this.descriptor.usage&J.STATIC)}set static(t){t?this.descriptor.usage|=J.STATIC:this.descriptor.usage&=~J.STATIC;}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=Y("resource"),this.emit("change",this));return}r&&this.emit("update",this);}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this);}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners();}};});function Vn(i,t){if(!(i instanceof bt)){let e=t?J.INDEX:J.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=J.INDEX|J.COPY_DST):(i=new Float32Array(i),e=J.VERTEX|J.COPY_DST)),i=new bt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e});}return i}var uc=p(()=>{or();sr();});function cc(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,h=-1/0,l=s.BYTES_PER_ELEMENT,u=(r.offset||0)/l,c=(r.stride||2*4)/l;for(let f=u;f<s.length;f+=c){let d=s[f],m=s[f+1];d>a&&(a=d),m>h&&(h=m),d<o&&(o=d),m<n&&(n=m);}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=h,e}var dc=p(()=>{});function Gg(i){return (i instanceof bt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Vn(i.buffer,false),i}var ee,ni=p(()=>{Ft();$t();Mt();or();uc();dc();ee=class extends j{constructor(t={}){super(),this.uid=Y("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new nt,this._boundsDirty=true;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list";}onBufferUpdate(){this._boundsDirty=true,this.emit("update",this);}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=Gg(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r;}addIndex(t){this.indexBuffer=Vn(t,true),this.buffers.push(this.indexBuffer);}get bounds(){return this._boundsDirty?(this._boundsDirty=false,cc(this,"aPosition",this._bounds)):this._bounds}destroy(t=false){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null;}};});var Ig,Dg,Bs,fc=p(()=>{or();sr();ni();Ig=new Float32Array(1),Dg=new Uint32Array(1),Bs=class extends ee{constructor(){let e=new bt({data:Ig,label:"attribute-batch-buffer",usage:J.VERTEX|J.COPY_DST,shrinkToFit:false}),r=new bt({data:Dg,label:"index-batch-buffer",usage:J.INDEX|J.COPY_DST,shrinkToFit:false}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r});}};});function nr(i,t){let e=pc[i];return e===void 0&&(Nn[t]===void 0&&(Nn[t]=1),pc[i]=e=Nn[t]++),e}var Nn,pc,ks=p(()=>{Nn=Object.create(null),pc=Object.create(null);});function mc(){if(!Fs){Fs="mediump";let i=Ms();i&&i.getShaderPrecisionFormat&&(Fs=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump");}return Fs}var Fs,gc=p(()=>{Un();});function xc(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
|
|
22
22
|
|
|
23
23
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
24
24
|
#define in varying
|
|
@@ -33,27 +33,27 @@ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Xu(i,t){if(i===0)th
|
|
|
33
33
|
#define out varying
|
|
34
34
|
#endif
|
|
35
35
|
${i}
|
|
36
|
-
`}var
|
|
37
|
-
${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var
|
|
38
|
-
${i}`:i}var
|
|
39
|
-
${i}`}var
|
|
36
|
+
`}var _c=p(()=>{});function yc(i,t,e){let r=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(i.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
|
|
37
|
+
${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var bc=p(()=>{});function vc(i,t){return t?`#version 300 es
|
|
38
|
+
${i}`:i}var Sc=p(()=>{});function Tc(i,{name:t="pixi-program"},e=true){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?Ug:Lg;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,i.indexOf("#define SHADER_NAME")!==-1?i:`${`#define SHADER_NAME ${t}`}
|
|
39
|
+
${i}`}var Ug,Lg,wc=p(()=>{Ug={},Lg={};});function Pc(i,t){return t?i.replace("#version 300 es",""):i}var Mc=p(()=>{});var $n,Yn,Cc,ar,Rs=p(()=>{ks();gc();_c();bc();Sc();wc();Mc();$n={stripVersion:Pc,ensurePrecision:yc,addProgramDefines:xc,setProgramName:Tc,insertVersion:vc},Yn=Object.create(null),Cc=class Xn{constructor(t){t={...Xn.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:mc()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys($n).forEach(n=>{let a=r[n];s=$n[n](s,a,true),o=$n[n](o,a,false);}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=nr(`${this.vertex}:${this.fragment}`,"gl-program");}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null;}static from(t){let e=`${t.vertex}:${t.fragment}`;return Yn[e]||(Yn[e]=new Xn(t)),Yn[e]}};Cc.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};ar=Cc;});function De(i){return Ac[i]??Ac.float32}var Ac,Gs=p(()=>{Ac={uint8x2:{size:2,stride:2,normalised:false},uint8x4:{size:4,stride:4,normalised:false},sint8x2:{size:2,stride:2,normalised:false},sint8x4:{size:4,stride:4,normalised:false},unorm8x2:{size:2,stride:2,normalised:true},unorm8x4:{size:4,stride:4,normalised:true},snorm8x2:{size:2,stride:2,normalised:true},snorm8x4:{size:4,stride:4,normalised:true},uint16x2:{size:2,stride:4,normalised:false},uint16x4:{size:4,stride:8,normalised:false},sint16x2:{size:2,stride:4,normalised:false},sint16x4:{size:4,stride:8,normalised:false},unorm16x2:{size:2,stride:4,normalised:true},unorm16x4:{size:4,stride:8,normalised:true},snorm16x2:{size:2,stride:4,normalised:true},snorm16x4:{size:4,stride:8,normalised:true},float16x2:{size:2,stride:4,normalised:false},float16x4:{size:4,stride:8,normalised:false},float32:{size:1,stride:4,normalised:false},float32x2:{size:2,stride:8,normalised:false},float32x3:{size:3,stride:12,normalised:false},float32x4:{size:4,stride:16,normalised:false},uint32:{size:1,stride:4,normalised:false},uint32x2:{size:2,stride:8,normalised:false},uint32x3:{size:3,stride:12,normalised:false},uint32x4:{size:4,stride:16,normalised:false},sint32:{size:1,stride:4,normalised:false},sint32x2:{size:2,stride:8,normalised:false},sint32x3:{size:3,stride:12,normalised:false},sint32x4:{size:4,stride:16,normalised:false}};});function Ec({source:i,entryPoint:t}){let e={},r=i.indexOf(`fn ${t}`);if(r!==-1){let s=i.indexOf("->",r);if(s!==-1){let o=i.substring(r,s),n=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,a;for(;(a=n.exec(o))!==null;){let h=Og[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:h,stride:De(h).stride,offset:0,instance:false,start:0};}}}return e}var Og,Bc=p(()=>{Gs();Og={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"};});function Is(i){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,o=/:\s*(\w+)/,n=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,l=i.match(t)?.map(c=>({group:parseInt(c.match(e)[1],10),binding:parseInt(c.match(r)[1],10),name:c.match(s)[2],isUniform:c.match(s)[1]==="<uniform>",type:c.match(o)[1]}));if(!l)return {groups:[],structs:[]};let u=i.match(n)?.map(c=>{let f=c.match(h)[1],d=c.match(a).reduce((m,x)=>{let[g,_]=x.split(":");return m[g.trim()]=_.trim(),m},{});return d?{name:f,members:d}:null}).filter(({name:c})=>l.some(f=>f.type===c))??[];return {groups:l,structs:u}}var kc=p(()=>{});var hr,Fc=p(()=>{hr=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(hr||{});});function Rc({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]=[]),r.isUniform?t[r.group].push({binding:r.binding,visibility:hr.VERTEX|hr.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:hr.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:hr.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:false}});}return t}var Gc=p(()=>{Fc();});function Ic({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]={}),t[r.group][r.name]=r.binding;}return t}var Dc=p(()=>{});function Uc(i,t){let e=new Set,r=new Set,s=[...i.structs,...t.structs].filter(n=>e.has(n.name)?false:(e.add(n.name),true)),o=[...i.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return r.has(a)?false:(r.add(a),true)});return {structs:s,groups:o}}var Lc=p(()=>{});var jn,ye,Ds=p(()=>{ks();Bc();kc();Gc();Dc();Lc();jn=Object.create(null),ye=class i{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:r,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=r,e.source===r.source){let a=Is(e.source);this.structsAndGroups=a;}else {let a=Is(r.source),h=Is(e.source);this.structsAndGroups=Uc(a,h);}this.layout=s??Ic(this.structsAndGroups),this.gpuLayout=o??Rc(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey();}_generateProgramKey(){let{vertex:t,fragment:e}=this,r=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=nr(r,"program");}get attributeData(){return this._attributeData??(this._attributeData=Ec(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null;}static from(t){let e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return jn[e]||(jn[e]=new i(t)),jn[e]}};});function Kn(i,t,e){if(i)for(let r in i){let s=r.toLocaleLowerCase(),o=t[s];if(o){let n=i[r];r==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n);}else z(`${r} placement hook does not exist in shader`);}}var Oc=p(()=>{St();});function qn(i){let t={};return (i.match(zg)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[];}),t}var zg,zc=p(()=>{zg=/\{\{(.*?)\}\}/g;});function Hc(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function Zn(i,t,e=false){let r=[];Hc(t,r),i.forEach(a=>{a.header&&Hc(a.header,r);});let s=r;e&&s.sort();let o=s.map((a,h)=>` @location(${h}) ${a},`).join(`
|
|
40
40
|
`),n=t.replace(/@in\s+[^;]+;\s*/g,"");return n=n.replace("{{in}}",`
|
|
41
41
|
${o}
|
|
42
|
-
`),n}var
|
|
43
|
-
`),o=e.sort().map(h=>` var ${
|
|
42
|
+
`),n}var Wc=p(()=>{});function Vc(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function Hg(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function Wg(i){let t=/@.*?\s+/g;return i.replace(t,"")}function Nc(i,t){let e=[];Vc(t,e),i.forEach(h=>{h.header&&Vc(h.header,e);});let r=0,s=e.sort().map(h=>h.indexOf("builtin")>-1?h:`@location(${r++}) ${h}`).join(`,
|
|
43
|
+
`),o=e.sort().map(h=>` var ${Wg(h)};`).join(`
|
|
44
44
|
`),n=`return VSOutput(
|
|
45
|
-
${e.sort().map(h=>` ${
|
|
45
|
+
${e.sort().map(h=>` ${Hg(h)}`).join(`,
|
|
46
46
|
`)});`,a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
|
|
47
47
|
${s}
|
|
48
48
|
`),a=a.replace("{{start}}",`
|
|
49
49
|
${o}
|
|
50
50
|
`),a=a.replace("{{return}}",`
|
|
51
51
|
${n}
|
|
52
|
-
`),a}var
|
|
52
|
+
`),a}var $c=p(()=>{});function Qn(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
|
|
53
53
|
`).length?e=e.replace(`{{${r}}}`,`//-----${r} START-----//
|
|
54
54
|
${s.join(`
|
|
55
55
|
`)}
|
|
56
|
-
//----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"");}return e}var
|
|
56
|
+
//----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"");}return e}var Yc=p(()=>{});function Xc({template:i,bits:t}){let e=Kc(i,t);if(be[e])return be[e];let{vertex:r,fragment:s}=Ng(i,t);return be[e]=qc(r,s,t),be[e]}function jc({template:i,bits:t}){let e=Kc(i,t);return be[e]||(be[e]=qc(i.vertex,i.fragment,t)),be[e]}function Ng(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=Zn(e,i.vertex,true);s=Nc(e,s);let o=Zn(r,i.fragment,true);return {vertex:s,fragment:o}}function Kc(i,t){return t.map(e=>(Jn.has(e)||Jn.set(e,Vg++),Jn.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function qc(i,t,e){let r=qn(i),s=qn(t);return e.forEach(o=>{Kn(o.vertex,r,o.name),Kn(o.fragment,s,o.name);}),{vertex:Qn(i,r),fragment:Qn(t,s)}}var be,Jn,Vg,Zc=p(()=>{Oc();zc();Wc();$c();Yc();be=Object.create(null),Jn=new Map,Vg=0;});var Qc,Jc,td,ed,rd=p(()=>{Qc=`
|
|
57
57
|
@in aPosition: vec2<f32>;
|
|
58
58
|
@in aUV: vec2<f32>;
|
|
59
59
|
|
|
@@ -97,7 +97,7 @@ ${s.join(`
|
|
|
97
97
|
|
|
98
98
|
{{return}}
|
|
99
99
|
};
|
|
100
|
-
`,
|
|
100
|
+
`,Jc=`
|
|
101
101
|
@in vUV : vec2<f32>;
|
|
102
102
|
@in vColor : vec4<f32>;
|
|
103
103
|
|
|
@@ -120,7 +120,7 @@ ${s.join(`
|
|
|
120
120
|
|
|
121
121
|
return finalColor;
|
|
122
122
|
};
|
|
123
|
-
`,
|
|
123
|
+
`,td=`
|
|
124
124
|
in vec2 aPosition;
|
|
125
125
|
in vec2 aUV;
|
|
126
126
|
|
|
@@ -156,7 +156,7 @@ ${s.join(`
|
|
|
156
156
|
|
|
157
157
|
{{end}}
|
|
158
158
|
}
|
|
159
|
-
`,
|
|
159
|
+
`,ed=`
|
|
160
160
|
|
|
161
161
|
in vec4 vColor;
|
|
162
162
|
in vec2 vUV;
|
|
@@ -177,7 +177,7 @@ ${s.join(`
|
|
|
177
177
|
|
|
178
178
|
{{end}}
|
|
179
179
|
}
|
|
180
|
-
`;});var
|
|
180
|
+
`;});var id,sd,od=p(()=>{id={name:"global-uniforms-bit",vertex:{header:`
|
|
181
181
|
struct GlobalUniforms {
|
|
182
182
|
uProjectionMatrix:mat3x3<f32>,
|
|
183
183
|
uWorldTransformMatrix:mat3x3<f32>,
|
|
@@ -186,22 +186,22 @@ ${s.join(`
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
189
|
-
`}},
|
|
189
|
+
`}},sd={name:"global-uniforms-bit",vertex:{header:`
|
|
190
190
|
uniform mat3 uProjectionMatrix;
|
|
191
191
|
uniform mat3 uWorldTransformMatrix;
|
|
192
192
|
uniform vec4 uWorldColorAlpha;
|
|
193
193
|
uniform vec2 uResolution;
|
|
194
|
-
`}};});function
|
|
194
|
+
`}};});function lr({bits:i,name:t}){let e=Xc({template:{fragment:Jc,vertex:Qc},bits:[id,...i]});return ye.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function ur({bits:i,name:t}){return new ar({name:t,...jc({template:{vertex:td,fragment:ed},bits:[sd,...i]})})}var Us=p(()=>{Rs();Ds();Zc();rd();od();});var Ls,Os,ta=p(()=>{Ls={name:"color-bit",vertex:{header:`
|
|
195
195
|
@in aColor: vec4<f32>;
|
|
196
196
|
`,main:`
|
|
197
197
|
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
198
|
-
`}},
|
|
198
|
+
`}},Os={name:"color-bit",vertex:{header:`
|
|
199
199
|
in vec4 aColor;
|
|
200
200
|
`,main:`
|
|
201
201
|
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
202
|
-
`}};});function
|
|
203
|
-
`)}function
|
|
204
|
-
`)}function
|
|
202
|
+
`}};});function $g(i){let t=[];if(i===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else {let e=0;for(let r=0;r<i;r++)t.push(`@group(1) @binding(${e++}) var textureSource${r+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${r+1}: sampler;`);}return t.join(`
|
|
203
|
+
`)}function Yg(i){let t=[];if(i===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else {t.push("switch vTextureId {");for(let e=0;e<i;e++)e===i-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}");}return t.join(`
|
|
204
|
+
`)}function zs(i){return ea[i]||(ea[i]={name:"texture-batch-bit",vertex:{header:`
|
|
205
205
|
@in aTextureIdAndRound: vec2<u32>;
|
|
206
206
|
@out @interpolate(flat) vTextureId : u32;
|
|
207
207
|
`,main:`
|
|
@@ -214,14 +214,14 @@ ${s.join(`
|
|
|
214
214
|
`},fragment:{header:`
|
|
215
215
|
@in @interpolate(flat) vTextureId: u32;
|
|
216
216
|
|
|
217
|
-
${
|
|
217
|
+
${$g(i)}
|
|
218
218
|
`,main:`
|
|
219
219
|
var uvDx = dpdx(vUV);
|
|
220
220
|
var uvDy = dpdy(vUV);
|
|
221
221
|
|
|
222
|
-
${
|
|
223
|
-
`}}),
|
|
224
|
-
`)}function
|
|
222
|
+
${Yg(i)}
|
|
223
|
+
`}}),ea[i]}function Xg(i){let t=[];for(let e=0;e<i;e++)e>0&&t.push("else"),e<i-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
|
|
224
|
+
`)}function Hs(i){return ra[i]||(ra[i]={name:"texture-batch-bit",vertex:{header:`
|
|
225
225
|
in vec2 aTextureIdAndRound;
|
|
226
226
|
out float vTextureId;
|
|
227
227
|
|
|
@@ -239,18 +239,18 @@ ${s.join(`
|
|
|
239
239
|
|
|
240
240
|
`,main:`
|
|
241
241
|
|
|
242
|
-
${
|
|
243
|
-
`}}),
|
|
242
|
+
${Xg(i)}
|
|
243
|
+
`}}),ra[i]}var ea,ra,ia=p(()=>{ea={};ra={};});var cr,dr,Ws=p(()=>{cr={name:"round-pixels-bit",vertex:{header:`
|
|
244
244
|
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
245
245
|
{
|
|
246
246
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
247
247
|
}
|
|
248
|
-
`}},
|
|
248
|
+
`}},dr={name:"round-pixels-bit",vertex:{header:`
|
|
249
249
|
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
250
250
|
{
|
|
251
251
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
252
252
|
}
|
|
253
|
-
`}};});var ra,sd,od=p(()=>{ra=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],sd=ra.reduce((i,t)=>(i[t]=true,i),{});});function nd(i,t){switch(i){case "f32":return 0;case "vec2<f32>":return new Float32Array(2*t);case "vec3<f32>":return new Float32Array(3*t);case "vec4<f32>":return new Float32Array(4*t);case "mat2x2<f32>":return new Float32Array([1,0,0,1]);case "mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case "mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var ad=p(()=>{});var hd,Mt,ye=p(()=>{wt();As();od();ad();hd=class ld{constructor(t,e){this._touched=0,this.uid=$("uniform"),this._resourceType="uniformGroup",this._resourceId=$("resource"),this.isUniformGroup=true,this._dirtyId=0,this.destroyed=false,e={...ld.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!sd[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${ra.join(", ")}`);o.value??(o.value=nd(o.type,o.size)),r[s]=o.value;}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=sr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group");}update(){this._dirtyId++;}};hd.defaultOptions={ubo:false,isStatic:false};Mt=hd;});function zs(i){let t=ud[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=ud[i]=new Mt({uTextures:{value:e,type:"i32",size:i}},{isStatic:true}),t}var ud,ia=p(()=>{ye();ud={};});var te,oi=p(()=>{te=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(te||{});});var ee,ni=p(()=>{Bt();wt();Bs();ei();Gs();oi();ye();ee=class i extends X{constructor(t){super(),this.uid=$("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=te.WEBGPU),r&&(n|=te.WEBGL)),this.compatibleRenderers=n;let h={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let l in a)for(let u in a[l]){let c=a[l][u];h[c]={group:l,binding:u,name:c};}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,h[u.name]=u;});}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[c.name]=c;});let l=0;for(let u in o)h[u]||(s[99]||(s[99]=new Ot,this._ownedBindGroups.push(s[99])),h[u]={group:99,binding:l,name:u},a[99]=a[99]||{},a[99][l]=u,l++);for(let u in o){let c=u,f=o[u];!f.source&&!f._resourceType&&(f=new Mt(f));let d=h[c];d&&(s[d.group]||(s[d.group]=new Ot,this._ownedBindGroups.push(s[d.group])),s[d.group].setResource(f,d.binding));}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,h);}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new Ot,this._ownedBindGroups.push(this.groups[e]));}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding);}});}return r}destroy(t=false){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy();}),this._ownedBindGroups=null,this.resources=null,this.groups=null;}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=xe.from(e)),r&&(n=or.from(r)),new i({gpuProgram:o,glProgram:n,...s})}};});var Hs,cd=p(()=>{Rs();Qn();ea();Os();ia();ni();Hs=class extends ee{constructor(t){let e=hr({name:"batch",bits:[Us,Ls(t),ur]}),r=ar({name:"batch",bits:[Is,Ds(t),lr]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:zs(t)}});}};});var dd,fd,md,gd=p(()=>{k();ac();cc();cd();dd=null,fd=class pd extends nc{constructor(){super(...arguments),this.geometry=new Cs,this.shader=dd||(dd=new Hs(this.maxTextures)),this.name=pd.extension.name,this.vertexSize=6;}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,h=a.a,l=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,{positions:m,uvs:x}=t,g=t.color,_=t.attributeOffset,y=_+t.attributeSize;for(let b=_;b<y;b++){let v=b*2,P=m[v],T=m[v+1];e[s++]=h*P+u*T+f,e[s++]=c*T+l*P+d,e[s++]=x[v],e[s++]=x[v+1],r[s++]=g,r[s++]=n;}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,h=a.a,l=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,m=t.bounds,x=m.maxX,g=m.minX,_=m.maxY,y=m.minY,b=n.uvs,v=t.color,P=o<<16|t.roundPixels&65535;e[s+0]=h*g+u*y+f,e[s+1]=c*y+l*g+d,e[s+2]=b.x0,e[s+3]=b.y0,r[s+4]=v,r[s+5]=P,e[s+6]=h*x+u*y+f,e[s+7]=c*y+l*x+d,e[s+8]=b.x1,e[s+9]=b.y1,r[s+10]=v,r[s+11]=P,e[s+12]=h*x+u*_+f,e[s+13]=c*_+l*x+d,e[s+14]=b.x2,e[s+15]=b.y2,r[s+16]=v,r[s+17]=P,e[s+18]=h*g+u*_+f,e[s+19]=c*_+l*g+d,e[s+20]=b.x3,e[s+21]=b.y3,r[s+22]=v,r[s+23]=P;}};fd.extension={type:[S.Batcher],name:"default"};md=fd;});function xd(i,t,e,r,s,o,n,a=null){let h=0;e*=t,s*=o;let l=a.a,u=a.b,c=a.c,f=a.d,d=a.tx,m=a.ty;for(;h<n;){let x=i[e],g=i[e+1];r[s]=l*x+c*g+d,r[s+1]=u*x+f*g+m,s+=o,e+=t,h++;}}function _d(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++;}var yd=p(()=>{});function sa(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,h=t.d,l=t.tx,u=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let c=e*r;for(let f=0;f<s;f++){let d=i[c],m=i[c+1];i[c]=o*d+a*m+l,i[c+1]=n*d+h*m+u,c+=r;}}var bd=p(()=>{});var $g,Ie,oa=p(()=>{tt();Yo();$g=new M,Ie=class{constructor(){this.packAsQuad=false,this.batcherName="default",this.topology="triangle-list",this.applyTransform=true,this.roundPixels=0,this._batcher=null,this._batch=null;}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?ts(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||$g}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology;}reset(){this.applyTransform=true,this.renderable=null,this.topology="triangle-list";}};});var cr,vd,Sd,Td=p(()=>{k();cr={extension:{type:S.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let v=i;e=v.x,r=v.y,n=a=v.radius,s=o=0;}else if(i.type==="ellipse"){let v=i;e=v.x,r=v.y,n=v.halfWidth,a=v.halfHeight,s=o=0;}else {let v=i,P=v.width/2,T=v.height/2;e=v.x+P,r=v.y+T,n=a=Math.max(0,Math.min(v.radius,Math.min(P,T))),s=P-n,o=T-a;}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let h=Math.ceil(2.3*Math.sqrt(n+a)),l=h*8+(s?4:0)+(o?4:0);if(l===0)return t;if(h===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let u=0,c=h*4+(s?2:0)+2,f=c,d=l,m=s+n,x=o,g=e+m,_=e-m,y=r+x;if(t[u++]=g,t[u++]=y,t[--c]=y,t[--c]=_,o){let v=r-x;t[f++]=_,t[f++]=v,t[--d]=v,t[--d]=g;}for(let v=1;v<h;v++){let P=Math.PI/2*(v/h),T=s+Math.cos(P)*n,w=o+Math.sin(P)*a,E=e+T,G=e-T,A=r+w,C=r-w;t[u++]=E,t[u++]=A,t[--c]=A,t[--c]=G,t[f++]=G,t[f++]=C,t[--d]=C,t[--d]=E;}m=s,x=o+a,g=e+m,_=e-m,y=r+x;let b=r-x;return t[u++]=g,t[u++]=y,t[--d]=b,t[--d]=g,s&&(t[u++]=_,t[u++]=y,t[--d]=b,t[--d]=_),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let u=0;u<i.length;u+=2)n+=i[u],a+=i[u+1];n/=i.length/2,a/=i.length/2;let h=r;t[h*e]=n,t[h*e+1]=a;let l=h++;for(let u=0;u<i.length;u+=2)t[h*e]=i[u],t[h*e+1]=i[u+1],u>0&&(s[o++]=h,s[o++]=l,s[o++]=h-1),h++;s[o++]=l+1,s[o++]=l,s[o++]=h-1;}},vd={...cr,extension:{...cr.extension,name:"ellipse"}},Sd={...cr,extension:{...cr.extension,name:"roundedRectangle"}};});function wd(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a;}return e<0?-1:1}var Pd=p(()=>{});function Md(i,t,e,r,s,o,n,a){let h=i-e*s,l=t-r*s,u=i+e*o,c=t+r*o,f,d;n?(f=r,d=-e):(f=-r,d=e);let m=h+f,x=l+d,g=u+f,_=c+d;return a.push(m,x),a.push(g,_),2}function Ue(i,t,e,r,s,o,n,a){let h=e-i,l=r-t,u=Math.atan2(h,l),c=Math.atan2(s-i,o-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let f=u,d=c-u,m=Math.abs(d),x=Math.sqrt(h*h+l*l),g=(15*m*Math.sqrt(x)/Math.PI>>0)+1,_=d/g;if(f+=_,a){n.push(i,t),n.push(e,r);for(let y=1,b=f;y<g;y++,b+=_)n.push(i,t),n.push(i+Math.sin(b)*x,t+Math.cos(b)*x);n.push(i,t),n.push(s,o);}else {n.push(e,r),n.push(i,t);for(let y=1,b=f;y<g;y++,b+=_)n.push(i+Math.sin(b)*x,t+Math.cos(b)*x),n.push(i,t);n.push(s,o),n.push(i,t);}return g*2}function Cd(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,h=a.alignment;if(t.alignment!==.5){let J=wd(i);h=(h-.5)*J+.5;}let l=new N(i[0],i[1]),u=new N(i[i.length-2],i[i.length-1]),c=r,f=Math.abs(l.x-u.x)<n&&Math.abs(l.y-u.y)<n;if(c){i=i.slice(),f&&(i.pop(),i.pop(),u.set(i[i.length-2],i[i.length-1]));let J=(l.x+u.x)*.5,de=(u.y+l.y)*.5;i.unshift(J,de),i.push(J,de);}let d=s,m=i.length/2,x=i.length,g=d.length/2,_=a.width/2,y=_*_,b=a.miterLimit*a.miterLimit,v=i[0],P=i[1],T=i[2],w=i[3],E=0,G=0,A=-(P-w),C=v-T,L=0,Z=0,mt=Math.sqrt(A*A+C*C);A/=mt,C/=mt,A*=_,C*=_;let Ar=h,U=(1-Ar)*2,z=Ar*2;c||(a.cap==="round"?x+=Ue(v-A*(U-z)*.5,P-C*(U-z)*.5,v-A*U,P-C*U,v+A*z,P+C*z,d,true)+2:a.cap==="square"&&(x+=Md(v,P,A,C,U,z,true,d))),d.push(v-A*U,P-C*U),d.push(v+A*z,P+C*z);for(let J=1;J<m-1;++J){v=i[(J-1)*2],P=i[(J-1)*2+1],T=i[J*2],w=i[J*2+1],E=i[(J+1)*2],G=i[(J+1)*2+1],A=-(P-w),C=v-T,mt=Math.sqrt(A*A+C*C),A/=mt,C/=mt,A*=_,C*=_,L=-(w-G),Z=T-E,mt=Math.sqrt(L*L+Z*Z),L/=mt,Z/=mt,L*=_,Z*=_;let de=T-v,Er=P-w,Br=T-E,kr=G-w,bh=de*Br+Er*kr,Ui=Er*Br-kr*de,Fr=Ui<0;if(Math.abs(Ui)<.001*Math.abs(bh)){d.push(T-A*U,w-C*U),d.push(T+A*z,w+C*z),bh>=0&&(a.join==="round"?x+=Ue(T,w,T-A*U,w-C*U,T-L*U,w-Z*U,d,false)+4:x+=2,d.push(T-L*z,w-Z*z),d.push(T+L*U,w+Z*U));continue}let vh=(-A+v)*(-C+w)-(-A+T)*(-C+P),Sh=(-L+E)*(-Z+w)-(-L+T)*(-Z+G),Di=(de*Sh-Br*vh)/Ui,Li=(kr*vh-Er*Sh)/Ui,Ao=(Di-T)*(Di-T)+(Li-w)*(Li-w),Te=T+(Di-T)*U,we=w+(Li-w)*U,Pe=T-(Di-T)*z,Me=w-(Li-w)*z,Dm=Math.min(de*de+Er*Er,Br*Br+kr*kr),Th=Fr?U:z,Lm=Dm+Th*Th*y;Ao<=Lm?a.join==="bevel"||Ao/y>b?(Fr?(d.push(Te,we),d.push(T+A*z,w+C*z),d.push(Te,we),d.push(T+L*z,w+Z*z)):(d.push(T-A*U,w-C*U),d.push(Pe,Me),d.push(T-L*U,w-Z*U),d.push(Pe,Me)),x+=2):a.join==="round"?Fr?(d.push(Te,we),d.push(T+A*z,w+C*z),x+=Ue(T,w,T+A*z,w+C*z,T+L*z,w+Z*z,d,true)+4,d.push(Te,we),d.push(T+L*z,w+Z*z)):(d.push(T-A*U,w-C*U),d.push(Pe,Me),x+=Ue(T,w,T-A*U,w-C*U,T-L*U,w-Z*U,d,false)+4,d.push(T-L*U,w-Z*U),d.push(Pe,Me)):(d.push(Te,we),d.push(Pe,Me)):(d.push(T-A*U,w-C*U),d.push(T+A*z,w+C*z),a.join==="round"?Fr?x+=Ue(T,w,T+A*z,w+C*z,T+L*z,w+Z*z,d,true)+2:x+=Ue(T,w,T-A*U,w-C*U,T-L*U,w-Z*U,d,false)+2:a.join==="miter"&&Ao/y<=b&&(Fr?(d.push(Pe,Me),d.push(Pe,Me)):(d.push(Te,we),d.push(Te,we)),x+=2),d.push(T-L*U,w-Z*U),d.push(T+L*z,w+Z*z),x+=2);}v=i[(m-2)*2],P=i[(m-2)*2+1],T=i[(m-1)*2],w=i[(m-1)*2+1],A=-(P-w),C=v-T,mt=Math.sqrt(A*A+C*C),A/=mt,C/=mt,A*=_,C*=_,d.push(T-A*U,w-C*U),d.push(T+A*z,w+C*z),c||(a.cap==="round"?x+=Ue(T-A*(U-z)*.5,w-C*(U-z)*.5,T-A*U,w-C*U,T+A*z,w+C*z,d,false)+2:a.cap==="square"&&(x+=Md(T,w,A,C,U,z,false,d)));let Um=1e-4*1e-4;for(let J=g;J<x+g-2;++J)v=d[J*2],P=d[J*2+1],T=d[(J+1)*2],w=d[(J+1)*2+1],E=d[(J+2)*2],G=d[(J+2)*2+1],!(Math.abs(v*(w-G)+T*(G-P)+E*(P-w))<Um)&&o.push(J,J+1,J+2);}var Ad=p(()=>{Wt();Pd();});function Ed(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],h=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-h)<s,u=e,c=i.length/2,f=u.length/2;for(let d=0;d<c;d++)u.push(i[d*2]),u.push(i[d*2+1]);for(let d=0;d<c-1;d++)r.push(f+d,f+d+1);l&&r.push(f+c-1,f);}var Bd=p(()=>{});var ua=Bo((tM,la)=>{la.exports=Ns;la.exports.default=Ns;function Ns(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Fd(i,0,s,e,true),n=[];if(!o||o.next===o.prev)return n;var a,h,l,u,c,f,d;if(r&&(o=Qg(i,t,o,e)),i.length>80*e){a=l=i[0],h=u=i[1];for(var m=e;m<s;m+=e)c=i[m],f=i[m+1],c<a&&(a=c),f<h&&(h=f),c>l&&(l=c),f>u&&(u=f);d=Math.max(l-a,u-h),d=d!==0?32767/d:0;}return ai(o,n,e,a,h,d,0),n}function Fd(i,t,e,r,s){var o,n;if(s===ha(i,t,e,r)>0)for(o=t;o<e;o+=r)n=kd(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=kd(o,i[o],i[o+1],n);return n&&$s(n,n.next)&&(li(n),n=n.next),n}function De(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=false,!e.steiner&&($s(e,e.next)||nt(e.prev,e,e.next)===0)){if(li(e),e=t=e.prev,e===e.next)break;r=true;}else e=e.next;while(r||e!==t);return t}function ai(i,t,e,r,s,o,n){if(i){!n&&o&&ix(i,r,s,o);for(var a=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,o?Kg(i,r,s,o):jg(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),li(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=qg(De(i),t,e),ai(i,t,e,r,s,o,2)):n===2&&Zg(i,t,e,r,s,o):ai(De(i),t,e,r,s,o,1);break}}}}function jg(i){var t=i.prev,e=i,r=i.next;if(nt(t,e,r)>=0)return false;for(var s=t.x,o=e.x,n=r.x,a=t.y,h=e.y,l=r.y,u=s<o?s<n?s:n:o<n?o:n,c=a<h?a<l?a:l:h<l?h:l,f=s>o?s>n?s:n:o>n?o:n,d=a>h?a>l?a:l:h>l?h:l,m=r.next;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=c&&m.y<=d&&dr(s,a,o,h,n,l,m.x,m.y)&&nt(m.prev,m,m.next)>=0)return false;m=m.next;}return true}function Kg(i,t,e,r){var s=i.prev,o=i,n=i.next;if(nt(s,o,n)>=0)return false;for(var a=s.x,h=o.x,l=n.x,u=s.y,c=o.y,f=n.y,d=a<h?a<l?a:l:h<l?h:l,m=u<c?u<f?u:f:c<f?c:f,x=a>h?a>l?a:l:h>l?h:l,g=u>c?u>f?u:f:c>f?c:f,_=na(d,m,t,e,r),y=na(x,g,t,e,r),b=i.prevZ,v=i.nextZ;b&&b.z>=_&&v&&v.z<=y;){if(b.x>=d&&b.x<=x&&b.y>=m&&b.y<=g&&b!==s&&b!==n&&dr(a,u,h,c,l,f,b.x,b.y)&&nt(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=d&&v.x<=x&&v.y>=m&&v.y<=g&&v!==s&&v!==n&&dr(a,u,h,c,l,f,v.x,v.y)&&nt(v.prev,v,v.next)>=0))return false;v=v.nextZ;}for(;b&&b.z>=_;){if(b.x>=d&&b.x<=x&&b.y>=m&&b.y<=g&&b!==s&&b!==n&&dr(a,u,h,c,l,f,b.x,b.y)&&nt(b.prev,b,b.next)>=0)return false;b=b.prevZ;}for(;v&&v.z<=y;){if(v.x>=d&&v.x<=x&&v.y>=m&&v.y<=g&&v!==s&&v!==n&&dr(a,u,h,c,l,f,v.x,v.y)&&nt(v.prev,v,v.next)>=0)return false;v=v.nextZ;}return true}function qg(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!$s(s,o)&&Gd(s,r,r.next,o)&&hi(s,o)&&hi(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),li(r),li(r.next),r=i=o),r=r.next;}while(r!==i);return De(r)}function Zg(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&nx(n,a)){var h=Rd(n,a);n=De(n,n.next),h=De(h,h.next),ai(n,t,e,r,s,o,0),ai(h,t,e,r,s,o,0);return}a=a.next;}n=n.next;}while(n!==i)}function Qg(i,t,e,r){var s=[],o,n,a,h,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,h=o<n-1?t[o+1]*r:i.length,l=Fd(i,a,h,r,false),l===l.next&&(l.steiner=true),s.push(ox(l));for(s.sort(Jg),o=0;o<s.length;o++)e=tx(s[o],e);return e}function Jg(i,t){return i.x-t.x}function tx(i,t){var e=ex(i,t);if(!e)return t;var r=Rd(e,i);return De(r,r.next),De(e,e.next)}function ex(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;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<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next;}while(e!==t);if(!n)return null;var h=n,l=n.x,u=n.y,c=1/0,f;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&dr(s<u?r:o,s,l,u,s<u?o:r,s,e.x,e.y)&&(f=Math.abs(s-e.y)/(r-e.x),hi(e,i)&&(f<c||f===c&&(e.x>n.x||e.x===n.x&&rx(n,e)))&&(n=e,c=f)),e=e.next;while(e!==h);return n}function rx(i,t){return nt(i.prev,i,t.prev)<0&&nt(t.next,i,i.next)<0}function ix(i,t,e,r){var s=i;do s.z===0&&(s.z=na(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,sx(s);}function sx(i){var t,e,r,s,o,n,a,h,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(h=l;a>0||h>0&&r;)a!==0&&(h===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,h--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r;}o.nextZ=null,l*=2;}while(n>1);return i}function na(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function ox(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function dr(i,t,e,r,s,o,n,a){return (s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function nx(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!ax(i,t)&&(hi(i,t)&&hi(t,i)&&hx(i,t)&&(nt(i.prev,i,t.prev)||nt(i,t.prev,t))||$s(i,t)&&nt(i.prev,i,i.next)>0&&nt(t.prev,t,t.next)>0)}function nt(i,t,e){return (t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function $s(i,t){return i.x===t.x&&i.y===t.y}function Gd(i,t,e,r){var s=Vs(nt(i,t,e)),o=Vs(nt(i,t,r)),n=Vs(nt(e,r,i)),a=Vs(nt(e,r,t));return !!(s!==o&&n!==a||s===0&&Ws(i,e,t)||o===0&&Ws(i,r,t)||n===0&&Ws(e,i,r)||a===0&&Ws(e,t,r))}function Ws(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Vs(i){return i>0?1:i<0?-1:0}function ax(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Gd(e,e.next,i,t))return true;e=e.next;}while(e!==i);return false}function hi(i,t){return nt(i.prev,i,i.next)<0?nt(i,t,i.next)>=0&&nt(i,i.prev,t)>=0:nt(i,t,i.prev)<0||nt(i,i.next,t)<0}function hx(i,t){var e=i,r=false,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function Rd(i,t){var e=new aa(i.i,i.x,i.y),r=new aa(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function kd(i,t,e,r){var s=new aa(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function li(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ);}function aa(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=false;}Ns.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(ha(i,0,o,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,u=a<h-1?t[a+1]*e:i.length;n-=Math.abs(ha(i,l,u,e));}var c=0;for(a=0;a<r.length;a+=3){var f=r[a]*e,d=r[a+1]*e,m=r[a+2]*e;c+=Math.abs((i[f]-i[m])*(i[d+1]-i[f+1])-(i[f]-i[d])*(i[m+1]-i[f+1]));}return n===0&&c===0?0:Math.abs((c-n)/n)};function ha(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Ns.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r));}return e};});function Ys(i,t,e,r,s,o,n){let a=(0, Id.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let h=s*r;for(let l=0;l<i.length;l+=2)e[h]=i[l],e[h+1]=i[l+1],h+=r;}var Id,ca=p(()=>{Id=Oi(ua());});var lx,Ud,Dd=p(()=>{k();ca();lx=[],Ud={extension:{type:S.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){Ys(i,lx,t,e,r,s,o);}};});var Ld,Od=p(()=>{k();Ld={extension:{type:S.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2;}};});var zd,Hd=p(()=>{k();zd={extension:{type:S.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2;}};});function Vd(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color);}}function Nd(i,t){let e=ot.get().createCanvas(i,t),r=e.getContext("2d");return {canvas:e,context:r}}function ux(i){let t=i[0]??{};return (typeof t=="number"||i[1])&&(I("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??Et.defaultLinearOptions.textureSize}),t}var Wd,fa,Et,fr=p(()=>{Ct();$t();tt();ys();xt();wt();dt();Jo();Wd=[{offset:0,color:"white"},{offset:1,color:"black"}],fa=class da{constructor(...t){this.uid=$("fillGradient"),this.type="linear",this.colorStops=[];let e=ux(t);e={...e.type==="radial"?da.defaultRadialOptions:da.defaultLinearOptions,...rs(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color);});}addColorStop(t,e){return this.colorStops.push({offset:t,color:V.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=t;t=r,r=g,o*=-1;}if(n<0){let g=e;e=s,s=g,n*=-1;}}let h=this.colorStops.length?this.colorStops:Wd,l=this._textureSize,{canvas:u,context:c}=Nd(l,1),f=a?c.createLinearGradient(this._textureSize,0,0,0):c.createLinearGradient(0,0,this._textureSize,0);Vd(f,h),c.fillStyle=f,c.fillRect(0,0,l,1),this.texture=new F({source:new Zt({resource:u,addressMode:this._wrapMode})});let d=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),x=new M;x.scale(d/l,1),x.rotate(m),x.translate(t,e),this.textureSpace==="local"&&x.scale(l,l),this.transform=x;}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient();}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:Wd,e=this._textureSize,{canvas:r,context:s}=Nd(e,e),{x:o,y:n}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,u=this.outerRadius,c=a-u,f=h-u,d=e/(u*2),m=(o-c)*d,x=(n-f)*d,g=s.createRadialGradient(m,x,l*d,(a-c)*d,(h-f)*d,u*d);Vd(g,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=g,s.translate(m,x),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-x),s.fillRect(0,0,e,e),this.texture=new F({source:new Zt({resource:r,addressMode:this._wrapMode})});let _=new M;_.scale(1/d,1/d),_.translate(c,f),this.textureSpace==="local"&&_.scale(e,e),this.transform=_;}get styleKey(){return this.uid}destroy(){this.texture?.destroy(true),this.texture=null;}};fa.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};fa.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Et=fa;});function $d(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(dx);t.width&&n.pad(t.width);let{x:a,y:h}=n,l=1/n.width,u=1/n.height,c=-a*l,f=-h*u,d=s.a,m=s.b,x=s.c,g=s.d;s.a*=l,s.b*=l,s.c*=u,s.d*=u,s.tx=c*d+f*x+s.tx,s.ty=c*m+f*g+s.ty;}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return !(t.fill instanceof Et)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(cx.copyFrom(r).invert()),s}var cx,dx,Yd=p(()=>{tt();kt();fr();cx=new M,dx=new q;});function jd(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")mx(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,h=o.data.style,l=o.data.hole;n&&l&&Xd(l.shapePath,h,true,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),Xd(a,h,n,r,e);}}}function mx(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,h=[],l=Xs.rectangle,u=fx,c=i.image;u.x=i.dx,u.y=i.dy,u.width=i.dw,u.height=i.dh;let f=i.transform;l.build(u,h),f&&sa(h,f),l.triangulate(h,r,2,a,o,n);let d=c.uvs;s.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);let m=W.get(Ie);m.indexOffset=n,m.indexSize=o.length-n,m.attributeOffset=a,m.attributeSize=r.length/2-a,m.baseColor=i.style,m.alpha=i.alpha,m.texture=c,m.geometryData=e,t.push(m);}function Xd(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:h,transform:l,holes:u})=>{let c=a.length,f=o.length/2,d=[],m=Xs[h.type],x="triangle-list";if(m.build(h,d),l&&sa(d,l),e){let b=h.closePath??true,v=t;v.pixelLine?(Ed(d,b,o,a),x="line-list"):Cd(d,v,false,b,o,a);}else if(u){let b=[],v=d.slice();gx(u).forEach(T=>{b.push(v.length/2),v.push(...T);}),Ys(v,b,o,2,f,a,c);}else m.triangulate(d,o,2,f,a,c);let g=n.length/2,_=t.texture;if(_!==F.WHITE){let b=$d(px,t,h,l);xd(o,2,f,n,g,2,o.length/2-f,b);}else _d(n,g,2,o.length/2-f);let y=W.get(Ie);y.indexOffset=c,y.indexSize=a.length-c,y.attributeOffset=f,y.attributeSize=o.length/2-f,y.baseColor=t.color,y.alpha=t.alpha,y.texture=_,y.geometryData=s,y.topology=x,r.push(y);});}function gx(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];Xs[r.type].build(r,s),t.push(s);}return t}var Xs,fx,px,Kd=p(()=>{k();tt();kt();yd();bd();xt();Lt();oa();Td();Ad();Bd();Dd();Od();Hd();Yd();ca();Xs={};R.handleByMap(S.ShapeBuilder,Xs);R.add(Ld,Ud,zd,cr,vd,Sd);fx=new q,px=new M;});var pa,ma,xa,pr,js=p(()=>{k();Zu();gd();Zo();dt();Lt();Kd();pa=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]};}},ma=class{constructor(){this.batcher=new md,this.instructions=new Xe;}init(){this.instructions.reset();}get geometry(){return I(Kh,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},xa=class ga{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash");}init(t){ga.defaultOptions.bezierSmoothness=t?.bezierSmoothness??ga.defaultOptions.bezierSmoothness;}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),jd(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=false:r==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=false;}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=W.get(ma),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=false;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let u=0;u<r.length;u++){let c=r[u];a.add(c);}a.finish(e.instructions);let h=a.geometry;h.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,true),h.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,true);let l=a.batches;for(let u=0;u<l.length;u++){let c=l[u];c.bindGroup=qu(c.textures.textures,c.textures.count);}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new pa;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null;}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(W.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{W.return(r);});}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context);}};xa.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"graphicsContext"};xa.defaultOptions={bezierSmoothness:.5};pr=xa;});var xx,_a,ya,ba,va,Sa,Ta,wa,Le,Ks=p(()=>{xx={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},_a=0,ya=1,ba=2,va=3,Sa=4,Ta=5,wa=class qd{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=true,this.depthMask=true;}get blend(){return !!(this.data&1<<_a)}set blend(t){!!(this.data&1<<_a)!==t&&(this.data^=1<<_a);}get offsets(){return !!(this.data&1<<ya)}set offsets(t){!!(this.data&1<<ya)!==t&&(this.data^=1<<ya);}set cullMode(t){if(t==="none"){this.culling=false;return}this.culling=true,this.clockwiseFrontFace=t==="front";}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return !!(this.data&1<<ba)}set culling(t){!!(this.data&1<<ba)!==t&&(this.data^=1<<ba);}get depthTest(){return !!(this.data&1<<va)}set depthTest(t){!!(this.data&1<<va)!==t&&(this.data^=1<<va);}get depthMask(){return !!(this.data&1<<Ta)}set depthMask(t){!!(this.data&1<<Ta)!==t&&(this.data^=1<<Ta);}get clockwiseFrontFace(){return !!(this.data&1<<Sa)}set clockwiseFrontFace(t){!!(this.data&1<<Sa)!==t&&(this.data^=1<<Sa);}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=xx[t]||0;}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t;}toString(){return `[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new qd;return t.depthTest=false,t.blend=true,t}};wa.default2d=wa.for2d();Le=wa;});function be(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r;}var ui=p(()=>{});var ci,Zd=p(()=>{k();Ks();Lt();ui();oa();ci=class{constructor(t,e){this.state=Le.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash");}validateRenderable(t){let e=t.context,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return !!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t));}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s);}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound);}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,be(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t);}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable;}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e);}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=W.get(Ie);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{W.return(e);}),this._graphicsBatchesHash[t]=null;}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null;}};ci.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"graphics"};});var Pa=p(()=>{k();js();Zd();R.add(ci);R.add(pr);});var ve,qs=p(()=>{ve=class{constructor(){this.batcherName="default",this.packAsQuad=false,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1;}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t;}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1;}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1);}get uvs(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}};});var di,Qd=p(()=>{k();tt();ei();ye();ri();Lt();ui();qs();di=class{constructor(t,e){this.localUniforms=new Mt({uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Ot({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash");}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return true;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,true;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return false}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e);}else r.break(e),e.add(t);}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e);}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(W.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound);}execute(t){if(!t.isRenderable)return;t.state.blendMode=le(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),be(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t);}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=W.get(ve);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&W.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null;}};di.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"mesh"};});var Ma=p(()=>{k();Qd();R.add(di);});var Zs,Jd=p(()=>{Zs=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let l=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,l,0);}};});function Ca(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var tf=p(()=>{});function rf(i){return {dynamicUpdate:ef(i,true),staticUpdate:ef(i,false)}}function ef(i,t){let e=[];e.push(`
|
|
253
|
+
`}};});var sa,nd,ad=p(()=>{sa=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],nd=sa.reduce((i,t)=>(i[t]=true,i),{});});function hd(i,t){switch(i){case "f32":return 0;case "vec2<f32>":return new Float32Array(2*t);case "vec3<f32>":return new Float32Array(3*t);case "vec4<f32>":return new Float32Array(4*t);case "mat2x2<f32>":return new Float32Array([1,0,0,1]);case "mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case "mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var ld=p(()=>{});var ud,At,ve=p(()=>{Mt();ks();ad();ld();ud=class cd{constructor(t,e){this._touched=0,this.uid=Y("uniform"),this._resourceType="uniformGroup",this._resourceId=Y("resource"),this.isUniformGroup=true,this._dirtyId=0,this.destroyed=false,e={...cd.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!nd[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${sa.join(", ")}`);o.value??(o.value=hd(o.type,o.size)),r[s]=o.value;}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=nr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group");}update(){this._dirtyId++;}};ud.defaultOptions={ubo:false,isStatic:false};At=ud;});function Vs(i){let t=dd[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=dd[i]=new At({uTextures:{value:e,type:"i32",size:i}},{isStatic:true}),t}var dd,oa=p(()=>{ve();dd={};});var re,ai=p(()=>{re=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(re||{});});var ie,hi=p(()=>{Ft();Mt();Rs();ii();Ds();ai();ve();ie=class i extends j{constructor(t){super(),this.uid=Y("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=re.WEBGPU),r&&(n|=re.WEBGL)),this.compatibleRenderers=n;let h={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let l in a)for(let u in a[l]){let c=a[l][u];h[c]={group:l,binding:u,name:c};}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,h[u.name]=u;});}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[c.name]=c;});let l=0;for(let u in o)h[u]||(s[99]||(s[99]=new Ht,this._ownedBindGroups.push(s[99])),h[u]={group:99,binding:l,name:u},a[99]=a[99]||{},a[99][l]=u,l++);for(let u in o){let c=u,f=o[u];!f.source&&!f._resourceType&&(f=new At(f));let d=h[c];d&&(s[d.group]||(s[d.group]=new Ht,this._ownedBindGroups.push(s[d.group])),s[d.group].setResource(f,d.binding));}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,h);}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new Ht,this._ownedBindGroups.push(this.groups[e]));}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding);}});}return r}destroy(t=false){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy();}),this._ownedBindGroups=null,this.resources=null,this.groups=null;}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=ye.from(e)),r&&(n=ar.from(r)),new i({gpuProgram:o,glProgram:n,...s})}};});var Ns,fd=p(()=>{Us();ta();ia();Ws();oa();hi();Ns=class extends ie{constructor(t){let e=ur({name:"batch",bits:[Os,Hs(t),dr]}),r=lr({name:"batch",bits:[Ls,zs(t),cr]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:Vs(t)}});}};});var pd,md,xd,_d=p(()=>{k();lc();fc();fd();pd=null,md=class gd extends hc{constructor(){super(...arguments),this.geometry=new Bs,this.shader=pd||(pd=new Ns(this.maxTextures)),this.name=gd.extension.name,this.vertexSize=6;}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,h=a.a,l=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,{positions:m,uvs:x}=t,g=t.color,_=t.attributeOffset,y=_+t.attributeSize;for(let b=_;b<y;b++){let v=b*2,P=m[v],T=m[v+1];e[s++]=h*P+u*T+f,e[s++]=c*T+l*P+d,e[s++]=x[v],e[s++]=x[v+1],r[s++]=g,r[s++]=n;}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,h=a.a,l=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,m=t.bounds,x=m.maxX,g=m.minX,_=m.maxY,y=m.minY,b=n.uvs,v=t.color,P=o<<16|t.roundPixels&65535;e[s+0]=h*g+u*y+f,e[s+1]=c*y+l*g+d,e[s+2]=b.x0,e[s+3]=b.y0,r[s+4]=v,r[s+5]=P,e[s+6]=h*x+u*y+f,e[s+7]=c*y+l*x+d,e[s+8]=b.x1,e[s+9]=b.y1,r[s+10]=v,r[s+11]=P,e[s+12]=h*x+u*_+f,e[s+13]=c*_+l*x+d,e[s+14]=b.x2,e[s+15]=b.y2,r[s+16]=v,r[s+17]=P,e[s+18]=h*g+u*_+f,e[s+19]=c*_+l*g+d,e[s+20]=b.x3,e[s+21]=b.y3,r[s+22]=v,r[s+23]=P;}};md.extension={type:[S.Batcher],name:"default"};xd=md;});function yd(i,t,e,r,s,o,n,a=null){let h=0;e*=t,s*=o;let l=a.a,u=a.b,c=a.c,f=a.d,d=a.tx,m=a.ty;for(;h<n;){let x=i[e],g=i[e+1];r[s]=l*x+c*g+d,r[s+1]=u*x+f*g+m,s+=o,e+=t,h++;}}function bd(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++;}var vd=p(()=>{});function na(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,h=t.d,l=t.tx,u=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let c=e*r;for(let f=0;f<s;f++){let d=i[c],m=i[c+1];i[c]=o*d+a*m+l,i[c+1]=n*d+h*m+u,c+=r;}}var Sd=p(()=>{});var jg,Ue,aa=p(()=>{et();jo();jg=new M,Ue=class{constructor(){this.packAsQuad=false,this.batcherName="default",this.topology="triangle-list",this.applyTransform=true,this.roundPixels=0,this._batcher=null,this._batch=null;}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?is(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||jg}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology;}reset(){this.applyTransform=true,this.renderable=null,this.topology="triangle-list";}};});var fr,Td,wd,Pd=p(()=>{k();fr={extension:{type:S.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let v=i;e=v.x,r=v.y,n=a=v.radius,s=o=0;}else if(i.type==="ellipse"){let v=i;e=v.x,r=v.y,n=v.halfWidth,a=v.halfHeight,s=o=0;}else {let v=i,P=v.width/2,T=v.height/2;e=v.x+P,r=v.y+T,n=a=Math.max(0,Math.min(v.radius,Math.min(P,T))),s=P-n,o=T-a;}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let h=Math.ceil(2.3*Math.sqrt(n+a)),l=h*8+(s?4:0)+(o?4:0);if(l===0)return t;if(h===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let u=0,c=h*4+(s?2:0)+2,f=c,d=l,m=s+n,x=o,g=e+m,_=e-m,y=r+x;if(t[u++]=g,t[u++]=y,t[--c]=y,t[--c]=_,o){let v=r-x;t[f++]=_,t[f++]=v,t[--d]=v,t[--d]=g;}for(let v=1;v<h;v++){let P=Math.PI/2*(v/h),T=s+Math.cos(P)*n,w=o+Math.sin(P)*a,E=e+T,R=e-T,A=r+w,C=r-w;t[u++]=E,t[u++]=A,t[--c]=A,t[--c]=R,t[f++]=R,t[f++]=C,t[--d]=C,t[--d]=E;}m=s,x=o+a,g=e+m,_=e-m,y=r+x;let b=r-x;return t[u++]=g,t[u++]=y,t[--d]=b,t[--d]=g,s&&(t[u++]=_,t[u++]=y,t[--d]=b,t[--d]=_),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let u=0;u<i.length;u+=2)n+=i[u],a+=i[u+1];n/=i.length/2,a/=i.length/2;let h=r;t[h*e]=n,t[h*e+1]=a;let l=h++;for(let u=0;u<i.length;u+=2)t[h*e]=i[u],t[h*e+1]=i[u+1],u>0&&(s[o++]=h,s[o++]=l,s[o++]=h-1),h++;s[o++]=l+1,s[o++]=l,s[o++]=h-1;}},Td={...fr,extension:{...fr.extension,name:"ellipse"}},wd={...fr,extension:{...fr.extension,name:"roundedRectangle"}};});function Md(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a;}return e<0?-1:1}var Cd=p(()=>{});function Ad(i,t,e,r,s,o,n,a){let h=i-e*s,l=t-r*s,u=i+e*o,c=t+r*o,f,d;n?(f=r,d=-e):(f=-r,d=e);let m=h+f,x=l+d,g=u+f,_=c+d;return a.push(m,x),a.push(g,_),2}function Le(i,t,e,r,s,o,n,a){let h=e-i,l=r-t,u=Math.atan2(h,l),c=Math.atan2(s-i,o-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let f=u,d=c-u,m=Math.abs(d),x=Math.sqrt(h*h+l*l),g=(15*m*Math.sqrt(x)/Math.PI>>0)+1,_=d/g;if(f+=_,a){n.push(i,t),n.push(e,r);for(let y=1,b=f;y<g;y++,b+=_)n.push(i,t),n.push(i+Math.sin(b)*x,t+Math.cos(b)*x);n.push(i,t),n.push(s,o);}else {n.push(e,r),n.push(i,t);for(let y=1,b=f;y<g;y++,b+=_)n.push(i+Math.sin(b)*x,t+Math.cos(b)*x),n.push(i,t);n.push(s,o),n.push(i,t);}return g*2}function Ed(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,h=a.alignment;if(t.alignment!==.5){let tt=Md(i);h=(h-.5)*tt+.5;}let l=new $(i[0],i[1]),u=new $(i[i.length-2],i[i.length-1]),c=r,f=Math.abs(l.x-u.x)<n&&Math.abs(l.y-u.y)<n;if(c){i=i.slice(),f&&(i.pop(),i.pop(),u.set(i[i.length-2],i[i.length-1]));let tt=(l.x+u.x)*.5,pe=(u.y+l.y)*.5;i.unshift(tt,pe),i.push(tt,pe);}let d=s,m=i.length/2,x=i.length,g=d.length/2,_=a.width/2,y=_*_,b=a.miterLimit*a.miterLimit,v=i[0],P=i[1],T=i[2],w=i[3],E=0,R=0,A=-(P-w),C=v-T,O=0,Q=0,xt=Math.sqrt(A*A+C*C);A/=xt,C/=xt,A*=_,C*=_;let Br=h,L=(1-Br)*2,H=Br*2;c||(a.cap==="round"?x+=Le(v-A*(L-H)*.5,P-C*(L-H)*.5,v-A*L,P-C*L,v+A*H,P+C*H,d,true)+2:a.cap==="square"&&(x+=Ad(v,P,A,C,L,H,true,d))),d.push(v-A*L,P-C*L),d.push(v+A*H,P+C*H);for(let tt=1;tt<m-1;++tt){v=i[(tt-1)*2],P=i[(tt-1)*2+1],T=i[tt*2],w=i[tt*2+1],E=i[(tt+1)*2],R=i[(tt+1)*2+1],A=-(P-w),C=v-T,xt=Math.sqrt(A*A+C*C),A/=xt,C/=xt,A*=_,C*=_,O=-(w-R),Q=T-E,xt=Math.sqrt(O*O+Q*Q),O/=xt,Q/=xt,O*=_,Q*=_;let pe=T-v,kr=P-w,Fr=T-E,Rr=R-w,Sh=pe*Fr+kr*Rr,Li=kr*Fr-Rr*pe,Gr=Li<0;if(Math.abs(Li)<.001*Math.abs(Sh)){d.push(T-A*L,w-C*L),d.push(T+A*H,w+C*H),Sh>=0&&(a.join==="round"?x+=Le(T,w,T-A*L,w-C*L,T-O*L,w-Q*L,d,false)+4:x+=2,d.push(T-O*H,w-Q*H),d.push(T+O*L,w+Q*L));continue}let Th=(-A+v)*(-C+w)-(-A+T)*(-C+P),wh=(-O+E)*(-Q+w)-(-O+T)*(-Q+R),Oi=(pe*wh-Fr*Th)/Li,zi=(Rr*Th-kr*wh)/Li,ko=(Oi-T)*(Oi-T)+(zi-w)*(zi-w),Pe=T+(Oi-T)*L,Me=w+(zi-w)*L,Ce=T-(Oi-T)*H,Ae=w-(zi-w)*H,Om=Math.min(pe*pe+kr*kr,Fr*Fr+Rr*Rr),Ph=Gr?L:H,zm=Om+Ph*Ph*y;ko<=zm?a.join==="bevel"||ko/y>b?(Gr?(d.push(Pe,Me),d.push(T+A*H,w+C*H),d.push(Pe,Me),d.push(T+O*H,w+Q*H)):(d.push(T-A*L,w-C*L),d.push(Ce,Ae),d.push(T-O*L,w-Q*L),d.push(Ce,Ae)),x+=2):a.join==="round"?Gr?(d.push(Pe,Me),d.push(T+A*H,w+C*H),x+=Le(T,w,T+A*H,w+C*H,T+O*H,w+Q*H,d,true)+4,d.push(Pe,Me),d.push(T+O*H,w+Q*H)):(d.push(T-A*L,w-C*L),d.push(Ce,Ae),x+=Le(T,w,T-A*L,w-C*L,T-O*L,w-Q*L,d,false)+4,d.push(T-O*L,w-Q*L),d.push(Ce,Ae)):(d.push(Pe,Me),d.push(Ce,Ae)):(d.push(T-A*L,w-C*L),d.push(T+A*H,w+C*H),a.join==="round"?Gr?x+=Le(T,w,T+A*H,w+C*H,T+O*H,w+Q*H,d,true)+2:x+=Le(T,w,T-A*L,w-C*L,T-O*L,w-Q*L,d,false)+2:a.join==="miter"&&ko/y<=b&&(Gr?(d.push(Ce,Ae),d.push(Ce,Ae)):(d.push(Pe,Me),d.push(Pe,Me)),x+=2),d.push(T-O*L,w-Q*L),d.push(T+O*H,w+Q*H),x+=2);}v=i[(m-2)*2],P=i[(m-2)*2+1],T=i[(m-1)*2],w=i[(m-1)*2+1],A=-(P-w),C=v-T,xt=Math.sqrt(A*A+C*C),A/=xt,C/=xt,A*=_,C*=_,d.push(T-A*L,w-C*L),d.push(T+A*H,w+C*H),c||(a.cap==="round"?x+=Le(T-A*(L-H)*.5,w-C*(L-H)*.5,T-A*L,w-C*L,T+A*H,w+C*H,d,false)+2:a.cap==="square"&&(x+=Ad(T,w,A,C,L,H,false,d)));let Lm=1e-4*1e-4;for(let tt=g;tt<x+g-2;++tt)v=d[tt*2],P=d[tt*2+1],T=d[(tt+1)*2],w=d[(tt+1)*2+1],E=d[(tt+2)*2],R=d[(tt+2)*2+1],!(Math.abs(v*(w-R)+T*(R-P)+E*(P-w))<Lm)&&o.push(tt,tt+1,tt+2);}var Bd=p(()=>{Nt();Cd();});function kd(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],h=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-h)<s,u=e,c=i.length/2,f=u.length/2;for(let d=0;d<c;d++)u.push(i[d*2]),u.push(i[d*2+1]);for(let d=0;d<c-1;d++)r.push(f+d,f+d+1);l&&r.push(f+c-1,f);}var Fd=p(()=>{});var da=Fo((iM,ca)=>{ca.exports=Xs;ca.exports.default=Xs;function Xs(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Gd(i,0,s,e,true),n=[];if(!o||o.next===o.prev)return n;var a,h,l,u,c,f,d;if(r&&(o=ex(i,t,o,e)),i.length>80*e){a=l=i[0],h=u=i[1];for(var m=e;m<s;m+=e)c=i[m],f=i[m+1],c<a&&(a=c),f<h&&(h=f),c>l&&(l=c),f>u&&(u=f);d=Math.max(l-a,u-h),d=d!==0?32767/d:0;}return li(o,n,e,a,h,d,0),n}function Gd(i,t,e,r,s){var o,n;if(s===ua(i,t,e,r)>0)for(o=t;o<e;o+=r)n=Rd(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=Rd(o,i[o],i[o+1],n);return n&&js(n,n.next)&&(ci(n),n=n.next),n}function Oe(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=false,!e.steiner&&(js(e,e.next)||ht(e.prev,e,e.next)===0)){if(ci(e),e=t=e.prev,e===e.next)break;r=true;}else e=e.next;while(r||e!==t);return t}function li(i,t,e,r,s,o,n){if(i){!n&&o&&nx(i,r,s,o);for(var a=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,o?Qg(i,r,s,o):Zg(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),ci(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=Jg(Oe(i),t,e),li(i,t,e,r,s,o,2)):n===2&&tx(i,t,e,r,s,o):li(Oe(i),t,e,r,s,o,1);break}}}}function Zg(i){var t=i.prev,e=i,r=i.next;if(ht(t,e,r)>=0)return false;for(var s=t.x,o=e.x,n=r.x,a=t.y,h=e.y,l=r.y,u=s<o?s<n?s:n:o<n?o:n,c=a<h?a<l?a:l:h<l?h:l,f=s>o?s>n?s:n:o>n?o:n,d=a>h?a>l?a:l:h>l?h:l,m=r.next;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=c&&m.y<=d&&pr(s,a,o,h,n,l,m.x,m.y)&&ht(m.prev,m,m.next)>=0)return false;m=m.next;}return true}function Qg(i,t,e,r){var s=i.prev,o=i,n=i.next;if(ht(s,o,n)>=0)return false;for(var a=s.x,h=o.x,l=n.x,u=s.y,c=o.y,f=n.y,d=a<h?a<l?a:l:h<l?h:l,m=u<c?u<f?u:f:c<f?c:f,x=a>h?a>l?a:l:h>l?h:l,g=u>c?u>f?u:f:c>f?c:f,_=ha(d,m,t,e,r),y=ha(x,g,t,e,r),b=i.prevZ,v=i.nextZ;b&&b.z>=_&&v&&v.z<=y;){if(b.x>=d&&b.x<=x&&b.y>=m&&b.y<=g&&b!==s&&b!==n&&pr(a,u,h,c,l,f,b.x,b.y)&&ht(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=d&&v.x<=x&&v.y>=m&&v.y<=g&&v!==s&&v!==n&&pr(a,u,h,c,l,f,v.x,v.y)&&ht(v.prev,v,v.next)>=0))return false;v=v.nextZ;}for(;b&&b.z>=_;){if(b.x>=d&&b.x<=x&&b.y>=m&&b.y<=g&&b!==s&&b!==n&&pr(a,u,h,c,l,f,b.x,b.y)&&ht(b.prev,b,b.next)>=0)return false;b=b.prevZ;}for(;v&&v.z<=y;){if(v.x>=d&&v.x<=x&&v.y>=m&&v.y<=g&&v!==s&&v!==n&&pr(a,u,h,c,l,f,v.x,v.y)&&ht(v.prev,v,v.next)>=0)return false;v=v.nextZ;}return true}function Jg(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!js(s,o)&&Id(s,r,r.next,o)&&ui(s,o)&&ui(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),ci(r),ci(r.next),r=i=o),r=r.next;}while(r!==i);return Oe(r)}function tx(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&lx(n,a)){var h=Dd(n,a);n=Oe(n,n.next),h=Oe(h,h.next),li(n,t,e,r,s,o,0),li(h,t,e,r,s,o,0);return}a=a.next;}n=n.next;}while(n!==i)}function ex(i,t,e,r){var s=[],o,n,a,h,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,h=o<n-1?t[o+1]*r:i.length,l=Gd(i,a,h,r,false),l===l.next&&(l.steiner=true),s.push(hx(l));for(s.sort(rx),o=0;o<s.length;o++)e=ix(s[o],e);return e}function rx(i,t){return i.x-t.x}function ix(i,t){var e=sx(i,t);if(!e)return t;var r=Dd(e,i);return Oe(r,r.next),Oe(e,e.next)}function sx(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;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<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next;}while(e!==t);if(!n)return null;var h=n,l=n.x,u=n.y,c=1/0,f;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&pr(s<u?r:o,s,l,u,s<u?o:r,s,e.x,e.y)&&(f=Math.abs(s-e.y)/(r-e.x),ui(e,i)&&(f<c||f===c&&(e.x>n.x||e.x===n.x&&ox(n,e)))&&(n=e,c=f)),e=e.next;while(e!==h);return n}function ox(i,t){return ht(i.prev,i,t.prev)<0&&ht(t.next,i,i.next)<0}function nx(i,t,e,r){var s=i;do s.z===0&&(s.z=ha(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,ax(s);}function ax(i){var t,e,r,s,o,n,a,h,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(h=l;a>0||h>0&&r;)a!==0&&(h===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,h--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r;}o.nextZ=null,l*=2;}while(n>1);return i}function ha(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function hx(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function pr(i,t,e,r,s,o,n,a){return (s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function lx(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!ux(i,t)&&(ui(i,t)&&ui(t,i)&&cx(i,t)&&(ht(i.prev,i,t.prev)||ht(i,t.prev,t))||js(i,t)&&ht(i.prev,i,i.next)>0&&ht(t.prev,t,t.next)>0)}function ht(i,t,e){return (t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function js(i,t){return i.x===t.x&&i.y===t.y}function Id(i,t,e,r){var s=Ys(ht(i,t,e)),o=Ys(ht(i,t,r)),n=Ys(ht(e,r,i)),a=Ys(ht(e,r,t));return !!(s!==o&&n!==a||s===0&&$s(i,e,t)||o===0&&$s(i,r,t)||n===0&&$s(e,i,r)||a===0&&$s(e,t,r))}function $s(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Ys(i){return i>0?1:i<0?-1:0}function ux(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Id(e,e.next,i,t))return true;e=e.next;}while(e!==i);return false}function ui(i,t){return ht(i.prev,i,i.next)<0?ht(i,t,i.next)>=0&&ht(i,i.prev,t)>=0:ht(i,t,i.prev)<0||ht(i,i.next,t)<0}function cx(i,t){var e=i,r=false,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function Dd(i,t){var e=new la(i.i,i.x,i.y),r=new la(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function Rd(i,t,e,r){var s=new la(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function ci(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ);}function la(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=false;}Xs.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(ua(i,0,o,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,u=a<h-1?t[a+1]*e:i.length;n-=Math.abs(ua(i,l,u,e));}var c=0;for(a=0;a<r.length;a+=3){var f=r[a]*e,d=r[a+1]*e,m=r[a+2]*e;c+=Math.abs((i[f]-i[m])*(i[d+1]-i[f+1])-(i[f]-i[d])*(i[m+1]-i[f+1]));}return n===0&&c===0?0:Math.abs((c-n)/n)};function ua(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Xs.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r));}return e};});function Ks(i,t,e,r,s,o,n){let a=(0, Ud.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let h=s*r;for(let l=0;l<i.length;l+=2)e[h]=i[l],e[h+1]=i[l+1],h+=r;}var Ud,fa=p(()=>{Ud=Wi(da());});var dx,Ld,Od=p(()=>{k();fa();dx=[],Ld={extension:{type:S.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){Ks(i,dx,t,e,r,s,o);}};});var zd,Hd=p(()=>{k();zd={extension:{type:S.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2;}};});var Wd,Vd=p(()=>{k();Wd={extension:{type:S.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2;}};});function $d(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color);}}function Yd(i,t){let e=at.get().createCanvas(i,t),r=e.getContext("2d");return {canvas:e,context:r}}function fx(i){let t=i[0]??{};return (typeof t=="number"||i[1])&&(I("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??kt.defaultLinearOptions.textureSize}),t}var Nd,ma,kt,mr=p(()=>{Et();Xt();et();Ss();yt();Mt();pt();en();Nd=[{offset:0,color:"white"},{offset:1,color:"black"}],ma=class pa{constructor(...t){this.uid=Y("fillGradient"),this.type="linear",this.colorStops=[];let e=fx(t);e={...e.type==="radial"?pa.defaultRadialOptions:pa.defaultLinearOptions,...os(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color);});}addColorStop(t,e){return this.colorStops.push({offset:t,color:N.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=t;t=r,r=g,o*=-1;}if(n<0){let g=e;e=s,s=g,n*=-1;}}let h=this.colorStops.length?this.colorStops:Nd,l=this._textureSize,{canvas:u,context:c}=Yd(l,1),f=a?c.createLinearGradient(this._textureSize,0,0,0):c.createLinearGradient(0,0,this._textureSize,0);$d(f,h),c.fillStyle=f,c.fillRect(0,0,l,1),this.texture=new F({source:new Jt({resource:u,addressMode:this._wrapMode})});let d=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),x=new M;x.scale(d/l,1),x.rotate(m),x.translate(t,e),this.textureSpace==="local"&&x.scale(l,l),this.transform=x;}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient();}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:Nd,e=this._textureSize,{canvas:r,context:s}=Yd(e,e),{x:o,y:n}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,u=this.outerRadius,c=a-u,f=h-u,d=e/(u*2),m=(o-c)*d,x=(n-f)*d,g=s.createRadialGradient(m,x,l*d,(a-c)*d,(h-f)*d,u*d);$d(g,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=g,s.translate(m,x),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-x),s.fillRect(0,0,e,e),this.texture=new F({source:new Jt({resource:r,addressMode:this._wrapMode})});let _=new M;_.scale(1/d,1/d),_.translate(c,f),this.textureSpace==="local"&&_.scale(e,e),this.transform=_;}get styleKey(){return this.uid}destroy(){this.texture?.destroy(true),this.texture=null;}};ma.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};ma.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};kt=ma;});function Xd(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(mx);t.width&&n.pad(t.width);let{x:a,y:h}=n,l=1/n.width,u=1/n.height,c=-a*l,f=-h*u,d=s.a,m=s.b,x=s.c,g=s.d;s.a*=l,s.b*=l,s.c*=u,s.d*=u,s.tx=c*d+f*x+s.tx,s.ty=c*m+f*g+s.ty;}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return !(t.fill instanceof kt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(px.copyFrom(r).invert()),s}var px,mx,jd=p(()=>{et();Rt();mr();px=new M,mx=new Z;});function qd(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")_x(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,h=o.data.style,l=o.data.hole;n&&l&&Kd(l.shapePath,h,true,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),Kd(a,h,n,r,e);}}}function _x(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,h=[],l=qs.rectangle,u=gx,c=i.image;u.x=i.dx,u.y=i.dy,u.width=i.dw,u.height=i.dh;let f=i.transform;l.build(u,h),f&&na(h,f),l.triangulate(h,r,2,a,o,n);let d=c.uvs;s.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);let m=V.get(Ue);m.indexOffset=n,m.indexSize=o.length-n,m.attributeOffset=a,m.attributeSize=r.length/2-a,m.baseColor=i.style,m.alpha=i.alpha,m.texture=c,m.geometryData=e,t.push(m);}function Kd(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:h,transform:l,holes:u})=>{let c=a.length,f=o.length/2,d=[],m=qs[h.type],x="triangle-list";if(m.build(h,d),l&&na(d,l),e){let b=h.closePath??true,v=t;v.pixelLine?(kd(d,b,o,a),x="line-list"):Ed(d,v,false,b,o,a);}else if(u){let b=[],v=d.slice();yx(u).forEach(T=>{b.push(v.length/2),v.push(...T);}),Ks(v,b,o,2,f,a,c);}else m.triangulate(d,o,2,f,a,c);let g=n.length/2,_=t.texture;if(_!==F.WHITE){let b=Xd(xx,t,h,l);yd(o,2,f,n,g,2,o.length/2-f,b);}else bd(n,g,2,o.length/2-f);let y=V.get(Ue);y.indexOffset=c,y.indexSize=a.length-c,y.attributeOffset=f,y.attributeSize=o.length/2-f,y.baseColor=t.color,y.alpha=t.alpha,y.texture=_,y.geometryData=s,y.topology=x,r.push(y);});}function yx(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];qs[r.type].build(r,s),t.push(s);}return t}var qs,gx,xx,Zd=p(()=>{k();et();Rt();vd();Sd();yt();zt();aa();Pd();Bd();Fd();Od();Hd();Vd();jd();fa();qs={};G.handleByMap(S.ShapeBuilder,qs);G.add(zd,Ld,Wd,fr,Td,wd);gx=new Z,xx=new M;});var ga,xa,ya,gr,Zs=p(()=>{k();Ju();_d();Jo();pt();zt();Zd();ga=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]};}},xa=class{constructor(){this.batcher=new xd,this.instructions=new Ke;}init(){this.instructions.reset();}get geometry(){return I(Zh,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},ya=class _a{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash");}init(t){_a.defaultOptions.bezierSmoothness=t?.bezierSmoothness??_a.defaultOptions.bezierSmoothness;}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),qd(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=false:r==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=false;}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=V.get(xa),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=false;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let u=0;u<r.length;u++){let c=r[u];a.add(c);}a.finish(e.instructions);let h=a.geometry;h.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,true),h.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,true);let l=a.batches;for(let u=0;u<l.length;u++){let c=l[u];c.bindGroup=Qu(c.textures.textures,c.textures.count);}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new ga;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null;}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(V.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{V.return(r);});}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context);}};ya.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"graphicsContext"};ya.defaultOptions={bezierSmoothness:.5};gr=ya;});var bx,ba,va,Sa,Ta,wa,Pa,Ma,ze,Qs=p(()=>{bx={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},ba=0,va=1,Sa=2,Ta=3,wa=4,Pa=5,Ma=class Qd{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=true,this.depthMask=true;}get blend(){return !!(this.data&1<<ba)}set blend(t){!!(this.data&1<<ba)!==t&&(this.data^=1<<ba);}get offsets(){return !!(this.data&1<<va)}set offsets(t){!!(this.data&1<<va)!==t&&(this.data^=1<<va);}set cullMode(t){if(t==="none"){this.culling=false;return}this.culling=true,this.clockwiseFrontFace=t==="front";}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return !!(this.data&1<<Sa)}set culling(t){!!(this.data&1<<Sa)!==t&&(this.data^=1<<Sa);}get depthTest(){return !!(this.data&1<<Ta)}set depthTest(t){!!(this.data&1<<Ta)!==t&&(this.data^=1<<Ta);}get depthMask(){return !!(this.data&1<<Pa)}set depthMask(t){!!(this.data&1<<Pa)!==t&&(this.data^=1<<Pa);}get clockwiseFrontFace(){return !!(this.data&1<<wa)}set clockwiseFrontFace(t){!!(this.data&1<<wa)!==t&&(this.data^=1<<wa);}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=bx[t]||0;}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t;}toString(){return `[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new Qd;return t.depthTest=false,t.blend=true,t}};Ma.default2d=Ma.for2d();ze=Ma;});function Se(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r;}var di=p(()=>{});var fi,Jd=p(()=>{k();Qs();zt();di();aa();fi=class{constructor(t,e){this.state=ze.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash");}validateRenderable(t){let e=t.context,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return !!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t));}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s);}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound);}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Se(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t);}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable;}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e);}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=V.get(Ue);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{V.return(e);}),this._graphicsBatchesHash[t]=null;}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null;}};fi.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"graphics"};});var Ca=p(()=>{k();Zs();Jd();G.add(fi);G.add(gr);});var Te,Js=p(()=>{Te=class{constructor(){this.batcherName="default",this.packAsQuad=false,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1;}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t;}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1;}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1);}get uvs(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}};});var pi,tf=p(()=>{k();et();ii();ve();si();zt();di();Js();pi=class{constructor(t,e){this.localUniforms=new At({uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Ht({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash");}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return true;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,true;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return false}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e);}else r.break(e),e.add(t);}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e);}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(V.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound);}execute(t){if(!t.isRenderable)return;t.state.blendMode=ce(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Se(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t);}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=V.get(Te);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&V.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null;}};pi.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"mesh"};});var Aa=p(()=>{k();tf();G.add(pi);});var to,ef=p(()=>{to=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let l=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,l,0);}};});function Ea(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var rf=p(()=>{});function of(i){return {dynamicUpdate:sf(i,true),staticUpdate:sf(i,false)}}function sf(i,t){let e=[];e.push(`
|
|
254
254
|
|
|
255
255
|
var index = 0;
|
|
256
256
|
|
|
@@ -258,13 +258,13 @@ ${s.join(`
|
|
|
258
258
|
{
|
|
259
259
|
const p = ps[i];
|
|
260
260
|
|
|
261
|
-
`);let r=0;for(let o in i){let n=i[o];if(t!==n.dynamic)continue;e.push(`offset = index + ${r}`),e.push(n.code);let a=
|
|
261
|
+
`);let r=0;for(let o in i){let n=i[o];if(t!==n.dynamic)continue;e.push(`offset = index + ${r}`),e.push(n.code);let a=De(n.format);r+=a.stride/4;}e.push(`
|
|
262
262
|
index += stride * 4;
|
|
263
263
|
}
|
|
264
264
|
`),e.unshift(`
|
|
265
265
|
var stride = ${r};
|
|
266
266
|
`);let s=e.join(`
|
|
267
|
-
`);return new Function("ps","f32v","u32v",s)}var
|
|
267
|
+
`);return new Function("ps","f32v","u32v",s)}var nf=p(()=>{Gs();});function vx(i){let t=[];for(let e in i){let r=i[e];t.push(e,r.code,r.dynamic?"d":"s");}return t.join("_")}var eo,af=p(()=>{or();sr();ni();Gs();On();rf();nf();eo=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let u in r){let c=r[u],f=De(c.format);c.dynamic?o+=f.stride:s+=f.stride;}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new te(e*4*s),this.dynamicAttributeBuffer=new te(e*4*o),this.indexBuffer=Ea(e);let n=new ee,a=0,h=0;this._staticBuffer=new bt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:false,usage:J.VERTEX|J.COPY_DST}),this._dynamicBuffer=new bt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:false,usage:J.VERTEX|J.COPY_DST});for(let u in r){let c=r[u],f=De(c.format);c.dynamic?(n.addAttribute(c.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:c.format}),a+=f.size):(n.addAttribute(c.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:h*4,format:c.format}),h+=f.size);}n.addIndex(this.indexBuffer);let l=this.getParticleUpdate(r);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=n;}getParticleUpdate(t){let e=vx(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return of(t)}update(t,e){t.length>this._size&&(e=true,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new te(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new te(this._size*this._dynamicStride*4*4),this.indexBuffer=Ea(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,true));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,true),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,true);}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy();}};});var hf,lf=p(()=>{hf=`varying vec2 vUV;
|
|
268
268
|
varying vec4 vColor;
|
|
269
269
|
|
|
270
270
|
uniform sampler2D uTexture;
|
|
@@ -272,7 +272,7 @@ uniform sampler2D uTexture;
|
|
|
272
272
|
void main(void){
|
|
273
273
|
vec4 color = texture2D(uTexture, vUV) * vColor;
|
|
274
274
|
gl_FragColor = color;
|
|
275
|
-
}`;});var
|
|
275
|
+
}`;});var uf,cf=p(()=>{uf=`attribute vec2 aVertex;
|
|
276
276
|
attribute vec2 aUV;
|
|
277
277
|
attribute vec4 aColor;
|
|
278
278
|
|
|
@@ -311,7 +311,7 @@ void main(void){
|
|
|
311
311
|
vUV = aUV;
|
|
312
312
|
vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
|
|
313
313
|
}
|
|
314
|
-
`;});var
|
|
314
|
+
`;});var Ba,df=p(()=>{Ba=`
|
|
315
315
|
struct ParticleUniforms {
|
|
316
316
|
uProjectionMatrix:mat3x3<f32>,
|
|
317
317
|
uColor:vec4<f32>,
|
|
@@ -364,8 +364,8 @@ fn mainFragment(
|
|
|
364
364
|
var sample = textureSample(uTexture, uSampler, uv) * color;
|
|
365
365
|
|
|
366
366
|
return sample;
|
|
367
|
-
}`;});var Js,cf=p(()=>{Ct();tt();Bs();Gs();ni();xt();tn();af();lf();uf();Js=class extends ee{constructor(){let t=or.from({vertex:hf,fragment:nf}),e=xe.from({fragment:{source:Aa,entryPoint:"mainFragment"},vertex:{source:Aa,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:F.WHITE.source,uSampler:new is({}),uniforms:{uTranslationMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new V(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}});}};});var mr,Ea=p(()=>{tt();ye();ri();Ks();ui();of();cf();mr=class{constructor(t,e){this.state=Le.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Mt({uTranslationMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Js,this.state=Le.for2d();}validateRenderable(t){return false}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t);}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new Qs({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=false,o.blendMode=le(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,be(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t);}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null);}};});var fi,df=p(()=>{k();Jd();Ea();fi=class extends mr{constructor(t){super(t,new Zs);}};fi.extension={type:[S.WebGLPipes],name:"particle"};});var to,ff=p(()=>{to=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,true),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6});}};});var pi,pf=p(()=>{k();ff();Ea();pi=class extends mr{constructor(t){super(t,new to);}};pi.extension={type:[S.WebGPUPipes],name:"particle"};});var Ba=p(()=>{k();df();pf();R.add(fi);R.add(pi);});var gr,ka=p(()=>{gr=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=true,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null;}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null;}};});function mi(i,t){let{texture:e,bounds:r}=i;gs(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s;}var Fa=p(()=>{An();});var gi,mf=p(()=>{k();Lt();ka();Fa();gi=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText");}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate());}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e);}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r);}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid);}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),W.return(e.batchableSprite),this._gpuText[t]=null;}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=false,mi(s,t);}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture;}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:W.get(gr)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null;}};gi.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"text"};});var Ga,Xt,xi=p(()=>{$t();Or();Ga=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=false;}_createCanvasAndContext(t,e){let r=ot.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return {canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=ne(t),e=ne(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t);}clear(){this._canvasPool={};}},Xt=new Ga;});function gf(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return false;return true}function xf(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return false;return true}function _f(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:true});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,h=0,l=e-1,u=r-1;for(;h<r&&gf(n,e,h);)++h;if(h===r)return q.EMPTY;for(;gf(n,e,u);)--u;for(;xf(n,e,a,h,u);)++a;for(;xf(n,e,l,h,u);)--l;return ++l,++u,new q(a/t,h/t,(l-a)/t,(u-h)/t)}var yf=p(()=>{kt();});var bf,ue,eo=p(()=>{tt();wt();bf={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},ue=class{constructor(t,e){this.uid=$("fillPattern"),this.transform=new M,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=bf[e].addressModeU,t.source.style.addressModeV=bf[e].addressModeV);}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null;}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}};});var Sf=Bo((wC,vf)=>{vf.exports=bx;var Ra={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},yx=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function bx(i){var t=[];return i.replace(yx,function(e,r,s){var o=r.toLowerCase();for(s=Sx(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Ra[o])return s.unshift(r),t.push(s);if(s.length<Ra[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Ra[o])));}}),t}var vx=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function Sx(i){var t=i.match(vx);return t?t.map(Number):[]}});function wf(i,t){let e=(0, Tf.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let h=e[a],l=h[0],u=h;switch(l){case "M":o=u[1],n=u[2],t.moveTo(o,n);break;case "m":o+=u[1],n+=u[2],t.moveTo(o,n);break;case "H":o=u[1],t.lineTo(o,n);break;case "h":o+=u[1],t.lineTo(o,n);break;case "V":n=u[1],t.lineTo(o,n);break;case "v":n+=u[1],t.lineTo(o,n);break;case "L":o=u[1],n=u[2],t.lineTo(o,n);break;case "l":o+=u[1],n+=u[2],t.lineTo(o,n);break;case "C":o=u[5],n=u[6],t.bezierCurveTo(u[1],u[2],u[3],u[4],o,n);break;case "c":t.bezierCurveTo(o+u[1],n+u[2],o+u[3],n+u[4],o+u[5],n+u[6]),o+=u[5],n+=u[6];break;case "S":o=u[3],n=u[4],t.bezierCurveToShort(u[1],u[2],o,n);break;case "s":t.bezierCurveToShort(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case "Q":o=u[3],n=u[4],t.quadraticCurveTo(u[1],u[2],o,n);break;case "q":t.quadraticCurveTo(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case "T":o=u[1],n=u[2],t.quadraticCurveToShort(o,n);break;case "t":o+=u[1],n+=u[2],t.quadraticCurveToShort(o,n);break;case "A":o=u[6],n=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case "a":o+=u[6],n+=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case "Z":case "z":t.closePath(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:O(`Unknown SVG path command: ${l}`);}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s));}return t}var Tf,Pf=p(()=>{Tf=Oi(Sf());bt();});var ro,Mf=p(()=>{kt();ro=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r;}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return false;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return false;let o=this.x-t,n=this.y-e,a=this.radius,h=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+h&&l>a-(r-h)}getBounds(t){return t||(t=new q),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}};});var io,Cf=p(()=>{kt();io=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s;}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return false;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return false;let a=r*(1-s),h=r-a,l=o-h,u=n-h,c=o+a,f=n+a,d=t-this.x,m=e-this.y,x=d*d/(l*l)+m*m/(u*u),g=d*d/(c*c)+m*m/(f*f);return x>1&&g<=1}getBounds(t){return t||(t=new q),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}};});function Af(i,t,e,r,s,o){let n=i-e,a=t-r,h=s-e,l=o-r,u=n*h+a*l,c=h*h+l*l,f=-1;c!==0&&(f=u/c);let d,m;f<0?(d=e,m=r):f>1?(d=s,m=o):(d=e+f*h,m=r+f*l);let x=i-d,g=t-m;return x*x+g*g}var Ef=p(()=>{});var Tx,wx,xr,Bf=p(()=>{Ef();kt();xr=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r;}this.points=e,this.closePath=true;}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],h=e[(s+3)%r];t+=(a-o)*(h+n);}return t<0}containsPolygon(t){let e=this.getBounds(Tx),r=t.getBounds(wx);if(!e.containsRect(r))return false;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return false}return true}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=false,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],u=this.points[n*2+1];h>e!=u>e&&t<(l-a)*((e-h)/(u-h))+a&&(r=!r);}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:h}=this,l=h.length-(this.closePath?0:2);for(let u=0;u<l;u+=2){let c=h[u],f=h[u+1],d=h[(u+2)%h.length],m=h[(u+3)%h.length],x=Af(t,e,c,f,d,m),g=Math.sign((d-c)*(e-f)-(m-f)*(t-c));if(x<=(g<0?a:n))return true}return false}getBounds(t){t||(t=new q);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,h=e.length;a<h;a+=2){let l=e[a],u=e[a+1];r=l<r?l:r,s=l>s?l:s,o=u<o?u:o,n=u>n?u:n;}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}};});var so,oo,kf=p(()=>{kt();so=(i,t,e,r,s,o,n)=>{let a=i-e,h=t-r,l=Math.sqrt(a*a+h*h);return l>=s-o&&l<=s+n},oo=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o;}getBounds(t){return t||(t=new q),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return false;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return true;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return true}return false}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:h,radius:l}=this,u=r*(1-s),c=r-u,f=o+l,d=n+l,m=a-l*2,x=h-l*2,g=o+a,_=n+h;return (t>=o-u&&t<=o+c||t>=g-c&&t<=g+u)&&e>=d&&e<=d+x||(e>=n-u&&e<=n+c||e>=_-c&&e<=_+u)&&t>=f&&t<=f+m?true:t<f&&e<d&&so(t,e,f,d,l,c,u)||t>g-l&&e<d&&so(t,e,g-l,d,l,c,u)||t>g-l&&e>_-l&&so(t,e,g-l,_-l,l,c,u)||t<f&&e>_-l&&so(t,e,f,_-l,l,c,u)}toString(){return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}};});function ao(i,t,e,r,s,o,n,a,h,l){let c=Math.min(.99,Math.max(0,l??pr.defaultOptions.bezierSmoothness)),f=(Mx-c)/1;return f*=f,Cx(t,e,r,s,o,n,a,h,i,f),i}function Cx(i,t,e,r,s,o,n,a,h,l){Ua(i,t,e,r,s,o,n,a,h,l,0),h.push(n,a);}function Ua(i,t,e,r,s,o,n,a,h,l,u){if(u>Px)return;let c=Math.PI,f=(i+e)/2,d=(t+r)/2,m=(e+s)/2,x=(r+o)/2,g=(s+n)/2,_=(o+a)/2,y=(f+m)/2,b=(d+x)/2,v=(m+g)/2,P=(x+_)/2,T=(y+v)/2,w=(b+P)/2;if(u>0){let E=n-i,G=a-t,A=Math.abs((e-n)*G-(r-a)*E),C=Math.abs((s-n)*G-(o-a)*E),L,Z;if(A>no&&C>no){if((A+C)*(A+C)<=l*(E*E+G*G)){if(_r<Ia){h.push(T,w);return}let mt=Math.atan2(o-r,s-e);if(L=Math.abs(mt-Math.atan2(r-t,e-i)),Z=Math.abs(Math.atan2(a-o,n-s)-mt),L>=c&&(L=2*c-L),Z>=c&&(Z=2*c-Z),L+Z<_r){h.push(T,w);return}if(Oe!==0){if(L>Oe){h.push(e,r);return}if(Z>Oe){h.push(s,o);return}}}}else if(A>no){if(A*A<=l*(E*E+G*G)){if(_r<Ia){h.push(T,w);return}if(L=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),L>=c&&(L=2*c-L),L<_r){h.push(e,r),h.push(s,o);return}if(Oe!==0&&L>Oe){h.push(e,r);return}}}else if(C>no){if(C*C<=l*(E*E+G*G)){if(_r<Ia){h.push(T,w);return}if(L=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),L>=c&&(L=2*c-L),L<_r){h.push(e,r),h.push(s,o);return}if(Oe!==0&&L>Oe){h.push(s,o);return}}}else if(E=T-(i+n)/2,G=w-(t+a)/2,E*E+G*G<=l){h.push(T,w);return}}Ua(i,t,f,d,y,b,T,w,h,l,u+1),Ua(T,w,v,P,g,_,n,a,h,l,u+1);}var Px,no,Mx,Ia,_r,Oe,Da=p(()=>{js();Px=8,no=11920929e-14,Mx=1,Ia=.01,_r=0,Oe=0;});function Gf(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??pr.defaultOptions.bezierSmoothness)),u=(Bx-l)/1;return u*=u,Fx(t,e,r,s,o,n,i,u),i}function Fx(i,t,e,r,s,o,n,a){La(n,i,t,e,r,s,o,a,0),n.push(s,o);}function La(i,t,e,r,s,o,n,a,h){if(h>Ax)return;let l=Math.PI,u=(t+r)/2,c=(e+s)/2,f=(r+o)/2,d=(s+n)/2,m=(u+f)/2,x=(c+d)/2,g=o-t,_=n-e,y=Math.abs((r-o)*_-(s-n)*g);if(y>Ex){if(y*y<=a*(g*g+_*_)){if(Ff<kx){i.push(m,x);return}let b=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(b>=l&&(b=2*l-b),b<Ff){i.push(m,x);return}}}else if(g=m-(t+o)/2,_=x-(e+n)/2,g*g+_*_<=a){i.push(m,x);return}La(i,t,e,u,c,m,x,a,h+1),La(i,m,x,f,d,o,n,a,h+1);}var Ax,Ex,Bx,kx,Ff,Rf=p(()=>{js();Ax=8,Ex=11920929e-14,Bx=1,kx=.01,Ff=0;});function ho(i,t,e,r,s,o,n,a){let h=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,u=s;l*=n?-1:1;for(let c=0;c<a+1;c++){let f=Math.cos(u),d=Math.sin(u),m=t+f*r,x=e+d*r;i.push(m,x),u+=l;}}var Oa=p(()=>{});function If(i,t,e,r,s,o){let n=i[i.length-2],h=i[i.length-1]-e,l=n-t,u=s-e,c=r-t,f=Math.abs(h*c-l*u);if(f<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let d=h*h+l*l,m=u*u+c*c,x=h*u+l*c,g=o*Math.sqrt(d)/f,_=o*Math.sqrt(m)/f,y=g*x/d,b=_*x/m,v=g*c+_*l,P=g*u+_*h,T=l*(_+y),w=h*(_+y),E=c*(g+b),G=u*(g+b),A=Math.atan2(w-P,T-v),C=Math.atan2(G-P,E-v);ho(i,v+t,P+e,o,A,C,l*u>c*h);}var Uf=p(()=>{Oa();});function Gx(i,t){let e=t===-1.5707963267948966?-0.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return [{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function Lf(i,t,e,r,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let u=Math.sin(a*_i/360),c=Math.cos(a*_i/360),f=c*(t-r)/2+u*(e-s)/2,d=-u*(t-r)/2+c*(e-s)/2;if(f===0&&d===0)return;o=Math.abs(o),n=Math.abs(n);let m=Math.pow(f,2)/Math.pow(o,2)+Math.pow(d,2)/Math.pow(n,2);m>1&&(o*=Math.sqrt(m),n*=Math.sqrt(m)),Rx(t,e,r,s,o,n,h,l,u,c,f,d,za);let{ang1:x,ang2:g}=za,{centerX:_,centerY:y}=za,b=Math.abs(g)/(_i/4);Math.abs(1-b)<1e-7&&(b=1);let v=Math.max(Math.ceil(b),1);g/=v;let P=i[i.length-2],T=i[i.length-1],w={x:0,y:0};for(let E=0;E<v;E++){let G=Gx(x,g),{x:A,y:C}=Ha(G[0],o,n,c,u,_,y,w),{x:L,y:Z}=Ha(G[1],o,n,c,u,_,y,w),{x:mt,y:Ar}=Ha(G[2],o,n,c,u,_,y,w);ao(i,P,T,A,C,L,Z,mt,Ar),P=mt,T=Ar,x+=g;}}var _i,za,Ha,Df,Rx,Of=p(()=>{Da();_i=Math.PI*2,za={centerX:0,centerY:0,ang1:0,ang2:0},Ha=({x:i,y:t},e,r,s,o,n,a,h)=>{i*=e,t*=r;let l=s*i-o*t,u=o*i+s*t;return h.x=l+n,h.y=u+a,h};Df=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},Rx=(i,t,e,r,s,o,n,a,h,l,u,c,f)=>{let d=Math.pow(s,2),m=Math.pow(o,2),x=Math.pow(u,2),g=Math.pow(c,2),_=d*m-d*g-m*x;_<0&&(_=0),_/=d*g+m*x,_=Math.sqrt(_)*(n===a?-1:1);let y=_*s/o*c,b=_*-o/s*u,v=l*y-h*b+(i+e)/2,P=h*y+l*b+(t+r)/2,T=(u-y)/s,w=(c-b)/o,E=(-u-y)/s,G=(-c-b)/o,A=Df(1,0,T,w),C=Df(T,w,E,G);a===0&&C>0&&(C-=_i),a===1&&C<0&&(C+=_i),f.centerX=v,f.centerY=P,f.ang1=A,f.ang2=C;};});function zf(i,t,e){let r=(n,a)=>{let h=a.x-n.x,l=a.y-n.y,u=Math.sqrt(h*h+l*l),c=h/u,f=l/u;return {len:u,nx:c,ny:f}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y);},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],h=a.radius??e;if(h<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],u=r(a,o),c=r(a,l);if(u.len<1e-4||c.len<1e-4){s(n,a),o=a;continue}let f=Math.asin(u.nx*c.ny-u.ny*c.nx),d=1,m=false;u.nx*c.nx-u.ny*-c.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,m=true):f>0&&(d=-1,m=true);let x=f/2,g,_=Math.abs(Math.cos(x)*h/Math.sin(x));_>Math.min(u.len/2,c.len/2)?(_=Math.min(u.len/2,c.len/2),g=Math.abs(_*Math.sin(x)/Math.cos(x))):g=h;let y=a.x+c.nx*_+-c.ny*g*d,b=a.y+c.ny*_+c.nx*g*d,v=Math.atan2(u.ny,u.nx)+Math.PI/2*d,P=Math.atan2(c.ny,c.nx)-Math.PI/2*d;n===0&&i.moveTo(y+Math.cos(v)*g,b+Math.sin(v)*g),i.arc(y,b,g,v,P,m),o=a;}}function Hf(i,t,e,r){let s=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),o=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let h=t[(a+1)%n],l=h.radius??e;if(l<=0){a===0?i.moveTo(h.x,h.y):i.lineTo(h.x,h.y);continue}let u=t[a],c=t[(a+2)%n],f=s(u,h),d;if(f<1e-4)d=h;else {let g=Math.min(f/2,l);d=o(h,u,g/f);}let m=s(c,h),x;if(m<1e-4)x=h;else {let g=Math.min(m/2,l);x=o(h,c,g/m);}a===0?i.moveTo(d.x,d.y):i.lineTo(d.x,d.y),i.quadraticCurveTo(h.x,h.y,x.x,x.y,r);}}var Wf=p(()=>{});var Ix,lo,Vf=p(()=>{Mf();Cf();Bf();kt();kf();Vt();Da();Rf();Oa();Uf();Of();Wf();Ix=new q,lo=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new st,this._graphicsPath2D=t,this.signed=t.checkForHoles;}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return (s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(false);let a=this._currentPoly.points;return ho(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return If(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let h=this._currentPoly.points;return Lf(h,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let h=this._currentPoly;return ao(this._currentPoly.points,h.lastX,h.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return Gf(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(true),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(true),t.transform(e));let r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data);}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let h=a.shape,l=o?.shape;l&&l.containsPolygon(h)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a;}}}return this}finish(t=false){this.endPoly(t);}rect(t,e,r,s,o){return this.drawShape(new q(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new ro(t,e,r),s),this}poly(t,e,r){let s=new xr(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,h=Math.PI*2/s,l=[];for(let u=0;u<s;u++){let c=a-u*h;l.push(t+r*Math.cos(c),e+r*Math.sin(c));}return this.poly(l,true,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let h=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,h);let l=-1*Math.PI/2+n,u=Math.PI*2/s,c=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){let d=f*u+l,m=t+r*Math.cos(d),x=e+r*Math.sin(d),g=d+Math.PI+c,_=d-Math.PI-c,y=m+o*Math.cos(g),b=x+o*Math.sin(g),v=m+o*Math.cos(_),P=x+o*Math.sin(_);f===0?this.moveTo(y,b):this.lineTo(y,b),this.quadraticCurveTo(m,x,v,P,a);}return this.closePath()}roundShape(t,e,r=false,s){return t.length<3?this:(r?Hf(this,t,e,s):zf(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),h=t+r,l=e+s,u=a<0?-a:0,c=Math.abs(a);return this.moveTo(t,e+c).arcTo(t+u,e+u,t+c,e,c).lineTo(h-c,e).arcTo(h-u,e+u,h,e+c,c).lineTo(h,l-c).arcTo(h-u,l-u,t+r-c,l,c).lineTo(t+c,l).arcTo(t+u,l-u,t,l-c,c).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),h=t+r,l=e+s,u=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-a,t,e+a];for(let c=u.length-1;c>=2;c-=2)u[c]===u[c-2]&&u[c-1]===u[c-3]&&u.splice(c-1,2);return this.poly(u,true,n)}ellipse(t,e,r,s,o){return this.drawShape(new io(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new oo(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new xr,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=false){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=true){if(!this._currentPoly&&(this._currentPoly=new xr,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty;}this._currentPoly.points.push(r,s);}else this._currentPoly.points.push(0,0);}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data);}this.finish();}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(Ix);s.transform?t.addRect(o,s.transform):t.addRect(o);}return t}};});function yi(i,t){return i?i.prepend(t):t.clone()}var Se,Wa=p(()=>{Wt();wt();bt();Pf();Vf();Se=class i{constructor(t,e=false){this.instructions=[],this.uid=$("graphicsPath"),this._dirty=true,this.checkForHoles=e,typeof t=="string"?wf(t,this):this.instructions=t?.slice()??[];}get shapePath(){return this._shapePath||(this._shapePath=new lo(this)),this._dirty&&(this._dirty=false,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=true,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=true,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=true,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=true,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=true,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(N.shared),h=0,l=0;if(!n||n.action!=="bezierCurveTo")h=a.x,l=a.y;else {h=n.data[2],l=n.data[3];let u=a.x,c=a.y;h=u+(u-h),l=c+(c-l);}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,r,s,o]}),this._dirty=true,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=true,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=true,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=true,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=true,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(N.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else {n=s.data[0],a=s.data[1];let h=o.x,l=o.y;n=h+(h-n),a=l+(l-a);}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=true,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=true,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=true,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=true,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=true,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=true,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=true,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=true,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=true,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=true,this}star(t,e,r,s,o,n,a){o||(o=s/2);let h=-1*Math.PI/2+n,l=r*2,u=Math.PI*2/l,c=[];for(let f=0;f<l;f++){let d=f%2?o:s,m=f*u+h;c.push(t+d*Math.cos(m),e+d*Math.sin(m));}return this.poly(c,true,a),this}clone(t=false){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()});}return e}clear(){return this.instructions.length=0,this._dirty=true,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,h=0,l=0,u=0,c=0,f=0,d=0,m=0,x=0;for(let g=0;g<this.instructions.length;g++){let _=this.instructions[g],y=_.data;switch(_.action){case "moveTo":case "lineTo":h=y[0],l=y[1],y[0]=e*h+s*l+n,y[1]=r*h+o*l+a;break;case "bezierCurveTo":u=y[0],c=y[1],f=y[2],d=y[3],h=y[4],l=y[5],y[0]=e*u+s*c+n,y[1]=r*u+o*c+a,y[2]=e*f+s*d+n,y[3]=r*f+o*d+a,y[4]=e*h+s*l+n,y[5]=r*h+o*l+a;break;case "quadraticCurveTo":u=y[0],c=y[1],h=y[2],l=y[3],y[0]=e*u+s*c+n,y[1]=r*u+o*c+a,y[2]=e*h+s*l+n,y[3]=r*h+o*l+a;break;case "arcToSvg":h=y[5],l=y[6],m=y[0],x=y[1],y[0]=e*m+s*x,y[1]=r*m+o*x,y[5]=e*h+s*l+n,y[6]=r*h+o*l+a;break;case "circle":y[4]=yi(y[3],t);break;case "rect":y[4]=yi(y[4],t);break;case "ellipse":y[8]=yi(y[8],t);break;case "roundRect":y[5]=yi(y[5],t);break;case "addPath":y[0].transform(t);break;case "poly":y[2]=yi(y[2],t);break;default:O("unknown transform action",_.action);break}}return this._dirty=true,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e];}switch(r.action){case "moveTo":case "lineTo":t.x=r.data[0],t.y=r.data[1];break;case "quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case "bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case "arc":case "arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case "addPath":r.data[0].getLastPoint(t);break}return t}};});function rt(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var Va=p(()=>{});function Nf(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case "lineargradient":t.defs[n.id]=Ux(n);break;case "radialgradient":t.defs[n.id]=Dx();break;}}}}function Ux(i){let t=rt(i,"x1",0),e=rt(i,"y1",0),r=rt(i,"x2",1),s=rt(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new Et(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let h=i.children[a],l=rt(h,"offset",0),u=V.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,u);}return n}function Dx(i){return O("[SVG Parser] Radial gradients are not yet supported"),new Et(0,0,1,0)}var $f=p(()=>{Ct();bt();fr();Va();});function Na(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var Yf=p(()=>{});function $a(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:false,useStroke:false};for(let n in Xf){let a=i.getAttribute(n);a&&jf(t,o,n,a.trim());}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let h=n[a].trim(),[l,u]=h.split(":");Xf[l]&&jf(t,o,l,u.trim());}}return {strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function jf(i,t,e,r){switch(e){case "stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Na(r);t.strokeStyle.fill=i.defs[s];}else t.strokeStyle.color=V.shared.setValue(r).toNumber();t.useStroke=true;}break;case "stroke-width":t.strokeStyle.width=Number(r);break;case "fill":if(r!=="none"){if(r.startsWith("url(")){let s=Na(r);t.fillStyle.fill=i.defs[s];}else t.fillStyle.color=V.shared.setValue(r).toNumber();t.useFill=true;}break;case "fill-opacity":t.fillStyle.alpha=Number(r);break;case "stroke-opacity":t.strokeStyle.alpha=Number(r);break;case "opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var Xf,Kf=p(()=>{Ct();Yf();Xf={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};});function qf(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg");}let e={context:t,defs:{},path:new Se};Nf(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=$a(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&Zf(a,e,s,o);}return t}function Zf(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=$a(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let h,l,u,c,f,d,m,x,g,_,y,b,v,P,T,w,E;switch(i.nodeName.toLowerCase()){case "path":P=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&O("SVG Evenodd fill rule not supported, your svg may render incorrectly"),T=new Se(P,true),t.context.path(T),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "circle":m=rt(i,"cx",0),x=rt(i,"cy",0),g=rt(i,"r",0),t.context.ellipse(m,x,g,g),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "rect":h=rt(i,"x",0),l=rt(i,"y",0),w=rt(i,"width",0),E=rt(i,"height",0),_=rt(i,"rx",0),y=rt(i,"ry",0),_||y?t.context.roundRect(h,l,w,E,_||y):t.context.rect(h,l,w,E),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "ellipse":m=rt(i,"cx",0),x=rt(i,"cy",0),_=rt(i,"rx",0),y=rt(i,"ry",0),t.context.beginPath(),t.context.ellipse(m,x,_,y),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "line":u=rt(i,"x1",0),c=rt(i,"y1",0),f=rt(i,"x2",0),d=rt(i,"y2",0),t.context.beginPath(),t.context.moveTo(u,c),t.context.lineTo(f,d),r&&t.context.stroke(r);break;case "polygon":v=i.getAttribute("points"),b=v.match(/\d+/g).map(G=>parseInt(G,10)),t.context.poly(b,true),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "polyline":v=i.getAttribute("points"),b=v.match(/\d+/g).map(G=>parseInt(G,10)),t.context.poly(b,false),r&&t.context.stroke(r);break;case "g":case "svg":break;default:{O(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let G=0;G<s.length;G++)Zf(s[G],t,e,r);}var Qf=p(()=>{bt();Wa();$f();Va();Kf();});function Lx(i){return V.isColorLike(i)}function Jf(i){return i instanceof ue}function tp(i){return i instanceof Et}function Ox(i){return i instanceof F}function zx(i,t,e){let r=V.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=F.WHITE,{...e,...i}}function Hx(i,t,e){return i.texture=t,{...e,...i}}function ep(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function rp(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function Wx(i,t){let e={...t,...i},r=V.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function ce(i,t){if(i==null)return null;let e={},r=i;return Lx(i)?zx(e,i,t):Ox(i)?Hx(e,i,t):Jf(i)?ep(e,i,t):tp(i)?rp(e,i,t):r.fill&&Jf(r.fill)?ep(r,r.fill,t):r.fill&&tp(r.fill)?rp(r,r.fill,t):Wx(r,t)}function yr(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=ce(i,h);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var Ya=p(()=>{Ct();xt();fr();eo();});var Vx,ip,Xa,Rt,ja=p(()=>{Bt();Ct();tt();Wt();xt();wt();dt();Vt();Wa();Qf();Ya();Vx=new N,ip=new M,Xa=class re extends X{constructor(){super(...arguments),this.uid=$("graphicsContext"),this.dirty=true,this.batchMode="auto",this.instructions=[],this._activePath=new Se,this._transform=new M,this._fillStyle={...re.defaultFillStyle},this._strokeStyle={...re.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new st,this._boundsDirty=true;}clone(){let t=new re;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=true,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=ce(t,re.defaultFillStyle);}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=yr(t,re.defaultStrokeStyle);}setFillStyle(t){return this._fillStyle=ce(t,re.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=ce(t,re.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?V.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Se,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(I(H,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=ce(t,re.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(N.shared);this._activePath.clear(),this._activePath.moveTo(t,e);}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=yr(t,re.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else {e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,r,s,o,n),this}arcTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,h.a*n+h.c*a+h.tx,h.b*n+h.d*a+h.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*r+h.c*s+h.tx,h.b*r+h.d*s+h.ty,h.a*o+h.c*n+h.tx,h.b*o+h.d*n+h.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,qf(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,r,s,o,n){return t instanceof M?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof M?(this._transform.append(t),this):(ip.set(t,e,r,s,o,n),this._transform.append(ip),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=true,this._boundsDirty=true);}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds);}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform);}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),h=o.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a);}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return false;let e=this.instructions,r=false;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let h=n.style,l=a.shapePath.shapePrimitives;for(let u=0;u<l.length;u++){let c=l[u].shape;if(!h||!c)continue;let f=l[u].transform,d=f?f.applyInverse(t,Vx):t;if(o.action==="fill")r=c.contains(d.x,d.y);else {let x=h;r=c.strokeContains(d.x,d.y,x.width,x.alignment);}let m=n.hole;if(m){let x=m.shapePath?.shapePrimitives;if(x)for(let g=0;g<x.length;g++)x[g].shape.contains(d.x,d.y)&&(r=false);}if(r)return true}}return r}destroy(t=false){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r);}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null;}};Xa.defaultFillStyle={color:16777215,alpha:1,texture:F.WHITE,matrix:null,fill:null,textureSpace:"local"};Xa.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:F.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:false};Rt=Xa;});function uo(i){let t=[],e=0;for(let r=0;r<sp.length;r++){let s=`_${sp[r]}`;t[e++]=i[s];}return e=op(i._fill,t,e),e=Nx(i._stroke,t,e),e=$x(i.dropShadow,t,e),t.join("-")}function op(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function Nx(i,t,e){return i&&(e=op(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function $x(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=V.shared.setValue(i.color).toNumber()),e}var sp,Ka=p(()=>{Ct();sp=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];});function Yx(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=zt.defaultDropShadow;i.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance};}if(t.strokeThickness!==void 0){I(H,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(V.isColorLike(e))r.color=e;else if(e instanceof Et||e instanceof ue)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness};}if(Array.isArray(t.fillGradientStops)){I(H,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=zt.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new Et({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>V.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o);}),i.fill={fill:r};}}var qa,zt,bi=p(()=>{Bt();Ct();dt();fr();eo();ja();Ya();Ka();qa=class br extends X{constructor(t={}){super(),Yx(t);let e={...br.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r];}this.update();}get align(){return this._align}set align(t){this._align=t,this.update();}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update();}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...br.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...br.defaultDropShadow}):null,this.update();}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update();}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update();}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update();}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update();}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update();}get leading(){return this._leading}set leading(t){this._leading=t,this.update();}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update();}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update();}get padding(){return this._padding}set padding(t){this._padding=t,this.update();}get trim(){return this._trim}set trim(t){this._trim=t,this.update();}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update();}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update();}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update();}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update();}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Rt.defaultFillStyle,...t},()=>{this._fill=ce({...this._originalFill},Rt.defaultFillStyle);})),this._fill=ce(t===0?"black":t,Rt.defaultFillStyle),this.update());}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Rt.defaultStrokeStyle,...t},()=>{this._stroke=yr({...this._originalStroke},Rt.defaultStrokeStyle);})),this._stroke=yr(t,Rt.defaultStrokeStyle),this.update());}_generateKey(){return this._styleKey=uo(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this);}reset(){let t=br.defaultTextStyle;for(let e in t)this[e]=t[e];}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new br({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=false){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r);}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null;}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),true)})}_isFillStyle(t){return (t??null)!==null&&!(V.isColorLike(t)||t instanceof Et||t instanceof ue)}};qa.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};qa.defaultTextStyle={align:"left",breakWords:false,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:false,whiteSpace:"pre",wordWrap:false,wordWrapWidth:100};zt=qa;});function co(i,t,e,r){let s=Xx;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=vt.getOptimalTexture(s.width,s.height,r,false);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var Xx,Za=p(()=>{je();Vt();Xx=new st;});function ze(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!jx.includes(s)&&(s=`"${s}"`),e[r]=s;}return `${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var jx,fo=p(()=>{jx=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];});var Qa,jt,ie,Ja=p(()=>{$t();fo();Qa={willReadFrequently:true},jt=class B{static get experimentalLetterSpacingSupported(){let t=B._experimentalLetterSpacingSupported;if(t!==void 0){let e=ot.get().getCanvasRenderingContext2D().prototype;t=B._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e;}return t}constructor(t,e,r,s,o,n,a,h,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l;}static measureText(t=" ",e,r=B._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(B._measurementCache[o])return B._measurementCache[o];let n=ze(e),a=B.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=B.__context;h.font=n;let u=(s?B._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),c=new Array(u.length),f=0;for(let y=0;y<u.length;y++){let b=B._measureText(u[y],e.letterSpacing,h);c[y]=b,f=Math.max(f,b);}let d=e._stroke?.width||0,m=f+d;e.dropShadow&&(m+=e.dropShadow.distance);let x=e.lineHeight||a.fontSize,g=Math.max(x,a.fontSize+d)+(u.length-1)*(x+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new B(t,e,m,g,u,c,x+e.leading,f,a)}static _measureText(t,e,r){let s=false;B.experimentalLetterSpacingSupported&&(B.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=true):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else {let u=(B.graphemeSegmenter(t).length-1)*e;n+=u,l+=u;}return Math.max(n,l)}static _wordWrap(t,e,r=B._canvas){let s=r.getContext("2d",Qa),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=B._collapseSpaces(u),f=B._collapseNewlines(u),d=!c,m=e.wordWrapWidth+l,x=B._tokenize(t);for(let g=0;g<x.length;g++){let _=x[g];if(B._isNewline(_)){if(!f){a+=B._addLine(n),d=!c,n="",o=0;continue}_=" ";}if(c){let b=B.isBreakingSpace(_),v=B.isBreakingSpace(n[n.length-1]);if(b&&v)continue}let y=B._getFromCache(_,l,h,s);if(y>m)if(n!==""&&(a+=B._addLine(n),n="",o=0),B.canBreakWords(_,e.breakWords)){let b=B.wordWrapSplit(_);for(let v=0;v<b.length;v++){let P=b[v],T=P,w=1;for(;b[v+w];){let G=b[v+w];if(!B.canBreakChars(T,G,_,v,e.breakWords))P+=G;else break;T=G,w++;}v+=w-1;let E=B._getFromCache(P,l,h,s);E+o>m&&(a+=B._addLine(n),d=false,n="",o=0),n+=P,o+=E;}}else {n.length>0&&(a+=B._addLine(n),n="",o=0);let b=g===x.length-1;a+=B._addLine(_,!b),d=false,n="",o=0;}else y+o>m&&(d=false,a+=B._addLine(n),n="",o=0),(n.length>0||!B.isBreakingSpace(_)||d)&&(n+=_,o+=y);}return a+=B._addLine(n,false),a}static _addLine(t,e=true){return t=B._trimRight(t),t=e?`${t}
|
|
368
|
-
`:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=B._measureText(t,e,s)+e,r[t]=o),o}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--){let r=t[e];if(!B.isBreakingSpace(r))break;t=t.slice(0,-1);}return t}static _isNewline(t){return typeof t!="string"?false:B._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?false:B._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(B.isBreakingSpace(o,n)||B._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o;}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return true}static wordWrapSplit(t){return B.graphemeSegmenter(t)}static measureFont(t){if(B._fonts[t])return B._fonts[t];let e=B._context;e.font=t;let r=e.measureText(B.METRICS_STRING+B.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return B._fonts[t]=s,s}static clearMetrics(t=""){t?delete B._fonts[t]:B._fonts={};}static get _canvas(){if(!B.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",Qa)?.measureText)return B.__canvas=e,e;t=ot.get().createCanvas();}catch{t=ot.get().createCanvas();}t.width=t.height=10,B.__canvas=t;}return B.__canvas}static get _context(){return B.__context||(B.__context=B._canvas.getContext("2d",Qa)),B.__context}};jt.METRICS_STRING="|\xC9q\xC5";jt.BASELINE_SYMBOL="M";jt.BASELINE_MULTIPLIER=1.4;jt.HEIGHT_MULTIPLIER=2;jt.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();jt.experimentalLetterSpacing=false;jt._fonts={};jt._newlines=[10,13];jt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];jt._measurementCache={};ie=jt;});function vr(i,t,e,r=0){if(i.texture===F.WHITE&&!i.fill)return V.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof ue){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(M.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof Et){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,h=1;n&&e&&(a=e.width+r,h=e.height+r);let l,u=false;if(o){let{start:c,end:f}=s;l=t.createLinearGradient(c.x*a,c.y*h,f.x*a,f.y*h),u=Math.abs(f.x-c.x)<Math.abs((f.y-c.y)*.1);}else {let{center:c,innerRadius:f,outerCenter:d,outerRadius:m}=s;l=t.createRadialGradient(c.x*a,c.y*h,f*a,d.x*a,d.y*h,m*a);}if(u&&n&&e){let c=e.lineHeight/h;for(let f=0;f<e.lines.length;f++){let d=(f*e.lineHeight+r/2)/h;s.colorStops.forEach(m=>{let x=d+m.offset*c;l.addColorStop(Math.floor(x*np)/np,V.shared.setValue(m.color).toHex());});}}else s.colorStops.forEach(c=>{l.addColorStop(c.offset,V.shared.setValue(c.color).toHex());});return l}}else {let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(M.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return O("FillStyle not recognised",i),"red"}var np,th=p(()=>{Ct();tt();xt();bt();fr();eo();np=1e5;});var vi,ap=p(()=>{Ct();k();Or();xi();je();yf();dt();bi();Za();Ja();fo();th();vi=class{constructor(t){this._activeTextures={},this._renderer=t;}getTextureSize(t,e,r){let s=ie.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=ne(o),n=ne(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(I("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof zt||(t.style=new zt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Xt.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=ie.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),h=Xt.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,r,s,h);let u=co(l,n,a,s);if(r.trim){let c=_f(l,s);u.frame.copyFrom(c),u.updateUvs();}return {texture:u,canvasAndContext:h}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++;}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",vt.returnTexture(t);}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(Xt.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null);}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=ze(e),h=ie.measureText(t||" ",e),l=h.lines,u=h.lineHeight,c=h.lineWidths,f=h.maxLineWidth,d=h.fontProperties,m=o.height;if(n.resetTransform(),n.scale(r,r),n.textBaseline=e.textBaseline,e._stroke?.width){let y=e._stroke;n.lineWidth=y.width,n.miterLimit=y.miterLimit,n.lineJoin=y.join,n.lineCap=y.cap;}n.font=a;let x,g,_=e.dropShadow?2:1;for(let y=0;y<_;++y){let b=e.dropShadow&&y===0,v=b?Math.ceil(Math.max(1,m)+e.padding*2):0,P=v*r;if(b){n.fillStyle="black",n.strokeStyle="black";let E=e.dropShadow,G=E.color,A=E.alpha;n.shadowColor=V.shared.setValue(G).setAlpha(A).toRgbaString();let C=E.blur*r,L=E.distance*r;n.shadowBlur=C,n.shadowOffsetX=Math.cos(E.angle)*L,n.shadowOffsetY=Math.sin(E.angle)*L+P;}else {if(n.fillStyle=e._fill?vr(e._fill,n,h):null,e._stroke?.width){let E=e._stroke.width*e._stroke.alignment;n.strokeStyle=vr(e._stroke,n,h,E);}n.shadowColor="black";}let T=(u-d.fontSize)/2;u-d.fontSize<0&&(T=0);let w=e._stroke?.width??0;for(let E=0;E<l.length;E++)x=w/2,g=w/2+E*u+d.ascent+T,e.align==="right"?x+=f-c[E]:e.align==="center"&&(x+=(f-c[E])/2),e._stroke?.width&&this._drawLetterSpacing(l[E],e,s,x+e.padding,g+e.padding-v,true),e._fill!==void 0&&this._drawLetterSpacing(l[E],e,s,x+e.padding,g+e.padding-v);}}_drawLetterSpacing(t,e,r,s,o,n=false){let{context:a}=r,h=e.letterSpacing,l=false;if(ie.experimentalLetterSpacingSupported&&(ie.experimentalLetterSpacing?(a.letterSpacing=`${h}px`,a.textLetterSpacing=`${h}px`,l=true):(a.letterSpacing="0px",a.textLetterSpacing="0px")),h===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let u=s,c=ie.graphemeSegmenter(t),f=a.measureText(t).width,d=0;for(let m=0;m<c.length;++m){let x=c[m];n?a.strokeText(x,u,o):a.fillText(x,u,o);let g="";for(let _=m+1;_<c.length;++_)g+=c[_];d=a.measureText(g).width,u+=f-d+h,f=d;}}destroy(){this._activeTextures=null;}};vi.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"canvasText"};});var eh=p(()=>{k();mf();ap();R.add(vi);R.add(gi);});var po,hp=p(()=>{dt();Sn();ja();po=class i extends Ze{constructor(t){t instanceof Rt&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Rt,this._context.on("update",this.onViewUpdate,this),this.allowChildren=false,this.roundPixels=r??false;}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate());}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===true||t?.context===true)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t);}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t;}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t;}clone(t=false){return t?new i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){I(H,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){I(H,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){I(H,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return (t.width!==Rt.defaultStrokeStyle.width||t.color!==Rt.defaultStrokeStyle.color||t.alpha!==Rt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return I(H,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return I(H,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return I(H,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return I(H,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return I(H,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return I(H,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}};});var lp,up,cp=p(()=>{lp={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
367
|
+
}`;});var ro,ff=p(()=>{Et();et();Rs();Ds();hi();yt();rn();lf();cf();df();ro=class extends ie{constructor(){let t=ar.from({vertex:uf,fragment:hf}),e=ye.from({fragment:{source:Ba,entryPoint:"mainFragment"},vertex:{source:Ba,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:F.WHITE.source,uSampler:new ns({}),uniforms:{uTranslationMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new N(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}});}};});var xr,ka=p(()=>{et();ve();si();Qs();di();af();ff();xr=class{constructor(t,e){this.state=ze.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new At({uTranslationMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new ro,this.state=ze.for2d();}validateRenderable(t){return false}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t);}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new eo({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=false,o.blendMode=ce(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Se(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t);}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null);}};});var mi,pf=p(()=>{k();ef();ka();mi=class extends xr{constructor(t){super(t,new to);}};mi.extension={type:[S.WebGLPipes],name:"particle"};});var io,mf=p(()=>{io=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,true),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6});}};});var gi,gf=p(()=>{k();mf();ka();gi=class extends xr{constructor(t){super(t,new io);}};gi.extension={type:[S.WebGPUPipes],name:"particle"};});var Fa=p(()=>{k();pf();gf();G.add(mi);G.add(gi);});var _r,Ra=p(()=>{_r=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=true,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null;}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null;}};});function xi(i,t){let{texture:e,bounds:r}=i;ys(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s;}var Ga=p(()=>{Bn();});var _i,xf=p(()=>{k();zt();Ra();Ga();_i=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText");}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate());}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e);}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r);}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid);}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),V.return(e.batchableSprite),this._gpuText[t]=null;}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=false,xi(s,t);}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture;}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:V.get(_r)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null;}};_i.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"text"};});var Ia,Kt,yi=p(()=>{Xt();Hr();Ia=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=false;}_createCanvasAndContext(t,e){let r=at.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return {canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=he(t),e=he(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t);}clear(){this._canvasPool={};}},Kt=new Ia;});function _f(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return false;return true}function yf(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return false;return true}function bf(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:true});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,h=0,l=e-1,u=r-1;for(;h<r&&_f(n,e,h);)++h;if(h===r)return Z.EMPTY;for(;_f(n,e,u);)--u;for(;yf(n,e,a,h,u);)++a;for(;yf(n,e,l,h,u);)--l;return ++l,++u,new Z(a/t,h/t,(l-a)/t,(u-h)/t)}var vf=p(()=>{Rt();});var Sf,de,so=p(()=>{et();Mt();Sf={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},de=class{constructor(t,e){this.uid=Y("fillPattern"),this.transform=new M,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Sf[e].addressModeU,t.source.style.addressModeV=Sf[e].addressModeV);}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null;}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}};});var wf=Fo((CC,Tf)=>{Tf.exports=Tx;var Da={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},Sx=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function Tx(i){var t=[];return i.replace(Sx,function(e,r,s){var o=r.toLowerCase();for(s=Px(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Da[o])return s.unshift(r),t.push(s);if(s.length<Da[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Da[o])));}}),t}var wx=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function Px(i){var t=i.match(wx);return t?t.map(Number):[]}});function Mf(i,t){let e=(0, Pf.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let h=e[a],l=h[0],u=h;switch(l){case "M":o=u[1],n=u[2],t.moveTo(o,n);break;case "m":o+=u[1],n+=u[2],t.moveTo(o,n);break;case "H":o=u[1],t.lineTo(o,n);break;case "h":o+=u[1],t.lineTo(o,n);break;case "V":n=u[1],t.lineTo(o,n);break;case "v":n+=u[1],t.lineTo(o,n);break;case "L":o=u[1],n=u[2],t.lineTo(o,n);break;case "l":o+=u[1],n+=u[2],t.lineTo(o,n);break;case "C":o=u[5],n=u[6],t.bezierCurveTo(u[1],u[2],u[3],u[4],o,n);break;case "c":t.bezierCurveTo(o+u[1],n+u[2],o+u[3],n+u[4],o+u[5],n+u[6]),o+=u[5],n+=u[6];break;case "S":o=u[3],n=u[4],t.bezierCurveToShort(u[1],u[2],o,n);break;case "s":t.bezierCurveToShort(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case "Q":o=u[3],n=u[4],t.quadraticCurveTo(u[1],u[2],o,n);break;case "q":t.quadraticCurveTo(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case "T":o=u[1],n=u[2],t.quadraticCurveToShort(o,n);break;case "t":o+=u[1],n+=u[2],t.quadraticCurveToShort(o,n);break;case "A":o=u[6],n=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case "a":o+=u[6],n+=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case "Z":case "z":t.closePath(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:z(`Unknown SVG path command: ${l}`);}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s));}return t}var Pf,Cf=p(()=>{Pf=Wi(wf());St();});var oo,Af=p(()=>{Rt();oo=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r;}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return false;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return false;let o=this.x-t,n=this.y-e,a=this.radius,h=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+h&&l>a-(r-h)}getBounds(t){return t||(t=new Z),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}};});var no,Ef=p(()=>{Rt();no=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s;}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return false;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return false;let a=r*(1-s),h=r-a,l=o-h,u=n-h,c=o+a,f=n+a,d=t-this.x,m=e-this.y,x=d*d/(l*l)+m*m/(u*u),g=d*d/(c*c)+m*m/(f*f);return x>1&&g<=1}getBounds(t){return t||(t=new Z),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}};});function Bf(i,t,e,r,s,o){let n=i-e,a=t-r,h=s-e,l=o-r,u=n*h+a*l,c=h*h+l*l,f=-1;c!==0&&(f=u/c);let d,m;f<0?(d=e,m=r):f>1?(d=s,m=o):(d=e+f*h,m=r+f*l);let x=i-d,g=t-m;return x*x+g*g}var kf=p(()=>{});var Mx,Cx,yr,Ff=p(()=>{kf();Rt();yr=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r;}this.points=e,this.closePath=true;}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],h=e[(s+3)%r];t+=(a-o)*(h+n);}return t<0}containsPolygon(t){let e=this.getBounds(Mx),r=t.getBounds(Cx);if(!e.containsRect(r))return false;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return false}return true}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=false,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],u=this.points[n*2+1];h>e!=u>e&&t<(l-a)*((e-h)/(u-h))+a&&(r=!r);}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:h}=this,l=h.length-(this.closePath?0:2);for(let u=0;u<l;u+=2){let c=h[u],f=h[u+1],d=h[(u+2)%h.length],m=h[(u+3)%h.length],x=Bf(t,e,c,f,d,m),g=Math.sign((d-c)*(e-f)-(m-f)*(t-c));if(x<=(g<0?a:n))return true}return false}getBounds(t){t||(t=new Z);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,h=e.length;a<h;a+=2){let l=e[a],u=e[a+1];r=l<r?l:r,s=l>s?l:s,o=u<o?u:o,n=u>n?u:n;}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return `[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}};});var ao,ho,Rf=p(()=>{Rt();ao=(i,t,e,r,s,o,n)=>{let a=i-e,h=t-r,l=Math.sqrt(a*a+h*h);return l>=s-o&&l<=s+n},ho=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o;}getBounds(t){return t||(t=new Z),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return false;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return true;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return true}return false}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:h,radius:l}=this,u=r*(1-s),c=r-u,f=o+l,d=n+l,m=a-l*2,x=h-l*2,g=o+a,_=n+h;return (t>=o-u&&t<=o+c||t>=g-c&&t<=g+u)&&e>=d&&e<=d+x||(e>=n-u&&e<=n+c||e>=_-c&&e<=_+u)&&t>=f&&t<=f+m?true:t<f&&e<d&&ao(t,e,f,d,l,c,u)||t>g-l&&e<d&&ao(t,e,g-l,d,l,c,u)||t>g-l&&e>_-l&&ao(t,e,g-l,_-l,l,c,u)||t<f&&e>_-l&&ao(t,e,f,_-l,l,c,u)}toString(){return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}};});function uo(i,t,e,r,s,o,n,a,h,l){let c=Math.min(.99,Math.max(0,l??gr.defaultOptions.bezierSmoothness)),f=(Ex-c)/1;return f*=f,Bx(t,e,r,s,o,n,a,h,i,f),i}function Bx(i,t,e,r,s,o,n,a,h,l){La(i,t,e,r,s,o,n,a,h,l,0),h.push(n,a);}function La(i,t,e,r,s,o,n,a,h,l,u){if(u>Ax)return;let c=Math.PI,f=(i+e)/2,d=(t+r)/2,m=(e+s)/2,x=(r+o)/2,g=(s+n)/2,_=(o+a)/2,y=(f+m)/2,b=(d+x)/2,v=(m+g)/2,P=(x+_)/2,T=(y+v)/2,w=(b+P)/2;if(u>0){let E=n-i,R=a-t,A=Math.abs((e-n)*R-(r-a)*E),C=Math.abs((s-n)*R-(o-a)*E),O,Q;if(A>lo&&C>lo){if((A+C)*(A+C)<=l*(E*E+R*R)){if(br<Ua){h.push(T,w);return}let xt=Math.atan2(o-r,s-e);if(O=Math.abs(xt-Math.atan2(r-t,e-i)),Q=Math.abs(Math.atan2(a-o,n-s)-xt),O>=c&&(O=2*c-O),Q>=c&&(Q=2*c-Q),O+Q<br){h.push(T,w);return}if(He!==0){if(O>He){h.push(e,r);return}if(Q>He){h.push(s,o);return}}}}else if(A>lo){if(A*A<=l*(E*E+R*R)){if(br<Ua){h.push(T,w);return}if(O=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),O>=c&&(O=2*c-O),O<br){h.push(e,r),h.push(s,o);return}if(He!==0&&O>He){h.push(e,r);return}}}else if(C>lo){if(C*C<=l*(E*E+R*R)){if(br<Ua){h.push(T,w);return}if(O=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),O>=c&&(O=2*c-O),O<br){h.push(e,r),h.push(s,o);return}if(He!==0&&O>He){h.push(s,o);return}}}else if(E=T-(i+n)/2,R=w-(t+a)/2,E*E+R*R<=l){h.push(T,w);return}}La(i,t,f,d,y,b,T,w,h,l,u+1),La(T,w,v,P,g,_,n,a,h,l,u+1);}var Ax,lo,Ex,Ua,br,He,Oa=p(()=>{Zs();Ax=8,lo=11920929e-14,Ex=1,Ua=.01,br=0,He=0;});function If(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??gr.defaultOptions.bezierSmoothness)),u=(Rx-l)/1;return u*=u,Ix(t,e,r,s,o,n,i,u),i}function Ix(i,t,e,r,s,o,n,a){za(n,i,t,e,r,s,o,a,0),n.push(s,o);}function za(i,t,e,r,s,o,n,a,h){if(h>kx)return;let l=Math.PI,u=(t+r)/2,c=(e+s)/2,f=(r+o)/2,d=(s+n)/2,m=(u+f)/2,x=(c+d)/2,g=o-t,_=n-e,y=Math.abs((r-o)*_-(s-n)*g);if(y>Fx){if(y*y<=a*(g*g+_*_)){if(Gf<Gx){i.push(m,x);return}let b=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(b>=l&&(b=2*l-b),b<Gf){i.push(m,x);return}}}else if(g=m-(t+o)/2,_=x-(e+n)/2,g*g+_*_<=a){i.push(m,x);return}za(i,t,e,u,c,m,x,a,h+1),za(i,m,x,f,d,o,n,a,h+1);}var kx,Fx,Rx,Gx,Gf,Df=p(()=>{Zs();kx=8,Fx=11920929e-14,Rx=1,Gx=.01,Gf=0;});function co(i,t,e,r,s,o,n,a){let h=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,u=s;l*=n?-1:1;for(let c=0;c<a+1;c++){let f=Math.cos(u),d=Math.sin(u),m=t+f*r,x=e+d*r;i.push(m,x),u+=l;}}var Ha=p(()=>{});function Uf(i,t,e,r,s,o){let n=i[i.length-2],h=i[i.length-1]-e,l=n-t,u=s-e,c=r-t,f=Math.abs(h*c-l*u);if(f<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let d=h*h+l*l,m=u*u+c*c,x=h*u+l*c,g=o*Math.sqrt(d)/f,_=o*Math.sqrt(m)/f,y=g*x/d,b=_*x/m,v=g*c+_*l,P=g*u+_*h,T=l*(_+y),w=h*(_+y),E=c*(g+b),R=u*(g+b),A=Math.atan2(w-P,T-v),C=Math.atan2(R-P,E-v);co(i,v+t,P+e,o,A,C,l*u>c*h);}var Lf=p(()=>{Ha();});function Dx(i,t){let e=t===-1.5707963267948966?-0.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return [{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function zf(i,t,e,r,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let u=Math.sin(a*bi/360),c=Math.cos(a*bi/360),f=c*(t-r)/2+u*(e-s)/2,d=-u*(t-r)/2+c*(e-s)/2;if(f===0&&d===0)return;o=Math.abs(o),n=Math.abs(n);let m=Math.pow(f,2)/Math.pow(o,2)+Math.pow(d,2)/Math.pow(n,2);m>1&&(o*=Math.sqrt(m),n*=Math.sqrt(m)),Ux(t,e,r,s,o,n,h,l,u,c,f,d,Wa);let{ang1:x,ang2:g}=Wa,{centerX:_,centerY:y}=Wa,b=Math.abs(g)/(bi/4);Math.abs(1-b)<1e-7&&(b=1);let v=Math.max(Math.ceil(b),1);g/=v;let P=i[i.length-2],T=i[i.length-1],w={x:0,y:0};for(let E=0;E<v;E++){let R=Dx(x,g),{x:A,y:C}=Va(R[0],o,n,c,u,_,y,w),{x:O,y:Q}=Va(R[1],o,n,c,u,_,y,w),{x:xt,y:Br}=Va(R[2],o,n,c,u,_,y,w);uo(i,P,T,A,C,O,Q,xt,Br),P=xt,T=Br,x+=g;}}var bi,Wa,Va,Of,Ux,Hf=p(()=>{Oa();bi=Math.PI*2,Wa={centerX:0,centerY:0,ang1:0,ang2:0},Va=({x:i,y:t},e,r,s,o,n,a,h)=>{i*=e,t*=r;let l=s*i-o*t,u=o*i+s*t;return h.x=l+n,h.y=u+a,h};Of=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},Ux=(i,t,e,r,s,o,n,a,h,l,u,c,f)=>{let d=Math.pow(s,2),m=Math.pow(o,2),x=Math.pow(u,2),g=Math.pow(c,2),_=d*m-d*g-m*x;_<0&&(_=0),_/=d*g+m*x,_=Math.sqrt(_)*(n===a?-1:1);let y=_*s/o*c,b=_*-o/s*u,v=l*y-h*b+(i+e)/2,P=h*y+l*b+(t+r)/2,T=(u-y)/s,w=(c-b)/o,E=(-u-y)/s,R=(-c-b)/o,A=Of(1,0,T,w),C=Of(T,w,E,R);a===0&&C>0&&(C-=bi),a===1&&C<0&&(C+=bi),f.centerX=v,f.centerY=P,f.ang1=A,f.ang2=C;};});function Wf(i,t,e){let r=(n,a)=>{let h=a.x-n.x,l=a.y-n.y,u=Math.sqrt(h*h+l*l),c=h/u,f=l/u;return {len:u,nx:c,ny:f}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y);},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],h=a.radius??e;if(h<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],u=r(a,o),c=r(a,l);if(u.len<1e-4||c.len<1e-4){s(n,a),o=a;continue}let f=Math.asin(u.nx*c.ny-u.ny*c.nx),d=1,m=false;u.nx*c.nx-u.ny*-c.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,m=true):f>0&&(d=-1,m=true);let x=f/2,g,_=Math.abs(Math.cos(x)*h/Math.sin(x));_>Math.min(u.len/2,c.len/2)?(_=Math.min(u.len/2,c.len/2),g=Math.abs(_*Math.sin(x)/Math.cos(x))):g=h;let y=a.x+c.nx*_+-c.ny*g*d,b=a.y+c.ny*_+c.nx*g*d,v=Math.atan2(u.ny,u.nx)+Math.PI/2*d,P=Math.atan2(c.ny,c.nx)-Math.PI/2*d;n===0&&i.moveTo(y+Math.cos(v)*g,b+Math.sin(v)*g),i.arc(y,b,g,v,P,m),o=a;}}function Vf(i,t,e,r){let s=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),o=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let h=t[(a+1)%n],l=h.radius??e;if(l<=0){a===0?i.moveTo(h.x,h.y):i.lineTo(h.x,h.y);continue}let u=t[a],c=t[(a+2)%n],f=s(u,h),d;if(f<1e-4)d=h;else {let g=Math.min(f/2,l);d=o(h,u,g/f);}let m=s(c,h),x;if(m<1e-4)x=h;else {let g=Math.min(m/2,l);x=o(h,c,g/m);}a===0?i.moveTo(d.x,d.y):i.lineTo(d.x,d.y),i.quadraticCurveTo(h.x,h.y,x.x,x.y,r);}}var Nf=p(()=>{});var Lx,fo,$f=p(()=>{Af();Ef();Ff();Rt();Rf();$t();Oa();Df();Ha();Lf();Hf();Nf();Lx=new Z,fo=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new nt,this._graphicsPath2D=t,this.signed=t.checkForHoles;}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return (s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(false);let a=this._currentPoly.points;return co(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Uf(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let h=this._currentPoly.points;return zf(h,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let h=this._currentPoly;return uo(this._currentPoly.points,h.lastX,h.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return If(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(true),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(true),t.transform(e));let r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data);}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let h=a.shape,l=o?.shape;l&&l.containsPolygon(h)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a;}}}return this}finish(t=false){this.endPoly(t);}rect(t,e,r,s,o){return this.drawShape(new Z(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new oo(t,e,r),s),this}poly(t,e,r){let s=new yr(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,h=Math.PI*2/s,l=[];for(let u=0;u<s;u++){let c=a-u*h;l.push(t+r*Math.cos(c),e+r*Math.sin(c));}return this.poly(l,true,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let h=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,h);let l=-1*Math.PI/2+n,u=Math.PI*2/s,c=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){let d=f*u+l,m=t+r*Math.cos(d),x=e+r*Math.sin(d),g=d+Math.PI+c,_=d-Math.PI-c,y=m+o*Math.cos(g),b=x+o*Math.sin(g),v=m+o*Math.cos(_),P=x+o*Math.sin(_);f===0?this.moveTo(y,b):this.lineTo(y,b),this.quadraticCurveTo(m,x,v,P,a);}return this.closePath()}roundShape(t,e,r=false,s){return t.length<3?this:(r?Vf(this,t,e,s):Wf(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),h=t+r,l=e+s,u=a<0?-a:0,c=Math.abs(a);return this.moveTo(t,e+c).arcTo(t+u,e+u,t+c,e,c).lineTo(h-c,e).arcTo(h-u,e+u,h,e+c,c).lineTo(h,l-c).arcTo(h-u,l-u,t+r-c,l,c).lineTo(t+c,l).arcTo(t+u,l-u,t,l-c,c).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),h=t+r,l=e+s,u=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-a,t,e+a];for(let c=u.length-1;c>=2;c-=2)u[c]===u[c-2]&&u[c-1]===u[c-3]&&u.splice(c-1,2);return this.poly(u,true,n)}ellipse(t,e,r,s,o){return this.drawShape(new no(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new ho(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new yr,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=false){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=true){if(!this._currentPoly&&(this._currentPoly=new yr,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty;}this._currentPoly.points.push(r,s);}else this._currentPoly.points.push(0,0);}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data);}this.finish();}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(Lx);s.transform?t.addRect(o,s.transform):t.addRect(o);}return t}};});function vi(i,t){return i?i.prepend(t):t.clone()}var we,Na=p(()=>{Nt();Mt();St();Cf();$f();we=class i{constructor(t,e=false){this.instructions=[],this.uid=Y("graphicsPath"),this._dirty=true,this.checkForHoles=e,typeof t=="string"?Mf(t,this):this.instructions=t?.slice()??[];}get shapePath(){return this._shapePath||(this._shapePath=new fo(this)),this._dirty&&(this._dirty=false,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=true,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=true,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=true,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=true,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=true,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint($.shared),h=0,l=0;if(!n||n.action!=="bezierCurveTo")h=a.x,l=a.y;else {h=n.data[2],l=n.data[3];let u=a.x,c=a.y;h=u+(u-h),l=c+(c-l);}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,r,s,o]}),this._dirty=true,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=true,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=true,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=true,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=true,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint($.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else {n=s.data[0],a=s.data[1];let h=o.x,l=o.y;n=h+(h-n),a=l+(l-a);}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=true,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=true,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=true,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=true,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=true,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=true,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=true,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=true,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=true,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=true,this}star(t,e,r,s,o,n,a){o||(o=s/2);let h=-1*Math.PI/2+n,l=r*2,u=Math.PI*2/l,c=[];for(let f=0;f<l;f++){let d=f%2?o:s,m=f*u+h;c.push(t+d*Math.cos(m),e+d*Math.sin(m));}return this.poly(c,true,a),this}clone(t=false){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()});}return e}clear(){return this.instructions.length=0,this._dirty=true,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,h=0,l=0,u=0,c=0,f=0,d=0,m=0,x=0;for(let g=0;g<this.instructions.length;g++){let _=this.instructions[g],y=_.data;switch(_.action){case "moveTo":case "lineTo":h=y[0],l=y[1],y[0]=e*h+s*l+n,y[1]=r*h+o*l+a;break;case "bezierCurveTo":u=y[0],c=y[1],f=y[2],d=y[3],h=y[4],l=y[5],y[0]=e*u+s*c+n,y[1]=r*u+o*c+a,y[2]=e*f+s*d+n,y[3]=r*f+o*d+a,y[4]=e*h+s*l+n,y[5]=r*h+o*l+a;break;case "quadraticCurveTo":u=y[0],c=y[1],h=y[2],l=y[3],y[0]=e*u+s*c+n,y[1]=r*u+o*c+a,y[2]=e*h+s*l+n,y[3]=r*h+o*l+a;break;case "arcToSvg":h=y[5],l=y[6],m=y[0],x=y[1],y[0]=e*m+s*x,y[1]=r*m+o*x,y[5]=e*h+s*l+n,y[6]=r*h+o*l+a;break;case "circle":y[4]=vi(y[3],t);break;case "rect":y[4]=vi(y[4],t);break;case "ellipse":y[8]=vi(y[8],t);break;case "roundRect":y[5]=vi(y[5],t);break;case "addPath":y[0].transform(t);break;case "poly":y[2]=vi(y[2],t);break;default:z("unknown transform action",_.action);break}}return this._dirty=true,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e];}switch(r.action){case "moveTo":case "lineTo":t.x=r.data[0],t.y=r.data[1];break;case "quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case "bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case "arc":case "arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case "addPath":r.data[0].getLastPoint(t);break}return t}};});function ot(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var $a=p(()=>{});function Yf(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case "lineargradient":t.defs[n.id]=Ox(n);break;case "radialgradient":t.defs[n.id]=zx();break;}}}}function Ox(i){let t=ot(i,"x1",0),e=ot(i,"y1",0),r=ot(i,"x2",1),s=ot(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new kt(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let h=i.children[a],l=ot(h,"offset",0),u=N.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,u);}return n}function zx(i){return z("[SVG Parser] Radial gradients are not yet supported"),new kt(0,0,1,0)}var Xf=p(()=>{Et();St();mr();$a();});function Ya(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var jf=p(()=>{});function Xa(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:false,useStroke:false};for(let n in Kf){let a=i.getAttribute(n);a&&qf(t,o,n,a.trim());}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let h=n[a].trim(),[l,u]=h.split(":");Kf[l]&&qf(t,o,l,u.trim());}}return {strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function qf(i,t,e,r){switch(e){case "stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Ya(r);t.strokeStyle.fill=i.defs[s];}else t.strokeStyle.color=N.shared.setValue(r).toNumber();t.useStroke=true;}break;case "stroke-width":t.strokeStyle.width=Number(r);break;case "fill":if(r!=="none"){if(r.startsWith("url(")){let s=Ya(r);t.fillStyle.fill=i.defs[s];}else t.fillStyle.color=N.shared.setValue(r).toNumber();t.useFill=true;}break;case "fill-opacity":t.fillStyle.alpha=Number(r);break;case "stroke-opacity":t.strokeStyle.alpha=Number(r);break;case "opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var Kf,Zf=p(()=>{Et();jf();Kf={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};});function Qf(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg");}let e={context:t,defs:{},path:new we};Yf(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=Xa(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&Jf(a,e,s,o);}return t}function Jf(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=Xa(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let h,l,u,c,f,d,m,x,g,_,y,b,v,P,T,w,E;switch(i.nodeName.toLowerCase()){case "path":P=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&z("SVG Evenodd fill rule not supported, your svg may render incorrectly"),T=new we(P,true),t.context.path(T),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "circle":m=ot(i,"cx",0),x=ot(i,"cy",0),g=ot(i,"r",0),t.context.ellipse(m,x,g,g),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "rect":h=ot(i,"x",0),l=ot(i,"y",0),w=ot(i,"width",0),E=ot(i,"height",0),_=ot(i,"rx",0),y=ot(i,"ry",0),_||y?t.context.roundRect(h,l,w,E,_||y):t.context.rect(h,l,w,E),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "ellipse":m=ot(i,"cx",0),x=ot(i,"cy",0),_=ot(i,"rx",0),y=ot(i,"ry",0),t.context.beginPath(),t.context.ellipse(m,x,_,y),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "line":u=ot(i,"x1",0),c=ot(i,"y1",0),f=ot(i,"x2",0),d=ot(i,"y2",0),t.context.beginPath(),t.context.moveTo(u,c),t.context.lineTo(f,d),r&&t.context.stroke(r);break;case "polygon":v=i.getAttribute("points"),b=v.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(b,true),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "polyline":v=i.getAttribute("points"),b=v.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(b,false),r&&t.context.stroke(r);break;case "g":case "svg":break;default:{z(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let R=0;R<s.length;R++)Jf(s[R],t,e,r);}var tp=p(()=>{St();Na();Xf();$a();Zf();});function Hx(i){return N.isColorLike(i)}function ep(i){return i instanceof de}function rp(i){return i instanceof kt}function Wx(i){return i instanceof F}function Vx(i,t,e){let r=N.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=F.WHITE,{...e,...i}}function Nx(i,t,e){return i.texture=t,{...e,...i}}function ip(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function sp(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function $x(i,t){let e={...t,...i},r=N.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function fe(i,t){if(i==null)return null;let e={},r=i;return Hx(i)?Vx(e,i,t):Wx(i)?Nx(e,i,t):ep(i)?ip(e,i,t):rp(i)?sp(e,i,t):r.fill&&ep(r.fill)?ip(r,r.fill,t):r.fill&&rp(r.fill)?sp(r,r.fill,t):$x(r,t)}function vr(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=fe(i,h);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var ja=p(()=>{Et();yt();mr();so();});var Yx,op,Ka,Dt,qa=p(()=>{Ft();Et();et();Nt();yt();Mt();pt();$t();Na();tp();ja();Yx=new $,op=new M,Ka=class se extends j{constructor(){super(...arguments),this.uid=Y("graphicsContext"),this.dirty=true,this.batchMode="auto",this.instructions=[],this._activePath=new we,this._transform=new M,this._fillStyle={...se.defaultFillStyle},this._strokeStyle={...se.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new nt,this._boundsDirty=true;}clone(){let t=new se;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=true,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=fe(t,se.defaultFillStyle);}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=vr(t,se.defaultStrokeStyle);}setFillStyle(t){return this._fillStyle=fe(t,se.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=fe(t,se.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?N.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new we,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(I(W,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=fe(t,se.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint($.shared);this._activePath.clear(),this._activePath.moveTo(t,e);}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=vr(t,se.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else {e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,r,s,o,n),this}arcTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,h.a*n+h.c*a+h.tx,h.b*n+h.d*a+h.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*r+h.c*s+h.tx,h.b*r+h.d*s+h.ty,h.a*o+h.c*n+h.tx,h.b*o+h.d*n+h.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,Qf(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,r,s,o,n){return t instanceof M?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof M?(this._transform.append(t),this):(op.set(t,e,r,s,o,n),this._transform.append(op),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=true,this._boundsDirty=true);}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds);}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform);}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),h=o.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a);}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return false;let e=this.instructions,r=false;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let h=n.style,l=a.shapePath.shapePrimitives;for(let u=0;u<l.length;u++){let c=l[u].shape;if(!h||!c)continue;let f=l[u].transform,d=f?f.applyInverse(t,Yx):t;if(o.action==="fill")r=c.contains(d.x,d.y);else {let x=h;r=c.strokeContains(d.x,d.y,x.width,x.alignment);}let m=n.hole;if(m){let x=m.shapePath?.shapePrimitives;if(x)for(let g=0;g<x.length;g++)x[g].shape.contains(d.x,d.y)&&(r=false);}if(r)return true}}return r}destroy(t=false){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r);}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null;}};Ka.defaultFillStyle={color:16777215,alpha:1,texture:F.WHITE,matrix:null,fill:null,textureSpace:"local"};Ka.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:F.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:false};Dt=Ka;});function po(i){let t=[],e=0;for(let r=0;r<np.length;r++){let s=`_${np[r]}`;t[e++]=i[s];}return e=ap(i._fill,t,e),e=Xx(i._stroke,t,e),e=jx(i.dropShadow,t,e),t.join("-")}function ap(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function Xx(i,t,e){return i&&(e=ap(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function jx(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=N.shared.setValue(i.color).toNumber()),e}var np,Za=p(()=>{Et();np=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];});function Kx(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Wt.defaultDropShadow;i.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance};}if(t.strokeThickness!==void 0){I(W,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(N.isColorLike(e))r.color=e;else if(e instanceof kt||e instanceof de)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness};}if(Array.isArray(t.fillGradientStops)){I(W,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=Wt.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new kt({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>N.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o);}),i.fill={fill:r};}}var Qa,Wt,Si=p(()=>{Ft();Et();pt();mr();so();qa();ja();Za();Qa=class Sr extends j{constructor(t={}){super(),Kx(t);let e={...Sr.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r];}this.update();}get align(){return this._align}set align(t){this._align=t,this.update();}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update();}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...Sr.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Sr.defaultDropShadow}):null,this.update();}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update();}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update();}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update();}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update();}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update();}get leading(){return this._leading}set leading(t){this._leading=t,this.update();}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update();}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update();}get padding(){return this._padding}set padding(t){this._padding=t,this.update();}get trim(){return this._trim}set trim(t){this._trim=t,this.update();}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update();}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update();}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update();}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update();}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Dt.defaultFillStyle,...t},()=>{this._fill=fe({...this._originalFill},Dt.defaultFillStyle);})),this._fill=fe(t===0?"black":t,Dt.defaultFillStyle),this.update());}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Dt.defaultStrokeStyle,...t},()=>{this._stroke=vr({...this._originalStroke},Dt.defaultStrokeStyle);})),this._stroke=vr(t,Dt.defaultStrokeStyle),this.update());}_generateKey(){return this._styleKey=po(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this);}reset(){let t=Sr.defaultTextStyle;for(let e in t)this[e]=t[e];}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Sr({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=false){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r);}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null;}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),true)})}_isFillStyle(t){return (t??null)!==null&&!(N.isColorLike(t)||t instanceof kt||t instanceof de)}};Qa.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Qa.defaultTextStyle={align:"left",breakWords:false,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:false,whiteSpace:"pre",wordWrap:false,wordWrapWidth:100};Wt=Qa;});function mo(i,t,e,r){let s=qx;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=Tt.getOptimalTexture(s.width,s.height,r,false);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var qx,Ja=p(()=>{qe();$t();qx=new nt;});function We(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!Zx.includes(s)&&(s=`"${s}"`),e[r]=s;}return `${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var Zx,go=p(()=>{Zx=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];});var th,qt,oe,eh=p(()=>{Xt();go();th={willReadFrequently:true},qt=class B{static get experimentalLetterSpacingSupported(){let t=B._experimentalLetterSpacingSupported;if(t!==void 0){let e=at.get().getCanvasRenderingContext2D().prototype;t=B._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e;}return t}constructor(t,e,r,s,o,n,a,h,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l;}static measureText(t=" ",e,r=B._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(B._measurementCache[o])return B._measurementCache[o];let n=We(e),a=B.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=B.__context;h.font=n;let u=(s?B._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),c=new Array(u.length),f=0;for(let y=0;y<u.length;y++){let b=B._measureText(u[y],e.letterSpacing,h);c[y]=b,f=Math.max(f,b);}let d=e._stroke?.width||0,m=f+d;e.dropShadow&&(m+=e.dropShadow.distance);let x=e.lineHeight||a.fontSize,g=Math.max(x,a.fontSize+d)+(u.length-1)*(x+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new B(t,e,m,g,u,c,x+e.leading,f,a)}static _measureText(t,e,r){let s=false;B.experimentalLetterSpacingSupported&&(B.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=true):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else {let u=(B.graphemeSegmenter(t).length-1)*e;n+=u,l+=u;}return Math.max(n,l)}static _wordWrap(t,e,r=B._canvas){let s=r.getContext("2d",th),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=B._collapseSpaces(u),f=B._collapseNewlines(u),d=!c,m=e.wordWrapWidth+l,x=B._tokenize(t);for(let g=0;g<x.length;g++){let _=x[g];if(B._isNewline(_)){if(!f){a+=B._addLine(n),d=!c,n="",o=0;continue}_=" ";}if(c){let b=B.isBreakingSpace(_),v=B.isBreakingSpace(n[n.length-1]);if(b&&v)continue}let y=B._getFromCache(_,l,h,s);if(y>m)if(n!==""&&(a+=B._addLine(n),n="",o=0),B.canBreakWords(_,e.breakWords)){let b=B.wordWrapSplit(_);for(let v=0;v<b.length;v++){let P=b[v],T=P,w=1;for(;b[v+w];){let R=b[v+w];if(!B.canBreakChars(T,R,_,v,e.breakWords))P+=R;else break;T=R,w++;}v+=w-1;let E=B._getFromCache(P,l,h,s);E+o>m&&(a+=B._addLine(n),d=false,n="",o=0),n+=P,o+=E;}}else {n.length>0&&(a+=B._addLine(n),n="",o=0);let b=g===x.length-1;a+=B._addLine(_,!b),d=false,n="",o=0;}else y+o>m&&(d=false,a+=B._addLine(n),n="",o=0),(n.length>0||!B.isBreakingSpace(_)||d)&&(n+=_,o+=y);}return a+=B._addLine(n,false),a}static _addLine(t,e=true){return t=B._trimRight(t),t=e?`${t}
|
|
368
|
+
`:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=B._measureText(t,e,s)+e,r[t]=o),o}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--){let r=t[e];if(!B.isBreakingSpace(r))break;t=t.slice(0,-1);}return t}static _isNewline(t){return typeof t!="string"?false:B._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?false:B._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(B.isBreakingSpace(o,n)||B._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o;}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return true}static wordWrapSplit(t){return B.graphemeSegmenter(t)}static measureFont(t){if(B._fonts[t])return B._fonts[t];let e=B._context;e.font=t;let r=e.measureText(B.METRICS_STRING+B.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return B._fonts[t]=s,s}static clearMetrics(t=""){t?delete B._fonts[t]:B._fonts={};}static get _canvas(){if(!B.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",th)?.measureText)return B.__canvas=e,e;t=at.get().createCanvas();}catch{t=at.get().createCanvas();}t.width=t.height=10,B.__canvas=t;}return B.__canvas}static get _context(){return B.__context||(B.__context=B._canvas.getContext("2d",th)),B.__context}};qt.METRICS_STRING="|\xC9q\xC5";qt.BASELINE_SYMBOL="M";qt.BASELINE_MULTIPLIER=1.4;qt.HEIGHT_MULTIPLIER=2;qt.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();qt.experimentalLetterSpacing=false;qt._fonts={};qt._newlines=[10,13];qt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];qt._measurementCache={};oe=qt;});function Tr(i,t,e,r=0){if(i.texture===F.WHITE&&!i.fill)return N.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof de){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(M.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof kt){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,h=1;n&&e&&(a=e.width+r,h=e.height+r);let l,u=false;if(o){let{start:c,end:f}=s;l=t.createLinearGradient(c.x*a,c.y*h,f.x*a,f.y*h),u=Math.abs(f.x-c.x)<Math.abs((f.y-c.y)*.1);}else {let{center:c,innerRadius:f,outerCenter:d,outerRadius:m}=s;l=t.createRadialGradient(c.x*a,c.y*h,f*a,d.x*a,d.y*h,m*a);}if(u&&n&&e){let c=e.lineHeight/h;for(let f=0;f<e.lines.length;f++){let d=(f*e.lineHeight+r/2)/h;s.colorStops.forEach(m=>{let x=d+m.offset*c;l.addColorStop(Math.floor(x*hp)/hp,N.shared.setValue(m.color).toHex());});}}else s.colorStops.forEach(c=>{l.addColorStop(c.offset,N.shared.setValue(c.color).toHex());});return l}}else {let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(M.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return z("FillStyle not recognised",i),"red"}var hp,rh=p(()=>{Et();et();yt();St();mr();so();hp=1e5;});var Ti,lp=p(()=>{Et();k();Hr();yi();qe();vf();pt();Si();Ja();eh();go();rh();Ti=class{constructor(t){this._activeTextures={},this._renderer=t;}getTextureSize(t,e,r){let s=oe.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=he(o),n=he(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(I("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof Wt||(t.style=new Wt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Kt.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=oe.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),h=Kt.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,r,s,h);let u=mo(l,n,a,s);if(r.trim){let c=bf(l,s);u.frame.copyFrom(c),u.updateUvs();}return {texture:u,canvasAndContext:h}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++;}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Tt.returnTexture(t);}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(Kt.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null);}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=We(e),h=oe.measureText(t||" ",e),l=h.lines,u=h.lineHeight,c=h.lineWidths,f=h.maxLineWidth,d=h.fontProperties,m=o.height;if(n.resetTransform(),n.scale(r,r),n.textBaseline=e.textBaseline,e._stroke?.width){let y=e._stroke;n.lineWidth=y.width,n.miterLimit=y.miterLimit,n.lineJoin=y.join,n.lineCap=y.cap;}n.font=a;let x,g,_=e.dropShadow?2:1;for(let y=0;y<_;++y){let b=e.dropShadow&&y===0,v=b?Math.ceil(Math.max(1,m)+e.padding*2):0,P=v*r;if(b){n.fillStyle="black",n.strokeStyle="black";let E=e.dropShadow,R=E.color,A=E.alpha;n.shadowColor=N.shared.setValue(R).setAlpha(A).toRgbaString();let C=E.blur*r,O=E.distance*r;n.shadowBlur=C,n.shadowOffsetX=Math.cos(E.angle)*O,n.shadowOffsetY=Math.sin(E.angle)*O+P;}else {if(n.fillStyle=e._fill?Tr(e._fill,n,h):null,e._stroke?.width){let E=e._stroke.width*e._stroke.alignment;n.strokeStyle=Tr(e._stroke,n,h,E);}n.shadowColor="black";}let T=(u-d.fontSize)/2;u-d.fontSize<0&&(T=0);let w=e._stroke?.width??0;for(let E=0;E<l.length;E++)x=w/2,g=w/2+E*u+d.ascent+T,e.align==="right"?x+=f-c[E]:e.align==="center"&&(x+=(f-c[E])/2),e._stroke?.width&&this._drawLetterSpacing(l[E],e,s,x+e.padding,g+e.padding-v,true),e._fill!==void 0&&this._drawLetterSpacing(l[E],e,s,x+e.padding,g+e.padding-v);}}_drawLetterSpacing(t,e,r,s,o,n=false){let{context:a}=r,h=e.letterSpacing,l=false;if(oe.experimentalLetterSpacingSupported&&(oe.experimentalLetterSpacing?(a.letterSpacing=`${h}px`,a.textLetterSpacing=`${h}px`,l=true):(a.letterSpacing="0px",a.textLetterSpacing="0px")),h===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let u=s,c=oe.graphemeSegmenter(t),f=a.measureText(t).width,d=0;for(let m=0;m<c.length;++m){let x=c[m];n?a.strokeText(x,u,o):a.fillText(x,u,o);let g="";for(let _=m+1;_<c.length;++_)g+=c[_];d=a.measureText(g).width,u+=f-d+h,f=d;}}destroy(){this._activeTextures=null;}};Ti.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"canvasText"};});var ih=p(()=>{k();xf();lp();G.add(Ti);G.add(_i);});var xo,up=p(()=>{pt();wn();qa();xo=class i extends Je{constructor(t){t instanceof Dt&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Dt,this._context.on("update",this.onViewUpdate,this),this.allowChildren=false,this.roundPixels=r??false;}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate());}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===true||t?.context===true)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t);}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t;}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t;}clone(t=false){return t?new i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){I(W,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){I(W,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){I(W,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return (t.width!==Dt.defaultStrokeStyle.width||t.color!==Dt.defaultStrokeStyle.color||t.alpha!==Dt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return I(W,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return I(W,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return I(W,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return I(W,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return I(W,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return I(W,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}};});var cp,dp,fp=p(()=>{cp={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
369
369
|
struct LocalUniforms {
|
|
370
370
|
uColor:vec4<f32>,
|
|
371
371
|
uTransformMatrix:mat3x3<f32>,
|
|
@@ -392,7 +392,7 @@ fn mainFragment(
|
|
|
392
392
|
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
393
393
|
`,main:`
|
|
394
394
|
outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
|
|
395
|
-
`}},
|
|
395
|
+
`}},dp={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
396
396
|
uniform mat3 uTransformMatrix;
|
|
397
397
|
uniform vec4 uColor;
|
|
398
398
|
uniform float uRound;
|
|
@@ -408,7 +408,7 @@ fn mainFragment(
|
|
|
408
408
|
uniform float uDistance;
|
|
409
409
|
`,main:`
|
|
410
410
|
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
|
|
411
|
-
`}};});var
|
|
411
|
+
`}};});var pp,mp,gp=p(()=>{pp={name:"msdf-bit",fragment:{header:`
|
|
412
412
|
fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
|
|
413
413
|
|
|
414
414
|
// MSDF
|
|
@@ -435,7 +435,7 @@ fn mainFragment(
|
|
|
435
435
|
return coverage;
|
|
436
436
|
|
|
437
437
|
}
|
|
438
|
-
`}},
|
|
438
|
+
`}},mp={name:"msdf-bit",fragment:{header:`
|
|
439
439
|
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
|
|
440
440
|
|
|
441
441
|
// MSDF
|
|
@@ -462,16 +462,16 @@ fn mainFragment(
|
|
|
462
462
|
|
|
463
463
|
return coverage;
|
|
464
464
|
}
|
|
465
|
-
`}};});var
|
|
466
|
-
`&&_!=="\r"&&_!==" "&&_!==" "&&(d=true,f=Math.ceil(Math.max(w,f))),h+T>m&&(l+=f,f=w,h=0,l+f>x)){n.update();let
|
|
465
|
+
`}};});var sh,oh,_o,xp=p(()=>{et();Cs();Us();ta();ia();Ws();oa();hi();ve();fp();gp();_o=class extends ie{constructor(){let t=new At({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=ir();sh??(sh=lr({name:"sdf-shader",bits:[Ls,zs(e),cp,pp,cr]})),oh??(oh=ur({name:"sdf-shader",bits:[Os,Hs(e),dp,mp,dr]})),super({glProgram:oh,gpuProgram:sh,resources:{localUniforms:t,batchSamplers:Vs(e)}});}};});var yo,_p=p(()=>{Ft();pt();yo=class extends j{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=true,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100;}get font(){return I(W,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return I(W,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return I(W,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return I(W,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return I(W,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=false){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(true)),this.pages=null);}};});function bo(i){if(i==="")return [];typeof i=="string"&&(i=[i]);let t=[];for(let e=0,r=i.length;e<r;e++){let s=i[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,h=n;a<=h;a++)t.push(String.fromCharCode(a));}else t.push(...Array.from(s));}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var nh=p(()=>{});var yp,ah,vp=p(()=>{Et();Rt();yi();Ss();yt();pt();eh();go();rh();Si();_p();nh();yp=class bp extends yo{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=false;let e={...bp.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let r=e.style.clone();e.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=F.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=We(r);e.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/s):r.fontSize=this.baseRenderedFontSize=s,this._style=r,this._skipKerning=e.skipKerning??false,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=oe.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize;}ensureCharacters(t){let e=bo(t).filter(g=>!this._currentChars.includes(g)).filter((g,_,y)=>y.indexOf(g)===_);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:s,context:o}=r.canvasAndContext,n=r.texture.source,a=this._style,h=this._currentX,l=this._currentY,u=this.baseRenderedFontSize/this.baseMeasurementFontSize,c=this._padding*u,f=0,d=false,m=s.width/this.resolution,x=s.height/this.resolution;for(let g=0;g<e.length;g++){let _=e[g],y=oe.measureText(_,a,s,false);y.lineHeight=y.height;let b=y.width*u,v=Math.ceil((a.fontStyle==="italic"?2:1)*b),P=y.height*u,T=v+c*2,w=P+c*2;if(d=false,_!==`
|
|
466
|
+
`&&_!=="\r"&&_!==" "&&_!==" "&&(d=true,f=Math.ceil(Math.max(w,f))),h+T>m&&(l+=f,f=w,h=0,l+f>x)){n.update();let R=this._nextPage();s=R.canvasAndContext.canvas,o=R.canvasAndContext.context,n=R.texture.source,l=0;}let E=b/u-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:E,kerning:{}},d){this._drawGlyph(o,y,h+c,l+c,u,a);let R=n.width*u,A=n.height*u,C=new Z(h/R*n.width,l/A*n.height,T/R*n.width,w/A*n.height);this.chars[_].texture=new F({source:n,frame:C}),h+=Math.ceil(T);}}n.update(),this._currentX=h,this._currentY=l,this._skipKerning&&this._applyKerning(e,o);}get pageTextures(){return I(W,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],h=r[o];h||(h=r[o]=e.measureText(o).width);let l=r[a];l||(l=r[a]=e.measureText(a).width);let u=e.measureText(o+a).width,c=u-(h+l);c&&(this.chars[o].kerning[a]=c),u=e.measureText(o+a).width,c=u-(h+l),c&&(this.chars[a].kerning[o]=c);}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=Kt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new F({source:new Jt({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,r){e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=We(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;let s=e._stroke,o=s?.width??0;if(s&&(t.lineWidth=o,t.lineJoin=s.join,t.miterLimit=s.miterLimit,t.strokeStyle=Tr(s,t)),e._fill&&(t.fillStyle=Tr(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=N.shared.setValue(n.color).toArray(),h=n.blur*r,l=n.distance*r;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=h,t.shadowOffsetX=Math.cos(n.angle)*l,t.shadowOffsetY=Math.sin(n.angle)*l;}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;}_drawGlyph(t,e,r,s,o,n){let a=e.text,h=e.fontProperties,u=(n._stroke?.width??0)*o,c=r+u/2,f=s-u/2,d=h.descent*o,m=e.lineHeight*o;n.stroke&&u&&t.strokeText(a,c,f+m-d),n._fill&&t.fillText(a,c,f+m-d);}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];Kt.returnCanvasAndContext(e),r.destroy(true);}this.pages=null;}};yp.defaultOptions={textureSize:512,style:new Wt,mipmap:true};ah=yp;});function vo(i,t,e,r){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=true,h={width:0,start:0,index:0,positions:[],chars:[]},l=m=>{let x=o.width;for(let g=0;g<h.index;g++){let _=m.positions[g];o.chars.push(m.chars[g]),o.charPositions.push(_+x);}o.width+=m.width,a=false,h.width=0,h.index=0,h.chars.length=0;},u=()=>{let m=o.chars.length-1;if(r){let x=o.chars[m];for(;x===" ";)o.width-=e.chars[x].xAdvance,x=o.chars[--m];}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=true,s.lines.push(o),s.height+=e.lineHeight;},c=e.baseMeasurementFontSize/t.fontSize,f=t.letterSpacing*c,d=t.wordWrapWidth*c;for(let m=0;m<i.length+1;m++){let x,g=m===i.length;g||(x=i[m]);let _=e.chars[x]||e.chars[" "];if(/(?:\s)/.test(x)||x==="\r"||x===`
|
|
467
467
|
`||g){if(!a&&t.wordWrap&&o.width+h.width-f>d?(u(),l(h),g||o.charPositions.push(0)):(h.start=o.width,l(h),g||o.charPositions.push(0)),x==="\r"||x===`
|
|
468
|
-
`)o.width!==0&&u();else if(!g){let P=_.xAdvance+(_.kerning[n]||0)+f;o.width+=P,o.spaceWidth=P,o.spacesIndex.push(o.charPositions.length),o.chars.push(x);}}else {let v=_.kerning[n]||0,P=_.xAdvance+v+f;h.positions[h.index++]=h.width+v,h.chars.push(x),h.width+=P;}n=x;}return u(),t.align==="center"?Kx(s):t.align==="right"?qx(s):t.align==="justify"&&Zx(s),s}function Kx(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r;}}function qx(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r;}}function Zx(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,l=(t-r.width)/a;for(let u=0;u<r.charPositions.length;u++)u===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[u]+=n;}}var nh=p(()=>{});var yo,ah,bp,vp=p(()=>{ti();dt();bt();bi();yp();nh();sh();yo=0,ah=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:false};}getFont(t,e){let r=`${e.fontFamily}-bitmap`,s=true;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=false;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=false;}if(!lt.has(r)){let n=new oh({style:e,overrideFill:s,overrideSize:true,...this.defaultOptions});yo++,yo>50&&O("BitmapText",`You have dynamically created ${yo} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{yo--,lt.remove(r);}),lt.set(r,n);}let o=lt.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=true){let s=this.getFont(t,e);return _o([...t],e,s,r)}measureText(t,e,r=true){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},I(H,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof zt?s:new zt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new oh({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:false}),h=xo(e.chars);return a.ensureCharacters(h.join("")),lt.set(`${r}-bitmap`,a),a.once("destroy",()=>lt.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=lt.get(e);r&&r.destroy();}},bp=new ah;});function Sp(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels;}var Si,Tp=p(()=>{ti();k();Lt();hp();mp();vp();nh();Si=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText");}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=false,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);Sp(t,r),t._didTextUpdate&&(t._didTextUpdate=false,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t);}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid);}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(W.return(e.customShader),e.customShader=null),W.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null;}updateRenderable(t){let e=this._getGpuBitmapText(t);Sp(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t);}_updateContext(t,e){let{context:r}=e,s=bp.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=W.get(mo)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,h=_o(o,n,s,true),l=0,u=n.padding,c=h.scale,f=h.width,d=h.height+h.offsetY;n._stroke&&(f+=n._stroke.width/c,d+=n._stroke.width/c),r.translate(-t._anchor._x*f-u,-t._anchor._y*d-u).scale(c,c);let m=s.applyFillAsTint?n._fill.color:16777215;for(let x=0;x<h.lines.length;x++){let g=h.lines[x];for(let _=0;_<g.charPositions.length;_++){let y=o[l++],b=s.chars[y];b?.texture&&r.texture(b.texture,m||"black",Math.round(g.charPositions[_]+b.xOffset),Math.round(a+b.yOffset));}a+=s.lineHeight;}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=W.get(po);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=lt.get(`${r}-bitmap`),{a:o,b:n,c:a,d:h}=t.groupTransform,l=Math.sqrt(o*o+n*n),u=Math.sqrt(a*a+h*h),c=(Math.abs(l)+Math.abs(u))/2,f=s.baseRenderedFontSize/t._style.fontSize,d=c*s.distanceField.range*(1/f);e.customShader.resources.localUniforms.uniforms.uDistance=d;}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null;}};Si.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"bitmapText"};});var hh=p(()=>{k();Tp();R.add(Si);});var Ti,wp=p(()=>{k();xt();Lt();ka();Fa();Ti=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText");}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate());}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=false,true):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e);}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r);}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid);}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),W.return(e.batchableSprite),this._gpuText[t]=null;}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o);}),t._didTextUpdate=false,mi(s,t);}async _updateGpuText(t){t._didTextUpdate=false;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=true,e.currentKey=r;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=false,e.textureNeedsUploading=true,t.onViewUpdate(),mi(n,t);}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:F.EMPTY,currentKey:"--",batchableSprite:W.get(gr),textureNeedsUploading:false,generatingTexture:false},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=F.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null;}};Ti.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"htmlText"};});function Pp(){let{userAgent:i}=ot.get().getNavigator();return /^((?!chrome|android).)*safari/i.test(i)}var Mp=p(()=>{$t();});var Cp,Ap,Sr,lh=p(()=>{Cp="http://www.w3.org/2000/svg",Ap="http://www.w3.org/1999/xhtml",Sr=class{constructor(){this.svgRoot=document.createElementNS(Cp,"svg"),this.foreignObject=document.createElementNS(Cp,"foreignObject"),this.domElement=document.createElementNS(Ap,"div"),this.styleElement=document.createElementNS(Ap,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s);}};});function kp(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${V.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[Gp(t)]:[],...i.dropShadow?[Fp(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return Qx(i.tagStyles,s),s.join(" ")}function Fp(i){let t=V.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function Gp(i){return [`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${V.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${V.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function Qx(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)Bp[o]?s.push(Bp[o](r[o])):Ep[o]&&s.push(Ep[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`);}}var Ep,Bp,Rp=p(()=>{Ct();Ep={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},Bp={fill:i=>`color: ${V.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:Gp,dropShadow:Fp};});var bo,Ip=p(()=>{bt();bi();Ka();Rp();bo=class i extends zt{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{};}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update();}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=uo(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update();}clone(){return new i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=kp(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update());}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update());}set fill(t){typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t;}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t;}};});function Up(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(h){s[h]||(r.push(h),s[h]=true);}if(Array.isArray(e))for(let h=0;h<e.length;h++)a(e[h]);else a(e);n&&n.forEach(h=>{let l=h.split(":")[1].trim();a(l);});for(let h in t.tagStyles){let l=t.tagStyles[h].fontFamily;a(l);}return r}var Dp=p(()=>{});async function Lp(i){let e=await(await ot.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e);})}var Op=p(()=>{$t();});async function uh(i,t){let e=await Lp(t);return `@font-face {
|
|
468
|
+
`)o.width!==0&&u();else if(!g){let P=_.xAdvance+(_.kerning[n]||0)+f;o.width+=P,o.spaceWidth=P,o.spacesIndex.push(o.charPositions.length),o.chars.push(x);}}else {let v=_.kerning[n]||0,P=_.xAdvance+v+f;h.positions[h.index++]=h.width+v,h.chars.push(x),h.width+=P;}n=x;}return u(),t.align==="center"?Qx(s):t.align==="right"?Jx(s):t.align==="justify"&&t_(s),s}function Qx(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r;}}function Jx(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r;}}function t_(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,l=(t-r.width)/a;for(let u=0;u<r.charPositions.length;u++)u===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[u]+=n;}}var hh=p(()=>{});var So,lh,Sp,Tp=p(()=>{ri();pt();St();Si();vp();hh();nh();So=0,lh=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:false};}getFont(t,e){let r=`${e.fontFamily}-bitmap`,s=true;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=false;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=false;}if(!ct.has(r)){let n=new ah({style:e,overrideFill:s,overrideSize:true,...this.defaultOptions});So++,So>50&&z("BitmapText",`You have dynamically created ${So} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{So--,ct.remove(r);}),ct.set(r,n);}let o=ct.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=true){let s=this.getFont(t,e);return vo([...t],e,s,r)}measureText(t,e,r=true){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},I(W,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Wt?s:new Wt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new ah({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:false}),h=bo(e.chars);return a.ensureCharacters(h.join("")),ct.set(`${r}-bitmap`,a),a.once("destroy",()=>ct.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=ct.get(e);r&&r.destroy();}},Sp=new lh;});function wp(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels;}var wi,Pp=p(()=>{ri();k();zt();up();xp();Tp();hh();wi=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText");}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=false,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);wp(t,r),t._didTextUpdate&&(t._didTextUpdate=false,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t);}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid);}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(V.return(e.customShader),e.customShader=null),V.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null;}updateRenderable(t){let e=this._getGpuBitmapText(t);wp(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t);}_updateContext(t,e){let{context:r}=e,s=Sp.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=V.get(_o)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,h=vo(o,n,s,true),l=0,u=n.padding,c=h.scale,f=h.width,d=h.height+h.offsetY;n._stroke&&(f+=n._stroke.width/c,d+=n._stroke.width/c),r.translate(-t._anchor._x*f-u,-t._anchor._y*d-u).scale(c,c);let m=s.applyFillAsTint?n._fill.color:16777215;for(let x=0;x<h.lines.length;x++){let g=h.lines[x];for(let _=0;_<g.charPositions.length;_++){let y=o[l++],b=s.chars[y];b?.texture&&r.texture(b.texture,m||"black",Math.round(g.charPositions[_]+b.xOffset),Math.round(a+b.yOffset));}a+=s.lineHeight;}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=V.get(xo);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=ct.get(`${r}-bitmap`),{a:o,b:n,c:a,d:h}=t.groupTransform,l=Math.sqrt(o*o+n*n),u=Math.sqrt(a*a+h*h),c=(Math.abs(l)+Math.abs(u))/2,f=s.baseRenderedFontSize/t._style.fontSize,d=c*s.distanceField.range*(1/f);e.customShader.resources.localUniforms.uniforms.uDistance=d;}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null;}};wi.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"bitmapText"};});var uh=p(()=>{k();Pp();G.add(wi);});var Pi,Mp=p(()=>{k();yt();zt();Ra();Ga();Pi=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText");}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate());}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=false,true):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e);}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r);}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid);}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),V.return(e.batchableSprite),this._gpuText[t]=null;}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o);}),t._didTextUpdate=false,xi(s,t);}async _updateGpuText(t){t._didTextUpdate=false;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=true,e.currentKey=r;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=false,e.textureNeedsUploading=true,t.onViewUpdate(),xi(n,t);}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:F.EMPTY,currentKey:"--",batchableSprite:V.get(_r),textureNeedsUploading:false,generatingTexture:false},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=F.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null;}};Pi.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"htmlText"};});function Cp(){let{userAgent:i}=at.get().getNavigator();return /^((?!chrome|android).)*safari/i.test(i)}var Ap=p(()=>{Xt();});var Ep,Bp,wr,ch=p(()=>{Ep="http://www.w3.org/2000/svg",Bp="http://www.w3.org/1999/xhtml",wr=class{constructor(){this.svgRoot=document.createElementNS(Ep,"svg"),this.foreignObject=document.createElementNS(Ep,"foreignObject"),this.domElement=document.createElementNS(Bp,"div"),this.styleElement=document.createElementNS(Bp,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s);}};});function Rp(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${N.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[Ip(t)]:[],...i.dropShadow?[Gp(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return e_(i.tagStyles,s),s.join(" ")}function Gp(i){let t=N.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function Ip(i){return [`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${N.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${N.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function e_(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)Fp[o]?s.push(Fp[o](r[o])):kp[o]&&s.push(kp[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`);}}var kp,Fp,Dp=p(()=>{Et();kp={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},Fp={fill:i=>`color: ${N.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:Ip,dropShadow:Gp};});var To,Up=p(()=>{St();Si();Za();Dp();To=class i extends Wt{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{};}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update();}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=po(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update();}clone(){return new i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=Rp(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update());}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update());}set fill(t){typeof t!="string"&&typeof t!="number"&&z("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t;}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&z("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t;}};});function Lp(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(h){s[h]||(r.push(h),s[h]=true);}if(Array.isArray(e))for(let h=0;h<e.length;h++)a(e[h]);else a(e);n&&n.forEach(h=>{let l=h.split(":")[1].trim();a(l);});for(let h in t.tagStyles){let l=t.tagStyles[h].fontFamily;a(l);}return r}var Op=p(()=>{});async function zp(i){let e=await(await at.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e);})}var Hp=p(()=>{Xt();});async function dh(i,t){let e=await zp(t);return `@font-face {
|
|
469
469
|
font-family: "${i.fontFamily}";
|
|
470
470
|
src: url('${e}');
|
|
471
471
|
font-weight: ${i.fontWeight};
|
|
472
472
|
font-style: ${i.fontStyle};
|
|
473
|
-
}`}var
|
|
474
|
-
`)}var
|
|
473
|
+
}`}var Wp=p(()=>{Hp();});async function Vp(i,t,e){let r=i.filter(s=>ct.has(`${s}-and-url`)).map((s,o)=>{if(!wo.has(s)){let{url:n}=ct.get(`${s}-and-url`);o===0?wo.set(s,dh({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):wo.set(s,dh({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n));}return wo.get(s)});return (await Promise.all(r)).join(`
|
|
474
|
+
`)}var wo,Np=p(()=>{ri();Wp();wo=new Map;});function $p(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:h,height:l}=s.image;return a.setAttribute("width",h.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}var Yp=p(()=>{});function Xp(i,t){let e=Kt.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var jp=p(()=>{yi();});function Kp(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r();},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous";})}var qp=p(()=>{});function Qp(i,t,e,r){r||(r=Zp||(Zp=new wr));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let h=t.padding*2;return {width:a.width-h,height:a.height-h}}var Zp,Jp=p(()=>{ch();});var Pr,tm=p(()=>{k();yi();qe();ai();Ap();St();zt();Ja();ch();Up();Op();Np();Yp();jp();qp();Jp();Pr=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===re.WEBGPU;}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,r).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,r){let s=V.get(wr),o=Lp(t,r),n=await Vp(o,r,To.defaultTextStyle),a=Qp(t,r,n,s),h=Math.ceil(Math.ceil(Math.max(1,a.width)+r.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+r.padding*2)*e),u=s.image,c=2;u.width=(h|0)+c,u.height=(l|0)+c;let f=$p(t,r,e,n,s);await Kp(u,f,Cp()&&o.length>0);let d=u,m;this._createCanvas&&(m=Xp(u,e));let x=mo(m?m.canvas:d,u.width-c,u.height-c,e);return this._createCanvas&&(this._renderer.texture.initSource(x.source),Kt.returnCanvasAndContext(m)),V.return(s),x}_increaseReferenceCount(t){this._activeTextures[t].usageCount++;}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(r=>{e.texture=r,this._cleanUp(e);}).catch(()=>{z("HTMLTextSystem: Failed to clean texture");}),this._activeTextures[t]=null));}_cleanUp(t){Tt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown";}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null;}};Pr.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"htmlText"};Pr.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"};});var fh=p(()=>{k();Mp();tm();G.add(Pr);G.add(Pi);});var em,Mr,Po=p(()=>{or();sr();ni();pt();em=class rm extends ee{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(I(W,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...rm.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new bt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:J.VERTEX|J.COPY_DST}),h=new bt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:J.VERTEX|J.COPY_DST}),l=new bt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:J.INDEX|J.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:h,format:"float32x2",stride:2*4,offset:0}},indexBuffer:l,topology:e.topology}),this.batchMode="auto";}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t;}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t;}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t;}};em.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:false};Mr=em;});var Mi,im,sm=p(()=>{Mi={name:"local-uniform-bit",vertex:{header:`
|
|
475
475
|
|
|
476
476
|
struct LocalUniforms {
|
|
477
477
|
uTransformMatrix:mat3x3<f32>,
|
|
@@ -488,7 +488,7 @@ fn mainFragment(
|
|
|
488
488
|
{
|
|
489
489
|
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
490
490
|
}
|
|
491
|
-
`}},{...
|
|
491
|
+
`}},{...Mi,vertex:{...Mi.vertex,header:Mi.vertex.header.replace("group(1)","group(2)")}},im={name:"local-uniform-bit",vertex:{header:`
|
|
492
492
|
|
|
493
493
|
uniform mat3 uTransformMatrix;
|
|
494
494
|
uniform vec4 uColor;
|
|
@@ -501,7 +501,7 @@ fn mainFragment(
|
|
|
501
501
|
{
|
|
502
502
|
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
503
503
|
}
|
|
504
|
-
`}};});var
|
|
504
|
+
`}};});var om,nm,am=p(()=>{om={name:"tiling-bit",vertex:{header:`
|
|
505
505
|
struct TilingUniforms {
|
|
506
506
|
uMapCoord:mat3x3<f32>,
|
|
507
507
|
uClampFrame:vec4<f32>,
|
|
@@ -544,7 +544,7 @@ fn mainFragment(
|
|
|
544
544
|
}
|
|
545
545
|
|
|
546
546
|
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
|
|
547
|
-
`}},
|
|
547
|
+
`}},nm={name:"tiling-bit",vertex:{header:`
|
|
548
548
|
uniform mat3 uTextureTransform;
|
|
549
549
|
uniform vec4 uSizeAnchor;
|
|
550
550
|
|
|
@@ -566,4 +566,4 @@ fn mainFragment(
|
|
|
566
566
|
|
|
567
567
|
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
568
568
|
|
|
569
|
-
`}};});var dh,fh,To,nm=p(()=>{tt();Rs();rm();Os();ni();ye();xt();om();To=class extends ee{constructor(){dh??(dh=ar({name:"tiling-sprite-shader",bits:[wi,im,lr]})),fh??(fh=hr({name:"tiling-sprite-shader",bits:[em,sm,ur]}));let t=new Mt({uMapCoord:{value:new M,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new M,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:fh,gpuProgram:dh,resources:{localUniforms:new Mt({uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:F.EMPTY.source,uSampler:F.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var wo,am=p(()=>{So();wo=class extends wr{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function hm(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height;}var lm=p(()=>{});function um(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,h=r.c,l=r.d,u=r.tx,c=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+h*d+u,i[e+1]=a*f+l*d+c,e+=t,s++;}}var cm=p(()=>{});function dm(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=M.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),um(t,2,0,a);}var fm=p(()=>{tt();cm();});var Po,Pi,pm=p(()=>{k();ri();Ks();oi();ui();qs();So();nm();am();lm();fm();Po=new wo,Pi=class{constructor(t){this._state=Le.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash");}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ve);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e);}else r.break(e),s.shader||(s.shader=new To),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,be(t.groupColorAlpha,r.uColor,0),this._state.blendMode=le(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Po,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new wr({indices:Po.indices,positions:Po.positions.slice(),uvs:Po.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:true,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),dm(t,r.uvs),hm(t,r.positions);}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=true;return this._renderer.type===te.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Pi.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"tilingSprite"};});var ph=p(()=>{k();pm();R.add(Pi);});var mm,xm,_m=p(()=>{dt();So();mm=class gm extends wr{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(I(H,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e);}build(t){t={...gm.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;r.push(f*h,d*l),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,m=d*this.verticesX+f,x=d*this.verticesX+f+1,g=(d+1)*this.verticesX+f,_=(d+1)*this.verticesX+f+1;o.push(m,x,g,x,_,g);}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};mm.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};xm=mm;});var ym,vm,Sm=p(()=>{_m();ym=class bm extends xm{constructor(t={}){t={...bm.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=r>f?1:r/f,m=Math.min(c,d),x=h*e,g=l*r;t[0]=t[8]=t[16]=t[24]=-x,t[2]=t[10]=t[18]=t[26]=s*m-x,t[4]=t[12]=t[20]=t[28]=e-o*m-x,t[6]=t[14]=t[22]=t[30]=e-x,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*m-g,t[17]=t[19]=t[21]=t[23]=r-a*m-g,t[25]=t[27]=t[29]=t[31]=r-g,this.getBuffer("aPosition").update();}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update();}};ym.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};vm=ym;});var Mi,Tm=p(()=>{k();Lt();qs();Sm();Mi=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash");}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];W.return(e.geometry),W.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=W.get(ve);return e.geometry=W.get(vm),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null;}};Mi.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"nineSliceSprite"};});var mh=p(()=>{k();Tm();R.add(Mi);});var Ci,wm=p(()=>{k();Ci=class{constructor(t){this._renderer=t;}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Ci.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"filter"};});function Pm(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var Mm=p(()=>{});var Jx,Ai,Cm=p(()=>{k();tt();Wt();ei();si();ye();xt();je();oi();Vt();Mm();bt();Jx=new Jt({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Ai=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Mt({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Ot({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=true;return}let o=s.bounds;if(t.renderables?Pm(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m);}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=true,u=false,c=false,f=true;for(let d=0;d<r.length;d++){let m=r[d];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),h+=m.padding,m.antialias==="off"?l=false:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(f=false),!!!(m.compatibleRenderers&e.type)){c=false;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??true)){O("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),c=false;break}c=m.enabled||c,u||(u=m.blendRequired);}if(!c){s.skip=true;return}if(f){let d=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/m,0,d.height/m);}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=true;return}s.skip=false,s.bounds=o,s.blendRequired=u,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=vt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,true),e.globalUniforms.push({offset:o});}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=F.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a);}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,false),vt.returnTexture(r);else {let a=e.inputTexture,h=vt.getOptimalTexture(s.width,s.height,a.source._resolution,false),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,true);let c=a;a=h,h=c;}n[l].apply(this,a,e.previousRenderSurface,false),vt.returnTexture(a),vt.returnTexture(h);}e.blendRequired&&vt.returnTexture(o);}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=vt.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=N.shared,u=n.previousRenderSurface===r,c=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(c=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,x=m.uOutputFrame,g=m.uInputSize,_=m.uInputPixel,y=m.uInputClamp,b=m.uGlobalFrame,v=m.uOutputTexture;if(u){let w=this._filterStackIndex;for(;w>0;){w--;let E=this._filterStack[this._filterStackIndex-1];if(!E.skip){h.x=E.bounds.minX,h.y=E.bounds.minY;break}}x[0]=a.minX-h.x,x[1]=a.minY-h.y;}else x[0]=0,x[1]=0;x[2]=e.frame.width,x[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],y[0]=.5*_[2],y[1]=.5*_[3],y[2]=e.frame.width*g[2]-.5*_[2],y[3]=e.frame.height*g[3]-.5*_[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;b[0]=h.x*c,b[1]=h.y*c,b[2]=P.source.width*c,b[3]=P.source.height*c;let T=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof F?(v[0]=r.frame.width,v[1]=r.frame.height):(v[0]=T.width,v[1]=T.height),v[2]=T.isRoot?-1:1,d.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(w,0);}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:Jx,shader:t,state:t._state,topology:"triangle-list"}),o.type===te.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new st,container:null,filterEffect:null,blendRequired:false,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(M.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Ai.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"filter"};});var gh=p(()=>{k();wm();Cm();R.add(Ai);R.add(Ci);});var t_={};var Am=p(()=>{hu();pn();gu();_u();ms();vs();Pa();Ma();Ba();eh();hh();ch();ph();mh();gh();});var e_={};var Bm=p(()=>{pn();ms();vs();Pa();Ma();Ba();eh();hh();ch();ph();mh();gh();});var ct={};Nm(ct,{DistortionFilter:()=>zi,EqualizerFilter:()=>Ut,Filter:()=>ut,MonoFilter:()=>Hi,ReverbFilter:()=>Wi,StereoFilter:()=>Vi,StreamFilter:()=>Ni,TelephoneFilter:()=>$i});var wh;function Ph(i){return wh=i,i}function j(){return wh}var ut=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var zi=class extends ut{constructor(t=0){let e;if(!j().useLegacy){let{audioContext:r}=j().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,j().useLegacy)return;let e=t*1e3,r=44100,s=new Float32Array(r),o=Math.PI/180,n=0,a;for(;n<r;++n)a=n*2/r-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var at=class{static setParamValue(t,e){if(t.setValueAtTime){let r=j().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var K=class extends ut{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,h=0,l=0){let u=[],c=[{f:K.F32,type:"lowshelf",gain:i},{f:K.F64,type:"peaking",gain:t},{f:K.F125,type:"peaking",gain:e},{f:K.F250,type:"peaking",gain:r},{f:K.F500,type:"peaking",gain:s},{f:K.F1K,type:"peaking",gain:o},{f:K.F2K,type:"peaking",gain:n},{f:K.F4K,type:"peaking",gain:a},{f:K.F8K,type:"peaking",gain:h},{f:K.F16K,type:"highshelf",gain:l}];j().useLegacy||(u=c.map(f=>{let d=j().context.audioContext.createBiquadFilter();return d.type=f.type,at.setParamValue(d.Q,1),d.frequency.value=f.f,at.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(i,t=0){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);at.setParamValue(this.bandsMap[i].gain,t);}getGain(i){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);return this.bandsMap[i].gain.value}set f32(i){this.setGain(K.F32,i);}get f32(){return this.getGain(K.F32)}set f64(i){this.setGain(K.F64,i);}get f64(){return this.getGain(K.F64)}set f125(i){this.setGain(K.F125,i);}get f125(){return this.getGain(K.F125)}set f250(i){this.setGain(K.F250,i);}get f250(){return this.getGain(K.F250)}set f500(i){this.setGain(K.F500,i);}get f500(){return this.getGain(K.F500)}set f1k(i){this.setGain(K.F1K,i);}get f1k(){return this.getGain(K.F1K)}set f2k(i){this.setGain(K.F2K,i);}get f2k(){return this.getGain(K.F2K)}set f4k(i){this.setGain(K.F4K,i);}get f4k(){return this.getGain(K.F4K)}set f8k(i){this.setGain(K.F8K,i);}get f8k(){return this.getGain(K.F8K)}set f16k(i){this.setGain(K.F16K,i);}get f16k(){return this.getGain(K.F16K)}reset(){this.bands.forEach(i=>{at.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},Ut=K;Ut.F32=32;Ut.F64=64;Ut.F125=125;Ut.F250=250;Ut.F500=500;Ut.F1K=1e3;Ut.F2K=2e3;Ut.F4K=4e3;Ut.F8K=8e3;Ut.F16K=16e3;var Hi=class extends ut{constructor(){let t,e;if(!j().useLegacy){let{audioContext:r}=j().context;e=r.createChannelSplitter(),t=r.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var Wi=class extends ut{constructor(t=3,e=2,r=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=r,this._rebuild();}_clamp(t,e,r){return Math.min(r,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(j().useLegacy)return;let{audioContext:t}=j().context,e=t.sampleRate,r=e*this._seconds,s=t.createBuffer(2,r,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<r;l++)a=this._reverse?r-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var Vi=class extends ut{constructor(t=0){let e,r,s;if(!j().useLegacy){let{audioContext:o}=j().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(r=o.createPanner(),r.panningModel="equalpower",s=r);}super(s),this._stereo=e,this._panner=r,this.pan=t;}set pan(t){this._pan=t,this._stereo?at.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Ni=class extends ut{constructor(){let t,e;if(!j().useLegacy){let{audioContext:r}=j().context;t=r.createMediaStreamDestination(),e=r.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var $i=class extends ut{constructor(){let t,e;if(!j().useLegacy){let{audioContext:r}=j().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",at.setParamValue(s.frequency,2e3),o.type="lowpass",at.setParamValue(o.frequency,2e3),n.type="highpass",at.setParamValue(n.frequency,500),a.type="highpass",at.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};k();var Em={extension:{type:S.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(Am(),t_));}};k();var km={extension:{type:S.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Bm(),e_));}};k();k();vs();ms();Tn();$t();Rn();Vr();Bt();ps();Oi(ua());R.add(Em,km);var Ei=class extends X{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var i_=0,xh=class extends X{constructor(i){super(),this.id=i_++,this.init(i);}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(i){this._playing=false,this._duration=i.source.duration;let t=this._source=i.source.cloneNode(false);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters");}refresh(){let i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=i.volume*(i.muted?0:1),r=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*r,this._source.playbackRate=this._speed*i.speed*t.speed;}refreshPaused(){let i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(i){let{start:t,end:e,speed:r,loop:s,volume:o,muted:n}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=r,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-xh.PADDING),this._end=Math.min(this._end+xh.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),ft.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){ft.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){ft.shared.remove(this._onUpdate,this),this.removeAllListeners();let i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Mo=xh;Mo.PADDING=.1;var Bi=class extends X{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Mo(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,r=this.parent;if(e.readyState===4){r.isLoaded=true;let h=r.autoPlayStart();t&&setTimeout(()=>{t(null,r,h);},0);return}if(!r.url){t(new Error("sound.url or sound.source must be set"));return}e.src=r.url;let s=()=>{a(),r.isLoaded=true;let h=r.autoPlayStart();t&&t(null,r,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var ki=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var He=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],_h=["audio/mpeg","audio/ogg"],We={};function Fm(i){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),r={},s=/^no$/;He.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";r[o]=!!n||!!a;}),Object.assign(We,r);}Fm();var o_=0,Fi=class extends X{constructor(t){super(),this.id=o_++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let r=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);at.setParamValue(this._gain.gain,o*s*r),at.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,r=this._paused||e.paused||t.paused;r!==this._pausedReal&&(this._pausedReal=r,r?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",r));}play(t){let{start:e,end:r,speed:s,loop:o,volume:n,muted:a,filters:h}=t;r&&console.assert(r>e,"End time is before start time"),this._paused=false;let{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=r,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=r,this._source.loopStart=e,this._source.start(0,e)):r?this._source.start(0,e,r-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){ft.shared.remove(this._updateListener,this),t&&ft.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),r=e-this._lastUpdate;if(r>0||t){let s=this._source.playbackRate.value;this._elapsed+=r*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Ve=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(r=>{e===null?this._input.connect(r.destination):e.connect(r.destination),e=r;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Gm=class extends Ve{constructor(i){let t=i.audioContext,e=t.createBufferSource(),r=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(r),r.connect(i.destination),super(s,r),this.context=i,this.bufferSource=e,this.gain=r,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Gm.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,at.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Co=Gm;Co.BUFFER_SIZE=0;var Ne=class{init(t){this.parent=t,this._nodes=new Co(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Fi(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,r=await ot.get().fetch(e);this._decode(await r.arrayBuffer(),t);}_decode(t,e){let r=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?r(null,t):this.parent.context.decode(t,r);}};var Pr=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=j().useLegacy?new Bi:new Ne;return new Pr(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(i){let[t]=i.map(e=>({url:e,ext:At.extname(e).slice(1)})).filter(({ext:e})=>We[e]).sort((e,r)=>He.indexOf(e.ext)-He.indexOf(r.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return j().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get filters(){return this.media.filters}set filters(i){this.media.filters=i;}addSprites(i,t){if(typeof i=="object"){let r={};for(let s in i)r[s]=this.addSprites(s,i[s]);return r}console.assert(!this._sprites[i],`Alias ${i} is already taken`);let e=new ki(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(i){if(i){let t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let r=this._createInstance();return this._instances.push(r),this.isPlaying=true,r.once("end",()=>{e.complete&&e.complete(this),this._onComplete(r);}),r.once("stop",()=>{this._onComplete(r);}),r.play(e),r}refresh(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh();}refreshPaused(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}_preload(i){this.media.load(i);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0;}_onComplete(i){if(this._instances){let t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(i);}_createInstance(){if(Pr._pool.length>0){let i=Pr._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),Pr._pool.indexOf(i)<0&&Pr._pool.push(i);}},It=Pr;It._pool=[];var Mr=class i extends Ve{constructor(){let t=window,e=new i.AudioContext,r=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(r),r.connect(e.destination),super(s,r),this.autoPause=true,this._ctx=e,this._offlineCtx=new i.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=r,this.analyser=s,this.events=new X,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let r=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},r);s&&s.catch(r);}};var Cr=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new Mr),this._htmlAudioContext=new Ei,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return Mr.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof It)return this._sounds[t]=e,e;let r=this._getOptions(e),s=It.from(r);return this._sounds[t]=s,s}_getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let r=!!this._sounds[t];return e&&console.assert(r,`No sound matching alias '${t}'.`),r}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let r=this.find(t);return e!==void 0&&(r.volume=e),r.volume}speed(t,e){let r=this.find(t);return e!==void 0&&(r.speed=e),r.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var Rm=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=At.basename(t,At.extname(t))),e},Im={extension:S.Asset,detection:{test:async()=>true,add:async i=>[...i,...He.filter(t=>We[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[S.LoadParser],priority:Qe.High},test(i){let t=At.extname(i).slice(1);return !!We[t]||_h.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>It.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return j().add(Rm(t),e),e},async unload(i,t){j().remove(Rm(t));}}};R.add(Im);var Y=Ph(new Cr);var it;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(it||={});var se=class i{static init(t){i._getStepCounter=t.getStepCounter,i._setStepCounter=t.setStepCounter,i._getCurrentGameStepState=t.getCurrentGameStepState,i._restoreGameStepState=t.restoreGameStepState,i._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(i._onGoNextEnd=t.onGoNextEnd),i._getVariable=t.getVariable,i._setVariable=t.setVariable,i._removeVariable=t.removeVariable,i._getFlag=t.getFlag,i._setFlag=t.setFlag,t.onLabelClosing&&(i._onLabelClosing=t.onLabelClosing),i._addHistoryItem=t.addHistoryItem,i._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,i._getCharacter=t.getCharacter;}static _getStepCounter=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return i._getStepCounter()}static set stepCounter(t){i._setStepCounter(t);}static _getCurrentGameStepState=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return i._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return i._restoreGameStepState}static _getOpenedLabels=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return i._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return i._onGoNextEnd}static _getVariable=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return i._getVariable}static _setVariable=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return i._setVariable}static _removeVariable=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return i._removeVariable}static _getFlag=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return i._getFlag}static _setFlag=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return i._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return i._onLabelClosing}static _addHistoryItem=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return i._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentStepsRunningNumber(){return i._getCurrentStepsRunningNumber()}static _getCharacter=()=>{throw it.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getCharacter(){return i._getCharacter}static onEnd;static onError};function Gi(i){try{if(typeof i>"u")return i;let t=JSON.stringify(i);return JSON.parse(t)}catch(t){throw it.error("Error creating exportable element",i,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var D=class{constructor(){}static soundAliasesOrder=[];static soundsPlaying={};static sounds={}};var $e=class i extends It{alias;pause(){if(!this.alias)throw new Error("[Pixi\u2019VN] The alias is not defined.");let t=D.soundsPlaying[this.alias];if(!t)throw new Error("[Pixi\u2019VN] The alias is not found in the playInStepIndex.");return D.soundsPlaying[this.alias]={...t,paused:true},super.pause()}resume(){if(!this.alias)throw new Error("[Pixi\u2019VN] The alias is not defined.");let t=D.soundsPlaying[this.alias];if(!t)throw new Error("[Pixi\u2019VN] The alias is not found in the playInStepIndex.");return D.soundsPlaying[this.alias]={options:t.options,stepIndex:se.stepCounter,paused:false},super.resume()}destroy(){return this.alias&&delete D.soundsPlaying[this.alias],super.destroy()}stop(){if(!this.alias)throw new Error("[Pixi\u2019VN] The alias is not defined.");return delete D.soundsPlaying[this.alias],super.stop()}play(t){if(typeof t=="string"&&(this.alias=t),!this.alias)throw new Error("[Pixi\u2019VN] The alias is not defined.");return D.soundsPlaying[this.alias]={stepIndex:se.stepCounter,options:t,paused:false},super.play(t)}static from(t){let e=It.from(t);return new i(e.media,e.options)}};function Ri(i){let t=[];for(let e of i)e.type==="TelephoneFilter"?t.push(new ct.TelephoneFilter):e.type==="StreamFilter"?t.push(new ct.StreamFilter):e.type==="StereoFilter"?t.push(new ct.StereoFilter(e.pan)):e.type==="ReverbFilter"?t.push(new ct.ReverbFilter(e.seconds,e.decay,e.reverse)):e.type==="MonoFilter"?t.push(new ct.MonoFilter):e.type==="EqualizerFilter"?t.push(new ct.EqualizerFilter(e.f32,e.f64,e.f125,e.f250,e.f500,e.f1k,e.f2k,e.f4k,e.f8k,e.f16k)):e.type==="DistortionFilter"?t.push(new ct.DistortionFilter(e.amount)):it.error("Unknown sound filter type");return t}function yh(i){if(!i)return;let t=[];for(let e of i)e instanceof ct.TelephoneFilter?t.push({type:"TelephoneFilter"}):e instanceof ct.StreamFilter?t.push({type:"StreamFilter"}):e instanceof ct.StereoFilter?t.push({type:"StereoFilter",pan:e.pan}):e instanceof ct.ReverbFilter?t.push({type:"ReverbFilter",seconds:e.seconds,decay:e.decay,reverse:e.reverse}):e instanceof ct.MonoFilter?t.push({type:"MonoFilter"}):e instanceof ct.EqualizerFilter?t.push({type:"EqualizerFilter",f32:e.f32,f64:e.f64,f125:e.f125,f250:e.f250,f500:e.f500,f1k:e.f1k,f2k:e.f2k,f4k:e.f4k,f8k:e.f8k,f16k:e.f16k}):e instanceof ct.DistortionFilter?t.push({type:"DistortionFilter",amount:e.amount}):it.error("Unknown sound filter type");return t}var Ii=class extends Cr{constructor(){super();}get context(){return Y.context}get filtersAll(){return Y.filtersAll}set filtersAll(t){Y.filtersAll=t.filter(e=>!(e instanceof ct.Filter));}get supported(){return Y.supported}getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}add(t,e){if(typeof t=="object")throw new Error("[Pixi\u2019VN] The method add(map: SoundSourceMap, globalOptions?: Options) is deprecated. Use add(alias: string, options: Options | string | ArrayBuffer | AudioBuffer | HTMLAudioElement | Sound): Sound; instead.");this.exists(t)&&this.remove(t),e instanceof It&&(e=e.options);let r;if(e instanceof $e)r=e;else {let s=this.getOptions(e||{});r=$e.from(s);}return r.alias=t,!D.soundAliasesOrder.includes(t)&&D.soundAliasesOrder.push(t),D.sounds[t]=r,Y.add(t,r),r}get useLegacy(){return Y.useLegacy}set useLegacy(t){Y.useLegacy=t;}get disableAutoPause(){return Y.disableAutoPause}set disableAutoPause(t){Y.disableAutoPause=t;}remove(t){return D.soundAliasesOrder=D.soundAliasesOrder.filter(e=>e!==t),delete D.soundsPlaying[t],delete D.sounds[t],Y.remove(t)}get volumeAll(){return Y.volumeAll}set volumeAll(t){Y.volumeAll=t;}get speedAll(){return Y.speedAll}set speedAll(t){Y.speedAll=t;}togglePauseAll(){return Y.togglePauseAll()}pauseAll(){return Y.pauseAll()}resumeAll(){return Y.resumeAll()}toggleMuteAll(){return Y.toggleMuteAll()}muteAll(){return Y.muteAll()}unmuteAll(){return Y.unmuteAll()}removeAll(){return D.soundAliasesOrder=[],D.soundsPlaying={},D.sounds={},Y.removeAll()}stopAll(){for(let t in D.sounds)D.sounds[t].stop();return D.soundsPlaying={},Y.stopAll()}exists(t,e){return Y.exists(t,e)||t in D.sounds}isPlaying(){return Y.isPlaying()}find(t){let e=D.sounds[t];return e||(e=Y.find(t),e&&(D.sounds[t]=e),e)}play(t,e){if(!this.exists(t))throw new Error("[Pixi\u2019VN] The alias is not found in the sound library.");return D.soundsPlaying[t]={stepIndex:se.stepCounter,options:e,paused:false},Y.play(t,e)}stop(t){return delete D.soundsPlaying[t],Y.stop(t)}pause(t){let e=D.soundsPlaying[t];if(!e)throw new Error("[Pixi\u2019VN] The alias is not found in the playInStepIndex.");return D.soundsPlaying[t]={...e,paused:true},Y.pause(t)}resume(t){let e=D.soundsPlaying[t];if(!e)throw new Error("[Pixi\u2019VN] The alias is not found in the playInStepIndex.");return D.soundsPlaying[t]={options:e.options,stepIndex:se.stepCounter,paused:false},Y.resume(t)}volume(t,e){return Y.volume(t,e)}speed(t,e){return Y.speed(t,e)}duration(t){return Y.duration(t)}close(){return Y.close()}clear(){this.stopAll();}export(){let t={};for(let e in D.soundsPlaying){let r=D.soundsPlaying[e],s=this.find(e);s&&(t[e]={...r,sound:{options:{...s.options,autoPlay:s.autoPlay,loop:s.loop,preload:s.preload,singleInstance:s.singleInstance,url:s.options.url,volume:s.options.volume},filters:yh(s.media.filters)}});}return {soundsPlaying:Gi(t),soundAliasesOrder:Gi(D.soundAliasesOrder),filters:Gi(yh(this.filtersAll))}}removeOldSoundAndExport(){return this.export()}restore(t){let e=se.stepCounter-1;this.clear();try{if(t.hasOwnProperty("soundAliasesOrder"))D.soundAliasesOrder=t.soundAliasesOrder;else {it.error("The data does not have the properties soundAliasesOrder");return}if(t.hasOwnProperty("filters")){let r=t.filters;r&&(this.filtersAll=Ri(r));}if(t.hasOwnProperty("playInStepIndex")){let r=t.playInStepIndex;r&&(D.soundsPlaying=r);}if(t.hasOwnProperty("sounds")){let r=t.sounds;for(let s in r){let o=r[s],n=!1,a=this.add(s,{...o.options,autoPlay:!1});if(s in D.soundsPlaying){let h=D.soundsPlaying[s];(o.options.loop||h.options&&typeof h.options=="object"&&h.options.loop||h.stepIndex===e)&&(n=!0),o.filters&&(a.filters=Ri(o.filters)),n&&a.play();}}}if(t.hasOwnProperty("soundsPlaying")){let r=t.soundsPlaying;for(let s in r){let o=r[s];D.soundsPlaying[s]={paused:o.paused,stepIndex:o.stepIndex,options:o.options};let n=r[s].sound,a=!1,h;if(this.exists(s)?(h=this.find(s),n.options.url=h.options.url,n.options.volume=h.options.volume,h.options=n.options,h.autoPlay=!1,h.filters=n.filters?Ri(n.filters):[]):h=this.add(s,{...n.options,autoPlay:!1}),s in D.soundsPlaying){let l=D.soundsPlaying[s];(n.options.loop||l.options&&typeof l.options=="object"&&l.options.loop||l.stepIndex===e)&&(a=!0),n.filters&&(h.filters=Ri(n.filters)),a&&h.play();}}}else {it.error("The data does not have the properties soundsPlaying");return}}catch(r){it.error("Error importing data",r);}}};var BR=new Ii;exports.Sound=$e;exports.SoundManagerStatic=D;exports.sound=BR;
|
|
569
|
+
`}};});var ph,mh,Mo,hm=p(()=>{et();Us();sm();Ws();hi();ve();yt();am();Mo=class extends ie{constructor(){ph??(ph=lr({name:"tiling-sprite-shader",bits:[Mi,om,cr]})),mh??(mh=ur({name:"tiling-sprite-shader",bits:[im,nm,dr]}));let t=new At({uMapCoord:{value:new M,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new M,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:mh,gpuProgram:ph,resources:{localUniforms:new At({uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:F.EMPTY.source,uSampler:F.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var Co,lm=p(()=>{Po();Co=class extends Mr{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function um(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height;}var cm=p(()=>{});function dm(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,h=r.c,l=r.d,u=r.tx,c=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+h*d+u,i[e+1]=a*f+l*d+c,e+=t,s++;}}var fm=p(()=>{});function pm(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=M.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),dm(t,2,0,a);}var mm=p(()=>{et();fm();});var Ao,Ci,gm=p(()=>{k();si();Qs();ai();di();Js();Po();hm();lm();cm();mm();Ao=new Co,Ci=class{constructor(t){this._state=ze.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash");}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new Te);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e);}else r.break(e),s.shader||(s.shader=new Mo),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Se(t.groupColorAlpha,r.uColor,0),this._state.blendMode=ce(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Ao,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Mr({indices:Ao.indices,positions:Ao.positions.slice(),uvs:Ao.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:true,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),pm(t,r.uvs),um(t,r.positions);}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=true;return this._renderer.type===re.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Ci.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"tilingSprite"};});var gh=p(()=>{k();gm();G.add(Ci);});var xm,ym,bm=p(()=>{pt();Po();xm=class _m extends Mr{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(I(W,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e);}build(t){t={..._m.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;r.push(f*h,d*l),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,m=d*this.verticesX+f,x=d*this.verticesX+f+1,g=(d+1)*this.verticesX+f,_=(d+1)*this.verticesX+f+1;o.push(m,x,g,x,_,g);}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};xm.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};ym=xm;});var vm,Tm,wm=p(()=>{bm();vm=class Sm extends ym{constructor(t={}){t={...Sm.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=r>f?1:r/f,m=Math.min(c,d),x=h*e,g=l*r;t[0]=t[8]=t[16]=t[24]=-x,t[2]=t[10]=t[18]=t[26]=s*m-x,t[4]=t[12]=t[20]=t[28]=e-o*m-x,t[6]=t[14]=t[22]=t[30]=e-x,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*m-g,t[17]=t[19]=t[21]=t[23]=r-a*m-g,t[25]=t[27]=t[29]=t[31]=r-g,this.getBuffer("aPosition").update();}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update();}};vm.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Tm=vm;});var Ai,Pm=p(()=>{k();zt();Js();wm();Ai=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash");}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];V.return(e.geometry),V.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=V.get(Te);return e.geometry=V.get(Tm),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null;}};Ai.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"nineSliceSprite"};});var xh=p(()=>{k();Pm();G.add(Ai);});var Ei,Mm=p(()=>{k();Ei=class{constructor(t){this._renderer=t;}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Ei.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"filter"};});function Cm(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var Am=p(()=>{});var r_,Bi,Em=p(()=>{k();et();Nt();ii();ni();ve();yt();qe();ai();$t();Am();St();r_=new ee({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Bi=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new At({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Ht({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=true;return}let o=s.bounds;if(t.renderables?Cm(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m);}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=true,u=false,c=false,f=true;for(let d=0;d<r.length;d++){let m=r[d];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),h+=m.padding,m.antialias==="off"?l=false:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(f=false),!!!(m.compatibleRenderers&e.type)){c=false;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??true)){z("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),c=false;break}c=m.enabled||c,u||(u=m.blendRequired);}if(!c){s.skip=true;return}if(f){let d=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/m,0,d.height/m);}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=true;return}s.skip=false,s.bounds=o,s.blendRequired=u,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=Tt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,true),e.globalUniforms.push({offset:o});}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=F.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a);}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,false),Tt.returnTexture(r);else {let a=e.inputTexture,h=Tt.getOptimalTexture(s.width,s.height,a.source._resolution,false),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,true);let c=a;a=h,h=c;}n[l].apply(this,a,e.previousRenderSurface,false),Tt.returnTexture(a),Tt.returnTexture(h);}e.blendRequired&&Tt.returnTexture(o);}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=Tt.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=$.shared,u=n.previousRenderSurface===r,c=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(c=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,x=m.uOutputFrame,g=m.uInputSize,_=m.uInputPixel,y=m.uInputClamp,b=m.uGlobalFrame,v=m.uOutputTexture;if(u){let w=this._filterStackIndex;for(;w>0;){w--;let E=this._filterStack[this._filterStackIndex-1];if(!E.skip){h.x=E.bounds.minX,h.y=E.bounds.minY;break}}x[0]=a.minX-h.x,x[1]=a.minY-h.y;}else x[0]=0,x[1]=0;x[2]=e.frame.width,x[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],y[0]=.5*_[2],y[1]=.5*_[3],y[2]=e.frame.width*g[2]-.5*_[2],y[3]=e.frame.height*g[3]-.5*_[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;b[0]=h.x*c,b[1]=h.y*c,b[2]=P.source.width*c,b[3]=P.source.height*c;let T=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof F?(v[0]=r.frame.width,v[1]=r.frame.height):(v[0]=T.width,v[1]=T.height),v[2]=T.isRoot?-1:1,d.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(w,0);}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:r_,shader:t,state:t._state,topology:"triangle-list"}),o.type===re.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new nt,container:null,filterEffect:null,blendRequired:false,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(M.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Bi.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"filter"};});var _h=p(()=>{k();Mm();Em();G.add(Bi);G.add(Ei);});var i_={};var Bm=p(()=>{uu();gn();_u();bu();_s();ws();Ca();Aa();Fa();ih();uh();fh();gh();xh();_h();});var s_={};var Fm=p(()=>{gn();_s();ws();Ca();Aa();Fa();ih();uh();fh();gh();xh();_h();});var ft={};Xm(ft,{DistortionFilter:()=>Vi,EqualizerFilter:()=>Lt,Filter:()=>dt,MonoFilter:()=>Ni,ReverbFilter:()=>$i,StereoFilter:()=>Yi,StreamFilter:()=>Xi,TelephoneFilter:()=>ji});var Mh;function Ch(i){return Mh=i,i}function K(){return Mh}var dt=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var Vi=class extends dt{constructor(t=0){let e;if(!K().useLegacy){let{audioContext:r}=K().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,K().useLegacy)return;let e=t*1e3,r=44100,s=new Float32Array(r),o=Math.PI/180,n=0,a;for(;n<r;++n)a=n*2/r-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var lt=class{static setParamValue(t,e){if(t.setValueAtTime){let r=K().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var q=class extends dt{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,h=0,l=0){let u=[],c=[{f:q.F32,type:"lowshelf",gain:i},{f:q.F64,type:"peaking",gain:t},{f:q.F125,type:"peaking",gain:e},{f:q.F250,type:"peaking",gain:r},{f:q.F500,type:"peaking",gain:s},{f:q.F1K,type:"peaking",gain:o},{f:q.F2K,type:"peaking",gain:n},{f:q.F4K,type:"peaking",gain:a},{f:q.F8K,type:"peaking",gain:h},{f:q.F16K,type:"highshelf",gain:l}];K().useLegacy||(u=c.map(f=>{let d=K().context.audioContext.createBiquadFilter();return d.type=f.type,lt.setParamValue(d.Q,1),d.frequency.value=f.f,lt.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(i,t=0){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);lt.setParamValue(this.bandsMap[i].gain,t);}getGain(i){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);return this.bandsMap[i].gain.value}set f32(i){this.setGain(q.F32,i);}get f32(){return this.getGain(q.F32)}set f64(i){this.setGain(q.F64,i);}get f64(){return this.getGain(q.F64)}set f125(i){this.setGain(q.F125,i);}get f125(){return this.getGain(q.F125)}set f250(i){this.setGain(q.F250,i);}get f250(){return this.getGain(q.F250)}set f500(i){this.setGain(q.F500,i);}get f500(){return this.getGain(q.F500)}set f1k(i){this.setGain(q.F1K,i);}get f1k(){return this.getGain(q.F1K)}set f2k(i){this.setGain(q.F2K,i);}get f2k(){return this.getGain(q.F2K)}set f4k(i){this.setGain(q.F4K,i);}get f4k(){return this.getGain(q.F4K)}set f8k(i){this.setGain(q.F8K,i);}get f8k(){return this.getGain(q.F8K)}set f16k(i){this.setGain(q.F16K,i);}get f16k(){return this.getGain(q.F16K)}reset(){this.bands.forEach(i=>{lt.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},Lt=q;Lt.F32=32;Lt.F64=64;Lt.F125=125;Lt.F250=250;Lt.F500=500;Lt.F1K=1e3;Lt.F2K=2e3;Lt.F4K=4e3;Lt.F8K=8e3;Lt.F16K=16e3;var Ni=class extends dt{constructor(){let t,e;if(!K().useLegacy){let{audioContext:r}=K().context;e=r.createChannelSplitter(),t=r.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var $i=class extends dt{constructor(t=3,e=2,r=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=r,this._rebuild();}_clamp(t,e,r){return Math.min(r,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(K().useLegacy)return;let{audioContext:t}=K().context,e=t.sampleRate,r=e*this._seconds,s=t.createBuffer(2,r,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<r;l++)a=this._reverse?r-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var Yi=class extends dt{constructor(t=0){let e,r,s;if(!K().useLegacy){let{audioContext:o}=K().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(r=o.createPanner(),r.panningModel="equalpower",s=r);}super(s),this._stereo=e,this._panner=r,this.pan=t;}set pan(t){this._pan=t,this._stereo?lt.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Xi=class extends dt{constructor(){let t,e;if(!K().useLegacy){let{audioContext:r}=K().context;t=r.createMediaStreamDestination(),e=r.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var ji=class extends dt{constructor(){let t,e;if(!K().useLegacy){let{audioContext:r}=K().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",lt.setParamValue(s.frequency,2e3),o.type="lowpass",lt.setParamValue(o.frequency,2e3),n.type="highpass",lt.setParamValue(n.frequency,500),a.type="highpass",lt.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};k();var km={extension:{type:S.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(Bm(),i_));}};k();var Rm={extension:{type:S.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Fm(),s_));}};k();k();ws();_s();Pn();Xt();Dn();$r();Ft();xs();Wi(da());G.add(km,Rm);var ki=class extends j{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var n_=0,yh=class extends j{constructor(i){super(),this.id=n_++,this.init(i);}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(i){this._playing=false,this._duration=i.source.duration;let t=this._source=i.source.cloneNode(false);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters");}refresh(){let i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=i.volume*(i.muted?0:1),r=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*r,this._source.playbackRate=this._speed*i.speed*t.speed;}refreshPaused(){let i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(i){let{start:t,end:e,speed:r,loop:s,volume:o,muted:n}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=r,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-yh.PADDING),this._end=Math.min(this._end+yh.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),mt.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){mt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){mt.shared.remove(this._onUpdate,this),this.removeAllListeners();let i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Eo=yh;Eo.PADDING=.1;var Fi=class extends j{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Eo(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,r=this.parent;if(e.readyState===4){r.isLoaded=true;let h=r.autoPlayStart();t&&setTimeout(()=>{t(null,r,h);},0);return}if(!r.url){t(new Error("sound.url or sound.source must be set"));return}e.src=r.url;let s=()=>{a(),r.isLoaded=true;let h=r.autoPlayStart();t&&t(null,r,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var Ri=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var Ve=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],bh=["audio/mpeg","audio/ogg"],Ne={};function Gm(i){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),r={},s=/^no$/;Ve.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";r[o]=!!n||!!a;}),Object.assign(Ne,r);}Gm();var h_=0,Gi=class extends j{constructor(t){super(),this.id=h_++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let r=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);lt.setParamValue(this._gain.gain,o*s*r),lt.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,r=this._paused||e.paused||t.paused;r!==this._pausedReal&&(this._pausedReal=r,r?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",r));}play(t){let{start:e,end:r,speed:s,loop:o,volume:n,muted:a,filters:h}=t;r&&console.assert(r>e,"End time is before start time"),this._paused=false;let{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=r,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=r,this._source.loopStart=e,this._source.start(0,e)):r?this._source.start(0,e,r-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){mt.shared.remove(this._updateListener,this),t&&mt.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),r=e-this._lastUpdate;if(r>0||t){let s=this._source.playbackRate.value;this._elapsed+=r*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var $e=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(r=>{e===null?this._input.connect(r.destination):e.connect(r.destination),e=r;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Im=class extends $e{constructor(i){let t=i.audioContext,e=t.createBufferSource(),r=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(r),r.connect(i.destination),super(s,r),this.context=i,this.bufferSource=e,this.gain=r,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Im.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,lt.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Bo=Im;Bo.BUFFER_SIZE=0;var Ye=class{init(t){this.parent=t,this._nodes=new Bo(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Gi(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,r=await at.get().fetch(e);this._decode(await r.arrayBuffer(),t);}_decode(t,e){let r=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?r(null,t):this.parent.context.decode(t,r);}};var Cr=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=K().useLegacy?new Fi:new Ye;return new Cr(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(i){let[t]=i.map(e=>({url:e,ext:Bt.extname(e).slice(1)})).filter(({ext:e})=>Ne[e]).sort((e,r)=>Ve.indexOf(e.ext)-Ve.indexOf(r.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return K().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get filters(){return this.media.filters}set filters(i){this.media.filters=i;}addSprites(i,t){if(typeof i=="object"){let r={};for(let s in i)r[s]=this.addSprites(s,i[s]);return r}console.assert(!this._sprites[i],`Alias ${i} is already taken`);let e=new Ri(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(i){if(i){let t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let r=this._createInstance();return this._instances.push(r),this.isPlaying=true,r.once("end",()=>{e.complete&&e.complete(this),this._onComplete(r);}),r.once("stop",()=>{this._onComplete(r);}),r.play(e),r}refresh(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh();}refreshPaused(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}_preload(i){this.media.load(i);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0;}_onComplete(i){if(this._instances){let t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(i);}_createInstance(){if(Cr._pool.length>0){let i=Cr._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),Cr._pool.indexOf(i)<0&&Cr._pool.push(i);}},Ut=Cr;Ut._pool=[];var Ar=class i extends $e{constructor(){let t=window,e=new i.AudioContext,r=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(r),r.connect(e.destination),super(s,r),this.autoPause=true,this._ctx=e,this._offlineCtx=new i.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=r,this.analyser=s,this.events=new j,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let r=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},r);s&&s.catch(r);}};var Er=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new Ar),this._htmlAudioContext=new ki,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return Ar.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof Ut)return this._sounds[t]=e,e;let r=this._getOptions(e),s=Ut.from(r);return this._sounds[t]=s,s}_getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let r=!!this._sounds[t];return e&&console.assert(r,`No sound matching alias '${t}'.`),r}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let r=this.find(t);return e!==void 0&&(r.volume=e),r.volume}speed(t,e){let r=this.find(t);return e!==void 0&&(r.speed=e),r.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var Dm=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=Bt.basename(t,Bt.extname(t))),e},Um={extension:S.Asset,detection:{test:async()=>true,add:async i=>[...i,...Ve.filter(t=>Ne[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[S.LoadParser],priority:tr.High},test(i){let t=Bt.extname(i).slice(1);return !!Ne[t]||bh.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>Ut.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return K().add(Dm(t),e),e},async unload(i,t){K().remove(Dm(t));}}};G.add(Um);var X=Ch(new Er);var rt;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(rt||(rt={}));var D=class D{static init(t){D._getStepCounter=t.getStepCounter,D._setStepCounter=t.setStepCounter,D._getCurrentGameStepState=t.getCurrentGameStepState,D._restoreGameStepState=t.restoreGameStepState,D._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(D._onGoNextEnd=t.onGoNextEnd),D._getVariable=t.getVariable,D._setVariable=t.setVariable,D._removeVariable=t.removeVariable,D._getFlag=t.getFlag,D._setFlag=t.setFlag,t.onLabelClosing&&(D._onLabelClosing=t.onLabelClosing),D._addHistoryItem=t.addHistoryItem,D._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,D._getCharacter=t.getCharacter;}static get stepCounter(){return D._getStepCounter()}static set stepCounter(t){D._setStepCounter(t);}static get currentGameStepState(){return D._getCurrentGameStepState()}static get restoreGameStepState(){return D._restoreGameStepState}static get openedLabels(){return D._getOpenedLabels()}static get onGoNextEnd(){return D._onGoNextEnd}static get getVariable(){return D._getVariable}static get setVariable(){return D._setVariable}static get removeVariable(){return D._removeVariable}static get getFlag(){return D._getFlag}static get setFlag(){return D._setFlag}static get onLabelClosing(){return D._onLabelClosing}static get addHistoryItem(){return D._addHistoryItem}static get currentStepsRunningNumber(){return D._getCurrentStepsRunningNumber()}static get getCharacter(){return D._getCharacter}};it(D,"_getStepCounter",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_setStepCounter",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_getCurrentGameStepState",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_restoreGameStepState",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_getOpenedLabels",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_onGoNextEnd",async()=>{}),it(D,"_getVariable",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_setVariable",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_removeVariable",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_getFlag",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_setFlag",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_onLabelClosing",()=>{}),it(D,"_addHistoryItem",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_getCurrentStepsRunningNumber",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),it(D,"_getCharacter",()=>{throw rt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")}),it(D,"onEnd"),it(D,"onError");var ne=D;function Ii(i){try{if(typeof i>"u")return i;let t=JSON.stringify(i);return JSON.parse(t)}catch(t){throw rt.error("Error creating exportable element",i,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var U=class{constructor(){}};it(U,"soundAliasesOrder",[]),it(U,"soundsPlaying",{}),it(U,"sounds",{});var Xe=class i extends Ut{constructor(){super(...arguments);it(this,"alias");}pause(){if(!this.alias)throw new Error("[Pixi\u2019VN] The alias is not defined.");let e=U.soundsPlaying[this.alias];if(!e)throw new Error("[Pixi\u2019VN] The alias is not found in the playInStepIndex.");return U.soundsPlaying[this.alias]={...e,paused:true},super.pause()}resume(){if(!this.alias)throw new Error("[Pixi\u2019VN] The alias is not defined.");let e=U.soundsPlaying[this.alias];if(!e)throw new Error("[Pixi\u2019VN] The alias is not found in the playInStepIndex.");return U.soundsPlaying[this.alias]={options:e.options,stepIndex:ne.stepCounter,paused:false},super.resume()}destroy(){return this.alias&&delete U.soundsPlaying[this.alias],super.destroy()}stop(){if(!this.alias)throw new Error("[Pixi\u2019VN] The alias is not defined.");return delete U.soundsPlaying[this.alias],super.stop()}play(e){if(typeof e=="string"&&(this.alias=e),!this.alias)throw new Error("[Pixi\u2019VN] The alias is not defined.");return U.soundsPlaying[this.alias]={stepIndex:ne.stepCounter,options:e,paused:false},super.play(e)}static from(e){let r=Ut.from(e);return new i(r.media,r.options)}};function Di(i){let t=[];for(let e of i)e.type==="TelephoneFilter"?t.push(new ft.TelephoneFilter):e.type==="StreamFilter"?t.push(new ft.StreamFilter):e.type==="StereoFilter"?t.push(new ft.StereoFilter(e.pan)):e.type==="ReverbFilter"?t.push(new ft.ReverbFilter(e.seconds,e.decay,e.reverse)):e.type==="MonoFilter"?t.push(new ft.MonoFilter):e.type==="EqualizerFilter"?t.push(new ft.EqualizerFilter(e.f32,e.f64,e.f125,e.f250,e.f500,e.f1k,e.f2k,e.f4k,e.f8k,e.f16k)):e.type==="DistortionFilter"?t.push(new ft.DistortionFilter(e.amount)):rt.error("Unknown sound filter type");return t}function vh(i){if(!i)return;let t=[];for(let e of i)e instanceof ft.TelephoneFilter?t.push({type:"TelephoneFilter"}):e instanceof ft.StreamFilter?t.push({type:"StreamFilter"}):e instanceof ft.StereoFilter?t.push({type:"StereoFilter",pan:e.pan}):e instanceof ft.ReverbFilter?t.push({type:"ReverbFilter",seconds:e.seconds,decay:e.decay,reverse:e.reverse}):e instanceof ft.MonoFilter?t.push({type:"MonoFilter"}):e instanceof ft.EqualizerFilter?t.push({type:"EqualizerFilter",f32:e.f32,f64:e.f64,f125:e.f125,f250:e.f250,f500:e.f500,f1k:e.f1k,f2k:e.f2k,f4k:e.f4k,f8k:e.f8k,f16k:e.f16k}):e instanceof ft.DistortionFilter?t.push({type:"DistortionFilter",amount:e.amount}):rt.error("Unknown sound filter type");return t}var Ui=class extends Er{constructor(){super();}get context(){return X.context}get filtersAll(){return X.filtersAll}set filtersAll(t){X.filtersAll=t.filter(e=>!(e instanceof ft.Filter));}get supported(){return X.supported}getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}add(t,e){if(typeof t=="object")throw new Error("[Pixi\u2019VN] The method add(map: SoundSourceMap, globalOptions?: Options) is deprecated. Use add(alias: string, options: Options | string | ArrayBuffer | AudioBuffer | HTMLAudioElement | Sound): Sound; instead.");this.exists(t)&&this.remove(t),e instanceof Ut&&(e=e.options);let r;if(e instanceof Xe)r=e;else {let s=this.getOptions(e||{});r=Xe.from(s);}return r.alias=t,!U.soundAliasesOrder.includes(t)&&U.soundAliasesOrder.push(t),U.sounds[t]=r,X.add(t,r),r}get useLegacy(){return X.useLegacy}set useLegacy(t){X.useLegacy=t;}get disableAutoPause(){return X.disableAutoPause}set disableAutoPause(t){X.disableAutoPause=t;}remove(t){return U.soundAliasesOrder=U.soundAliasesOrder.filter(e=>e!==t),delete U.soundsPlaying[t],delete U.sounds[t],X.remove(t)}get volumeAll(){return X.volumeAll}set volumeAll(t){X.volumeAll=t;}get speedAll(){return X.speedAll}set speedAll(t){X.speedAll=t;}togglePauseAll(){return X.togglePauseAll()}pauseAll(){return X.pauseAll()}resumeAll(){return X.resumeAll()}toggleMuteAll(){return X.toggleMuteAll()}muteAll(){return X.muteAll()}unmuteAll(){return X.unmuteAll()}removeAll(){return U.soundAliasesOrder=[],U.soundsPlaying={},U.sounds={},X.removeAll()}stopAll(){for(let t in U.sounds)U.sounds[t].stop();return U.soundsPlaying={},X.stopAll()}exists(t,e){return X.exists(t,e)||t in U.sounds}isPlaying(){return X.isPlaying()}find(t){let e=U.sounds[t];return e||(e=X.find(t),e&&(U.sounds[t]=e),e)}play(t,e){if(!this.exists(t))throw new Error("[Pixi\u2019VN] The alias is not found in the sound library.");return U.soundsPlaying[t]={stepIndex:ne.stepCounter,options:e,paused:false},X.play(t,e)}stop(t){return delete U.soundsPlaying[t],X.stop(t)}pause(t){let e=U.soundsPlaying[t];if(!e)throw new Error("[Pixi\u2019VN] The alias is not found in the playInStepIndex.");return U.soundsPlaying[t]={...e,paused:true},X.pause(t)}resume(t){let e=U.soundsPlaying[t];if(!e)throw new Error("[Pixi\u2019VN] The alias is not found in the playInStepIndex.");return U.soundsPlaying[t]={options:e.options,stepIndex:ne.stepCounter,paused:false},X.resume(t)}volume(t,e){return X.volume(t,e)}speed(t,e){return X.speed(t,e)}duration(t){return X.duration(t)}close(){return X.close()}clear(){this.stopAll();}export(){let t={};for(let e in U.soundsPlaying){let r=U.soundsPlaying[e],s=this.find(e);s&&(t[e]={...r,sound:{options:{...s.options,autoPlay:s.autoPlay,loop:s.loop,preload:s.preload,singleInstance:s.singleInstance,url:s.options.url,volume:s.options.volume},filters:vh(s.media.filters)}});}return {soundsPlaying:Ii(t),soundAliasesOrder:Ii(U.soundAliasesOrder),filters:Ii(vh(this.filtersAll))}}removeOldSoundAndExport(){return this.export()}restore(t){let e=ne.stepCounter-1;this.clear();try{if(t.hasOwnProperty("soundAliasesOrder"))U.soundAliasesOrder=t.soundAliasesOrder;else {rt.error("The data does not have the properties soundAliasesOrder");return}if(t.hasOwnProperty("filters")){let r=t.filters;r&&(this.filtersAll=Di(r));}if(t.hasOwnProperty("playInStepIndex")){let r=t.playInStepIndex;r&&(U.soundsPlaying=r);}if(t.hasOwnProperty("sounds")){let r=t.sounds;for(let s in r){let o=r[s],n=!1,a=this.add(s,{...o.options,autoPlay:!1});if(s in U.soundsPlaying){let h=U.soundsPlaying[s];(o.options.loop||h.options&&typeof h.options=="object"&&h.options.loop||h.stepIndex===e)&&(n=!0),o.filters&&(a.filters=Di(o.filters)),n&&a.play();}}}if(t.hasOwnProperty("soundsPlaying")){let r=t.soundsPlaying;for(let s in r){let o=r[s];U.soundsPlaying[s]={paused:o.paused,stepIndex:o.stepIndex,options:o.options};let n=r[s].sound,a=!1,h;if(this.exists(s)?(h=this.find(s),n.options.url=h.options.url,n.options.volume=h.options.volume,h.options=n.options,h.autoPlay=!1,h.filters=n.filters?Di(n.filters):[]):h=this.add(s,{...n.options,autoPlay:!1}),s in U.soundsPlaying){let l=U.soundsPlaying[s];(n.options.loop||l.options&&typeof l.options=="object"&&l.options.loop||l.stepIndex===e)&&(a=!0),n.filters&&(h.filters=Di(n.filters)),a&&h.play();}}}else {rt.error("The data does not have the properties soundsPlaying");return}}catch(r){rt.error("Error importing data",r);}}};var DG=new Ui;exports.Sound=Xe;exports.SoundManagerStatic=U;exports.sound=DG;
|