@drincs/pixi-vn 1.2.13 → 1.2.14

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.
@@ -1,9 +1,9 @@
1
- 'use strict';var Jm=Object.create;var Uo=Object.defineProperty;var tg=Object.getOwnPropertyDescriptor;var eg=Object.getOwnPropertyNames;var rg=Object.getPrototypeOf,ig=Object.prototype.hasOwnProperty;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var Lo=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),sg=(i,t)=>{for(var e in t)Uo(i,e,{get:t[e],enumerable:true});},og=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of eg(t))!ig.call(i,s)&&s!==e&&Uo(i,s,{get:()=>t[s],enumerable:!(r=tg(t,s))||r.enumerable});return i};var Wi=(i,t,e)=>(e=i!=null?Jm(rg(i)):{},og(Uo(e,"default",{value:i,enumerable:true}),i));var T,Oo,Ir,k,R=p(()=>{T=(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))(T||{}),Oo=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)=>Oo(i).priority??t,k={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Oo).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t));}),this},add(...i){return i.map(Oo).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 Dh=Lo((py,zo)=>{var ng=Object.prototype.hasOwnProperty,bt="~";function Dr(){}Object.create&&(Dr.prototype=Object.create(null),new Dr().__proto__||(bt=false));function ag(i,t,e){this.fn=i,this.context=t,this.once=e||false;}function Ih(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new ag(e,r||i,s),n=bt?bt+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 xt(){this._events=new Dr,this._eventsCount=0;}xt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)ng.call(e,r)&&t.push(bt?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};xt.prototype.listeners=function(t){var e=bt?bt+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};xt.prototype.listenerCount=function(t){var e=bt?bt+t:t,r=this._events[e];return r?r.fn?1:r.length:0};xt.prototype.emit=function(t,e,r,s,o,n){var a=bt?bt+t:t;if(!this._events[a])return false;var h=this._events[a],l=arguments.length,c,u;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(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c);}else {var f=h.length,d;for(u=0;u<f;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,true),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];h[u].fn.apply(h[u].context,c);}}return true};xt.prototype.on=function(t,e,r){return Ih(this,t,e,r,false)};xt.prototype.once=function(t,e,r){return Ih(this,t,e,r,true)};xt.prototype.removeListener=function(t,e,r,s){var o=bt?bt+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};xt.prototype.removeAllListeners=function(t){var e;return t?(e=bt?bt+t:t,this._events[e]&&Ki(this,e)):(this._events=new Dr,this._eventsCount=0),this};xt.prototype.off=xt.prototype.removeListener;xt.prototype.addListener=xt.prototype.on;xt.prefixed=bt;xt.EventEmitter=xt;typeof zo<"u"&&(zo.exports=xt);});var Uh,$,At=p(()=>{Uh=Wi(Dh()),$=Uh.default;});var hg,re,dt,kt,Yh,Lh,Ho,lg,qi,$h,Xh,Oh,zh,Hh,Ur,cg,ug,dg,fg,No,Wh,pg,Wo,Vo,Vh,Yo,Lt,Nh,jh,Kh=p(()=>{hg={grad:.9,turn:360,rad:360/(2*Math.PI)},re=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},dt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},kt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Yh=function(i){return (i=isFinite(i)?i%360:0)>0?i:i+360},Lh=function(i){return {r:kt(i.r,0,255),g:kt(i.g,0,255),b:kt(i.b,0,255),a:kt(i.a)}},Ho=function(i){return {r:dt(i.r),g:dt(i.g),b:dt(i.b),a:dt(i.a,3)}},lg=/^#([0-9a-f]{3,8})$/i,qi=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},$h=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}},Xh=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}},Oh=function(i){return {h:Yh(i.h),s:kt(i.s,0,100),l:kt(i.l,0,100),a:kt(i.a)}},zh=function(i){return {h:dt(i.h),s:dt(i.s),l:dt(i.l),a:dt(i.a,3)}},Hh=function(i){return Xh((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=$h(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;},cg=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ug=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,dg=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,fg=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,No={string:[[function(i){var t=lg.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?dt(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?dt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=dg.exec(i)||fg.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Lh({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=cg.exec(i)||ug.exec(i);if(!t)return null;var e,r,s=Oh({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(hg[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Hh(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 re(t)&&re(e)&&re(r)?Lh({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(!re(t)||!re(e)||!re(r))return null;var n=Oh({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Hh(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!re(t)||!re(e)||!re(r))return null;var n=function(a){return {h:Yh(a.h),s:kt(a.s,0,100),v:kt(a.v,0,100),a:kt(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Xh(n)},"hsv"]]},Wh=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]},pg=function(i){return typeof i=="string"?Wh(i.trim(),No.string):typeof i=="object"&&i!==null?Wh(i,No.object):[null,void 0]},Wo=function(i,t){var e=Ur(i);return {h:e.h,s:kt(e.s+100*t,0,100),l:e.l,a:e.a}},Vo=function(i){return (299*i.r+587*i.g+114*i.b)/1e3/255},Vh=function(i,t){var e=Ur(i);return {h:e.h,s:e.s,l:kt(e.l+100*t,0,100),a:e.a}},Yo=function(){function i(t){this.parsed=pg(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 dt(Vo(this.rgba),2)},i.prototype.isDark=function(){return Vo(this.rgba)<.5},i.prototype.isLight=function(){return Vo(this.rgba)>=.5},i.prototype.toHex=function(){return t=Ho(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?qi(dt(255*o)):"","#"+qi(e)+qi(r)+qi(s)+n;var t,e,r,s,o,n;},i.prototype.toRgb=function(){return Ho(this.rgba)},i.prototype.toRgbString=function(){return t=Ho(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 zh(Ur(this.rgba))},i.prototype.toHslString=function(){return t=zh(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=$h(this.rgba),{h:dt(t.h),s:dt(t.s),v:dt(t.v),a:dt(t.a,3)};var t;},i.prototype.invert=function(){return Lt({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),Lt(Wo(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Lt(Wo(this.rgba,-t))},i.prototype.grayscale=function(){return Lt(Wo(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Lt(Vh(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Lt(Vh(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"?Lt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):dt(this.rgba.a,3);var e;},i.prototype.hue=function(t){var e=Ur(this.rgba);return typeof t=="number"?Lt({h:t,s:e.s,l:e.l,a:e.a}):dt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Lt(t).toHex()},i}(),Lt=function(i){return i instanceof Yo?i:new Yo(i)},Nh=[],jh=function(i){i.forEach(function(t){Nh.indexOf(t)<0&&(t(Yo,No),Nh.push(t));});};});function qh(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 c=this.toRgb(),u=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=c,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<u&&(u=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 Zh=p(()=>{});var Ye,V,Pt=p(()=>{Kh();Zh();jh([qh]);Ye=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=Lt(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}};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 Qh,Jh=p(()=>{Qh={cullArea:null,cullable:false,cullableChildren:true};});var tl,el,rl,$o=p(()=>{tl=Math.PI*2,el=180/Math.PI,rl=Math.PI/180;});var N,Xo,Ot=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 Xo.x=0,Xo.y=0,Xo}},Xo=new N;});var C,mg,gg,J=p(()=>{$o();Ot();C=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),c=t.x,u=t.y;return e.x=n*l*c+-o*l*u+(h*o-a*n)*l,e.y=r*l*u+-s*l*c+(-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,c=e.b,u=e.c,f=e.d;return this.a=r*l+s*u,this.b=r*c+s*f,this.c=o*l+n*u,this.d=o*c+n*f,this.tx=a*l+h*u+e.tx,this.ty=a*c+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(tl-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 gg.identity()}static get shared(){return mg.identity()}},mg=new C,gg=new C;});var vt,jo=p(()=>{vt=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 Ko[i]===void 0&&(Ko[i]=-1),++Ko[i]}var Ko,St=p(()=>{Ko={default:-1};});function I(i,t,e=3){if(il[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1
+ 'use strict';var ox=Object.create;var Is=Object.defineProperty;var nx=Object.getOwnPropertyDescriptor;var ax=Object.getOwnPropertyNames;var hx=Object.getPrototypeOf,lx=Object.prototype.hasOwnProperty;var Il=i=>{throw TypeError(i)};var cx=(i,t,e)=>t in i?Is(i,t,{enumerable:true,configurable:true,writable:true,value:e}):i[t]=e;var m=(i,t)=>()=>(i&&(t=i(i=0)),t);var In=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),ux=(i,t)=>{for(var e in t)Is(i,e,{get:t[e],enumerable:true});},dx=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ax(t))!lx.call(i,s)&&s!==e&&Is(i,s,{get:()=>t[s],enumerable:!(r=nx(t,s))||r.enumerable});return i};var Ds=(i,t,e)=>(e=i!=null?ox(hx(i)):{},dx(Is(e,"default",{value:i,enumerable:true}),i));var k=(i,t,e)=>cx(i,typeof t!="symbol"?t+"":t,e),Dn=(i,t,e)=>t.has(i)||Il("Cannot "+e);var g=(i,t,e)=>(Dn(i,t,"read from private field"),e?e.call(i):t.get(i)),Q=(i,t,e)=>t.has(i)?Il("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),L=(i,t,e,r)=>(Dn(i,t,"write to private field"),t.set(i,e),e),R=(i,t,e)=>(Dn(i,t,"access private method"),e);var Us=(i,t,e,r)=>({set _(s){L(i,t,s);},get _(){return g(i,t,r)}});var w,Un,Mi,O,D=m(()=>{w=(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))(w||{}),Un=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},Mi=(i,t)=>Un(i).priority??t,O={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Un).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t));}),this},add(...i){return i.map(Un).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)=>Mi(n.value,e)-Mi(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)=>Mi(o,e)-Mi(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 Ol=In((vb,Ln)=>{var fx=Object.prototype.hasOwnProperty,Dt="~";function Ci(){}Object.create&&(Ci.prototype=Object.create(null),new Ci().__proto__||(Dt=false));function px(i,t,e){this.fn=i,this.context=t,this.once=e||false;}function Ll(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new px(e,r||i,s),n=Dt?Dt+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 Ns(i,t){--i._eventsCount===0?i._events=new Ci:delete i._events[t];}function Rt(){this._events=new Ci,this._eventsCount=0;}Rt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)fx.call(e,r)&&t.push(Dt?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Rt.prototype.listeners=function(t){var e=Dt?Dt+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};Rt.prototype.listenerCount=function(t){var e=Dt?Dt+t:t,r=this._events[e];return r?r.fn?1:r.length:0};Rt.prototype.emit=function(t,e,r,s,o,n){var a=Dt?Dt+t:t;if(!this._events[a])return false;var h=this._events[a],l=arguments.length,c,u;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(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c);}else {var f=h.length,d;for(u=0;u<f;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,true),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];h[u].fn.apply(h[u].context,c);}}return true};Rt.prototype.on=function(t,e,r){return Ll(this,t,e,r,false)};Rt.prototype.once=function(t,e,r){return Ll(this,t,e,r,true)};Rt.prototype.removeListener=function(t,e,r,s){var o=Dt?Dt+t:t;if(!this._events[o])return this;if(!e)return Ns(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&Ns(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:Ns(this,o);}return this};Rt.prototype.removeAllListeners=function(t){var e;return t?(e=Dt?Dt+t:t,this._events[e]&&Ns(this,e)):(this._events=new Ci,this._eventsCount=0),this};Rt.prototype.off=Rt.prototype.removeListener;Rt.prototype.addListener=Rt.prototype.on;Rt.prefixed=Dt;Rt.EventEmitter=Rt;typeof Ln<"u"&&(Ln.exports=Rt);});var zl,tt,$t=m(()=>{zl=Ds(Ol()),tt=zl.default;});var mx,Re,Pt,re,jl,Hl,On,gx,Ys,Kl,ql,Wl,Vl,Nl,Ai,xx,_x,yx,bx,Wn,Yl,vx,zn,Hn,$l,Vn,ne,Xl,Zl,Ql=m(()=>{mx={grad:.9,turn:360,rad:360/(2*Math.PI)},Re=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},re=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},jl=function(i){return (i=isFinite(i)?i%360:0)>0?i:i+360},Hl=function(i){return {r:re(i.r,0,255),g:re(i.g,0,255),b:re(i.b,0,255),a:re(i.a)}},On=function(i){return {r:Pt(i.r),g:Pt(i.g),b:Pt(i.b),a:Pt(i.a,3)}},gx=/^#([0-9a-f]{3,8})$/i,Ys=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Kl=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}},ql=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}},Wl=function(i){return {h:jl(i.h),s:re(i.s,0,100),l:re(i.l,0,100),a:re(i.a)}},Vl=function(i){return {h:Pt(i.h),s:Pt(i.s),l:Pt(i.l),a:Pt(i.a,3)}},Nl=function(i){return ql((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;},Ai=function(i){return {h:(t=Kl(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;},xx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_x=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,bx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Wn={string:[[function(i){var t=gx.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=yx.exec(i)||bx.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Hl({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=xx.exec(i)||_x.exec(i);if(!t)return null;var e,r,s=Wl({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(mx[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Nl(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 Re(t)&&Re(e)&&Re(r)?Hl({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(!Re(t)||!Re(e)||!Re(r))return null;var n=Wl({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Nl(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Re(t)||!Re(e)||!Re(r))return null;var n=function(a){return {h:jl(a.h),s:re(a.s,0,100),v:re(a.v,0,100),a:re(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return ql(n)},"hsv"]]},Yl=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]},vx=function(i){return typeof i=="string"?Yl(i.trim(),Wn.string):typeof i=="object"&&i!==null?Yl(i,Wn.object):[null,void 0]},zn=function(i,t){var e=Ai(i);return {h:e.h,s:re(e.s+100*t,0,100),l:e.l,a:e.a}},Hn=function(i){return (299*i.r+587*i.g+114*i.b)/1e3/255},$l=function(i,t){var e=Ai(i);return {h:e.h,s:e.s,l:re(e.l+100*t,0,100),a:e.a}},Vn=function(){function i(t){this.parsed=vx(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(Hn(this.rgba),2)},i.prototype.isDark=function(){return Hn(this.rgba)<.5},i.prototype.isLight=function(){return Hn(this.rgba)>=.5},i.prototype.toHex=function(){return t=On(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?Ys(Pt(255*o)):"","#"+Ys(e)+Ys(r)+Ys(s)+n;var t,e,r,s,o,n;},i.prototype.toRgb=function(){return On(this.rgba)},i.prototype.toRgbString=function(){return t=On(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 Vl(Ai(this.rgba))},i.prototype.toHslString=function(){return t=Vl(Ai(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=Kl(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 ne({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),ne(zn(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),ne(zn(this.rgba,-t))},i.prototype.grayscale=function(){return ne(zn(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),ne($l(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),ne($l(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"?ne({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=Ai(this.rgba);return typeof t=="number"?ne({h:t,s:e.s,l:e.l,a:e.a}):Pt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===ne(t).toHex()},i}(),ne=function(i){return i instanceof Vn?i:new Vn(i)},Xl=[],Zl=function(i){i.forEach(function(t){Xl.indexOf(t)<0&&(t(Vn,Wn),Xl.push(t));});};});function Jl(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 c=this.toRgb(),u=1/0,f="black";if(!o.length)for(var d in e)o[d]=new i(e[d]).toRgb();for(var p in e){var _=(a=c,h=o[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));_<u&&(u=_,f=p);}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 tc=m(()=>{});var Br,q,Vt=m(()=>{Ql();tc();Zl([Jl]);Br=class Ei{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 Ei)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]=Ei._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=Ei.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`);}let n=ne(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 Ei||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}};Br.shared=new Br;Br._temp=new Br;Br.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;q=Br;});var ec,rc=m(()=>{ec={cullArea:null,cullable:false,cullableChildren:true};});var ic,sc,oc,Nn=m(()=>{ic=Math.PI*2,sc=180/Math.PI,oc=Math.PI/180;});var Z,Yn,ae=m(()=>{Z=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 Yn.x=0,Yn.y=0,Yn}},Yn=new Z;});var E,Sx,Tx,at=m(()=>{Nn();ae();E=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 Z;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 Z;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),c=t.x,u=t.y;return e.x=n*l*c+-o*l*u+(h*o-a*n)*l,e.y=r*l*u+-s*l*c+(-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,c=e.b,u=e.c,f=e.d;return this.a=r*l+s*u,this.b=r*c+s*f,this.c=o*l+n*u,this.d=o*c+n*f,this.tx=a*l+h*u+e.tx,this.ty=a*c+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(ic-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 Tx.identity()}static get shared(){return Sx.identity()}},Sx=new E,Tx=new E;});var Ut,$n=m(()=>{Ut=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 J(i="default"){return Xn[i]===void 0&&(Xn[i]=-1),++Xn[i]}var Xn,Lt=m(()=>{Xn={default:-1};});function z(i,t,e=3){if(nc[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))),il[t]=true;}var il,H,sl,ct=p(()=>{il={},H="8.0.0",sl="8.3.4";});var Ce,qo=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 Zo,W,It=p(()=>{qo();Zo=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 Zo;});var ol,nl=p(()=>{ct();ol={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 Qo=p(()=>{});var al,hl=p(()=>{Qo();ct();al={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(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 ll,cl=p(()=>{ll={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,ul=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 Jo,Qi,dl=p(()=>{R();It();Jo=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);}},Qi=new Jo;k.handleByList(T.MaskEffect,Qi._effectClasses);});var fl,pl=p(()=>{ul();dl();fl={_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 ml,gl=p(()=>{ct();ml={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 Ji,K,Et=p(()=>{Ot();Ji=[new N,new N,new N,new N],K=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),c=r-l,u=a-l,f=a+o+l,d=h-l,m=h+n+l,x=a+c,g=a+o-c,_=h+c,y=h+n-c;return t>=u&&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 M=this.y<t.y?t.y:this.y;return (this.bottom>t.bottom?t.bottom:this.bottom)>M}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),c=Ji[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return false;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return false;let f=u*(h.y-a.y),d=u*(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*c.x+d*c.y)return false;let y=u*(a.y-l.y),v=u*(l.x-a.x),b=y*r+v*o,P=y*s+v*o,S=y*r+v*n,w=y*s+v*n;return !(Math.max(b,P,S,w)<=y*a.x+v*a.y||Math.min(b,P,S,w)>=y*c.x+v*c.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 xl,it,zt=p(()=>{J();Et();xl=new C,it=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=xl,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 K);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=xl,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,c=o.tx,u=o.ty,f=this.minX,d=this.minY,m=this.maxX,x=this.maxY,g=n*t+h*e+c,_=a*t+l*e+u;g<f&&(f=g),_<d&&(d=_),g>m&&(m=g),_>x&&(x=_),g=n*r+h*e+c,_=a*r+l*e+u,g<f&&(f=g),_<d&&(d=_),g>m&&(m=g),_>x&&(x=_),g=n*t+h*s+c,_=a*t+l*s+u,g<f&&(f=g),_<d&&(d=_),g>m&&(m=g),_>x&&(x=_),g=n*r+h*s+c,_=a*r+l*s+u,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:c,ty:u}=t,f=n*e+h*r+c,d=a*e+l*r+u;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=n*s+h*r+c,d=a*s+l*r+u,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+c,d=a*e+l*o+u,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+c,d=a*s+l*o+u,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,c=s.b,u=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+u*_+d,v=c*g+f*_+m;o=y<o?y:o,n=v<n?v:n,a=y>a?y:a,h=v>h?v: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 at,Bt,Ae=p(()=>{J();qo();zt();at=new Ce(C),Bt=new Ce(it);});var xg,_l,yl=p(()=>{J();zt();Ae();xg=new C,_l={getFastGlobalBounds(i,t){t||(t=new it),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=Bt.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(xg).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),Bt.return(r);}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Bt.return(r));}};});function ts(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=at.get().identity(),r=es(i,s)):r=C.IDENTITY,bl(i,e,r,t),s&&at.return(s),e.isValid||e.set(0,0,0,0),e}function bl(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=at.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=Bt.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++)bl(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,C.IDENTITY),Bt.return(t);}r||at.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(()=>{J();Ae();});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,c=s*a/255|0;return (h<<16)+(l<<8)+c}var tn=p(()=>{});function en(i,t){return i===vl?t:t===vl?i:is(i,t)}var vl,Sl=p(()=>{tn();vl=16777215;});function zr(i){return ((i&255)<<16)+(i&65280)+(i>>16&255)}var Tl,wl=p(()=>{rs();Ae();Sl();Tl={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,at.get().identity());return i.appendFrom(this.localTransform,e),at.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?zr(this.renderGroup.worldColor):this.parentRenderGroup?zr(en(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=en(t,e.localColor),e=e.parent;return zr(t)}};});function O(...i){rn!==Pl&&(rn++,rn===Pl?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i));}var rn,Pl,_t=p(()=>{rn=0,Pl=500;});function ss(i,t,e){return t.clear(),e||(e=C.IDENTITY),Ml(i,t,e,i,true),t.isValid||t.set(0,0,0,0),t}function Ml(i,t,e,r,s){let o;if(s)o=at.get(),o=e.copyTo(o);else {if(!i.visible||!i.measurable)return;i.updateLocalTransform();let h=i.localTransform;o=at.get(),o.appendFrom(h,e);}let n=t,a=!!i.effects.length;if(a&&(t=Bt.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++)Ml(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,C.IDENTITY),Bt.return(t);}at.return(o);}var sn=p(()=>{J();Ae();});function on(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&&on(s,t);}return t.didChange}var Cl=p(()=>{});var _g,Al,El=p(()=>{J();zt();rs();sn();Cl();_g=new C,Al={_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 it});let i=this._localBoundsCacheData;return i.index=1,i.didChange=false,i.data[0]!==this._didViewChangeTick&&(i.didChange=true,i.data[0]=this._didViewChangeTick),on(this,i),i.didChange&&ss(this,i.localBounds,_g),i.localBounds},getBounds(i,t){return ts(this,i,t||new it)}};});var Bl,Fl=p(()=>{Bl={_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 yg(i,t){return i._zIndex-t._zIndex}var Rl,Gl=p(()=>{Rl={_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(yg));}};});var kl,Il=p(()=>{Ot();Ae();kl={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(at.get(),e);return t=r.apply(i,t),at.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(at.get(),r);return e=s.applyInverse(i,e),at.return(s),e}};});var $e,nn=p(()=>{St();$e=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 ie(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 an(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 hn=p(()=>{});function bg(i){let t=Dl[i];return t===void 0&&(Dl[i]=Y("resource")),t}var Dl,Ul,ns,ln=p(()=>{At();St();ct();Dl=Object.create(null);Ul=class Ll extends ${constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=false,t={...Ll.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=bg(t),this._resourceId}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners();}};Ul.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};ns=Ul;});var Ol,pt,ce=p(()=>{At();Hr();hn();St();ln();Ol=class zl extends ${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={...zl.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=an(this.pixelWidth)&&an(this.pixelHeight);}static test(t){throw new Error("Unimplemented")}};Ol.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:false,sampleCount:1,antialias:false,autoGarbageCollect:false};pt=Ol;});function vg(){for(let i=0;i<16;i++){let t=[];cn.push(t);for(let e=0;e<16;e++){let r=as(Ee[i]*Ee[e]+Fe[i]*Be[e]),s=as(Be[i]*Ee[e]+Re[i]*Be[e]),o=as(Ee[i]*Fe[e]+Fe[i]*Re[e]),n=as(Be[i]*Fe[e]+Re[i]*Re[e]);for(let a=0;a<16;a++)if(Ee[a]===r&&Be[a]===s&&Fe[a]===o&&Re[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new C;t.set(Ee[i],Be[i],Fe[i],Re[i],0,0),Hl.push(t);}}var Ee,Be,Fe,Re,cn,Hl,as,tt,Wl=p(()=>{J();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],Fe=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Re=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],cn=[],Hl=[],as=Math.sign;vg();tt={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=>Fe[i],vY:i=>Re[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>cn[i][t],sub:(i,t)=>cn[i][tt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?tt.S:tt.N:Math.abs(t)*2<=Math.abs(i)?i>0?tt.E:tt.W:t>0?i>0?tt.SE:tt.SW:i>0?tt.NE:tt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Hl[tt.inv(t)];s.tx=e,s.ty=r,i.append(s);}};});var un,Vl=p(()=>{un=()=>{};});var Ge,dn=p(()=>{R();ce();Ge=class extends pt{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=T.TextureSource;});var Nl,hs,Yl=p(()=>{J();Nl=new C,hs=class{constructor(t,e){this.mapCoord=new C,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&&(Nl.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Nl));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 G,mt=p(()=>{At();Wl();Et();St();ct();Vl();dn();ce();Yl();G=class extends ${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 K,this.noFrame=false,this.dynamic=false,this.isTexture=true,this.label=e,this.source=t?.source??new pt,this.noFrame=!r,r)this.frame.copyFrom(r);else {let{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u;}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 c=a/2,u=h/2,f=o+c,d=n+u;l=tt.add(l,tt.NW),t.x0=f+c*tt.uX(l),t.y0=d+u*tt.uY(l),l=tt.add(l,2),t.x1=f+c*tt.uX(l),t.y1=d+u*tt.uY(l),l=tt.add(l,2),t.x2=f+c*tt.uX(l),t.y2=d+u*tt.uY(l),l=tt.add(l,2),t.x3=f+c*tt.uX(l),t.y3=d+u*tt.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}};G.EMPTY=new G({label:"EMPTY",source:new pt({label:"EMPTY"})});G.EMPTY.destroy=un;G.WHITE=new G({source:new Ge({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});G.WHITE.destroy=un;});var Sg,fn,yt,Xe=p(()=>{Hr();ce();mt();Sg=0,fn=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=false;}createTexture(t,e,r){let s=new pt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:false});return new G({source:s,label:`texturePool_${Sg++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=ie(o),n=ie(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={};}},yt=new fn;});var ls,$l=p(()=>{J();nn();Xe();ls=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=false,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new C,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 $e,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&&(yt.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 C),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return (this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new C),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 C),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 Xl(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r]);}var jl=p(()=>{});var pn,mn,gn,Kl,Tg,xn,Ht,Wr=p(()=>{At();Pt();Jh();R();J();$o();jo();St();ct();It();nl();hl();cl();pl();gl();yl();wl();El();Fl();Gl();Il();$l();jl();pn=new vt(null),mn=new vt(null),gn=new vt(null,1,1),Kl=1,Tg=2,xn=4,Ht=class i extends ${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 C,this.relativeGroupTransform=new C,this.groupTransform=this.relativeGroupTransform,this.destroyed=false,this._position=new vt(this,0,0),this._scale=gn,this._pivot=mn,this._skew=pn,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=[],Xl(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."),k.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(ls,this),this.groupTransform=C.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 C),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*el}set angle(t){this.rotation=t*rl;}get pivot(){return this._pivot===mn&&(this._pivot=new vt(this,0,0)),this._pivot}set pivot(t){this._pivot===mn&&(this._pivot=new vt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t);}get skew(){return this._skew===pn&&(this._skew=new vt(this,0,0)),this._skew}set skew(t){this._skew===pn&&(this._skew=new vt(this,0,0)),this._skew.copyFrom(t);}get scale(){return this._scale===gn&&(this._scale=new vt(this,1,1)),this._scale}set scale(t){this._scale===gn&&(this._scale=new vt(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|=Kl,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|=Kl,this._onUpdate());}get tint(){return zr(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._updateFlags|=Tg,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|=xn,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|=xn,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|=xn,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;}};k.mixin(Ht,al,_l,kl,Bl,Al,fl,ml,Rl,Qh,ol,Tl,ll);});var ue,cs=p(()=>{Ot();ue=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 wg(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=wg(e),o={apple:{phone:s(_n)&&!s(se),ipod:s(ql),tablet:!s(_n)&&(s(Zl)||nc(t))&&!s(se),universal:s(Ql),device:(s(_n)||s(ql)||s(Zl)||s(Ql)||nc(t))&&!s(se)},amazon:{phone:s(je),tablet:!s(je)&&s(us),device:s(je)||s(us)},android:{phone:!s(se)&&s(je)||!s(se)&&s(yn),tablet:!s(se)&&!s(je)&&!s(yn)&&(s(us)||s(Jl)),device:!s(se)&&(s(je)||s(us)||s(yn)||s(Jl))||s(/\bokhttp\b/i)},windows:{phone:s(se),tablet:s(tc),device:s(se)||s(tc)},other:{blackberry:s(ec),blackberry10:s(rc),opera:s(ic),firefox:s(oc),chrome:s(sc),device:s(ec)||s(rc)||s(ic)||s(oc)||s(sc)},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 _n,ql,Zl,Ql,yn,Jl,je,us,se,tc,ec,rc,ic,sc,oc,nc,bn=p(()=>{_n=/iPhone/i,ql=/iPod/i,Zl=/iPad/i,Ql=/\biOS-universal(?:.+)Mac\b/i,yn=/\bAndroid(?:.+)Mobile\b/i,Jl=/Android/i,je=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,us=/Silk/i,se=/Windows Phone/i,tc=/\bWindows(?:.+)ARM\b/i,ec=/BlackBerry/i,rc=/BB10/i,ic=/Opera Mini/i,sc=/\b(CriOS|Chrome)(?:.+)Mobile/i,oc=/Mobile(?:.+)Firefox\b/i,nc=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};});var ac=p(()=>{bn();bn();});var Pg,hc,lc=p(()=>{ac();Pg=Vr.default??Vr,hc=Pg(globalThis.navigator);});var Mg,ds,Cg,Ag,cc,uc,Eg,Bg,Fg,vn,fc,pc=p(()=>{cs();R();lc();Qo();Mg=9,ds=100,Cg=0,Ag=0,cc=2,uc=1,Eg=-1e3,Bg=-1e3,Fg=2,vn=class dc{constructor(t,e=hc){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=`${uc}px`,t.style.height=`${uc}px`,t.style.position="absolute",t.style.top=`${Eg}px`,t.style.left=`${Bg}px`,t.style.zIndex=Fg.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=`${Cg}px`,this._div.style.left=`${Ag}px`,this._div.style.zIndex=cc.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:{...dc.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=`
6
+ Deprecated since v${i}`),console.warn(r))),nc[t]=true;}var nc,j,ac,St=m(()=>{nc={},j="8.0.0",ac="8.3.4";});var hr,jn=m(()=>{hr=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 Kn,K,ie=m(()=>{jn();Kn=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 hr(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}},K=new Kn;});var hc,lc=m(()=>{St();hc={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){z("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i);}};});function $s(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 qn=m(()=>{});var cc,uc=m(()=>{qn();St();cc={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);}$s(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||z(j,"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 dc,fc=m(()=>{dc={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 Bi,pc=m(()=>{Bi=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 Zn,Xs,mc=m(()=>{D();ie();Zn=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 K.get(r.maskClass,t)}return t}returnMaskEffect(t){K.return(t);}},Xs=new Zn;O.handleByList(w.MaskEffect,Xs._effectClasses);});var gc,xc=m(()=>{pc();mc();gc={_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),Xs.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=Xs.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 Bi);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 Bi),this._filterEffect.filterArea=i;},get filterArea(){return this._filterEffect?.filterArea}};});var _c,yc=m(()=>{St();_c={label:null,get name(){return z(j,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){z(j,"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 js,it,Xt=m(()=>{ae();js=[new Z,new Z,new Z,new Z],it=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),c=r-l,u=a-l,f=a+o+l,d=h-l,p=h+n+l,_=a+c,x=a+o-c,y=h+c,b=h+n-c;return t>=u&&t<=f&&e>=d&&e<=p&&!(t>_&&t<x&&e>y&&e<b)}intersects(t,e){if(!e){let F=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=F)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=js[0].set(t.left,t.top),h=js[1].set(t.left,t.bottom),l=js[2].set(t.right,t.top),c=js[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return false;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return false;let f=u*(h.y-a.y),d=u*(a.x-h.x),p=f*r+d*o,_=f*s+d*o,x=f*r+d*n,y=f*s+d*n;if(Math.max(p,_,x,y)<=f*a.x+d*a.y||Math.min(p,_,x,y)>=f*c.x+d*c.y)return false;let b=u*(a.y-l.y),S=u*(l.x-a.x),v=b*r+S*o,M=b*s+S*o,T=b*r+S*n,P=b*s+S*n;return !(Math.max(v,M,T,P)<=b*a.x+S*a.y||Math.min(v,M,T,P)>=b*c.x+S*c.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 bc,ft,he=m(()=>{at();Xt();bc=new E,ft=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=bc,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 it);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=bc,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,c=o.tx,u=o.ty,f=this.minX,d=this.minY,p=this.maxX,_=this.maxY,x=n*t+h*e+c,y=a*t+l*e+u;x<f&&(f=x),y<d&&(d=y),x>p&&(p=x),y>_&&(_=y),x=n*r+h*e+c,y=a*r+l*e+u,x<f&&(f=x),y<d&&(d=y),x>p&&(p=x),y>_&&(_=y),x=n*t+h*s+c,y=a*t+l*s+u,x<f&&(f=x),y<d&&(d=y),x>p&&(p=x),y>_&&(_=y),x=n*r+h*s+c,y=a*r+l*s+u,x<f&&(f=x),y<d&&(d=y),x>p&&(p=x),y>_&&(_=y),this.minX=f,this.minY=d,this.maxX=p,this.maxY=_;}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:c,ty:u}=t,f=n*e+h*r+c,d=a*e+l*r+u;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=n*s+h*r+c,d=a*s+l*r+u,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+c,d=a*e+l*o+u,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+c,d=a*s+l*o+u,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,c=s.b,u=s.c,f=s.d,d=s.tx,p=s.ty;for(let _=e;_<r;_+=2){let x=t[_],y=t[_+1],b=l*x+u*y+d,S=c*x+f*y+p;o=b<o?b:o,n=S<n?S:n,a=b>a?b:a,h=S>h?S: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 xt,jt,lr=m(()=>{at();jn();he();xt=new hr(E),jt=new hr(ft);});var wx,vc,Sc=m(()=>{at();he();lr();wx=new E,vc={getFastGlobalBounds(i,t){t||(t=new ft),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=jt.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(wx).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),jt.return(r);}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),jt.return(r));}};});function Ks(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=xt.get().identity(),r=qs(i,s)):r=E.IDENTITY,Tc(i,e,r,t),s&&xt.return(s),e.isValid||e.set(0,0,0,0),e}function Tc(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=xt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=jt.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++)Tc(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,E.IDENTITY),jt.return(t);}r||xt.return(s);}function qs(i,t){let e=i.parent;return e&&(qs(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var Zs=m(()=>{at();lr();});function Qs(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,c=s*a/255|0;return (h<<16)+(l<<8)+c}var Qn=m(()=>{});function Jn(i,t){return i===wc?t:t===wc?i:Qs(i,t)}var wc,Pc=m(()=>{Qn();wc=16777215;});function Fi(i){return ((i&255)<<16)+(i&65280)+(i>>16&255)}var Mc,Cc=m(()=>{Zs();lr();Pc();Mc={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=qs(this,xt.get().identity());return i.appendFrom(this.localTransform,e),xt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?Fi(this.renderGroup.worldColor):this.parentRenderGroup?Fi(Jn(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Jn(t,e.localColor),e=e.parent;return Fi(t)}};});function $(...i){ta!==Ac&&(ta++,ta===Ac?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i));}var ta,Ac,kt=m(()=>{ta=0,Ac=500;});function Js(i,t,e){return t.clear(),e||(e=E.IDENTITY),Ec(i,t,e,i,true),t.isValid||t.set(0,0,0,0),t}function Ec(i,t,e,r,s){let o;if(s)o=xt.get(),o=e.copyTo(o);else {if(!i.visible||!i.measurable)return;i.updateLocalTransform();let h=i.localTransform;o=xt.get(),o.appendFrom(h,e);}let n=t,a=!!i.effects.length;if(a&&(t=jt.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++)Ec(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,E.IDENTITY),jt.return(t);}xt.return(o);}var ea=m(()=>{at();lr();});function ra(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&&ra(s,t);}return t.didChange}var Bc=m(()=>{});var Px,Fc,Rc=m(()=>{at();he();Zs();ea();Bc();Px=new E,Fc={_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 ft});let i=this._localBoundsCacheData;return i.index=1,i.didChange=false,i.data[0]!==this._didViewChangeTick&&(i.didChange=true,i.data[0]=this._didViewChangeTick),ra(this,i),i.didChange&&Js(this,i.localBounds,Px),i.localBounds},getBounds(i,t){return Ks(this,i,t||new ft)}};});var kc,Gc=m(()=>{kc={_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 Mx(i,t){return i._zIndex-t._zIndex}var Ic,Dc=m(()=>{Ic={_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(Mx));}};});var Uc,Lc=m(()=>{ae();lr();Uc={getGlobalPosition(i=new Z,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(xt.get(),e);return t=r.apply(i,t),xt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(xt.get(),r);return e=s.applyInverse(i,e),xt.return(s),e}};});var Fr,ia=m(()=>{Lt();Fr=class{constructor(){this.uid=J("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 ke(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 sa(i){return !(i&i-1)&&!!i}var Ri=m(()=>{});function to(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var oa=m(()=>{});function Cx(i){let t=Oc[i];return t===void 0&&(Oc[i]=J("resource")),t}var Oc,zc,eo,na=m(()=>{$t();Lt();St();Oc=Object.create(null);zc=class Hc extends tt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=false,t={...Hc.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){z(j,"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=Cx(t),this._resourceId}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners();}};zc.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};eo=zc;});var Wc,Et,He=m(()=>{$t();Ri();oa();Lt();na();Wc=class Vc extends tt{constructor(t={}){super(),this.options=t,this.uid=J("textureSource"),this._resourceType="textureSource",this._resourceId=J("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={...Vc.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 eo(to(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=J("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=J("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=sa(this.pixelWidth)&&sa(this.pixelHeight);}static test(t){throw new Error("Unimplemented")}};Wc.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:false,sampleCount:1,antialias:false,autoGarbageCollect:false};Et=Wc;});function Ax(){for(let i=0;i<16;i++){let t=[];aa.push(t);for(let e=0;e<16;e++){let r=ro(cr[i]*cr[e]+dr[i]*ur[e]),s=ro(ur[i]*cr[e]+fr[i]*ur[e]),o=ro(cr[i]*dr[e]+dr[i]*fr[e]),n=ro(ur[i]*dr[e]+fr[i]*fr[e]);for(let a=0;a<16;a++)if(cr[a]===r&&ur[a]===s&&dr[a]===o&&fr[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new E;t.set(cr[i],ur[i],dr[i],fr[i],0,0),Nc.push(t);}}var cr,ur,dr,fr,aa,Nc,ro,ut,Yc=m(()=>{at();cr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ur=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],dr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],fr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],aa=[],Nc=[],ro=Math.sign;Ax();ut={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=>cr[i],uY:i=>ur[i],vX:i=>dr[i],vY:i=>fr[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>aa[i][t],sub:(i,t)=>aa[i][ut.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?ut.S:ut.N:Math.abs(t)*2<=Math.abs(i)?i>0?ut.E:ut.W:t>0?i>0?ut.SE:ut.SW:i>0?ut.NE:ut.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Nc[ut.inv(t)];s.tx=e,s.ty=r,i.append(s);}};});var ha,$c=m(()=>{ha=()=>{};});var pr,la=m(()=>{D();He();pr=class extends Et{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}};pr.extension=w.TextureSource;});var Xc,io,jc=m(()=>{at();Xc=new E,io=class{constructor(t,e){this.mapCoord=new E,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&&(Xc.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Xc));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 U,Bt=m(()=>{$t();Yc();Xt();Lt();St();$c();la();He();jc();U=class extends tt{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=J("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new it,this.noFrame=false,this.dynamic=false,this.isTexture=true,this.label=e,this.source=t?.source??new Et,this.noFrame=!r,r)this.frame.copyFrom(r);else {let{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u;}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 io(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 c=a/2,u=h/2,f=o+c,d=n+u;l=ut.add(l,ut.NW),t.x0=f+c*ut.uX(l),t.y0=d+u*ut.uY(l),l=ut.add(l,2),t.x1=f+c*ut.uX(l),t.y1=d+u*ut.uY(l),l=ut.add(l,2),t.x2=f+c*ut.uX(l),t.y2=d+u*ut.uY(l),l=ut.add(l,2),t.x3=f+c*ut.uX(l),t.y3=d+u*ut.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 z(j,"Texture.baseTexture is now Texture.source"),this._source}};U.EMPTY=new U({label:"EMPTY",source:new Et({label:"EMPTY"})});U.EMPTY.destroy=ha;U.WHITE=new U({source:new pr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});U.WHITE.destroy=ha;});var Ex,ca,Gt,Rr=m(()=>{Ri();He();Bt();Ex=0,ca=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=false;}createTexture(t,e,r){let s=new Et({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:false});return new U({source:s,label:`texturePool_${Ex++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=ke(o),n=ke(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={};}},Gt=new ca;});var so,Kc=m(()=>{at();ia();Rr();so=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=false,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new E,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 Fr,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&&(Gt.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 E),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return (this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new E),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 E),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 qc(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r]);}var Zc=m(()=>{});var ua,da,fa,Qc,Bx,pa,le,ki=m(()=>{$t();Vt();rc();D();at();Nn();$n();Lt();St();ie();lc();uc();fc();xc();yc();Sc();Cc();Rc();Gc();Dc();Lc();Kc();Zc();ua=new Ut(null),da=new Ut(null),fa=new Ut(null,1,1),Qc=1,Bx=2,pa=4,le=class i extends tt{constructor(t={}){super(),this.uid=J("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 E,this.relativeGroupTransform=new E,this.groupTransform=this.relativeGroupTransform,this.destroyed=false,this._position=new Ut(this,0,0),this._scale=fa,this._pivot=da,this._skew=ua,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=[],qc(this,t,{children:true,parent:true,effects:true}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this);}static mixin(t){z("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),O.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||z(j,"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=K.get(so,this),this.groupTransform=E.IDENTITY,t?.addChild(this),this._updateIsSimple();}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),K.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 E),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*sc}set angle(t){this.rotation=t*oc;}get pivot(){return this._pivot===da&&(this._pivot=new Ut(this,0,0)),this._pivot}set pivot(t){this._pivot===da&&(this._pivot=new Ut(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t);}get skew(){return this._skew===ua&&(this._skew=new Ut(this,0,0)),this._skew}set skew(t){this._skew===ua&&(this._skew=new Ut(this,0,0)),this._skew.copyFrom(t);}get scale(){return this._scale===fa&&(this._scale=new Ut(this,1,1)),this._scale}set scale(t){this._scale===fa&&(this._scale=new Ut(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|=Qc,this._onUpdate());}get alpha(){return this.localAlpha}set tint(t){let r=q.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Qc,this._onUpdate());}get tint(){return Fi(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._updateFlags|=Bx,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|=pa,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|=pa,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|=pa,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;}};O.mixin(le,cc,vc,Uc,kc,Fc,gc,_c,Ic,ec,hc,Mc,dc);});var We,oo=m(()=>{ae();We=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 Z,this.page=new Z,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 Fx(i){return function(t){return t.test(i)}}function Gi(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=Fx(e),o={apple:{phone:s(ma)&&!s(Ge),ipod:s(Jc),tablet:!s(ma)&&(s(tu)||lu(t))&&!s(Ge),universal:s(eu),device:(s(ma)||s(Jc)||s(tu)||s(eu)||lu(t))&&!s(Ge)},amazon:{phone:s(kr),tablet:!s(kr)&&s(no),device:s(kr)||s(no)},android:{phone:!s(Ge)&&s(kr)||!s(Ge)&&s(ga),tablet:!s(Ge)&&!s(kr)&&!s(ga)&&(s(no)||s(ru)),device:!s(Ge)&&(s(kr)||s(no)||s(ga)||s(ru))||s(/\bokhttp\b/i)},windows:{phone:s(Ge),tablet:s(iu),device:s(Ge)||s(iu)},other:{blackberry:s(su),blackberry10:s(ou),opera:s(nu),firefox:s(hu),chrome:s(au),device:s(su)||s(ou)||s(nu)||s(hu)||s(au)},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 ma,Jc,tu,eu,ga,ru,kr,no,Ge,iu,su,ou,nu,au,hu,lu,xa=m(()=>{ma=/iPhone/i,Jc=/iPod/i,tu=/iPad/i,eu=/\biOS-universal(?:.+)Mac\b/i,ga=/\bAndroid(?:.+)Mobile\b/i,ru=/Android/i,kr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,no=/Silk/i,Ge=/Windows Phone/i,iu=/\bWindows(?:.+)ARM\b/i,su=/BlackBerry/i,ou=/BB10/i,nu=/Opera Mini/i,au=/\b(CriOS|Chrome)(?:.+)Mobile/i,hu=/Mobile(?:.+)Firefox\b/i,lu=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};});var cu=m(()=>{xa();xa();});var Rx,uu,du=m(()=>{cu();Rx=Gi.default??Gi,uu=Rx(globalThis.navigator);});var kx,ao,Gx,Ix,fu,pu,Dx,Ux,Lx,_a,gu,xu=m(()=>{oo();D();du();qn();kx=9,ao=100,Gx=0,Ix=0,fu=2,pu=1,Dx=-1e3,Ux=-1e3,Lx=2,_a=class mu{constructor(t,e=uu){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=`${pu}px`,t.style.height=`${pu}px`,t.style.position="absolute",t.style.top=`${Dx}px`,t.style.left=`${Ux}px`,t.style.zIndex=Lx.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=`${ao}px`,this._div.style.height=`${ao}px`,this._div.style.position="absolute",this._div.style.top=`${Gx}px`,this._div.style.left=`${Ix}px`,this._div.style.zIndex=fu.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:{...mu.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,$s(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))),il[t]=true;}var il,H,sl,ct=p(()=>{il=
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=`${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=cc.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 ue(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();}};vn.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"accessibility"};vn.defaultOptions={enabledByDefault:false,debug:false,activateOnTab:true,deactivateOnMouseMove:true};fc=vn;});var mc,gc=p(()=>{mc={accessible:false,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:false,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:true,_renderId:-1};});var xc=p(()=>{R();Wr();pc();gc();k.add(fc);k.mixin(Ht,mc);});var Nr,_c=p(()=>{R();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=T.Application;});var de,fs=p(()=>{de=(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))(de||{});});var Ke,yc=p(()=>{Ke=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 bc,ut,Yr=p(()=>{fs();yc();bc=class Ft{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 Ke(null,null,1/0),this.deltaMS=1/Ft.targetFPMS,this.elapsedMS=1/Ft.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=de.NORMAL){return this._addListener(new Ke(t,e,r))}addOnce(t,e,r=de.NORMAL){return this._addListener(new Ke(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*Ft.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,Ft.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(!Ft._shared){let t=Ft._shared=new Ft;t.autoStart=true,t._protected=true;}return Ft._shared}static get system(){if(!Ft._system){let t=Ft._system=new Ft;t.autoStart=true,t._protected=true;}return Ft._system}};bc.targetFPMS=.06;ut=bc;});var $r,vc=p(()=>{R();fs();Yr();$r=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,de.LOW);},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop();},this.start=()=>{this._ticker.start();},this._ticker=null,this.ticker=t.sharedTicker?ut.shared:new ut,t.autoStart&&this.start();}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy();}}};$r.extension=T.Application;});var Sn=p(()=>{R();_c();vc();k.add(Nr);k.add($r);});var Tn,Xt,wn=p(()=>{fs();Yr();Tn=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||(ut.system.add(this._tickerUpdate,this,de.INTERACTION),this._tickerAdded=true);}removeTickerListener(){this._tickerAdded&&(ut.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());}},Xt=new Tn;});var oe,ps=p(()=>{Ot();cs();oe=class extends ue{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,c,u,f,d,m,x){throw new Error("Method not implemented.")}};});var Tt,Pn=p(()=>{ps();Tt=class extends oe{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 jt,Mn=p(()=>{ps();jt=class extends oe{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2;}};jt.DOM_DELTA_PIXEL=0;jt.DOM_DELTA_LINE=1;jt.DOM_DELTA_PAGE=2;});var Rg,Gg,Xr,ms,Sc=p(()=>{At();Ot();_t();wn();ps();Pn();Mn();Rg=2048,Gg=new N,Xr=new N,ms=class{constructor(t){this.dispatch=new $,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){Xt.pauseUpdate=true;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,Gg.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<Rg&&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")&&(Xt.pauseUpdate=false),t.interactiveChildren&&t.children){let c=t.children;for(let u=c.length-1;u>=0;u--){let f=c[u],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")&&(Xt.pauseUpdate=false),t.interactiveChildren&&t.children){let h=t.children,l=r;for(let c=h.length-1;c>=0;c--){let u=h[c],f=this.hitTestRecursive(u,this._isInteractive(e)?e:u.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 Tt)){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 Tt)){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 c=this.createPointerEvent(t,"pointerleave",o);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),r&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c);}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 c=o?.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===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 Tt)){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 Tt)){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 Tt)){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 Tt)){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 jt)){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(Tt);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(jt);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(Tt);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 Tt&&e instanceof Tt&&(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 oe&&e instanceof oe&&(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 kg,Ig,An,gs,En=p(()=>{R();Sc();wn();Pn();Mn();kg=1,Ig={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},An=class Cn{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),Xt.init(this),this.autoPreventDefault=true,this._eventsAdded=false,this._rootPointerEvent=new Tt(null),this._rootWheelEvent=new jt(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Cn.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,Cn._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,Xt.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,Xt.domElement=t,this._addEvents();}_addEvents(){if(this._eventsAdded||!this.domElement)return;Xt.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;Xt.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=kg),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=Ig[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;}};An.extension={name:"events",type:[T.WebGLSystem,T.CanvasSystem,T.WebGPUSystem],priority:-1};An.defaultEventFeatures={move:true,globalMove:true,click:true,wheel:true};gs=An;});var Tc,wc=p(()=>{En();cs();Tc={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 ue))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 Pc=p(()=>{R();Wr();En();wc();k.add(gs);k.mixin(Ht,Tc);});var jr,Mc=p(()=>{R();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:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"dom"};});var qe,Bn=p(()=>{zt();Wr();qe=class extends Ht{constructor(t){super(t),this.canBundle=true,this.allowChildren=false,this._roundPixels=0,this._lastUsed=-1,this._bounds=new it(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 Cc=p(()=>{R();Mc();k.add(jr);});var Ze,Fn=p(()=>{Ze=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Ze||{});});var Ac,Ec=p(()=>{Ac={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 Bc,st,Wt=p(()=>{Ec();Bc=Ac,st={get(){return Bc},set(i){Bc=i;}};});function Vt(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 Dg(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ug(i,t,e){return i.replace(new RegExp(Dg(t),"g"),e)}function Lg(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 Mt,xs=p(()=>{Wt();Mt={toPosix(i){return Ug(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){Vt(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(Vt(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=Kr(this.toPosix(t??st.get().getBaseUrl())),s=Kr(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?Mt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(Vt(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=Lg(i),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return Vt(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(Vt(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(Vt(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){Vt(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){Vt(i),t&&Vt(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){Vt(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){Vt(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,c=i.length-1,u=0;for(;c>=s;--c){if(e=i.charCodeAt(c),e===47){if(!l){a=c+1;break}continue}h===-1&&(l=false,h=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1);}return n===-1||h===-1||u===0||u===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 fe,Rn=p(()=>{fe=(i,t,e=false)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i);});function Fc(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?Fc(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a));}}function Rc(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);}),Fc(i,s,0,e,r);}else r.push(i);return r}var Gc=p(()=>{});var Gn,kc=p(()=>{Gn=i=>!Array.isArray(i);});function Og(i){return i.split(".").pop().split("?").shift().split("#").shift()}var qr,Ic=p(()=>{_t();xs();Rn();Gc();kc();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 fe(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(c=>this._createBundleAssetId(t,c));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`);},fe(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l}=o,c=fe(n).map(d=>typeof d=="string"?Rc(d):Array.isArray(d)?d:[d]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let f=[];c.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(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${x.src}`);x=this._buildResolvedAsset(x,{aliases:u,data:a,format:h,loadParser:l}),f.push(x);});}),u.forEach(d=>{this._assetMap[d]=f;});});}resolveBundle(t){let e=Gn(t);t=fe(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=Gn(t);t=fe(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(c=>c[a]?c[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=Mt.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??Og(t.src),t}};qr.RETINA_PREFIX=/@([0-9\.]+)x/;});var kn,Dc=p(()=>{kn=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i};});var Uc,In,Lc=p(()=>{Et();mt();Uc=class Zr{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof G?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,c=new K(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new K(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 K(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 K(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 G({source:this.textureSource,frame:a,orig:c,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=[];}};Uc.BATCH_SIZE=1e3;In=Uc;});function Oc(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=Mt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Oc([`${s}/${t.data.meta.related_multi_packs[n]}`],o,true);Object.assign(r,a);});}return r}var zg,zc,Hc=p(()=>{Fn();Ic();Dc();R();mt();xs();Lc();zg=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];zc={extension:T.Asset,cache:{test:i=>i instanceof In,getCacheableAssets:(i,t)=>Oc(i,t,false)},resolver:{extension:{type:T.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&zg.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:T.LoadParser,priority:Ze.Normal,name:"spritesheetLoader"},async testParse(i,t){return Mt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=Mt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof G)a=r;else {let c=kn(n+(s??i.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c];}let h=new In(a.source,i);await h.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let c=[];for(let f of l){if(typeof f!="string")continue;let d=n+f;t.data?.ignoreMultiPack||(d=kn(d,t.src),c.push(e.load({src:d,data:{textureOptions:o,ignoreMultiPack:true}})));}let u=await Promise.all(c);h.linkedSheets=u,u.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(()=>{R();Hc();k.add(zc);});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 Dn=p(()=>{});var Qr,Wc=p(()=>{jo();mt();Dn();ct();Bn();Qr=class i extends qe{constructor(t=G.EMPTY){t instanceof G&&(t={texture:t});let{texture:e=G.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 vt({_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 G?new i(t):new i(G.from(t,e))}set texture(t){t||(t=G.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=Hg;i.measurable=true,ts(i,e,r),t.addBoundsMask(r),i.measurable=false;}var Hg,Un=p(()=>{zt();rs();Hg=new it;});function vs(i,t,e){let r=Bt.get();i.measurable=true;let s=at.get().identity(),o=Vc(i,e,s);ss(i,r,o),i.measurable=false,t.addBoundsMask(r),at.return(s),Bt.return(r);}function Vc(i,t,e){return i?(i!==t&&(Vc(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(O("Mask bounds, renderable is not inside the root container"),e)}var Ln=p(()=>{sn();Ae();_t();});var Jr,Nc=p(()=>{R();Wc();Un();Ln();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=T.MaskEffect;});var ti,Yc=p(()=>{R();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=T.MaskEffect;});var ei,$c=p(()=>{R();Wr();Un();Ln();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 Ht}};ei.extension=T.MaskEffect;});var Qe,Xc=p(()=>{Wt();R();ce();Qe=class extends pt{constructor(t){t.resource||(t.resource=st.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"))}};Qe.extension=T.TextureSource;});var Kt,Ss=p(()=>{Wt();R();_t();ce();Kt=class extends pt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=st.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}};Kt.extension=T.TextureSource;});async function jc(){return On??(On=(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"})()),On}var On,Kc=p(()=>{});var Ts,Zc,Qc=p(()=>{R();Yr();Kc();ce();Ts=class qc extends pt{constructor(t){super(t),this.isReady=false,this.uploadMethodId="video",t={...qc.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=ut.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 jc(),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&&(ut.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||(ut.shared.add(this.updateFrame,this),this._isConnectedToTicker=true,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ut.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0));}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Ts.extension=T.TextureSource;Ts.defaultOptions={...pt.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"};Zc=Ts;});var zn,ht,ri=p(()=>{_t();Rn();zn=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=fe(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}},ht=new zn;});function Jc(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Hn.length;s++){let o=Hn[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function tu(i={},t=false){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&ht.has(r))return ht.get(r);let o=new G({source:Jc(s)});return o.on("destroy",()=>{ht.has(r)&&ht.remove(r);}),t||ht.set(r,o),o}function eu(i,t=false){return typeof i=="string"?ht.get(i):i instanceof pt?new G({source:i}):tu(i,t)}var Hn,Wn=p(()=>{ri();R();ce();mt();Hn=[];k.handleByList(T.TextureSource,Hn);G.from=eu;pt.from=Jc;});var ws=p(()=>{R();Nc();Yc();$c();dn();Xc();Ss();Qc();Wn();k.add(Jr,ti,ei,Zc,Kt,Qe,Ge);});var Dt,ii=p(()=>{Dt=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=st.get().createCanvas().getContext("webgl",{})),Ps}var Ps,Vn=p(()=>{Wt();});function Vg(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 ru(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=Wg.replace(/%forloop%/gi,Vg(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 Wg,iu=p(()=>{Wg=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
- `);});function tr(){if(Je)return Je;let i=Ms();return Je=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),Je=ru(Je,i),i.getExtension("WEBGL_lose_context")?.loseContext(),Je}var Je,Cs=p(()=>{Vn();iu();Je=null;});function ou(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return su[e]||Ng(i,t,e)}function Ng(i,t,e){let r={},s=0;Nn||(Nn=tr());for(let n=0;n<Nn;n++){let a=n<t?i[n]:G.EMPTY.source;r[s++]=a.source,r[s++]=a.style;}let o=new Dt(r);return su[e]=o,o}var su,Nn,nu=p(()=>{ii();mt();Cs();su={};Nn=0;});var qt,Yn=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 $n(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 au=p(()=>{});var hu,lu=p(()=>{hu={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};});function ne(i,t){return t.alphaMode==="no-premultiply-alpha"&&hu[i]||i}var si=p(()=>{lu();});var As,cu=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 uu(){return jn>0?fu[--jn]:new Xn}function du(i){fu[jn++]=i;}var Xn,fu,jn,oi,pu,mu,gu=p(()=>{St();Yn();au();si();Cs();cu();Xn=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;}},fu=[],jn=0;oi=0,pu=class Es{constructor(t={}){this.uid=Y("batcher"),this.dirty=true,this.batchIndex=0,this.batches=[],this._elements=[],Es.defaultOptions.maxTextures=Es.defaultOptions.maxTextures??tr(),t={...Es.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++)du(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=uu(),s=r.textures;s.clear();let o=e[this.elementStart],n=ne(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,c=this.indexBuffer,u=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,v=ne(g.blendMode,y),b=n!==v||a!==g.topology;if(y._batchTick===oi&&!b){g._textureId=y._textureBindLocation,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=r;continue}y._batchTick=oi,(s.count>=m||b)&&(this._finishBatch(r,f,u-f,s,n,a,t,d),d="renderBatch",f=u,n=v,a=g.topology,r=uu(),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,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize));}s.count>0&&(this._finishBatch(r,f,u-f,s,n,a,t,d),f=u,++oi),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=u;}_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 qt(e);$n(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 $n(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++)du(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;}};pu.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};mu=pu;});var Z,er=p(()=>{Z=(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))(Z||{});});var gt,rr=p(()=>{At();St();er();gt=class extends ${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&Z.STATIC)}set static(t){t?this.descriptor.usage|=Z.STATIC:this.descriptor.usage&=~Z.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 Kn(i,t){if(!(i instanceof gt)){let e=t?Z.INDEX:Z.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=Z.INDEX|Z.COPY_DST):(i=new Float32Array(i),e=Z.VERTEX|Z.COPY_DST)),i=new gt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e});}return i}var xu=p(()=>{rr();er();});function _u(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,c=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let f=c;f<s.length;f+=u){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 yu=p(()=>{});function Yg(i){return (i instanceof gt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Kn(i.buffer,false),i}var Zt,ni=p(()=>{At();zt();St();rr();xu();yu();Zt=class extends ${constructor(t={}){super(),this.uid=Y("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new it,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=Yg(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=Kn(t,true),this.buffers.push(this.indexBuffer);}get bounds(){return this._boundsDirty?(this._boundsDirty=false,_u(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 $g,Xg,Bs,bu=p(()=>{rr();er();ni();$g=new Float32Array(1),Xg=new Uint32Array(1),Bs=class extends Zt{constructor(){let e=new gt({data:$g,label:"attribute-batch-buffer",usage:Z.VERTEX|Z.COPY_DST,shrinkToFit:false}),r=new gt({data:Xg,label:"index-batch-buffer",usage:Z.INDEX|Z.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 ir(i,t){let e=vu[i];return e===void 0&&(qn[t]===void 0&&(qn[t]=1),vu[i]=e=qn[t]++),e}var qn,vu,Fs=p(()=>{qn=Object.create(null),vu=Object.create(null);});function Su(){if(!Rs){Rs="mediump";let i=Ms();i&&i.getShaderPrecisionFormat&&(Rs=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump");}return Rs}var Rs,Tu=p(()=>{Vn();});function wu(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
19
+ `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${ao}px`,e.style.height=`${ao}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=fu.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 We(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!==kx||!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();}};_a.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"accessibility"};_a.defaultOptions={enabledByDefault:false,debug:false,activateOnTab:true,deactivateOnMouseMove:true};gu=_a;});var _u,yu=m(()=>{_u={accessible:false,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:false,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:true,_renderId:-1};});var bu=m(()=>{D();ki();xu();yu();O.add(gu);O.mixin(le,_u);});var Ii,vu=m(()=>{D();Ii=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;}};Ii.extension=w.Application;});var Ve,ho=m(()=>{Ve=(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))(Ve||{});});var Gr,Su=m(()=>{Gr=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 Tu,Tt,Di=m(()=>{ho();Su();Tu=class Kt{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 Gr(null,null,1/0),this.deltaMS=1/Kt.targetFPMS,this.elapsedMS=1/Kt.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=Ve.NORMAL){return this._addListener(new Gr(t,e,r))}addOnce(t,e,r=Ve.NORMAL){return this._addListener(new Gr(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*Kt.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,Kt.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(!Kt._shared){let t=Kt._shared=new Kt;t.autoStart=true,t._protected=true;}return Kt._shared}static get system(){if(!Kt._system){let t=Kt._system=new Kt;t.autoStart=true,t._protected=true;}return Kt._system}};Tu.targetFPMS=.06;Tt=Tu;});var Ui,wu=m(()=>{D();ho();Di();Ui=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,Ve.LOW);},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop();},this.start=()=>{this._ticker.start();},this._ticker=null,this.ticker=t.sharedTicker?Tt.shared:new Tt,t.autoStart&&this.start();}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy();}}};Ui.extension=w.Application;});var ya=m(()=>{D();vu();wu();O.add(Ii);O.add(Ui);});var ba,Te,va=m(()=>{ho();Di();ba=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||(Tt.system.add(this._tickerUpdate,this,Ve.INTERACTION),this._tickerAdded=true);}removeTickerListener(){this._tickerAdded&&(Tt.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());}},Te=new ba;});var Ie,lo=m(()=>{ae();oo();Ie=class extends We{constructor(){super(...arguments),this.client=new Z,this.movement=new Z,this.offset=new Z,this.global=new Z,this.screen=new Z;}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,c,u,f,d,p,_){throw new Error("Method not implemented.")}};});var Ot,Sa=m(()=>{lo();Ot=class extends Ie{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 we,Ta=m(()=>{lo();we=class extends Ie{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2;}};we.DOM_DELTA_PIXEL=0;we.DOM_DELTA_LINE=1;we.DOM_DELTA_PAGE=2;});var Ox,zx,Li,co,Pu=m(()=>{$t();ae();kt();va();lo();Sa();Ta();Ox=2048,zx=new Z,Li=new Z,co=class{constructor(t){this.dispatch=new tt,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 $(`[EventBoundary]: Event mapping not defined for ${t.type}`);}hitTest(t,e){Te.pauseUpdate=true;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,zx.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<Ox&&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")&&(Te.pauseUpdate=false),t.interactiveChildren&&t.children){let c=t.children;for(let u=c.length-1;u>=0;u--){let f=c[u],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 p=t.isInteractive();(d.length>0||p)&&(p&&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")&&(Te.pauseUpdate=false),t.interactiveChildren&&t.children){let h=t.children,l=r;for(let c=h.length-1;c>=0;c--){let u=h[c],f=this.hitTestRecursive(u,this._isInteractive(e)?e:u.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,Li),!t.hitArea.contains(Li.x,Li.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,Li),t.containsPoint(Li)):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 Ot)){$("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 Ot)){$("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 c=this.createPointerEvent(t,"pointerleave",o);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),r&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c);}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 c=o?.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===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 Ot)){$("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 Ot)){$("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 Ot)){$("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 Ot)){$("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 we)){$("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(Ot);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(we);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(Ot);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 Ot&&e instanceof Ot&&(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 Ie&&e instanceof Ie&&(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 Hx,Wx,Pa,uo,Ma=m(()=>{D();Pu();va();Sa();Ta();Hx=1,Wx={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Pa=class wa{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new co(null),Te.init(this),this.autoPreventDefault=true,this._eventsAdded=false,this._rootPointerEvent=new Ot(null),this._rootWheelEvent=new we(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...wa.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,wa._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,Te.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,Te.domElement=t,this._addEvents();}_addEvents(){if(this._eventsAdded||!this.domElement)return;Te.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;Te.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=Hx),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=Wx[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;}};Pa.extension={name:"events",type:[w.WebGLSystem,w.CanvasSystem,w.WebGPUSystem],priority:-1};Pa.defaultEventFeatures={move:true,globalMove:true,click:true,wheel:true};uo=Pa;});var Mu,Cu=m(()=>{Ma();oo();Mu={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??uo.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 We))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 Au=m(()=>{D();ki();Ma();Cu();O.add(uo);O.mixin(le,Mu);});var Oi,Eu=m(()=>{D();Oi=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;}};Oi.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"dom"};});var Ir,Ca=m(()=>{he();ki();Ir=class extends le{constructor(t){super(t),this.canBundle=true,this.allowChildren=false,this._roundPixels=0,this._lastUsed=-1,this._bounds=new ft(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=m(()=>{D();Eu();O.add(Oi);});var Dr,Aa=m(()=>{Dr=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Dr||{});});var Fu,Ru=m(()=>{Fu={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 ku,pt,ce=m(()=>{Ru();ku=Fu,pt={get(){return ku},set(i){ku=i;}};});function ue(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function zi(i){return i.split("?")[0].split("#")[0]}function Vx(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nx(i,t,e){return i.replace(new RegExp(Vx(t),"g"),e)}function Yx(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 Nt,fo=m(()=>{ce();Nt={toPosix(i){return Nx(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){ue(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(ue(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=zi(this.toPosix(t??pt.get().getBaseUrl())),s=zi(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?Nt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(ue(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=Yx(i),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return ue(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(ue(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(ue(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){ue(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){ue(i),t&&ue(t),i=zi(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){ue(i),i=zi(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){ue(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=zi(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,c=i.length-1,u=0;for(;c>=s;--c){if(e=i.charCodeAt(c),e===47){if(!l){a=c+1;break}continue}h===-1&&(l=false,h=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1);}return n===-1||h===-1||u===0||u===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 Ne,Ea=m(()=>{Ne=(i,t,e=false)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i);});function Gu(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?Gu(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a));}}function Iu(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);}),Gu(i,s,0,e,r);}else r.push(i);return r}var Du=m(()=>{});var Ba,Uu=m(()=>{Ba=i=>!Array.isArray(i);});function $x(i){return i.split(".").pop().split("?").shift().split("#").shift()}var Hi,Lu=m(()=>{kt();fo();Ea();Du();Uu();Hi=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 Ne(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&&$("[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(c=>this._createBundleAssetId(t,c));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)&&$(`[Resolver] already has key: ${o} overwriting`);},Ne(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l}=o,c=Ne(n).map(d=>typeof d=="string"?Iu(d):Array.isArray(d)?d:[d]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let f=[];c.forEach(d=>{d.forEach(p=>{let _={};if(typeof p!="object"){_.src=p;for(let x=0;x<this._parsers.length;x++){let y=this._parsers[x];if(y.test(p)){_=y.parse(p);break}}}else a=p.data??a,h=p.format??h,l=p.loadParser??l,_={..._,...p};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this._buildResolvedAsset(_,{aliases:u,data:a,format:h,loadParser:l}),f.push(_);});}),u.forEach(d=>{this._assetMap[d]=f;});});}resolveBundle(t){let e=Ba(t);t=Ne(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=Ba(t);t=Ne(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(c=>c[a]?c[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=Nt.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??$x(t.src),t}};Hi.RETINA_PREFIX=/@([0-9\.]+)x/;});var Fa,Ou=m(()=>{Fa=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i};});var zu,Ra,Hu=m(()=>{Xt();Bt();zu=class Wi{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof U?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<=Wi.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch();})}_processFrames(t){let e=t,r=Wi.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,c=new it(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new it(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 it(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 it(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 U({source:this.textureSource,frame:a,orig:c,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*Wi.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Wi.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=[];}};zu.BATCH_SIZE=1e3;Ra=zu;});function Wu(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=Nt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Wu([`${s}/${t.data.meta.related_multi_packs[n]}`],o,true);Object.assign(r,a);});}return r}var Xx,Vu,Nu=m(()=>{Aa();Lu();Ou();D();Bt();fo();Hu();Xx=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Vu={extension:w.Asset,cache:{test:i=>i instanceof Ra,getCacheableAssets:(i,t)=>Wu(i,t,false)},resolver:{extension:{type:w.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&Xx.includes(s)},parse:i=>{let t=i.split(".");return {resolution:parseFloat(Hi.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:w.LoadParser,priority:Dr.Normal,name:"spritesheetLoader"},async testParse(i,t){return Nt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=Nt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof U)a=r;else {let c=Fa(n+(s??i.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c];}let h=new Ra(a.source,i);await h.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let c=[];for(let f of l){if(typeof f!="string")continue;let d=n+f;t.data?.ignoreMultiPack||(d=Fa(d,t.src),c.push(e.load({src:d,data:{textureOptions:o,ignoreMultiPack:true}})));}let u=await Promise.all(c);h.linkedSheets=u,u.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 po=m(()=>{D();Nu();O.add(Vu);});function mo(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 ka=m(()=>{});var Vi,Yu=m(()=>{$n();Bt();ka();St();Ca();Vi=class i extends Ir{constructor(t=U.EMPTY){t instanceof U&&(t={texture:t});let{texture:e=U.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 Ut({_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 U?new i(t):new i(U.from(t,e))}set texture(t){t||(t=U.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 mo(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return z("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 go(i,t,e){let r=jx;i.measurable=true,Ks(i,e,r),t.addBoundsMask(r),i.measurable=false;}var jx,Ga=m(()=>{he();Zs();jx=new ft;});function xo(i,t,e){let r=jt.get();i.measurable=true;let s=xt.get().identity(),o=$u(i,e,s);Js(i,r,o),i.measurable=false,t.addBoundsMask(r),xt.return(s),jt.return(r);}function $u(i,t,e){return i?(i!==t&&($u(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):($("Mask bounds, renderable is not inside the root container"),e)}var Ia=m(()=>{ea();lr();kt();});var Ni,Xu=m(()=>{D();Yu();Ga();Ia();Ni=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 Vi),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||go(this.mask,t,e);}addLocalBounds(t,e){xo(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof Vi}};Ni.extension=w.MaskEffect;});var Yi,ju=m(()=>{D();Yi=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"}};Yi.extension=w.MaskEffect;});var $i,Ku=m(()=>{D();ki();Ga();Ia();$i=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){go(this.mask,t,e);}addLocalBounds(t,e){xo(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof le}};$i.extension=w.MaskEffect;});var Ur,qu=m(()=>{ce();D();He();Ur=class extends Et{constructor(t){t.resource||(t.resource=pt.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"))}};Ur.extension=w.TextureSource;});var Pe,_o=m(()=>{ce();D();kt();He();Pe=class extends Et{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=pt.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,$("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}};Pe.extension=w.TextureSource;});async function Zu(){return Da??(Da=(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"})()),Da}var Da,Qu=m(()=>{});var yo,td,ed=m(()=>{D();Di();Qu();He();yo=class Ju extends Et{constructor(t){super(t),this.isReady=false,this.uploadMethodId="video",t={...Ju.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=Tt.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 Zu(),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&&(Tt.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||(Tt.shared.add(this.updateFrame,this),this._isConnectedToTicker=true,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Tt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0));}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};yo.extension=w.TextureSource;yo.defaultOptions={...Et.defaultOptions,autoLoad:true,autoPlay:true,updateFPS:0,crossorigin:true,loop:false,muted:true,playsinline:true,preload:false};yo.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};td=yo;});var Ua,_t,Xi=m(()=>{kt();Ea();Ua=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||$(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Ne(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&&$("[Cache] already has key:",h),this._cache.set(h,o.get(h));});}remove(t){if(!this._cacheMap.has(t)){$(`[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}},_t=new Ua;});function rd(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<La.length;s++){let o=La[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function id(i={},t=false){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&_t.has(r))return _t.get(r);let o=new U({source:rd(s)});return o.on("destroy",()=>{_t.has(r)&&_t.remove(r);}),t||_t.set(r,o),o}function sd(i,t=false){return typeof i=="string"?_t.get(i):i instanceof Et?new U({source:i}):id(i,t)}var La,Oa=m(()=>{Xi();D();He();Bt();La=[];O.handleByList(w.TextureSource,La);U.from=sd;Et.from=rd;});var bo=m(()=>{D();Xu();ju();Ku();la();qu();_o();ed();Oa();O.add(Ni,Yi,$i,td,Pe,Ur,pr);});var se,ji=m(()=>{se=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 So(){return (!vo||vo?.isContextLost())&&(vo=pt.get().createCanvas().getContext("webgl",{})),vo}var vo,za=m(()=>{ce();});function qx(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 od(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=Kx.replace(/%forloop%/gi,qx(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 Kx,nd=m(()=>{Kx=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
+ `);});function Or(){if(Lr)return Lr;let i=So();return Lr=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),Lr=od(Lr,i),i.getExtension("WEBGL_lose_context")?.loseContext(),Lr}var Lr,To=m(()=>{za();nd();Lr=null;});function hd(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return ad[e]||Zx(i,t,e)}function Zx(i,t,e){let r={},s=0;Ha||(Ha=Or());for(let n=0;n<Ha;n++){let a=n<t?i[n]:U.EMPTY.source;r[s++]=a.source,r[s++]=a.style;}let o=new se(r);return ad[e]=o,o}var ad,Ha,ld=m(()=>{ji();Bt();To();ad={};Ha=0;});var Me,Wa=m(()=>{Me=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 Va(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 cd=m(()=>{});var ud,dd=m(()=>{ud={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};});function De(i,t){return t.alphaMode==="no-premultiply-alpha"&&ud[i]||i}var Ki=m(()=>{dd();});var wo,fd=m(()=>{wo=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0;}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null;}this.count=0;}};});function pd(){return Ya>0?gd[--Ya]:new Na}function md(i){gd[Ya++]=i;}var Na,gd,Ya,qi,xd,_d,yd=m(()=>{Lt();Wa();cd();Ki();To();fd();Na=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new wo,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=true;}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null;}},gd=[],Ya=0;qi=0,xd=class Po{constructor(t={}){this.uid=J("batcher"),this.dirty=true,this.batchIndex=0,this.batches=[],this._elements=[],Po.defaultOptions.maxTextures=Po.defaultOptions.maxTextures??Or(),t={...Po.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Me(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++)md(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=pd(),s=r.textures;s.clear();let o=e[this.elementStart],n=De(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,c=this.indexBuffer,u=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",p=this.maxTextures;for(let _=this.elementStart;_<this.elementSize;++_){let x=e[_];e[_]=null;let b=x.texture._source,S=De(x.blendMode,b),v=n!==S||a!==x.topology;if(b._batchTick===qi&&!v){x._textureId=b._textureBindLocation,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,h,l,x._attributeStart,x._textureId),this.packQuadIndex(c,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,h,l,x._attributeStart,x._textureId),this.packIndex(x,c,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=r;continue}b._batchTick=qi,(s.count>=p||v)&&(this._finishBatch(r,f,u-f,s,n,a,t,d),d="renderBatch",f=u,n=S,a=x.topology,r=pd(),s=r.textures,s.clear(),++qi),x._textureId=b._textureBindLocation=s.count,s.ids[b.uid]=s.count,s.textures[s.count++]=b,x._batch=r,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,h,l,x._attributeStart,x._textureId),this.packQuadIndex(c,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,h,l,x._attributeStart,x._textureId),this.packIndex(x,c,x._indexStart,x._attributeStart/this.vertexSize));}s.count>0&&(this._finishBatch(r,f,u-f,s,n,a,t,d),f=u,++qi),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=u;}_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,++qi,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 Me(e);Va(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 Va(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++)md(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;}};xd.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};_d=xd;});var ot,zr=m(()=>{ot=(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))(ot||{});});var Ft,Hr=m(()=>{$t();Lt();zr();Ft=class extends tt{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=J("buffer"),this._resourceType="buffer",this._resourceId=J("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&ot.STATIC)}set static(t){t?this.descriptor.usage|=ot.STATIC:this.descriptor.usage&=~ot.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=J("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 $a(i,t){if(!(i instanceof Ft)){let e=t?ot.INDEX:ot.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=ot.INDEX|ot.COPY_DST):(i=new Float32Array(i),e=ot.VERTEX|ot.COPY_DST)),i=new Ft({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e});}return i}var bd=m(()=>{Hr();zr();});function vd(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,c=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let f=c;f<s.length;f+=u){let d=s[f],p=s[f+1];d>a&&(a=d),p>h&&(h=p),d<o&&(o=d),p<n&&(n=p);}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=h,e}var Sd=m(()=>{});function Qx(i){return (i instanceof Ft||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=$a(i.buffer,false),i}var Ce,Zi=m(()=>{$t();he();Lt();Hr();bd();Sd();Ce=class extends tt{constructor(t={}){super(),this.uid=J("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new ft,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=Qx(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=$a(t,true),this.buffers.push(this.indexBuffer);}get bounds(){return this._boundsDirty?(this._boundsDirty=false,vd(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 Jx,t_,Mo,Td=m(()=>{Hr();zr();Zi();Jx=new Float32Array(1),t_=new Uint32Array(1),Mo=class extends Ce{constructor(){let e=new Ft({data:Jx,label:"attribute-batch-buffer",usage:ot.VERTEX|ot.COPY_DST,shrinkToFit:false}),r=new Ft({data:t_,label:"index-batch-buffer",usage:ot.INDEX|ot.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 Wr(i,t){let e=wd[i];return e===void 0&&(Xa[t]===void 0&&(Xa[t]=1),wd[i]=e=Xa[t]++),e}var Xa,wd,Co=m(()=>{Xa=Object.create(null),wd=Object.create(null);});function Pd(){if(!Ao){Ao="mediump";let i=So();i&&i.getShaderPrecisionFormat&&(Ao=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump");}return Ao}var Ao,Md=m(()=>{za();});function Cd(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 ru(i,t){if(i===0)th
33
33
  #define out varying
34
34
  #endif
35
35
  ${i}
36
- `}var Pu=p(()=>{});function Mu(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 Cu=p(()=>{});function Au(i,t){return t?`#version 300 es
38
- ${i}`:i}var Eu=p(()=>{});function Bu(i,{name:t="pixi-program"},e=true){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?jg:Kg;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 jg,Kg,Fu=p(()=>{jg={},Kg={};});function Ru(i,t){return t?i.replace("#version 300 es",""):i}var Gu=p(()=>{});var Zn,Qn,ku,sr,Gs=p(()=>{Fs();Tu();Pu();Cu();Eu();Fu();Gu();Zn={stripVersion:Ru,ensurePrecision:Mu,addProgramDefines:wu,setProgramName:Bu,insertVersion:Au},Qn=Object.create(null),ku=class Jn{constructor(t){t={...Jn.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Su()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(Zn).forEach(n=>{let a=r[n];s=Zn[n](s,a,true),o=Zn[n](o,a,false);}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=ir(`${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 Qn[e]||(Qn[e]=new Jn(t)),Qn[e]}};ku.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};sr=ku;});function ke(i){return Iu[i]??Iu.float32}var Iu,ks=p(()=>{Iu={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 Du({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=qg[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:h,stride:ke(h).stride,offset:0,instance:false,start:0};}}}return e}var qg,Uu=p(()=>{ks();qg={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(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(r)[1],10),name:u.match(s)[2],isUniform:u.match(s)[1]==="<uniform>",type:u.match(o)[1]}));if(!l)return {groups:[],structs:[]};let c=i.match(n)?.map(u=>{let f=u.match(h)[1],d=u.match(a).reduce((m,x)=>{let[g,_]=x.split(":");return m[g.trim()]=_.trim(),m},{});return d?{name:f,members:d}:null}).filter(({name:u})=>l.some(f=>f.type===u))??[];return {groups:l,structs:c}}var Lu=p(()=>{});var or,Ou=p(()=>{or=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(or||{});});function zu({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:or.VERTEX|or.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:or.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:or.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:false}});}return t}var Hu=p(()=>{Ou();});function Wu({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 Vu=p(()=>{});function Nu(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 Yu=p(()=>{});var ta,pe,Ds=p(()=>{Fs();Uu();Lu();Hu();Vu();Yu();ta=Object.create(null),pe=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=Nu(a,h);}this.layout=s??Wu(this.structsAndGroups),this.gpuLayout=o??zu(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=ir(r,"program");}get attributeData(){return this._attributeData??(this._attributeData=Du(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 ta[e]||(ta[e]=new i(t)),ta[e]}};});function ea(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 O(`${r} placement hook does not exist in shader`);}}var $u=p(()=>{_t();});function ra(i){let t={};return (i.match(Zg)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[];}),t}var Zg,Xu=p(()=>{Zg=/\{\{(.*?)\}\}/g;});function ju(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function ia(i,t,e=false){let r=[];ju(t,r),i.forEach(a=>{a.header&&ju(a.header,r);});let s=r;e&&s.sort();let o=s.map((a,h)=>` @location(${h}) ${a},`).join(`
36
+ `}var Ad=m(()=>{});function Ed(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 Bd=m(()=>{});function Fd(i,t){return t?`#version 300 es
38
+ ${i}`:i}var Rd=m(()=>{});function kd(i,{name:t="pixi-program"},e=true){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?e_:r_;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 e_,r_,Gd=m(()=>{e_={},r_={};});function Id(i,t){return t?i.replace("#version 300 es",""):i}var Dd=m(()=>{});var ja,Ka,Ud,Vr,Eo=m(()=>{Co();Md();Ad();Bd();Rd();Gd();Dd();ja={stripVersion:Id,ensurePrecision:Ed,addProgramDefines:Cd,setProgramName:kd,insertVersion:Fd},Ka=Object.create(null),Ud=class qa{constructor(t){t={...qa.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Pd()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(ja).forEach(n=>{let a=r[n];s=ja[n](s,a,true),o=ja[n](o,a,false);}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Wr(`${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 Ka[e]||(Ka[e]=new qa(t)),Ka[e]}};Ud.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};Vr=Ud;});function mr(i){return Ld[i]??Ld.float32}var Ld,Bo=m(()=>{Ld={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 Od({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=i_[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:h,stride:mr(h).stride,offset:0,instance:false,start:0};}}}return e}var i_,zd=m(()=>{Bo();i_={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 Fo(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(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(r)[1],10),name:u.match(s)[2],isUniform:u.match(s)[1]==="<uniform>",type:u.match(o)[1]}));if(!l)return {groups:[],structs:[]};let c=i.match(n)?.map(u=>{let f=u.match(h)[1],d=u.match(a).reduce((p,_)=>{let[x,y]=_.split(":");return p[x.trim()]=y.trim(),p},{});return d?{name:f,members:d}:null}).filter(({name:u})=>l.some(f=>f.type===u))??[];return {groups:l,structs:c}}var Hd=m(()=>{});var Nr,Wd=m(()=>{Nr=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(Nr||{});});function Vd({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:Nr.VERTEX|Nr.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:Nr.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:Nr.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:false}});}return t}var Nd=m(()=>{Wd();});function Yd({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 $d=m(()=>{});function Xd(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 jd=m(()=>{});var Za,Ye,Ro=m(()=>{Co();zd();Hd();Nd();$d();jd();Za=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=Fo(e.source);this.structsAndGroups=a;}else {let a=Fo(r.source),h=Fo(e.source);this.structsAndGroups=Xd(a,h);}this.layout=s??Yd(this.structsAndGroups),this.gpuLayout=o??Vd(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=Wr(r,"program");}get attributeData(){return this._attributeData??(this._attributeData=Od(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 Za[e]||(Za[e]=new i(t)),Za[e]}};});function Qa(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 $(`${r} placement hook does not exist in shader`);}}var Kd=m(()=>{kt();});function Ja(i){let t={};return (i.match(s_)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[];}),t}var s_,qd=m(()=>{s_=/\{\{(.*?)\}\}/g;});function Zd(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function th(i,t,e=false){let r=[];Zd(t,r),i.forEach(a=>{a.header&&Zd(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 Ku=p(()=>{});function qu(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function Qg(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function Jg(i){let t=/@.*?\s+/g;return i.replace(t,"")}function Zu(i,t){let e=[];qu(t,e),i.forEach(h=>{h.header&&qu(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 ${Jg(h)};`).join(`
42
+ `),n}var Qd=m(()=>{});function Jd(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function o_(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function n_(i){let t=/@.*?\s+/g;return i.replace(t,"")}function tf(i,t){let e=[];Jd(t,e),i.forEach(h=>{h.header&&Jd(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 ${n_(h)};`).join(`
44
44
  `),n=`return VSOutput(
45
- ${e.sort().map(h=>` ${Qg(h)}`).join(`,
45
+ ${e.sort().map(h=>` ${o_(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 Qu=p(()=>{});function sa(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
52
+ `),a}var ef=m(()=>{});function eh(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 Ju=p(()=>{});function td({template:i,bits:t}){let e=rd(i,t);if(me[e])return me[e];let{vertex:r,fragment:s}=ex(i,t);return me[e]=id(r,s,t),me[e]}function ed({template:i,bits:t}){let e=rd(i,t);return me[e]||(me[e]=id(i.vertex,i.fragment,t)),me[e]}function ex(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=ia(e,i.vertex,true);s=Zu(e,s);let o=ia(r,i.fragment,true);return {vertex:s,fragment:o}}function rd(i,t){return t.map(e=>(oa.has(e)||oa.set(e,tx++),oa.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function id(i,t,e){let r=ra(i),s=ra(t);return e.forEach(o=>{ea(o.vertex,r,o.name),ea(o.fragment,s,o.name);}),{vertex:sa(i,r),fragment:sa(t,s)}}var me,oa,tx,sd=p(()=>{$u();Xu();Ku();Qu();Ju();me=Object.create(null),oa=new Map,tx=0;});var od,nd,ad,hd,ld=p(()=>{od=`
56
+ //----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"");}return e}var rf=m(()=>{});function sf({template:i,bits:t}){let e=nf(i,t);if($e[e])return $e[e];let{vertex:r,fragment:s}=h_(i,t);return $e[e]=af(r,s,t),$e[e]}function of({template:i,bits:t}){let e=nf(i,t);return $e[e]||($e[e]=af(i.vertex,i.fragment,t)),$e[e]}function h_(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=th(e,i.vertex,true);s=tf(e,s);let o=th(r,i.fragment,true);return {vertex:s,fragment:o}}function nf(i,t){return t.map(e=>(rh.has(e)||rh.set(e,a_++),rh.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function af(i,t,e){let r=Ja(i),s=Ja(t);return e.forEach(o=>{Qa(o.vertex,r,o.name),Qa(o.fragment,s,o.name);}),{vertex:eh(i,r),fragment:eh(t,s)}}var $e,rh,a_,hf=m(()=>{Kd();qd();Qd();ef();rf();$e=Object.create(null),rh=new Map,a_=0;});var lf,cf,uf,df,ff=m(()=>{lf=`
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
- `,nd=`
100
+ `,cf=`
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
- `,ad=`
123
+ `,uf=`
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
- `,hd=`
159
+ `,df=`
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 cd,ud,dd=p(()=>{cd={name:"global-uniforms-bit",vertex:{header:`
180
+ `;});var pf,mf,gf=m(()=>{pf={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
- `}},ud={name:"global-uniforms-bit",vertex:{header:`
189
+ `}},mf={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 nr({bits:i,name:t}){let e=td({template:{fragment:nd,vertex:od},bits:[cd,...i]});return pe.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function ar({bits:i,name:t}){return new sr({name:t,...ed({template:{vertex:ad,fragment:hd},bits:[ud,...i]})})}var Us=p(()=>{Gs();Ds();sd();ld();dd();});var Ls,Os,na=p(()=>{Ls={name:"color-bit",vertex:{header:`
194
+ `}};});function Yr({bits:i,name:t}){let e=sf({template:{fragment:cf,vertex:lf},bits:[pf,...i]});return Ye.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function $r({bits:i,name:t}){return new Vr({name:t,...of({template:{vertex:uf,fragment:df},bits:[mf,...i]})})}var ko=m(()=>{Eo();Ro();hf();ff();gf();});var Go,Io,ih=m(()=>{Go={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
- `}},Os={name:"color-bit",vertex:{header:`
198
+ `}},Io={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 rx(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 ix(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 aa[i]||(aa[i]={name:"texture-batch-bit",vertex:{header:`
202
+ `}};});function l_(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 c_(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 Do(i){return sh[i]||(sh[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
- ${rx(i)}
217
+ ${l_(i)}
218
218
  `,main:`
219
219
  var uvDx = dpdx(vUV);
220
220
  var uvDy = dpdy(vUV);
221
221
 
222
- ${ix(i)}
223
- `}}),aa[i]}function sx(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 ha[i]||(ha[i]={name:"texture-batch-bit",vertex:{header:`
222
+ ${c_(i)}
223
+ `}}),sh[i]}function u_(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 Uo(i){return oh[i]||(oh[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
- ${sx(i)}
243
- `}}),ha[i]}var aa,ha,la=p(()=>{aa={};ha={};});var hr,lr,Ws=p(()=>{hr={name:"round-pixels-bit",vertex:{header:`
242
+ ${u_(i)}
243
+ `}}),oh[i]}var sh,oh,nh=m(()=>{sh={};oh={};});var Xr,jr,Lo=m(()=>{Xr={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
- `}},lr={name:"round-pixels-bit",vertex:{header:`
248
+ `}},jr={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 ca,fd,pd=p(()=>{ca=["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>"],fd=ca.reduce((i,t)=>(i[t]=true,i),{});});function md(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 gd=p(()=>{});var xd,wt,ge=p(()=>{St();Fs();pd();gd();xd=class _d{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={..._d.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,!fd[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${ca.join(", ")}`);o.value??(o.value=md(o.type,o.size)),r[s]=o.value;}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=ir(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group");}update(){this._dirtyId++;}};xd.defaultOptions={ubo:false,isStatic:false};wt=xd;});function Vs(i){let t=yd[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=yd[i]=new wt({uTextures:{value:e,type:"i32",size:i}},{isStatic:true}),t}var yd,ua=p(()=>{ge();yd={};});var Qt,ai=p(()=>{Qt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(Qt||{});});var Jt,hi=p(()=>{At();St();Gs();ii();Ds();ai();ge();Jt=class i extends ${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|=Qt.WEBGPU),r&&(n|=Qt.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 c in a[l]){let u=a[l][c];h[u]={group:l,binding:c,name:u};}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[c.name]=c;});}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,h[u.name]=u;});let l=0;for(let c in o)h[c]||(s[99]||(s[99]=new Dt,this._ownedBindGroups.push(s[99])),h[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(let c in o){let u=c,f=o[c];!f.source&&!f._resourceType&&(f=new wt(f));let d=h[u];d&&(s[d.group]||(s[d.group]=new Dt,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 Dt,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=pe.from(e)),r&&(n=sr.from(r)),new i({gpuProgram:o,glProgram:n,...s})}};});var Ns,bd=p(()=>{Us();na();la();Ws();ua();hi();Ns=class extends Jt{constructor(t){let e=ar({name:"batch",bits:[Os,Hs(t),lr]}),r=nr({name:"batch",bits:[Ls,zs(t),hr]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:Vs(t)}});}};});var vd,Sd,wd,Pd=p(()=>{R();gu();bu();bd();vd=null,Sd=class Td extends mu{constructor(){super(...arguments),this.geometry=new Bs,this.shader=vd||(vd=new Ns(this.maxTextures)),this.name=Td.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,c=a.c,u=a.d,f=a.tx,d=a.ty,{positions:m,uvs:x}=t,g=t.color,_=t.attributeOffset,y=_+t.attributeSize;for(let v=_;v<y;v++){let b=v*2,P=m[b],S=m[b+1];e[s++]=h*P+c*S+f,e[s++]=u*S+l*P+d,e[s++]=x[b],e[s++]=x[b+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,c=a.c,u=a.d,f=a.tx,d=a.ty,m=t.bounds,x=m.maxX,g=m.minX,_=m.maxY,y=m.minY,v=n.uvs,b=t.color,P=o<<16|t.roundPixels&65535;e[s+0]=h*g+c*y+f,e[s+1]=u*y+l*g+d,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=b,r[s+5]=P,e[s+6]=h*x+c*y+f,e[s+7]=u*y+l*x+d,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=b,r[s+11]=P,e[s+12]=h*x+c*_+f,e[s+13]=u*_+l*x+d,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=b,r[s+17]=P,e[s+18]=h*g+c*_+f,e[s+19]=u*_+l*g+d,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=b,r[s+23]=P;}};Sd.extension={type:[T.Batcher],name:"default"};wd=Sd;});function Md(i,t,e,r,s,o,n,a=null){let h=0;e*=t,s*=o;let l=a.a,c=a.b,u=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+u*g+d,r[s+1]=c*x+f*g+m,s+=o,e+=t,h++;}}function Cd(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++;}var Ad=p(()=>{});function da(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let f=0;f<s;f++){let d=i[u],m=i[u+1];i[u]=o*d+a*m+l,i[u+1]=n*d+h*m+c,u+=r;}}var Ed=p(()=>{});var ox,Ie,fa=p(()=>{J();tn();ox=new C,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?is(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||ox}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,Bd,Fd,Rd=p(()=>{R();cr={extension:{type:T.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let b=i;e=b.x,r=b.y,n=a=b.radius,s=o=0;}else if(i.type==="ellipse"){let b=i;e=b.x,r=b.y,n=b.halfWidth,a=b.halfHeight,s=o=0;}else {let b=i,P=b.width/2,S=b.height/2;e=b.x+P,r=b.y+S,n=a=Math.max(0,Math.min(b.radius,Math.min(P,S))),s=P-n,o=S-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 c=0,u=h*4+(s?2:0)+2,f=u,d=l,m=s+n,x=o,g=e+m,_=e-m,y=r+x;if(t[c++]=g,t[c++]=y,t[--u]=y,t[--u]=_,o){let b=r-x;t[f++]=_,t[f++]=b,t[--d]=b,t[--d]=g;}for(let b=1;b<h;b++){let P=Math.PI/2*(b/h),S=s+Math.cos(P)*n,w=o+Math.sin(P)*a,E=e+S,B=e-S,M=r+w,A=r-w;t[c++]=E,t[c++]=M,t[--u]=M,t[--u]=B,t[f++]=B,t[f++]=A,t[--d]=A,t[--d]=E;}m=s,x=o+a,g=e+m,_=e-m,y=r+x;let v=r-x;return t[c++]=g,t[c++]=y,t[--d]=v,t[--d]=g,s&&(t[c++]=_,t[c++]=y,t[--d]=v,t[--d]=_),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let c=0;c<i.length;c+=2)n+=i[c],a+=i[c+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 c=0;c<i.length;c+=2)t[h*e]=i[c],t[h*e+1]=i[c+1],c>0&&(s[o++]=h,s[o++]=l,s[o++]=h-1),h++;s[o++]=l+1,s[o++]=l,s[o++]=h-1;}},Bd={...cr,extension:{...cr.extension,name:"ellipse"}},Fd={...cr,extension:{...cr.extension,name:"roundedRectangle"}};});function Gd(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 kd=p(()=>{});function Id(i,t,e,r,s,o,n,a){let h=i-e*s,l=t-r*s,c=i+e*o,u=t+r*o,f,d;n?(f=r,d=-e):(f=-r,d=e);let m=h+f,x=l+d,g=c+f,_=u+d;return a.push(m,x),a.push(g,_),2}function De(i,t,e,r,s,o,n,a){let h=e-i,l=r-t,c=Math.atan2(h,l),u=Math.atan2(s-i,o-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let f=c,d=u-c,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,v=f;y<g;y++,v+=_)n.push(i,t),n.push(i+Math.sin(v)*x,t+Math.cos(v)*x);n.push(i,t),n.push(s,o);}else {n.push(e,r),n.push(i,t);for(let y=1,v=f;y<g;y++,v+=_)n.push(i+Math.sin(v)*x,t+Math.cos(v)*x),n.push(i,t);n.push(s,o),n.push(i,t);}return g*2}function Dd(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 Q=Gd(i);h=(h-.5)*Q+.5;}let l=new N(i[0],i[1]),c=new N(i[i.length-2],i[i.length-1]),u=r,f=Math.abs(l.x-c.x)<n&&Math.abs(l.y-c.y)<n;if(u){i=i.slice(),f&&(i.pop(),i.pop(),c.set(i[i.length-2],i[i.length-1]));let Q=(l.x+c.x)*.5,le=(c.y+l.y)*.5;i.unshift(Q,le),i.push(Q,le);}let d=s,m=i.length/2,x=i.length,g=d.length/2,_=a.width/2,y=_*_,v=a.miterLimit*a.miterLimit,b=i[0],P=i[1],S=i[2],w=i[3],E=0,B=0,M=-(P-w),A=b-S,L=0,q=0,ft=Math.sqrt(M*M+A*A);M/=ft,A/=ft,M*=_,A*=_;let Br=h,D=(1-Br)*2,z=Br*2;u||(a.cap==="round"?x+=De(b-M*(D-z)*.5,P-A*(D-z)*.5,b-M*D,P-A*D,b+M*z,P+A*z,d,true)+2:a.cap==="square"&&(x+=Id(b,P,M,A,D,z,true,d))),d.push(b-M*D,P-A*D),d.push(b+M*z,P+A*z);for(let Q=1;Q<m-1;++Q){b=i[(Q-1)*2],P=i[(Q-1)*2+1],S=i[Q*2],w=i[Q*2+1],E=i[(Q+1)*2],B=i[(Q+1)*2+1],M=-(P-w),A=b-S,ft=Math.sqrt(M*M+A*A),M/=ft,A/=ft,M*=_,A*=_,L=-(w-B),q=S-E,ft=Math.sqrt(L*L+q*q),L/=ft,q/=ft,L*=_,q*=_;let le=S-b,Fr=P-w,Rr=S-E,Gr=B-w,Eh=le*Rr+Fr*Gr,Oi=Fr*Rr-Gr*le,kr=Oi<0;if(Math.abs(Oi)<.001*Math.abs(Eh)){d.push(S-M*D,w-A*D),d.push(S+M*z,w+A*z),Eh>=0&&(a.join==="round"?x+=De(S,w,S-M*D,w-A*D,S-L*D,w-q*D,d,false)+4:x+=2,d.push(S-L*z,w-q*z),d.push(S+L*D,w+q*D));continue}let Bh=(-M+b)*(-A+w)-(-M+S)*(-A+P),Fh=(-L+E)*(-q+w)-(-L+S)*(-q+B),zi=(le*Fh-Rr*Bh)/Oi,Hi=(Gr*Bh-Fr*Fh)/Oi,Do=(zi-S)*(zi-S)+(Hi-w)*(Hi-w),Te=S+(zi-S)*D,we=w+(Hi-w)*D,Pe=S-(zi-S)*z,Me=w-(Hi-w)*z,Zm=Math.min(le*le+Fr*Fr,Rr*Rr+Gr*Gr),Rh=kr?D:z,Qm=Zm+Rh*Rh*y;Do<=Qm?a.join==="bevel"||Do/y>v?(kr?(d.push(Te,we),d.push(S+M*z,w+A*z),d.push(Te,we),d.push(S+L*z,w+q*z)):(d.push(S-M*D,w-A*D),d.push(Pe,Me),d.push(S-L*D,w-q*D),d.push(Pe,Me)),x+=2):a.join==="round"?kr?(d.push(Te,we),d.push(S+M*z,w+A*z),x+=De(S,w,S+M*z,w+A*z,S+L*z,w+q*z,d,true)+4,d.push(Te,we),d.push(S+L*z,w+q*z)):(d.push(S-M*D,w-A*D),d.push(Pe,Me),x+=De(S,w,S-M*D,w-A*D,S-L*D,w-q*D,d,false)+4,d.push(S-L*D,w-q*D),d.push(Pe,Me)):(d.push(Te,we),d.push(Pe,Me)):(d.push(S-M*D,w-A*D),d.push(S+M*z,w+A*z),a.join==="round"?kr?x+=De(S,w,S+M*z,w+A*z,S+L*z,w+q*z,d,true)+2:x+=De(S,w,S-M*D,w-A*D,S-L*D,w-q*D,d,false)+2:a.join==="miter"&&Do/y<=v&&(kr?(d.push(Pe,Me),d.push(Pe,Me)):(d.push(Te,we),d.push(Te,we)),x+=2),d.push(S-L*D,w-q*D),d.push(S+L*z,w+q*z),x+=2);}b=i[(m-2)*2],P=i[(m-2)*2+1],S=i[(m-1)*2],w=i[(m-1)*2+1],M=-(P-w),A=b-S,ft=Math.sqrt(M*M+A*A),M/=ft,A/=ft,M*=_,A*=_,d.push(S-M*D,w-A*D),d.push(S+M*z,w+A*z),u||(a.cap==="round"?x+=De(S-M*(D-z)*.5,w-A*(D-z)*.5,S-M*D,w-A*D,S+M*z,w+A*z,d,false)+2:a.cap==="square"&&(x+=Id(S,w,M,A,D,z,false,d)));let qm=1e-4*1e-4;for(let Q=g;Q<x+g-2;++Q)b=d[Q*2],P=d[Q*2+1],S=d[(Q+1)*2],w=d[(Q+1)*2+1],E=d[(Q+2)*2],B=d[(Q+2)*2+1],!(Math.abs(b*(w-B)+S*(B-P)+E*(P-w))<qm)&&o.push(Q,Q+1,Q+2);}var Ud=p(()=>{Ot();kd();});function Ld(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,c=e,u=i.length/2,f=c.length/2;for(let d=0;d<u;d++)c.push(i[d*2]),c.push(i[d*2+1]);for(let d=0;d<u-1;d++)r.push(f+d,f+d+1);l&&r.push(f+u-1,f);}var Od=p(()=>{});var _a=Lo((bM,xa)=>{xa.exports=Xs;xa.exports.default=Xs;function Xs(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Hd(i,0,s,e,true),n=[];if(!o||o.next===o.prev)return n;var a,h,l,c,u,f,d;if(r&&(o=dx(i,t,o,e)),i.length>80*e){a=l=i[0],h=c=i[1];for(var m=e;m<s;m+=e)u=i[m],f=i[m+1],u<a&&(a=u),f<h&&(h=f),u>l&&(l=u),f>c&&(c=f);d=Math.max(l-a,c-h),d=d!==0?32767/d:0;}return li(o,n,e,a,h,d,0),n}function Hd(i,t,e,r,s){var o,n;if(s===ga(i,t,e,r)>0)for(o=t;o<e;o+=r)n=zd(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=zd(o,i[o],i[o+1],n);return n&&js(n,n.next)&&(ui(n),n=n.next),n}function Ue(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=false,!e.steiner&&(js(e,e.next)||ot(e.prev,e,e.next)===0)){if(ui(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&&xx(i,r,s,o);for(var a=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,o?lx(i,r,s,o):hx(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),ui(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=cx(Ue(i),t,e),li(i,t,e,r,s,o,2)):n===2&&ux(i,t,e,r,s,o):li(Ue(i),t,e,r,s,o,1);break}}}}function hx(i){var t=i.prev,e=i,r=i.next;if(ot(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,c=s<o?s<n?s:n:o<n?o:n,u=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>=c&&m.x<=f&&m.y>=u&&m.y<=d&&ur(s,a,o,h,n,l,m.x,m.y)&&ot(m.prev,m,m.next)>=0)return false;m=m.next;}return true}function lx(i,t,e,r){var s=i.prev,o=i,n=i.next;if(ot(s,o,n)>=0)return false;for(var a=s.x,h=o.x,l=n.x,c=s.y,u=o.y,f=n.y,d=a<h?a<l?a:l:h<l?h:l,m=c<u?c<f?c:f:u<f?u:f,x=a>h?a>l?a:l:h>l?h:l,g=c>u?c>f?c:f:u>f?u:f,_=pa(d,m,t,e,r),y=pa(x,g,t,e,r),v=i.prevZ,b=i.nextZ;v&&v.z>=_&&b&&b.z<=y;){if(v.x>=d&&v.x<=x&&v.y>=m&&v.y<=g&&v!==s&&v!==n&&ur(a,c,h,u,l,f,v.x,v.y)&&ot(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=d&&b.x<=x&&b.y>=m&&b.y<=g&&b!==s&&b!==n&&ur(a,c,h,u,l,f,b.x,b.y)&&ot(b.prev,b,b.next)>=0))return false;b=b.nextZ;}for(;v&&v.z>=_;){if(v.x>=d&&v.x<=x&&v.y>=m&&v.y<=g&&v!==s&&v!==n&&ur(a,c,h,u,l,f,v.x,v.y)&&ot(v.prev,v,v.next)>=0)return false;v=v.prevZ;}for(;b&&b.z<=y;){if(b.x>=d&&b.x<=x&&b.y>=m&&b.y<=g&&b!==s&&b!==n&&ur(a,c,h,u,l,f,b.x,b.y)&&ot(b.prev,b,b.next)>=0)return false;b=b.nextZ;}return true}function cx(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!js(s,o)&&Wd(s,r,r.next,o)&&ci(s,o)&&ci(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),ui(r),ui(r.next),r=i=o),r=r.next;}while(r!==i);return Ue(r)}function ux(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&bx(n,a)){var h=Vd(n,a);n=Ue(n,n.next),h=Ue(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 dx(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=Hd(i,a,h,r,false),l===l.next&&(l.steiner=true),s.push(yx(l));for(s.sort(fx),o=0;o<s.length;o++)e=px(s[o],e);return e}function fx(i,t){return i.x-t.x}function px(i,t){var e=mx(i,t);if(!e)return t;var r=Vd(e,i);return Ue(r,r.next),Ue(e,e.next)}function mx(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,c=n.y,u=1/0,f;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&ur(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(f=Math.abs(s-e.y)/(r-e.x),ci(e,i)&&(f<u||f===u&&(e.x>n.x||e.x===n.x&&gx(n,e)))&&(n=e,u=f)),e=e.next;while(e!==h);return n}function gx(i,t){return ot(i.prev,i,t.prev)<0&&ot(t.next,i,i.next)<0}function xx(i,t,e,r){var s=i;do s.z===0&&(s.z=pa(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,_x(s);}function _x(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 pa(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 yx(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 ur(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 bx(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!vx(i,t)&&(ci(i,t)&&ci(t,i)&&Sx(i,t)&&(ot(i.prev,i,t.prev)||ot(i,t.prev,t))||js(i,t)&&ot(i.prev,i,i.next)>0&&ot(t.prev,t,t.next)>0)}function ot(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 Wd(i,t,e,r){var s=$s(ot(i,t,e)),o=$s(ot(i,t,r)),n=$s(ot(e,r,i)),a=$s(ot(e,r,t));return !!(s!==o&&n!==a||s===0&&Ys(i,e,t)||o===0&&Ys(i,r,t)||n===0&&Ys(e,i,r)||a===0&&Ys(e,t,r))}function Ys(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 $s(i){return i>0?1:i<0?-1:0}function vx(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&&Wd(e,e.next,i,t))return true;e=e.next;}while(e!==i);return false}function ci(i,t){return ot(i.prev,i,i.next)<0?ot(i,t,i.next)>=0&&ot(i,i.prev,t)>=0:ot(i,t,i.prev)<0||ot(i,i.next,t)<0}function Sx(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 Vd(i,t){var e=new ma(i.i,i.x,i.y),r=new ma(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 zd(i,t,e,r){var s=new ma(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 ui(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 ma(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(ga(i,0,o,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:i.length;n-=Math.abs(ga(i,l,c,e));}var u=0;for(a=0;a<r.length;a+=3){var f=r[a]*e,d=r[a+1]*e,m=r[a+2]*e;u+=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&&u===0?0:Math.abs((u-n)/n)};function ga(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, Nd.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 Nd,ya=p(()=>{Nd=Wi(_a());});var Tx,Yd,$d=p(()=>{R();ya();Tx=[],Yd={extension:{type:T.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,Tx,t,e,r,s,o);}};});var Xd,jd=p(()=>{R();Xd={extension:{type:T.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 Kd,qd=p(()=>{R();Kd={extension:{type:T.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 Qd(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color);}}function Jd(i,t){let e=st.get().createCanvas(i,t),r=e.getContext("2d");return {canvas:e,context:r}}function wx(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]??Ct.defaultLinearOptions.textureSize}),t}var Zd,va,Ct,dr=p(()=>{Pt();Wt();J();Ss();mt();St();ct();hn();Zd=[{offset:0,color:"white"},{offset:1,color:"black"}],va=class ba{constructor(...t){this.uid=Y("fillGradient"),this.type="linear",this.colorStops=[];let e=wx(t);e={...e.type==="radial"?ba.defaultRadialOptions:ba.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: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:Zd,l=this._textureSize,{canvas:c,context:u}=Jd(l,1),f=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);Qd(f,h),u.fillStyle=f,u.fillRect(0,0,l,1),this.texture=new G({source:new Kt({resource:c,addressMode:this._wrapMode})});let d=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),x=new C;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:Zd,e=this._textureSize,{canvas:r,context:s}=Jd(e,e),{x:o,y:n}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,u=a-c,f=h-c,d=e/(c*2),m=(o-u)*d,x=(n-f)*d,g=s.createRadialGradient(m,x,l*d,(a-u)*d,(h-f)*d,c*d);Qd(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 G({source:new Kt({resource:r,addressMode:this._wrapMode})});let _=new C;_.scale(1/d,1/d),_.translate(u,f),this.textureSpace==="local"&&_.scale(e,e),this.transform=_;}get styleKey(){return this.uid}destroy(){this.texture?.destroy(true),this.texture=null;}};va.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};va.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Ct=va;});function tf(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,c=1/n.height,u=-a*l,f=-h*c,d=s.a,m=s.b,x=s.c,g=s.d;s.a*=l,s.b*=l,s.c*=c,s.d*=c,s.tx=u*d+f*x+s.tx,s.ty=u*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 Ct)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(Px.copyFrom(r).invert()),s}var Px,Mx,ef=p(()=>{J();Et();dr();Px=new C,Mx=new K;});function sf(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")Ex(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&&rf(l.shapePath,h,true,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),rf(a,h,n,r,e);}}}function Ex(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,h=[],l=qs.rectangle,c=Cx,u=i.image;c.x=i.dx,c.y=i.dy,c.width=i.dw,c.height=i.dh;let f=i.transform;l.build(c,h),f&&da(h,f),l.triangulate(h,r,2,a,o,n);let d=u.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=u,m.geometryData=e,t.push(m);}function rf(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{let u=a.length,f=o.length/2,d=[],m=qs[h.type],x="triangle-list";if(m.build(h,d),l&&da(d,l),e){let v=h.closePath??true,b=t;b.pixelLine?(Ld(d,v,o,a),x="line-list"):Dd(d,b,false,v,o,a);}else if(c){let v=[],b=d.slice();Bx(c).forEach(S=>{v.push(b.length/2),b.push(...S);}),Ks(b,v,o,2,f,a,u);}else m.triangulate(d,o,2,f,a,u);let g=n.length/2,_=t.texture;if(_!==G.WHITE){let v=tf(Ax,t,h,l);Md(o,2,f,n,g,2,o.length/2-f,v);}else Cd(n,g,2,o.length/2-f);let y=W.get(Ie);y.indexOffset=u,y.indexSize=a.length-u,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 Bx(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,Cx,Ax,of=p(()=>{R();J();Et();Ad();Ed();mt();It();fa();Rd();Ud();Od();$d();jd();qd();ef();ya();qs={};k.handleByMap(T.ShapeBuilder,qs);k.add(Xd,Yd,Kd,cr,Bd,Fd);Cx=new K,Ax=new C;});var Sa,Ta,Pa,fr,Zs=p(()=>{R();nu();Pd();nn();ct();It();of();Sa=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]};}},Ta=class{constructor(){this.batcher=new wd,this.instructions=new $e;}init(){this.instructions.reset();}get geometry(){return I(sl,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Pa=class wa{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash");}init(t){wa.defaultOptions.bezierSmoothness=t?.bezierSmoothness??wa.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),sf(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(Ta),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<r.length;c++)r[c].applyTransform=false;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<r.length;c++){let u=r[c];a.add(u);}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 c=0;c<l.length;c++){let u=l[c];u.bindGroup=ou(u.textures.textures,u.textures.count);}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new Sa;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);}};Pa.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"graphicsContext"};Pa.defaultOptions={bezierSmoothness:.5};fr=Pa;});var Fx,Ma,Ca,Aa,Ea,Ba,Fa,Ra,Le,Qs=p(()=>{Fx={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},Ma=0,Ca=1,Aa=2,Ea=3,Ba=4,Fa=5,Ra=class nf{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=true,this.depthMask=true;}get blend(){return !!(this.data&1<<Ma)}set blend(t){!!(this.data&1<<Ma)!==t&&(this.data^=1<<Ma);}get offsets(){return !!(this.data&1<<Ca)}set offsets(t){!!(this.data&1<<Ca)!==t&&(this.data^=1<<Ca);}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<<Aa)}set culling(t){!!(this.data&1<<Aa)!==t&&(this.data^=1<<Aa);}get depthTest(){return !!(this.data&1<<Ea)}set depthTest(t){!!(this.data&1<<Ea)!==t&&(this.data^=1<<Ea);}get depthMask(){return !!(this.data&1<<Fa)}set depthMask(t){!!(this.data&1<<Fa)!==t&&(this.data^=1<<Fa);}get clockwiseFrontFace(){return !!(this.data&1<<Ba)}set clockwiseFrontFace(t){!!(this.data&1<<Ba)!==t&&(this.data^=1<<Ba);}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=Fx[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 nf;return t.depthTest=false,t.blend=true,t}};Ra.default2d=Ra.for2d();Le=Ra;});function xe(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,af=p(()=>{R();Qs();It();di();fa();fi=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,xe(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;}};fi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"graphics"};});var Ga=p(()=>{R();Zs();af();k.add(fi);k.add(fr);});var _e,Js=p(()=>{_e=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,hf=p(()=>{R();J();ii();ge();si();It();di();Js();pi=class{constructor(t,e){this.localUniforms=new wt({uTransformMatrix:{value:new C,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Dt({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=ne(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),xe(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(_e);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;}};pi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"mesh"};});var ka=p(()=>{R();hf();k.add(pi);});var to,lf=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 Ia(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 cf=p(()=>{});function df(i){return {dynamicUpdate:uf(i,true),staticUpdate:uf(i,false)}}function uf(i,t){let e=[];e.push(`
253
+ `}};});var ah,xf,_f=m(()=>{ah=["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>"],xf=ah.reduce((i,t)=>(i[t]=true,i),{});});function yf(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 bf=m(()=>{});var vf,zt,Xe=m(()=>{Lt();Co();_f();bf();vf=class Sf{constructor(t,e){this._touched=0,this.uid=J("uniform"),this._resourceType="uniformGroup",this._resourceId=J("resource"),this.isUniformGroup=true,this._dirtyId=0,this.destroyed=false,e={...Sf.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,!xf[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${ah.join(", ")}`);o.value??(o.value=yf(o.type,o.size)),r[s]=o.value;}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Wr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group");}update(){this._dirtyId++;}};vf.defaultOptions={ubo:false,isStatic:false};zt=vf;});function Oo(i){let t=Tf[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=Tf[i]=new zt({uTextures:{value:e,type:"i32",size:i}},{isStatic:true}),t}var Tf,hh=m(()=>{Xe();Tf={};});var Ae,Qi=m(()=>{Ae=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(Ae||{});});var Ee,Ji=m(()=>{$t();Lt();Eo();ji();Ro();Qi();Xe();Ee=class i extends tt{constructor(t){super(),this.uid=J("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|=Ae.WEBGPU),r&&(n|=Ae.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 c in a[l]){let u=a[l][c];h[u]={group:l,binding:c,name:u};}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[c.name]=c;});}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,h[u.name]=u;});let l=0;for(let c in o)h[c]||(s[99]||(s[99]=new se,this._ownedBindGroups.push(s[99])),h[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(let c in o){let u=c,f=o[c];!f.source&&!f._resourceType&&(f=new zt(f));let d=h[u];d&&(s[d.group]||(s[d.group]=new se,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 se,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=Vr.from(r)),new i({gpuProgram:o,glProgram:n,...s})}};});var zo,wf=m(()=>{ko();ih();nh();Lo();hh();Ji();zo=class extends Ee{constructor(t){let e=$r({name:"batch",bits:[Io,Uo(t),jr]}),r=Yr({name:"batch",bits:[Go,Do(t),Xr]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:Oo(t)}});}};});var Pf,Mf,Af,Ef=m(()=>{D();yd();Td();wf();Pf=null,Mf=class Cf extends _d{constructor(){super(...arguments),this.geometry=new Mo,this.shader=Pf||(Pf=new zo(this.maxTextures)),this.name=Cf.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,c=a.c,u=a.d,f=a.tx,d=a.ty,{positions:p,uvs:_}=t,x=t.color,y=t.attributeOffset,b=y+t.attributeSize;for(let S=y;S<b;S++){let v=S*2,M=p[v],T=p[v+1];e[s++]=h*M+c*T+f,e[s++]=u*T+l*M+d,e[s++]=_[v],e[s++]=_[v+1],r[s++]=x,r[s++]=n;}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,f=a.tx,d=a.ty,p=t.bounds,_=p.maxX,x=p.minX,y=p.maxY,b=p.minY,S=n.uvs,v=t.color,M=o<<16|t.roundPixels&65535;e[s+0]=h*x+c*b+f,e[s+1]=u*b+l*x+d,e[s+2]=S.x0,e[s+3]=S.y0,r[s+4]=v,r[s+5]=M,e[s+6]=h*_+c*b+f,e[s+7]=u*b+l*_+d,e[s+8]=S.x1,e[s+9]=S.y1,r[s+10]=v,r[s+11]=M,e[s+12]=h*_+c*y+f,e[s+13]=u*y+l*_+d,e[s+14]=S.x2,e[s+15]=S.y2,r[s+16]=v,r[s+17]=M,e[s+18]=h*x+c*y+f,e[s+19]=u*y+l*x+d,e[s+20]=S.x3,e[s+21]=S.y3,r[s+22]=v,r[s+23]=M;}};Mf.extension={type:[w.Batcher],name:"default"};Af=Mf;});function Bf(i,t,e,r,s,o,n,a=null){let h=0;e*=t,s*=o;let l=a.a,c=a.b,u=a.c,f=a.d,d=a.tx,p=a.ty;for(;h<n;){let _=i[e],x=i[e+1];r[s]=l*_+u*x+d,r[s+1]=c*_+f*x+p,s+=o,e+=t,h++;}}function Ff(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++;}var Rf=m(()=>{});function lh(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let f=0;f<s;f++){let d=i[u],p=i[u+1];i[u]=o*d+a*p+l,i[u+1]=n*d+h*p+c,u+=r;}}var kf=m(()=>{});var d_,gr,ch=m(()=>{at();Qn();d_=new E,gr=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?Qs(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||d_}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 Kr,Gf,If,Df=m(()=>{D();Kr={extension:{type:w.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,M=v.width/2,T=v.height/2;e=v.x+M,r=v.y+T,n=a=Math.max(0,Math.min(v.radius,Math.min(M,T))),s=M-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 c=0,u=h*4+(s?2:0)+2,f=u,d=l,p=s+n,_=o,x=e+p,y=e-p,b=r+_;if(t[c++]=x,t[c++]=b,t[--u]=b,t[--u]=y,o){let v=r-_;t[f++]=y,t[f++]=v,t[--d]=v,t[--d]=x;}for(let v=1;v<h;v++){let M=Math.PI/2*(v/h),T=s+Math.cos(M)*n,P=o+Math.sin(M)*a,F=e+T,G=e-T,A=r+P,B=r-P;t[c++]=F,t[c++]=A,t[--u]=A,t[--u]=G,t[f++]=G,t[f++]=B,t[--d]=B,t[--d]=F;}p=s,_=o+a,x=e+p,y=e-p,b=r+_;let S=r-_;return t[c++]=x,t[c++]=b,t[--d]=S,t[--d]=x,s&&(t[c++]=y,t[c++]=b,t[--d]=S,t[--d]=y),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let c=0;c<i.length;c+=2)n+=i[c],a+=i[c+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 c=0;c<i.length;c+=2)t[h*e]=i[c],t[h*e+1]=i[c+1],c>0&&(s[o++]=h,s[o++]=l,s[o++]=h-1),h++;s[o++]=l+1,s[o++]=l,s[o++]=h-1;}},Gf={...Kr,extension:{...Kr.extension,name:"ellipse"}},If={...Kr,extension:{...Kr.extension,name:"roundedRectangle"}};});function Uf(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 Lf=m(()=>{});function Of(i,t,e,r,s,o,n,a){let h=i-e*s,l=t-r*s,c=i+e*o,u=t+r*o,f,d;n?(f=r,d=-e):(f=-r,d=e);let p=h+f,_=l+d,x=c+f,y=u+d;return a.push(p,_),a.push(x,y),2}function xr(i,t,e,r,s,o,n,a){let h=e-i,l=r-t,c=Math.atan2(h,l),u=Math.atan2(s-i,o-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let f=c,d=u-c,p=Math.abs(d),_=Math.sqrt(h*h+l*l),x=(15*p*Math.sqrt(_)/Math.PI>>0)+1,y=d/x;if(f+=y,a){n.push(i,t),n.push(e,r);for(let b=1,S=f;b<x;b++,S+=y)n.push(i,t),n.push(i+Math.sin(S)*_,t+Math.cos(S)*_);n.push(i,t),n.push(s,o);}else {n.push(e,r),n.push(i,t);for(let b=1,S=f;b<x;b++,S+=y)n.push(i+Math.sin(S)*_,t+Math.cos(S)*_),n.push(i,t);n.push(s,o),n.push(i,t);}return x*2}function zf(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 nt=Uf(i);h=(h-.5)*nt+.5;}let l=new Z(i[0],i[1]),c=new Z(i[i.length-2],i[i.length-1]),u=r,f=Math.abs(l.x-c.x)<n&&Math.abs(l.y-c.y)<n;if(u){i=i.slice(),f&&(i.pop(),i.pop(),c.set(i[i.length-2],i[i.length-1]));let nt=(l.x+c.x)*.5,ze=(c.y+l.y)*.5;i.unshift(nt,ze),i.push(nt,ze);}let d=s,p=i.length/2,_=i.length,x=d.length/2,y=a.width/2,b=y*y,S=a.miterLimit*a.miterLimit,v=i[0],M=i[1],T=i[2],P=i[3],F=0,G=0,A=-(M-P),B=v-T,N=0,st=0,At=Math.sqrt(A*A+B*B);A/=At,B/=At,A*=y,B*=y;let vi=h,W=(1-vi)*2,X=vi*2;u||(a.cap==="round"?_+=xr(v-A*(W-X)*.5,M-B*(W-X)*.5,v-A*W,M-B*W,v+A*X,M+B*X,d,true)+2:a.cap==="square"&&(_+=Of(v,M,A,B,W,X,true,d))),d.push(v-A*W,M-B*W),d.push(v+A*X,M+B*X);for(let nt=1;nt<p-1;++nt){v=i[(nt-1)*2],M=i[(nt-1)*2+1],T=i[nt*2],P=i[nt*2+1],F=i[(nt+1)*2],G=i[(nt+1)*2+1],A=-(M-P),B=v-T,At=Math.sqrt(A*A+B*B),A/=At,B/=At,A*=y,B*=y,N=-(P-G),st=T-F,At=Math.sqrt(N*N+st*st),N/=At,st/=At,N*=y,st*=y;let ze=T-v,Si=M-P,Ti=T-F,wi=G-P,Fl=ze*Ti+Si*wi,Rs=Si*Ti-wi*ze,Pi=Rs<0;if(Math.abs(Rs)<.001*Math.abs(Fl)){d.push(T-A*W,P-B*W),d.push(T+A*X,P+B*X),Fl>=0&&(a.join==="round"?_+=xr(T,P,T-A*W,P-B*W,T-N*W,P-st*W,d,false)+4:_+=2,d.push(T-N*X,P-st*X),d.push(T+N*W,P+st*W));continue}let Rl=(-A+v)*(-B+P)-(-A+T)*(-B+M),kl=(-N+F)*(-st+P)-(-N+T)*(-st+G),ks=(ze*kl-Ti*Rl)/Rs,Gs=(wi*Rl-Si*kl)/Rs,Gn=(ks-T)*(ks-T)+(Gs-P)*(Gs-P),sr=T+(ks-T)*W,or=P+(Gs-P)*W,nr=T-(ks-T)*X,ar=P-(Gs-P)*X,ix=Math.min(ze*ze+Si*Si,Ti*Ti+wi*wi),Gl=Pi?W:X,sx=ix+Gl*Gl*b;Gn<=sx?a.join==="bevel"||Gn/b>S?(Pi?(d.push(sr,or),d.push(T+A*X,P+B*X),d.push(sr,or),d.push(T+N*X,P+st*X)):(d.push(T-A*W,P-B*W),d.push(nr,ar),d.push(T-N*W,P-st*W),d.push(nr,ar)),_+=2):a.join==="round"?Pi?(d.push(sr,or),d.push(T+A*X,P+B*X),_+=xr(T,P,T+A*X,P+B*X,T+N*X,P+st*X,d,true)+4,d.push(sr,or),d.push(T+N*X,P+st*X)):(d.push(T-A*W,P-B*W),d.push(nr,ar),_+=xr(T,P,T-A*W,P-B*W,T-N*W,P-st*W,d,false)+4,d.push(T-N*W,P-st*W),d.push(nr,ar)):(d.push(sr,or),d.push(nr,ar)):(d.push(T-A*W,P-B*W),d.push(T+A*X,P+B*X),a.join==="round"?Pi?_+=xr(T,P,T+A*X,P+B*X,T+N*X,P+st*X,d,true)+2:_+=xr(T,P,T-A*W,P-B*W,T-N*W,P-st*W,d,false)+2:a.join==="miter"&&Gn/b<=S&&(Pi?(d.push(nr,ar),d.push(nr,ar)):(d.push(sr,or),d.push(sr,or)),_+=2),d.push(T-N*W,P-st*W),d.push(T+N*X,P+st*X),_+=2);}v=i[(p-2)*2],M=i[(p-2)*2+1],T=i[(p-1)*2],P=i[(p-1)*2+1],A=-(M-P),B=v-T,At=Math.sqrt(A*A+B*B),A/=At,B/=At,A*=y,B*=y,d.push(T-A*W,P-B*W),d.push(T+A*X,P+B*X),u||(a.cap==="round"?_+=xr(T-A*(W-X)*.5,P-B*(W-X)*.5,T-A*W,P-B*W,T+A*X,P+B*X,d,false)+2:a.cap==="square"&&(_+=Of(T,P,A,B,W,X,false,d)));let rx=1e-4*1e-4;for(let nt=x;nt<_+x-2;++nt)v=d[nt*2],M=d[nt*2+1],T=d[(nt+1)*2],P=d[(nt+1)*2+1],F=d[(nt+2)*2],G=d[(nt+2)*2+1],!(Math.abs(v*(P-G)+T*(G-M)+F*(M-P))<rx)&&o.push(nt,nt+1,nt+2);}var Hf=m(()=>{ae();Lf();});function Wf(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,c=e,u=i.length/2,f=c.length/2;for(let d=0;d<u;d++)c.push(i[d*2]),c.push(i[d*2+1]);for(let d=0;d<u-1;d++)r.push(f+d,f+d+1);l&&r.push(f+u-1,f);}var Vf=m(()=>{});var mh=In((CC,ph)=>{ph.exports=Vo;ph.exports.default=Vo;function Vo(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Yf(i,0,s,e,true),n=[];if(!o||o.next===o.prev)return n;var a,h,l,c,u,f,d;if(r&&(o=y_(i,t,o,e)),i.length>80*e){a=l=i[0],h=c=i[1];for(var p=e;p<s;p+=e)u=i[p],f=i[p+1],u<a&&(a=u),f<h&&(h=f),u>l&&(l=u),f>c&&(c=f);d=Math.max(l-a,c-h),d=d!==0?32767/d:0;}return ts(o,n,e,a,h,d,0),n}function Yf(i,t,e,r,s){var o,n;if(s===fh(i,t,e,r)>0)for(o=t;o<e;o+=r)n=Nf(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=Nf(o,i[o],i[o+1],n);return n&&No(n,n.next)&&(rs(n),n=n.next),n}function _r(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=false,!e.steiner&&(No(e,e.next)||mt(e.prev,e,e.next)===0)){if(rs(e),e=t=e.prev,e===e.next)break;r=true;}else e=e.next;while(r||e!==t);return t}function ts(i,t,e,r,s,o,n){if(i){!n&&o&&w_(i,r,s,o);for(var a=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,o?g_(i,r,s,o):m_(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),rs(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=x_(_r(i),t,e),ts(i,t,e,r,s,o,2)):n===2&&__(i,t,e,r,s,o):ts(_r(i),t,e,r,s,o,1);break}}}}function m_(i){var t=i.prev,e=i,r=i.next;if(mt(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,c=s<o?s<n?s:n:o<n?o:n,u=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,p=r.next;p!==t;){if(p.x>=c&&p.x<=f&&p.y>=u&&p.y<=d&&qr(s,a,o,h,n,l,p.x,p.y)&&mt(p.prev,p,p.next)>=0)return false;p=p.next;}return true}function g_(i,t,e,r){var s=i.prev,o=i,n=i.next;if(mt(s,o,n)>=0)return false;for(var a=s.x,h=o.x,l=n.x,c=s.y,u=o.y,f=n.y,d=a<h?a<l?a:l:h<l?h:l,p=c<u?c<f?c:f:u<f?u:f,_=a>h?a>l?a:l:h>l?h:l,x=c>u?c>f?c:f:u>f?u:f,y=uh(d,p,t,e,r),b=uh(_,x,t,e,r),S=i.prevZ,v=i.nextZ;S&&S.z>=y&&v&&v.z<=b;){if(S.x>=d&&S.x<=_&&S.y>=p&&S.y<=x&&S!==s&&S!==n&&qr(a,c,h,u,l,f,S.x,S.y)&&mt(S.prev,S,S.next)>=0||(S=S.prevZ,v.x>=d&&v.x<=_&&v.y>=p&&v.y<=x&&v!==s&&v!==n&&qr(a,c,h,u,l,f,v.x,v.y)&&mt(v.prev,v,v.next)>=0))return false;v=v.nextZ;}for(;S&&S.z>=y;){if(S.x>=d&&S.x<=_&&S.y>=p&&S.y<=x&&S!==s&&S!==n&&qr(a,c,h,u,l,f,S.x,S.y)&&mt(S.prev,S,S.next)>=0)return false;S=S.prevZ;}for(;v&&v.z<=b;){if(v.x>=d&&v.x<=_&&v.y>=p&&v.y<=x&&v!==s&&v!==n&&qr(a,c,h,u,l,f,v.x,v.y)&&mt(v.prev,v,v.next)>=0)return false;v=v.nextZ;}return true}function x_(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!No(s,o)&&$f(s,r,r.next,o)&&es(s,o)&&es(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),rs(r),rs(r.next),r=i=o),r=r.next;}while(r!==i);return _r(r)}function __(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&C_(n,a)){var h=Xf(n,a);n=_r(n,n.next),h=_r(h,h.next),ts(n,t,e,r,s,o,0),ts(h,t,e,r,s,o,0);return}a=a.next;}n=n.next;}while(n!==i)}function y_(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=Yf(i,a,h,r,false),l===l.next&&(l.steiner=true),s.push(M_(l));for(s.sort(b_),o=0;o<s.length;o++)e=v_(s[o],e);return e}function b_(i,t){return i.x-t.x}function v_(i,t){var e=S_(i,t);if(!e)return t;var r=Xf(e,i);return _r(r,r.next),_r(e,e.next)}function S_(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,c=n.y,u=1/0,f;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&qr(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(f=Math.abs(s-e.y)/(r-e.x),es(e,i)&&(f<u||f===u&&(e.x>n.x||e.x===n.x&&T_(n,e)))&&(n=e,u=f)),e=e.next;while(e!==h);return n}function T_(i,t){return mt(i.prev,i,t.prev)<0&&mt(t.next,i,i.next)<0}function w_(i,t,e,r){var s=i;do s.z===0&&(s.z=uh(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,P_(s);}function P_(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 uh(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 M_(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 qr(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 C_(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!A_(i,t)&&(es(i,t)&&es(t,i)&&E_(i,t)&&(mt(i.prev,i,t.prev)||mt(i,t.prev,t))||No(i,t)&&mt(i.prev,i,i.next)>0&&mt(t.prev,t,t.next)>0)}function mt(i,t,e){return (t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function No(i,t){return i.x===t.x&&i.y===t.y}function $f(i,t,e,r){var s=Wo(mt(i,t,e)),o=Wo(mt(i,t,r)),n=Wo(mt(e,r,i)),a=Wo(mt(e,r,t));return !!(s!==o&&n!==a||s===0&&Ho(i,e,t)||o===0&&Ho(i,r,t)||n===0&&Ho(e,i,r)||a===0&&Ho(e,t,r))}function Ho(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 Wo(i){return i>0?1:i<0?-1:0}function A_(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&&$f(e,e.next,i,t))return true;e=e.next;}while(e!==i);return false}function es(i,t){return mt(i.prev,i,i.next)<0?mt(i,t,i.next)>=0&&mt(i,i.prev,t)>=0:mt(i,t,i.prev)<0||mt(i,i.next,t)<0}function E_(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 Xf(i,t){var e=new dh(i.i,i.x,i.y),r=new dh(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 Nf(i,t,e,r){var s=new dh(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 rs(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 dh(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;}Vo.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(fh(i,0,o,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:i.length;n-=Math.abs(fh(i,l,c,e));}var u=0;for(a=0;a<r.length;a+=3){var f=r[a]*e,d=r[a+1]*e,p=r[a+2]*e;u+=Math.abs((i[f]-i[p])*(i[d+1]-i[f+1])-(i[f]-i[d])*(i[p+1]-i[f+1]));}return n===0&&u===0?0:Math.abs((u-n)/n)};function fh(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}Vo.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 Yo(i,t,e,r,s,o,n){let a=(0, jf.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 jf,gh=m(()=>{jf=Ds(mh());});var B_,Kf,qf=m(()=>{D();gh();B_=[],Kf={extension:{type:w.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){Yo(i,B_,t,e,r,s,o);}};});var Zf,Qf=m(()=>{D();Zf={extension:{type:w.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 Jf,tp=m(()=>{D();Jf={extension:{type:w.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 rp(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color);}}function ip(i,t){let e=pt.get().createCanvas(i,t),r=e.getContext("2d");return {canvas:e,context:r}}function F_(i){let t=i[0]??{};return (typeof t=="number"||i[1])&&(z("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]??Yt.defaultLinearOptions.textureSize}),t}var ep,_h,Yt,Zr=m(()=>{Vt();ce();at();_o();Bt();Lt();St();oa();ep=[{offset:0,color:"white"},{offset:1,color:"black"}],_h=class xh{constructor(...t){this.uid=J("fillGradient"),this.type="linear",this.colorStops=[];let e=F_(t);e={...e.type==="radial"?xh.defaultRadialOptions:xh.defaultLinearOptions,...to(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:q.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 x=t;t=r,r=x,o*=-1;}if(n<0){let x=e;e=s,s=x,n*=-1;}}let h=this.colorStops.length?this.colorStops:ep,l=this._textureSize,{canvas:c,context:u}=ip(l,1),f=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);rp(f,h),u.fillStyle=f,u.fillRect(0,0,l,1),this.texture=new U({source:new Pe({resource:c,addressMode:this._wrapMode})});let d=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),_=new E;_.scale(d/l,1),_.rotate(p),_.translate(t,e),this.textureSpace==="local"&&_.scale(l,l),this.transform=_;}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient();}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:ep,e=this._textureSize,{canvas:r,context:s}=ip(e,e),{x:o,y:n}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,u=a-c,f=h-c,d=e/(c*2),p=(o-u)*d,_=(n-f)*d,x=s.createRadialGradient(p,_,l*d,(a-u)*d,(h-f)*d,c*d);rp(x,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=x,s.translate(p,_),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-_),s.fillRect(0,0,e,e),this.texture=new U({source:new Pe({resource:r,addressMode:this._wrapMode})});let y=new E;y.scale(1/d,1/d),y.translate(u,f),this.textureSpace==="local"&&y.scale(e,e),this.transform=y;}get styleKey(){return this.uid}destroy(){this.texture?.destroy(true),this.texture=null;}};_h.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};_h.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Yt=_h;});function sp(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(k_);t.width&&n.pad(t.width);let{x:a,y:h}=n,l=1/n.width,c=1/n.height,u=-a*l,f=-h*c,d=s.a,p=s.b,_=s.c,x=s.d;s.a*=l,s.b*=l,s.c*=c,s.d*=c,s.tx=u*d+f*_+s.tx,s.ty=u*p+f*x+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 Yt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(R_.copyFrom(r).invert()),s}var R_,k_,op=m(()=>{at();Xt();Zr();R_=new E,k_=new it;});function ap(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")D_(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&&np(l.shapePath,h,true,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),np(a,h,n,r,e);}}}function D_(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,h=[],l=$o.rectangle,c=G_,u=i.image;c.x=i.dx,c.y=i.dy,c.width=i.dw,c.height=i.dh;let f=i.transform;l.build(c,h),f&&lh(h,f),l.triangulate(h,r,2,a,o,n);let d=u.uvs;s.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);let p=K.get(gr);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=r.length/2-a,p.baseColor=i.style,p.alpha=i.alpha,p.texture=u,p.geometryData=e,t.push(p);}function np(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{let u=a.length,f=o.length/2,d=[],p=$o[h.type],_="triangle-list";if(p.build(h,d),l&&lh(d,l),e){let S=h.closePath??true,v=t;v.pixelLine?(Wf(d,S,o,a),_="line-list"):zf(d,v,false,S,o,a);}else if(c){let S=[],v=d.slice();U_(c).forEach(T=>{S.push(v.length/2),v.push(...T);}),Yo(v,S,o,2,f,a,u);}else p.triangulate(d,o,2,f,a,u);let x=n.length/2,y=t.texture;if(y!==U.WHITE){let S=sp(I_,t,h,l);Bf(o,2,f,n,x,2,o.length/2-f,S);}else Ff(n,x,2,o.length/2-f);let b=K.get(gr);b.indexOffset=u,b.indexSize=a.length-u,b.attributeOffset=f,b.attributeSize=o.length/2-f,b.baseColor=t.color,b.alpha=t.alpha,b.texture=y,b.geometryData=s,b.topology=_,r.push(b);});}function U_(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];$o[r.type].build(r,s),t.push(s);}return t}var $o,G_,I_,hp=m(()=>{D();at();Xt();Rf();kf();Bt();ie();ch();Df();Hf();Vf();qf();Qf();tp();op();gh();$o={};O.handleByMap(w.ShapeBuilder,$o);O.add(Zf,Kf,Jf,Kr,Gf,If);G_=new it,I_=new E;});var yh,bh,Sh,Qr,Xo=m(()=>{D();ld();Ef();ia();St();ie();hp();yh=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]};}},bh=class{constructor(){this.batcher=new Af,this.instructions=new Fr;}init(){this.instructions.reset();}get geometry(){return z(ac,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Sh=class vh{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash");}init(t){vh.defaultOptions.bezierSmoothness=t?.bezierSmoothness??vh.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),ap(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=K.get(bh),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<r.length;c++)r[c].applyTransform=false;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<r.length;c++){let u=r[c];a.add(u);}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 c=0;c<l.length;c++){let u=l[c];u.bindGroup=hd(u.textures.textures,u.textures.count);}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new yh;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]&&(K.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{K.return(r);});}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context);}};Sh.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"graphicsContext"};Sh.defaultOptions={bezierSmoothness:.5};Qr=Sh;});var L_,Th,wh,Ph,Mh,Ch,Ah,Eh,yr,jo=m(()=>{L_={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},Th=0,wh=1,Ph=2,Mh=3,Ch=4,Ah=5,Eh=class lp{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=true,this.depthMask=true;}get blend(){return !!(this.data&1<<Th)}set blend(t){!!(this.data&1<<Th)!==t&&(this.data^=1<<Th);}get offsets(){return !!(this.data&1<<wh)}set offsets(t){!!(this.data&1<<wh)!==t&&(this.data^=1<<wh);}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<<Ph)}set culling(t){!!(this.data&1<<Ph)!==t&&(this.data^=1<<Ph);}get depthTest(){return !!(this.data&1<<Mh)}set depthTest(t){!!(this.data&1<<Mh)!==t&&(this.data^=1<<Mh);}get depthMask(){return !!(this.data&1<<Ah)}set depthMask(t){!!(this.data&1<<Ah)!==t&&(this.data^=1<<Ah);}get clockwiseFrontFace(){return !!(this.data&1<<Ch)}set clockwiseFrontFace(t){!!(this.data&1<<Ch)!==t&&(this.data^=1<<Ch);}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=L_[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 lp;return t.depthTest=false,t.blend=true,t}};Eh.default2d=Eh.for2d();yr=Eh;});function je(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 is=m(()=>{});var ss,cp=m(()=>{D();jo();ie();is();ch();ss=class{constructor(t,e){this.state=yr.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,je(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=K.get(gr);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=>{K.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;}};ss.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"graphics"};});var Bh=m(()=>{D();Xo();cp();O.add(ss);O.add(Qr);});var Ke,Ko=m(()=>{Ke=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 os,up=m(()=>{D();at();ji();Xe();Ki();ie();is();Ko();os=class{constructor(t,e){this.localUniforms=new zt({uTransformMatrix:{value:new E,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new se({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&&(K.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound);}execute(t){if(!t.isRenderable)return;t.state.blendMode=De(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),je(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=K.get(Ke);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]&&K.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;}};os.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"mesh"};});var Fh=m(()=>{D();up();O.add(os);});var qo,dp=m(()=>{qo=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 Rh(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 fp=m(()=>{});function mp(i){return {dynamicUpdate:pp(i,true),staticUpdate:pp(i,false)}}function pp(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=ke(n.format);r+=a.stride/4;}e.push(`
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=mr(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 ff=p(()=>{ks();});function Rx(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,pf=p(()=>{rr();er();ni();ks();Yn();cf();ff();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 c in r){let u=r[c],f=ke(u.format);u.dynamic?o+=f.stride:s+=f.stride;}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new qt(e*4*s),this.dynamicAttributeBuffer=new qt(e*4*o),this.indexBuffer=Ia(e);let n=new Zt,a=0,h=0;this._staticBuffer=new gt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:false,usage:Z.VERTEX|Z.COPY_DST}),this._dynamicBuffer=new gt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:false,usage:Z.VERTEX|Z.COPY_DST});for(let c in r){let u=r[c],f=ke(u.format);u.dynamic?(n.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=f.size):(n.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:h*4,format:u.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=Rx(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return df(t)}update(t,e){t.length>this._size&&(e=true,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new qt(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new qt(this._size*this._dynamicStride*4*4),this.indexBuffer=Ia(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 mf,gf=p(()=>{mf=`varying vec2 vUV;
267
+ `);return new Function("ps","f32v","u32v",s)}var gp=m(()=>{Bo();});function O_(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 Zo,xp=m(()=>{Hr();zr();Zi();Bo();Wa();fp();gp();Zo=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let c in r){let u=r[c],f=mr(u.format);u.dynamic?o+=f.stride:s+=f.stride;}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Me(e*4*s),this.dynamicAttributeBuffer=new Me(e*4*o),this.indexBuffer=Rh(e);let n=new Ce,a=0,h=0;this._staticBuffer=new Ft({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:false,usage:ot.VERTEX|ot.COPY_DST}),this._dynamicBuffer=new Ft({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:false,usage:ot.VERTEX|ot.COPY_DST});for(let c in r){let u=r[c],f=mr(u.format);u.dynamic?(n.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=f.size):(n.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:h*4,format:u.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=O_(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return mp(t)}update(t,e){t.length>this._size&&(e=true,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Me(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Me(this._size*this._dynamicStride*4*4),this.indexBuffer=Rh(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 _p,yp=m(()=>{_p=`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 xf,_f=p(()=>{xf=`attribute vec2 aVertex;
275
+ }`;});var bp,vp=m(()=>{bp=`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 Da,yf=p(()=>{Da=`
314
+ `;});var kh,Sp=m(()=>{kh=`
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 ro,bf=p(()=>{Pt();J();Gs();Ds();hi();mt();ln();gf();_f();yf();ro=class extends Jt{constructor(){let t=sr.from({vertex:xf,fragment:mf}),e=pe.from({fragment:{source:Da,entryPoint:"mainFragment"},vertex:{source:Da,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:G.WHITE.source,uSampler:new ns({}),uniforms:{uTranslationMatrix:{value:new C,type:"mat3x3<f32>"},uColor:{value:new V(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}});}};});var pr,Ua=p(()=>{J();ge();si();Qs();di();pf();bf();pr=class{constructor(t,e){this.state=Le.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new wt({uTranslationMatrix:{value:new C,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=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 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=ne(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,xe(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t);}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null);}};});var mi,vf=p(()=>{R();lf();Ua();mi=class extends pr{constructor(t){super(t,new to);}};mi.extension={type:[T.WebGLPipes],name:"particle"};});var io,Sf=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,Tf=p(()=>{R();Sf();Ua();gi=class extends pr{constructor(t){super(t,new io);}};gi.extension={type:[T.WebGPUPipes],name:"particle"};});var La=p(()=>{R();vf();Tf();k.add(mi);k.add(gi);});var mr,Oa=p(()=>{mr=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 za=p(()=>{Dn();});var _i,wf=p(()=>{R();It();Oa();za();_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),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,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:W.get(mr)};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:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"text"};});var Ha,Nt,yi=p(()=>{Wt();Hr();Ha=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=false;}_createCanvasAndContext(t,e){let r=st.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=ie(t),e=ie(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={};}},Nt=new Ha;});function Pf(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 Mf(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 Cf(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,c=r-1;for(;h<r&&Pf(n,e,h);)++h;if(h===r)return K.EMPTY;for(;Pf(n,e,c);)--c;for(;Mf(n,e,a,h,c);)++a;for(;Mf(n,e,l,h,c);)--l;return ++l,++c,new K(a/t,h/t,(l-a)/t,(c-h)/t)}var Af=p(()=>{Et();});var Ef,ae,so=p(()=>{J();St();Ef={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"}},ae=class{constructor(t,e){this.uid=Y("fillPattern"),this.transform=new C,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Ef[e].addressModeU,t.source.style.addressModeV=Ef[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 Ff=Lo((NA,Bf)=>{Bf.exports=kx;var Wa={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},Gx=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function kx(i){var t=[];return i.replace(Gx,function(e,r,s){var o=r.toLowerCase();for(s=Dx(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Wa[o])return s.unshift(r),t.push(s);if(s.length<Wa[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Wa[o])));}}),t}var Ix=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function Dx(i){var t=i.match(Ix);return t?t.map(Number):[]}});function Gf(i,t){let e=(0, Rf.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let h=e[a],l=h[0],c=h;switch(l){case "M":o=c[1],n=c[2],t.moveTo(o,n);break;case "m":o+=c[1],n+=c[2],t.moveTo(o,n);break;case "H":o=c[1],t.lineTo(o,n);break;case "h":o+=c[1],t.lineTo(o,n);break;case "V":n=c[1],t.lineTo(o,n);break;case "v":n+=c[1],t.lineTo(o,n);break;case "L":o=c[1],n=c[2],t.lineTo(o,n);break;case "l":o+=c[1],n+=c[2],t.lineTo(o,n);break;case "C":o=c[5],n=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],o,n);break;case "c":t.bezierCurveTo(o+c[1],n+c[2],o+c[3],n+c[4],o+c[5],n+c[6]),o+=c[5],n+=c[6];break;case "S":o=c[3],n=c[4],t.bezierCurveToShort(c[1],c[2],o,n);break;case "s":t.bezierCurveToShort(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case "Q":o=c[3],n=c[4],t.quadraticCurveTo(c[1],c[2],o,n);break;case "q":t.quadraticCurveTo(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case "T":o=c[1],n=c[2],t.quadraticCurveToShort(o,n);break;case "t":o+=c[1],n+=c[2],t.quadraticCurveToShort(o,n);break;case "A":o=c[6],n=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case "a":o+=c[6],n+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[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 Rf,kf=p(()=>{Rf=Wi(Ff());_t();});var oo,If=p(()=>{Et();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 K),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,Df=p(()=>{Et();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,c=n-h,u=o+a,f=n+a,d=t-this.x,m=e-this.y,x=d*d/(l*l)+m*m/(c*c),g=d*d/(u*u)+m*m/(f*f);return x>1&&g<=1}getBounds(t){return t||(t=new K),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 Uf(i,t,e,r,s,o){let n=i-e,a=t-r,h=s-e,l=o-r,c=n*h+a*l,u=h*h+l*l,f=-1;u!==0&&(f=c/u);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 Lf=p(()=>{});var Ux,Lx,gr,Of=p(()=>{Lf();Et();gr=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(Ux),r=t.getBounds(Lx);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],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-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 c=0;c<l;c+=2){let u=h[c],f=h[c+1],d=h[(c+2)%h.length],m=h[(c+3)%h.length],x=Uf(t,e,u,f,d,m),g=Math.sign((d-u)*(e-f)-(m-f)*(t-u));if(x<=(g<0?a:n))return true}return false}getBounds(t){t||(t=new K);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],c=e[a+1];r=l<r?l:r,s=l>s?l:s,o=c<o?c:o,n=c>n?c: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,zf=p(()=>{Et();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 K),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,c=r*(1-s),u=r-c,f=o+l,d=n+l,m=a-l*2,x=h-l*2,g=o+a,_=n+h;return (t>=o-c&&t<=o+u||t>=g-u&&t<=g+c)&&e>=d&&e<=d+x||(e>=n-c&&e<=n+u||e>=_-u&&e<=_+c)&&t>=f&&t<=f+m?true:t<f&&e<d&&ao(t,e,f,d,l,u,c)||t>g-l&&e<d&&ao(t,e,g-l,d,l,u,c)||t>g-l&&e>_-l&&ao(t,e,g-l,_-l,l,u,c)||t<f&&e>_-l&&ao(t,e,f,_-l,l,u,c)}toString(){return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}};});function co(i,t,e,r,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??fr.defaultOptions.bezierSmoothness)),f=(zx-u)/1;return f*=f,Hx(t,e,r,s,o,n,a,h,i,f),i}function Hx(i,t,e,r,s,o,n,a,h,l){Na(i,t,e,r,s,o,n,a,h,l,0),h.push(n,a);}function Na(i,t,e,r,s,o,n,a,h,l,c){if(c>Ox)return;let u=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,v=(d+x)/2,b=(m+g)/2,P=(x+_)/2,S=(y+b)/2,w=(v+P)/2;if(c>0){let E=n-i,B=a-t,M=Math.abs((e-n)*B-(r-a)*E),A=Math.abs((s-n)*B-(o-a)*E),L,q;if(M>lo&&A>lo){if((M+A)*(M+A)<=l*(E*E+B*B)){if(xr<Va){h.push(S,w);return}let ft=Math.atan2(o-r,s-e);if(L=Math.abs(ft-Math.atan2(r-t,e-i)),q=Math.abs(Math.atan2(a-o,n-s)-ft),L>=u&&(L=2*u-L),q>=u&&(q=2*u-q),L+q<xr){h.push(S,w);return}if(Oe!==0){if(L>Oe){h.push(e,r);return}if(q>Oe){h.push(s,o);return}}}}else if(M>lo){if(M*M<=l*(E*E+B*B)){if(xr<Va){h.push(S,w);return}if(L=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),L>=u&&(L=2*u-L),L<xr){h.push(e,r),h.push(s,o);return}if(Oe!==0&&L>Oe){h.push(e,r);return}}}else if(A>lo){if(A*A<=l*(E*E+B*B)){if(xr<Va){h.push(S,w);return}if(L=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),L>=u&&(L=2*u-L),L<xr){h.push(e,r),h.push(s,o);return}if(Oe!==0&&L>Oe){h.push(s,o);return}}}else if(E=S-(i+n)/2,B=w-(t+a)/2,E*E+B*B<=l){h.push(S,w);return}}Na(i,t,f,d,y,v,S,w,h,l,c+1),Na(S,w,b,P,g,_,n,a,h,l,c+1);}var Ox,lo,zx,Va,xr,Oe,Ya=p(()=>{Zs();Ox=8,lo=11920929e-14,zx=1,Va=.01,xr=0,Oe=0;});function Wf(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??fr.defaultOptions.bezierSmoothness)),c=(Nx-l)/1;return c*=c,$x(t,e,r,s,o,n,i,c),i}function $x(i,t,e,r,s,o,n,a){$a(n,i,t,e,r,s,o,a,0),n.push(s,o);}function $a(i,t,e,r,s,o,n,a,h){if(h>Wx)return;let l=Math.PI,c=(t+r)/2,u=(e+s)/2,f=(r+o)/2,d=(s+n)/2,m=(c+f)/2,x=(u+d)/2,g=o-t,_=n-e,y=Math.abs((r-o)*_-(s-n)*g);if(y>Vx){if(y*y<=a*(g*g+_*_)){if(Hf<Yx){i.push(m,x);return}let v=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(v>=l&&(v=2*l-v),v<Hf){i.push(m,x);return}}}else if(g=m-(t+o)/2,_=x-(e+n)/2,g*g+_*_<=a){i.push(m,x);return}$a(i,t,e,c,u,m,x,a,h+1),$a(i,m,x,f,d,o,n,a,h+1);}var Wx,Vx,Nx,Yx,Hf,Vf=p(()=>{Zs();Wx=8,Vx=11920929e-14,Nx=1,Yx=.01,Hf=0;});function uo(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,c=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let f=Math.cos(c),d=Math.sin(c),m=t+f*r,x=e+d*r;i.push(m,x),c+=l;}}var Xa=p(()=>{});function Nf(i,t,e,r,s,o){let n=i[i.length-2],h=i[i.length-1]-e,l=n-t,c=s-e,u=r-t,f=Math.abs(h*u-l*c);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=c*c+u*u,x=h*c+l*u,g=o*Math.sqrt(d)/f,_=o*Math.sqrt(m)/f,y=g*x/d,v=_*x/m,b=g*u+_*l,P=g*c+_*h,S=l*(_+y),w=h*(_+y),E=u*(g+v),B=c*(g+v),M=Math.atan2(w-P,S-b),A=Math.atan2(B-P,E-b);uo(i,b+t,P+e,o,M,A,l*c>u*h);}var Yf=p(()=>{Xa();});function Xx(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 Xf(i,t,e,r,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*bi/360),u=Math.cos(a*bi/360),f=u*(t-r)/2+c*(e-s)/2,d=-c*(t-r)/2+u*(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)),jx(t,e,r,s,o,n,h,l,c,u,f,d,ja);let{ang1:x,ang2:g}=ja,{centerX:_,centerY:y}=ja,v=Math.abs(g)/(bi/4);Math.abs(1-v)<1e-7&&(v=1);let b=Math.max(Math.ceil(v),1);g/=b;let P=i[i.length-2],S=i[i.length-1],w={x:0,y:0};for(let E=0;E<b;E++){let B=Xx(x,g),{x:M,y:A}=Ka(B[0],o,n,u,c,_,y,w),{x:L,y:q}=Ka(B[1],o,n,u,c,_,y,w),{x:ft,y:Br}=Ka(B[2],o,n,u,c,_,y,w);co(i,P,S,M,A,L,q,ft,Br),P=ft,S=Br,x+=g;}}var bi,ja,Ka,$f,jx,jf=p(()=>{Ya();bi=Math.PI*2,ja={centerX:0,centerY:0,ang1:0,ang2:0},Ka=({x:i,y:t},e,r,s,o,n,a,h)=>{i*=e,t*=r;let l=s*i-o*t,c=o*i+s*t;return h.x=l+n,h.y=c+a,h};$f=(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)},jx=(i,t,e,r,s,o,n,a,h,l,c,u,f)=>{let d=Math.pow(s,2),m=Math.pow(o,2),x=Math.pow(c,2),g=Math.pow(u,2),_=d*m-d*g-m*x;_<0&&(_=0),_/=d*g+m*x,_=Math.sqrt(_)*(n===a?-1:1);let y=_*s/o*u,v=_*-o/s*c,b=l*y-h*v+(i+e)/2,P=h*y+l*v+(t+r)/2,S=(c-y)/s,w=(u-v)/o,E=(-c-y)/s,B=(-u-v)/o,M=$f(1,0,S,w),A=$f(S,w,E,B);a===0&&A>0&&(A-=bi),a===1&&A<0&&(A+=bi),f.centerX=b,f.centerY=P,f.ang1=M,f.ang2=A;};});function Kf(i,t,e){let r=(n,a)=>{let h=a.x-n.x,l=a.y-n.y,c=Math.sqrt(h*h+l*l),u=h/c,f=l/c;return {len:c,nx:u,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],c=r(a,o),u=r(a,l);if(c.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let f=Math.asin(c.nx*u.ny-c.ny*u.nx),d=1,m=false;c.nx*u.nx-c.ny*-u.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(c.len/2,u.len/2)?(_=Math.min(c.len/2,u.len/2),g=Math.abs(_*Math.sin(x)/Math.cos(x))):g=h;let y=a.x+u.nx*_+-u.ny*g*d,v=a.y+u.ny*_+u.nx*g*d,b=Math.atan2(c.ny,c.nx)+Math.PI/2*d,P=Math.atan2(u.ny,u.nx)-Math.PI/2*d;n===0&&i.moveTo(y+Math.cos(b)*g,v+Math.sin(b)*g),i.arc(y,v,g,b,P,m),o=a;}}function qf(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 c=t[a],u=t[(a+2)%n],f=s(c,h),d;if(f<1e-4)d=h;else {let g=Math.min(f/2,l);d=o(h,c,g/f);}let m=s(u,h),x;if(m<1e-4)x=h;else {let g=Math.min(m/2,l);x=o(h,u,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 Zf=p(()=>{});var Kx,fo,Qf=p(()=>{If();Df();Of();Et();zf();zt();Ya();Vf();Xa();Yf();jf();Zf();Kx=new K,fo=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new it,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 uo(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Nf(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let h=this._currentPoly.points;return Xf(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 co(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 Wf(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 K(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 gr(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 c=0;c<s;c++){let u=a-c*h;l.push(t+r*Math.cos(u),e+r*Math.sin(u));}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,c=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){let d=f*c+l,m=t+r*Math.cos(d),x=e+r*Math.sin(d),g=d+Math.PI+u,_=d-Math.PI-u,y=m+o*Math.cos(g),v=x+o*Math.sin(g),b=m+o*Math.cos(_),P=x+o*Math.sin(_);f===0?this.moveTo(y,v):this.lineTo(y,v),this.quadraticCurveTo(m,x,b,P,a);}return this.closePath()}roundShape(t,e,r=false,s){return t.length<3?this:(r?qf(this,t,e,s):Kf(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,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+r-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).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,c=[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 u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,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 gr,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 gr,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(Kx);s.transform?t.addRect(o,s.transform):t.addRect(o);}return t}};});function vi(i,t){return i?i.prepend(t):t.clone()}var ye,qa=p(()=>{Ot();St();_t();kf();Qf();ye=class i{constructor(t,e=false){this.instructions=[],this.uid=Y("graphicsPath"),this._dirty=true,this.checkForHoles=e,typeof t=="string"?Gf(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(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 c=a.x,u=a.y;h=c+(c-h),l=u+(u-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,c=Math.PI*2/l,u=[];for(let f=0;f<l;f++){let d=f%2?o:s,m=f*c+h;u.push(t+d*Math.cos(m),e+d*Math.sin(m));}return this.poly(u,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,c=0,u=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":c=y[0],u=y[1],f=y[2],d=y[3],h=y[4],l=y[5],y[0]=e*c+s*u+n,y[1]=r*c+o*u+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":c=y[0],u=y[1],h=y[2],l=y[3],y[0]=e*c+s*u+n,y[1]=r*c+o*u+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: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 et(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var Za=p(()=>{});function Jf(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]=qx(n);break;case "radialgradient":t.defs[n.id]=Zx();break;}}}}function qx(i){let t=et(i,"x1",0),e=et(i,"y1",0),r=et(i,"x2",1),s=et(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new Ct(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let h=i.children[a],l=et(h,"offset",0),c=V.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c);}return n}function Zx(i){return O("[SVG Parser] Radial gradients are not yet supported"),new Ct(0,0,1,0)}var tp=p(()=>{Pt();_t();dr();Za();});function Qa(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var ep=p(()=>{});function Ja(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:false,useStroke:false};for(let n in rp){let a=i.getAttribute(n);a&&ip(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,c]=h.split(":");rp[l]&&ip(t,o,l,c.trim());}}return {strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function ip(i,t,e,r){switch(e){case "stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Qa(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=Qa(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 rp,sp=p(()=>{Pt();ep();rp={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 op(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 ye};Jf(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=Ja(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&np(a,e,s,o);}return t}function np(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=Ja(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,c,u,f,d,m,x,g,_,y,v,b,P,S,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"),S=new ye(P,true),t.context.path(S),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "circle":m=et(i,"cx",0),x=et(i,"cy",0),g=et(i,"r",0),t.context.ellipse(m,x,g,g),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "rect":h=et(i,"x",0),l=et(i,"y",0),w=et(i,"width",0),E=et(i,"height",0),_=et(i,"rx",0),y=et(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=et(i,"cx",0),x=et(i,"cy",0),_=et(i,"rx",0),y=et(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":c=et(i,"x1",0),u=et(i,"y1",0),f=et(i,"x2",0),d=et(i,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(f,d),r&&t.context.stroke(r);break;case "polygon":b=i.getAttribute("points"),v=b.match(/\d+/g).map(B=>parseInt(B,10)),t.context.poly(v,true),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "polyline":b=i.getAttribute("points"),v=b.match(/\d+/g).map(B=>parseInt(B,10)),t.context.poly(v,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 B=0;B<s.length;B++)np(s[B],t,e,r);}var ap=p(()=>{_t();qa();tp();Za();sp();});function Qx(i){return V.isColorLike(i)}function hp(i){return i instanceof ae}function lp(i){return i instanceof Ct}function Jx(i){return i instanceof G}function t_(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=G.WHITE,{...e,...i}}function e_(i,t,e){return i.texture=t,{...e,...i}}function cp(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function up(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 r_(i,t){let e={...t,...i},r=V.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function he(i,t){if(i==null)return null;let e={},r=i;return Qx(i)?t_(e,i,t):Jx(i)?e_(e,i,t):hp(i)?cp(e,i,t):lp(i)?up(e,i,t):r.fill&&hp(r.fill)?cp(r,r.fill,t):r.fill&&lp(r.fill)?up(r,r.fill,t):r_(r,t)}function _r(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=he(i,h);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var th=p(()=>{Pt();mt();dr();so();});var i_,dp,eh,Rt,rh=p(()=>{At();Pt();J();Ot();mt();St();ct();zt();qa();ap();th();i_=new N,dp=new C,eh=class te extends ${constructor(){super(...arguments),this.uid=Y("graphicsContext"),this.dirty=true,this.batchMode="auto",this.instructions=[],this._activePath=new ye,this._transform=new C,this._fillStyle={...te.defaultFillStyle},this._strokeStyle={...te.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new it,this._boundsDirty=true;}clone(){let t=new te;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=he(t,te.defaultFillStyle);}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=_r(t,te.defaultStrokeStyle);}setFillStyle(t){return this._fillStyle=he(t,te.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=he(t,te.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 ye,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=he(t,te.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=_r(t,te.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++,op(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 C?(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 C?(this._transform.append(t),this):(dp.set(t,e,r,s,o,n),this._transform.append(dp),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 c=0;c<l.length;c++){let u=l[c].shape;if(!h||!u)continue;let f=l[c].transform,d=f?f.applyInverse(t,i_):t;if(o.action==="fill")r=u.contains(d.x,d.y);else {let x=h;r=u.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;}};eh.defaultFillStyle={color:16777215,alpha:1,texture:G.WHITE,matrix:null,fill:null,textureSpace:"local"};eh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:G.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:false};Rt=eh;});function po(i){let t=[],e=0;for(let r=0;r<fp.length;r++){let s=`_${fp[r]}`;t[e++]=i[s];}return e=pp(i._fill,t,e),e=s_(i._stroke,t,e),e=o_(i.dropShadow,t,e),t.join("-")}function pp(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function s_(i,t,e){return i&&(e=pp(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 o_(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 fp,ih=p(()=>{Pt();fp=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];});function n_(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Ut.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 Ct||e instanceof ae)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=Ut.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new Ct({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 sh,Ut,Si=p(()=>{At();Pt();ct();dr();so();rh();th();ih();sh=class yr extends ${constructor(t={}){super(),n_(t);let e={...yr.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({...yr.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...yr.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=he({...this._originalFill},Rt.defaultFillStyle);})),this._fill=he(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=_r({...this._originalStroke},Rt.defaultStrokeStyle);})),this._stroke=_r(t,Rt.defaultStrokeStyle),this.update());}_generateKey(){return this._styleKey=po(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this);}reset(){let t=yr.defaultTextStyle;for(let e in t)this[e]=t[e];}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new yr({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 Ct||t instanceof ae)}};sh.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};sh.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};Ut=sh;});function mo(i,t,e,r){let s=a_;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=yt.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 a_,oh=p(()=>{Xe();zt();a_=new it;});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)&&!h_.includes(s)&&(s=`"${s}"`),e[r]=s;}return `${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var h_,go=p(()=>{h_=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];});var nh,Yt,ee,ah=p(()=>{Wt();go();nh={willReadFrequently:true},Yt=class F{static get experimentalLetterSpacingSupported(){let t=F._experimentalLetterSpacingSupported;if(t!==void 0){let e=st.get().getCanvasRenderingContext2D().prototype;t=F._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=F._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(F._measurementCache[o])return F._measurementCache[o];let n=ze(e),a=F.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=F.__context;h.font=n;let c=(s?F._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),f=0;for(let y=0;y<c.length;y++){let v=F._measureText(c[y],e.letterSpacing,h);u[y]=v,f=Math.max(f,v);}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)+(c.length-1)*(x+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new F(t,e,m,g,c,u,x+e.leading,f,a)}static _measureText(t,e,r){let s=false;F.experimentalLetterSpacingSupported&&(F.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 c=(F.graphemeSegmenter(t).length-1)*e;n+=c,l+=c;}return Math.max(n,l)}static _wordWrap(t,e,r=F._canvas){let s=r.getContext("2d",nh),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=F._collapseSpaces(c),f=F._collapseNewlines(c),d=!u,m=e.wordWrapWidth+l,x=F._tokenize(t);for(let g=0;g<x.length;g++){let _=x[g];if(F._isNewline(_)){if(!f){a+=F._addLine(n),d=!u,n="",o=0;continue}_=" ";}if(u){let v=F.isBreakingSpace(_),b=F.isBreakingSpace(n[n.length-1]);if(v&&b)continue}let y=F._getFromCache(_,l,h,s);if(y>m)if(n!==""&&(a+=F._addLine(n),n="",o=0),F.canBreakWords(_,e.breakWords)){let v=F.wordWrapSplit(_);for(let b=0;b<v.length;b++){let P=v[b],S=P,w=1;for(;v[b+w];){let B=v[b+w];if(!F.canBreakChars(S,B,_,b,e.breakWords))P+=B;else break;S=B,w++;}b+=w-1;let E=F._getFromCache(P,l,h,s);E+o>m&&(a+=F._addLine(n),d=false,n="",o=0),n+=P,o+=E;}}else {n.length>0&&(a+=F._addLine(n),n="",o=0);let v=g===x.length-1;a+=F._addLine(_,!v),d=false,n="",o=0;}else y+o>m&&(d=false,a+=F._addLine(n),n="",o=0),(n.length>0||!F.isBreakingSpace(_)||d)&&(n+=_,o+=y);}return a+=F._addLine(n,false),a}static _addLine(t,e=true){return t=F._trimRight(t),t=e?`${t}
368
- `:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=F._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(!F.isBreakingSpace(r))break;t=t.slice(0,-1);}return t}static _isNewline(t){return typeof t!="string"?false:F._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?false:F._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(F.isBreakingSpace(o,n)||F._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 F.graphemeSegmenter(t)}static measureFont(t){if(F._fonts[t])return F._fonts[t];let e=F._context;e.font=t;let r=e.measureText(F.METRICS_STRING+F.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return F._fonts[t]=s,s}static clearMetrics(t=""){t?delete F._fonts[t]:F._fonts={};}static get _canvas(){if(!F.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",nh)?.measureText)return F.__canvas=e,e;t=st.get().createCanvas();}catch{t=st.get().createCanvas();}t.width=t.height=10,F.__canvas=t;}return F.__canvas}static get _context(){return F.__context||(F.__context=F._canvas.getContext("2d",nh)),F.__context}};Yt.METRICS_STRING="|\xC9q\xC5";Yt.BASELINE_SYMBOL="M";Yt.BASELINE_MULTIPLIER=1.4;Yt.HEIGHT_MULTIPLIER=2;Yt.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();Yt.experimentalLetterSpacing=false;Yt._fonts={};Yt._newlines=[10,13];Yt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Yt._measurementCache={};ee=Yt;});function br(i,t,e,r=0){if(i.texture===G.WHITE&&!i.fill)return V.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof ae){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(C.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof Ct){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,c=false;if(o){let{start:u,end:f}=s;l=t.createLinearGradient(u.x*a,u.y*h,f.x*a,f.y*h),c=Math.abs(f.x-u.x)<Math.abs((f.y-u.y)*.1);}else {let{center:u,innerRadius:f,outerCenter:d,outerRadius:m}=s;l=t.createRadialGradient(u.x*a,u.y*h,f*a,d.x*a,d.y*h,m*a);}if(c&&n&&e){let u=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*u;l.addColorStop(Math.floor(x*mp)/mp,V.shared.setValue(m.color).toHex());});}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,V.shared.setValue(u.color).toHex());});return l}}else {let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(C.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return O("FillStyle not recognised",i),"red"}var mp,hh=p(()=>{Pt();J();mt();_t();dr();so();mp=1e5;});var Ti,gp=p(()=>{Pt();R();Hr();yi();Xe();Af();ct();Si();oh();ah();go();hh();Ti=class{constructor(t){this._activeTextures={},this._renderer=t;}getTextureSize(t,e,r){let s=ee.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=ie(o),n=ie(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 Ut||(t.style=new Ut(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Nt.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=ee.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=Nt.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,r,s,h);let c=mo(l,n,a,s);if(r.trim){let u=Cf(l,s);c.frame.copyFrom(u),c.updateUvs();}return {texture:c,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",yt.returnTexture(t);}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(Nt.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=ee.measureText(t||" ",e),l=h.lines,c=h.lineHeight,u=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 v=e.dropShadow&&y===0,b=v?Math.ceil(Math.max(1,m)+e.padding*2):0,P=b*r;if(v){n.fillStyle="black",n.strokeStyle="black";let E=e.dropShadow,B=E.color,M=E.alpha;n.shadowColor=V.shared.setValue(B).setAlpha(M).toRgbaString();let A=E.blur*r,L=E.distance*r;n.shadowBlur=A,n.shadowOffsetX=Math.cos(E.angle)*L,n.shadowOffsetY=Math.sin(E.angle)*L+P;}else {if(n.fillStyle=e._fill?br(e._fill,n,h):null,e._stroke?.width){let E=e._stroke.width*e._stroke.alignment;n.strokeStyle=br(e._stroke,n,h,E);}n.shadowColor="black";}let S=(c-d.fontSize)/2;c-d.fontSize<0&&(S=0);let w=e._stroke?.width??0;for(let E=0;E<l.length;E++)x=w/2,g=w/2+E*c+d.ascent+S,e.align==="right"?x+=f-u[E]:e.align==="center"&&(x+=(f-u[E])/2),e._stroke?.width&&this._drawLetterSpacing(l[E],e,s,x+e.padding,g+e.padding-b,true),e._fill!==void 0&&this._drawLetterSpacing(l[E],e,s,x+e.padding,g+e.padding-b);}}_drawLetterSpacing(t,e,r,s,o,n=false){let{context:a}=r,h=e.letterSpacing,l=false;if(ee.experimentalLetterSpacingSupported&&(ee.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 c=s,u=ee.graphemeSegmenter(t),f=a.measureText(t).width,d=0;for(let m=0;m<u.length;++m){let x=u[m];n?a.strokeText(x,c,o):a.fillText(x,c,o);let g="";for(let _=m+1;_<u.length;++_)g+=u[_];d=a.measureText(g).width,c+=f-d+h,f=d;}}destroy(){this._activeTextures=null;}};Ti.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"canvasText"};});var lh=p(()=>{R();wf();gp();k.add(Ti);k.add(_i);});var xo,xp=p(()=>{ct();Bn();rh();xo=class i extends qe{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 _p,yp,bp=p(()=>{_p={name:"local-uniform-msdf-bit",vertex:{header:`
367
+ }`;});var Qo,Tp=m(()=>{Vt();at();Eo();Ro();Ji();Bt();na();yp();vp();Sp();Qo=class extends Ee{constructor(){let t=Vr.from({vertex:bp,fragment:_p}),e=Ye.from({fragment:{source:kh,entryPoint:"mainFragment"},vertex:{source:kh,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:U.WHITE.source,uSampler:new eo({}),uniforms:{uTranslationMatrix:{value:new E,type:"mat3x3<f32>"},uColor:{value:new q(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}});}};});var Jr,Gh=m(()=>{at();Xe();Ki();jo();is();xp();Tp();Jr=class{constructor(t,e){this.state=yr.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new zt({uTranslationMatrix:{value:new E,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 Qo,this.state=yr.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 Zo({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=De(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,je(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t);}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null);}};});var ns,wp=m(()=>{D();dp();Gh();ns=class extends Jr{constructor(t){super(t,new qo);}};ns.extension={type:[w.WebGLPipes],name:"particle"};});var Jo,Pp=m(()=>{Jo=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 as,Mp=m(()=>{D();Pp();Gh();as=class extends Jr{constructor(t){super(t,new Jo);}};as.extension={type:[w.WebGPUPipes],name:"particle"};});var Ih=m(()=>{D();wp();Mp();O.add(ns);O.add(as);});var ti,Dh=m(()=>{ti=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 hs(i,t){let{texture:e,bounds:r}=i;mo(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s;}var Uh=m(()=>{ka();});var ls,Cp=m(()=>{D();ie();Dh();Uh();ls=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),K.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,hs(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:K.get(ti)};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;}};ls.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"text"};});var Lh,de,cs=m(()=>{ce();Ri();Lh=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=false;}_createCanvasAndContext(t,e){let r=pt.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=ke(t),e=ke(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={};}},de=new Lh;});function Ap(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 Ep(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 Bp(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,c=r-1;for(;h<r&&Ap(n,e,h);)++h;if(h===r)return it.EMPTY;for(;Ap(n,e,c);)--c;for(;Ep(n,e,a,h,c);)++a;for(;Ep(n,e,l,h,c);)--l;return ++l,++c,new it(a/t,h/t,(l-a)/t,(c-h)/t)}var Fp=m(()=>{Xt();});var Rp,Ue,tn=m(()=>{at();Lt();Rp={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=J("fillPattern"),this.transform=new E,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Rp[e].addressModeU,t.source.style.addressModeV=Rp[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 Gp=In((Z1,kp)=>{kp.exports=H_;var Oh={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},z_=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function H_(i){var t=[];return i.replace(z_,function(e,r,s){var o=r.toLowerCase();for(s=V_(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Oh[o])return s.unshift(r),t.push(s);if(s.length<Oh[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Oh[o])));}}),t}var W_=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function V_(i){var t=i.match(W_);return t?t.map(Number):[]}});function Dp(i,t){let e=(0, Ip.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let h=e[a],l=h[0],c=h;switch(l){case "M":o=c[1],n=c[2],t.moveTo(o,n);break;case "m":o+=c[1],n+=c[2],t.moveTo(o,n);break;case "H":o=c[1],t.lineTo(o,n);break;case "h":o+=c[1],t.lineTo(o,n);break;case "V":n=c[1],t.lineTo(o,n);break;case "v":n+=c[1],t.lineTo(o,n);break;case "L":o=c[1],n=c[2],t.lineTo(o,n);break;case "l":o+=c[1],n+=c[2],t.lineTo(o,n);break;case "C":o=c[5],n=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],o,n);break;case "c":t.bezierCurveTo(o+c[1],n+c[2],o+c[3],n+c[4],o+c[5],n+c[6]),o+=c[5],n+=c[6];break;case "S":o=c[3],n=c[4],t.bezierCurveToShort(c[1],c[2],o,n);break;case "s":t.bezierCurveToShort(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case "Q":o=c[3],n=c[4],t.quadraticCurveTo(c[1],c[2],o,n);break;case "q":t.quadraticCurveTo(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case "T":o=c[1],n=c[2],t.quadraticCurveToShort(o,n);break;case "t":o+=c[1],n+=c[2],t.quadraticCurveToShort(o,n);break;case "A":o=c[6],n=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case "a":o+=c[6],n+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[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:$(`Unknown SVG path command: ${l}`);}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s));}return t}var Ip,Up=m(()=>{Ip=Ds(Gp());kt();});var en,Lp=m(()=>{Xt();en=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 it),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 rn,Op=m(()=>{Xt();rn=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,c=n-h,u=o+a,f=n+a,d=t-this.x,p=e-this.y,_=d*d/(l*l)+p*p/(c*c),x=d*d/(u*u)+p*p/(f*f);return _>1&&x<=1}getBounds(t){return t||(t=new it),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 zp(i,t,e,r,s,o){let n=i-e,a=t-r,h=s-e,l=o-r,c=n*h+a*l,u=h*h+l*l,f=-1;u!==0&&(f=c/u);let d,p;f<0?(d=e,p=r):f>1?(d=s,p=o):(d=e+f*h,p=r+f*l);let _=i-d,x=t-p;return _*_+x*x}var Hp=m(()=>{});var N_,Y_,ei,Wp=m(()=>{Hp();Xt();ei=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(N_),r=t.getBounds(Y_);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],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-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 c=0;c<l;c+=2){let u=h[c],f=h[c+1],d=h[(c+2)%h.length],p=h[(c+3)%h.length],_=zp(t,e,u,f,d,p),x=Math.sign((d-u)*(e-f)-(p-f)*(t-u));if(_<=(x<0?a:n))return true}return false}getBounds(t){t||(t=new it);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],c=e[a+1];r=l<r?l:r,s=l>s?l:s,o=c<o?c:o,n=c>n?c: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 sn,on,Vp=m(()=>{Xt();sn=(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},on=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 it),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,c=r*(1-s),u=r-c,f=o+l,d=n+l,p=a-l*2,_=h-l*2,x=o+a,y=n+h;return (t>=o-c&&t<=o+u||t>=x-u&&t<=x+c)&&e>=d&&e<=d+_||(e>=n-c&&e<=n+u||e>=y-u&&e<=y+c)&&t>=f&&t<=f+p?true:t<f&&e<d&&sn(t,e,f,d,l,u,c)||t>x-l&&e<d&&sn(t,e,x-l,d,l,u,c)||t>x-l&&e>y-l&&sn(t,e,x-l,y-l,l,u,c)||t<f&&e>y-l&&sn(t,e,f,y-l,l,u,c)}toString(){return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}};});function an(i,t,e,r,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??Qr.defaultOptions.bezierSmoothness)),f=(X_-u)/1;return f*=f,j_(t,e,r,s,o,n,a,h,i,f),i}function j_(i,t,e,r,s,o,n,a,h,l){Hh(i,t,e,r,s,o,n,a,h,l,0),h.push(n,a);}function Hh(i,t,e,r,s,o,n,a,h,l,c){if(c>$_)return;let u=Math.PI,f=(i+e)/2,d=(t+r)/2,p=(e+s)/2,_=(r+o)/2,x=(s+n)/2,y=(o+a)/2,b=(f+p)/2,S=(d+_)/2,v=(p+x)/2,M=(_+y)/2,T=(b+v)/2,P=(S+M)/2;if(c>0){let F=n-i,G=a-t,A=Math.abs((e-n)*G-(r-a)*F),B=Math.abs((s-n)*G-(o-a)*F),N,st;if(A>nn&&B>nn){if((A+B)*(A+B)<=l*(F*F+G*G)){if(ri<zh){h.push(T,P);return}let At=Math.atan2(o-r,s-e);if(N=Math.abs(At-Math.atan2(r-t,e-i)),st=Math.abs(Math.atan2(a-o,n-s)-At),N>=u&&(N=2*u-N),st>=u&&(st=2*u-st),N+st<ri){h.push(T,P);return}if(br!==0){if(N>br){h.push(e,r);return}if(st>br){h.push(s,o);return}}}}else if(A>nn){if(A*A<=l*(F*F+G*G)){if(ri<zh){h.push(T,P);return}if(N=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),N>=u&&(N=2*u-N),N<ri){h.push(e,r),h.push(s,o);return}if(br!==0&&N>br){h.push(e,r);return}}}else if(B>nn){if(B*B<=l*(F*F+G*G)){if(ri<zh){h.push(T,P);return}if(N=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),N>=u&&(N=2*u-N),N<ri){h.push(e,r),h.push(s,o);return}if(br!==0&&N>br){h.push(s,o);return}}}else if(F=T-(i+n)/2,G=P-(t+a)/2,F*F+G*G<=l){h.push(T,P);return}}Hh(i,t,f,d,b,S,T,P,h,l,c+1),Hh(T,P,v,M,x,y,n,a,h,l,c+1);}var $_,nn,X_,zh,ri,br,Wh=m(()=>{Xo();$_=8,nn=11920929e-14,X_=1,zh=.01,ri=0,br=0;});function Yp(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??Qr.defaultOptions.bezierSmoothness)),c=(Z_-l)/1;return c*=c,J_(t,e,r,s,o,n,i,c),i}function J_(i,t,e,r,s,o,n,a){Vh(n,i,t,e,r,s,o,a,0),n.push(s,o);}function Vh(i,t,e,r,s,o,n,a,h){if(h>K_)return;let l=Math.PI,c=(t+r)/2,u=(e+s)/2,f=(r+o)/2,d=(s+n)/2,p=(c+f)/2,_=(u+d)/2,x=o-t,y=n-e,b=Math.abs((r-o)*y-(s-n)*x);if(b>q_){if(b*b<=a*(x*x+y*y)){if(Np<Q_){i.push(p,_);return}let S=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(S>=l&&(S=2*l-S),S<Np){i.push(p,_);return}}}else if(x=p-(t+o)/2,y=_-(e+n)/2,x*x+y*y<=a){i.push(p,_);return}Vh(i,t,e,c,u,p,_,a,h+1),Vh(i,p,_,f,d,o,n,a,h+1);}var K_,q_,Z_,Q_,Np,$p=m(()=>{Xo();K_=8,q_=11920929e-14,Z_=1,Q_=.01,Np=0;});function hn(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,c=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let f=Math.cos(c),d=Math.sin(c),p=t+f*r,_=e+d*r;i.push(p,_),c+=l;}}var Nh=m(()=>{});function Xp(i,t,e,r,s,o){let n=i[i.length-2],h=i[i.length-1]-e,l=n-t,c=s-e,u=r-t,f=Math.abs(h*u-l*c);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,p=c*c+u*u,_=h*c+l*u,x=o*Math.sqrt(d)/f,y=o*Math.sqrt(p)/f,b=x*_/d,S=y*_/p,v=x*u+y*l,M=x*c+y*h,T=l*(y+b),P=h*(y+b),F=u*(x+S),G=c*(x+S),A=Math.atan2(P-M,T-v),B=Math.atan2(G-M,F-v);hn(i,v+t,M+e,o,A,B,l*c>u*h);}var jp=m(()=>{Nh();});function ty(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 qp(i,t,e,r,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*us/360),u=Math.cos(a*us/360),f=u*(t-r)/2+c*(e-s)/2,d=-c*(t-r)/2+u*(e-s)/2;if(f===0&&d===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(f,2)/Math.pow(o,2)+Math.pow(d,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),ey(t,e,r,s,o,n,h,l,c,u,f,d,Yh);let{ang1:_,ang2:x}=Yh,{centerX:y,centerY:b}=Yh,S=Math.abs(x)/(us/4);Math.abs(1-S)<1e-7&&(S=1);let v=Math.max(Math.ceil(S),1);x/=v;let M=i[i.length-2],T=i[i.length-1],P={x:0,y:0};for(let F=0;F<v;F++){let G=ty(_,x),{x:A,y:B}=$h(G[0],o,n,u,c,y,b,P),{x:N,y:st}=$h(G[1],o,n,u,c,y,b,P),{x:At,y:vi}=$h(G[2],o,n,u,c,y,b,P);an(i,M,T,A,B,N,st,At,vi),M=At,T=vi,_+=x;}}var us,Yh,$h,Kp,ey,Zp=m(()=>{Wh();us=Math.PI*2,Yh={centerX:0,centerY:0,ang1:0,ang2:0},$h=({x:i,y:t},e,r,s,o,n,a,h)=>{i*=e,t*=r;let l=s*i-o*t,c=o*i+s*t;return h.x=l+n,h.y=c+a,h};Kp=(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)},ey=(i,t,e,r,s,o,n,a,h,l,c,u,f)=>{let d=Math.pow(s,2),p=Math.pow(o,2),_=Math.pow(c,2),x=Math.pow(u,2),y=d*p-d*x-p*_;y<0&&(y=0),y/=d*x+p*_,y=Math.sqrt(y)*(n===a?-1:1);let b=y*s/o*u,S=y*-o/s*c,v=l*b-h*S+(i+e)/2,M=h*b+l*S+(t+r)/2,T=(c-b)/s,P=(u-S)/o,F=(-c-b)/s,G=(-u-S)/o,A=Kp(1,0,T,P),B=Kp(T,P,F,G);a===0&&B>0&&(B-=us),a===1&&B<0&&(B+=us),f.centerX=v,f.centerY=M,f.ang1=A,f.ang2=B;};});function Qp(i,t,e){let r=(n,a)=>{let h=a.x-n.x,l=a.y-n.y,c=Math.sqrt(h*h+l*l),u=h/c,f=l/c;return {len:c,nx:u,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],c=r(a,o),u=r(a,l);if(c.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let f=Math.asin(c.nx*u.ny-c.ny*u.nx),d=1,p=false;c.nx*u.nx-c.ny*-u.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,p=true):f>0&&(d=-1,p=true);let _=f/2,x,y=Math.abs(Math.cos(_)*h/Math.sin(_));y>Math.min(c.len/2,u.len/2)?(y=Math.min(c.len/2,u.len/2),x=Math.abs(y*Math.sin(_)/Math.cos(_))):x=h;let b=a.x+u.nx*y+-u.ny*x*d,S=a.y+u.ny*y+u.nx*x*d,v=Math.atan2(c.ny,c.nx)+Math.PI/2*d,M=Math.atan2(u.ny,u.nx)-Math.PI/2*d;n===0&&i.moveTo(b+Math.cos(v)*x,S+Math.sin(v)*x),i.arc(b,S,x,v,M,p),o=a;}}function Jp(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 c=t[a],u=t[(a+2)%n],f=s(c,h),d;if(f<1e-4)d=h;else {let x=Math.min(f/2,l);d=o(h,c,x/f);}let p=s(u,h),_;if(p<1e-4)_=h;else {let x=Math.min(p/2,l);_=o(h,u,x/p);}a===0?i.moveTo(d.x,d.y):i.lineTo(d.x,d.y),i.quadraticCurveTo(h.x,h.y,_.x,_.y,r);}}var tm=m(()=>{});var ry,ln,em=m(()=>{Lp();Op();Wp();Xt();Vp();he();Wh();$p();Nh();jp();Zp();tm();ry=new it,ln=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new ft,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 hn(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Xp(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let h=this._currentPoly.points;return qp(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 an(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 Yp(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 it(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new en(t,e,r),s),this}poly(t,e,r){let s=new ei(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 c=0;c<s;c++){let u=a-c*h;l.push(t+r*Math.cos(u),e+r*Math.sin(u));}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,c=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){let d=f*c+l,p=t+r*Math.cos(d),_=e+r*Math.sin(d),x=d+Math.PI+u,y=d-Math.PI-u,b=p+o*Math.cos(x),S=_+o*Math.sin(x),v=p+o*Math.cos(y),M=_+o*Math.sin(y);f===0?this.moveTo(b,S):this.lineTo(b,S),this.quadraticCurveTo(p,_,v,M,a);}return this.closePath()}roundShape(t,e,r=false,s){return t.length<3?this:(r?Jp(this,t,e,s):Qp(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,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+r-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).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,c=[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 u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,true,n)}ellipse(t,e,r,s,o){return this.drawShape(new rn(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new on(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 ei,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 ei,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(ry);s.transform?t.addRect(o,s.transform):t.addRect(o);}return t}};});function ds(i,t){return i?i.prepend(t):t.clone()}var qe,Xh=m(()=>{ae();Lt();kt();Up();em();qe=class i{constructor(t,e=false){this.instructions=[],this.uid=J("graphicsPath"),this._dirty=true,this.checkForHoles=e,typeof t=="string"?Dp(t,this):this.instructions=t?.slice()??[];}get shapePath(){return this._shapePath||(this._shapePath=new ln(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(Z.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 c=a.x,u=a.y;h=c+(c-h),l=u+(u-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(Z.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,c=Math.PI*2/l,u=[];for(let f=0;f<l;f++){let d=f%2?o:s,p=f*c+h;u.push(t+d*Math.cos(p),e+d*Math.sin(p));}return this.poly(u,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,c=0,u=0,f=0,d=0,p=0,_=0;for(let x=0;x<this.instructions.length;x++){let y=this.instructions[x],b=y.data;switch(y.action){case "moveTo":case "lineTo":h=b[0],l=b[1],b[0]=e*h+s*l+n,b[1]=r*h+o*l+a;break;case "bezierCurveTo":c=b[0],u=b[1],f=b[2],d=b[3],h=b[4],l=b[5],b[0]=e*c+s*u+n,b[1]=r*c+o*u+a,b[2]=e*f+s*d+n,b[3]=r*f+o*d+a,b[4]=e*h+s*l+n,b[5]=r*h+o*l+a;break;case "quadraticCurveTo":c=b[0],u=b[1],h=b[2],l=b[3],b[0]=e*c+s*u+n,b[1]=r*c+o*u+a,b[2]=e*h+s*l+n,b[3]=r*h+o*l+a;break;case "arcToSvg":h=b[5],l=b[6],p=b[0],_=b[1],b[0]=e*p+s*_,b[1]=r*p+o*_,b[5]=e*h+s*l+n,b[6]=r*h+o*l+a;break;case "circle":b[4]=ds(b[3],t);break;case "rect":b[4]=ds(b[4],t);break;case "ellipse":b[8]=ds(b[8],t);break;case "roundRect":b[5]=ds(b[5],t);break;case "addPath":b[0].transform(t);break;case "poly":b[2]=ds(b[2],t);break;default:$("unknown transform action",y.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 dt(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var jh=m(()=>{});function rm(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]=iy(n);break;case "radialgradient":t.defs[n.id]=sy();break;}}}}function iy(i){let t=dt(i,"x1",0),e=dt(i,"y1",0),r=dt(i,"x2",1),s=dt(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new Yt(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let h=i.children[a],l=dt(h,"offset",0),c=q.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c);}return n}function sy(i){return $("[SVG Parser] Radial gradients are not yet supported"),new Yt(0,0,1,0)}var im=m(()=>{Vt();kt();Zr();jh();});function Kh(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var sm=m(()=>{});function qh(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:false,useStroke:false};for(let n in om){let a=i.getAttribute(n);a&&nm(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,c]=h.split(":");om[l]&&nm(t,o,l,c.trim());}}return {strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function nm(i,t,e,r){switch(e){case "stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Kh(r);t.strokeStyle.fill=i.defs[s];}else t.strokeStyle.color=q.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=Kh(r);t.fillStyle.fill=i.defs[s];}else t.fillStyle.color=q.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 om,am=m(()=>{Vt();sm();om={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 hm(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 qe};rm(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=qh(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&lm(a,e,s,o);}return t}function lm(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=qh(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,c,u,f,d,p,_,x,y,b,S,v,M,T,P,F;switch(i.nodeName.toLowerCase()){case "path":M=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&$("SVG Evenodd fill rule not supported, your svg may render incorrectly"),T=new qe(M,true),t.context.path(T),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "circle":p=dt(i,"cx",0),_=dt(i,"cy",0),x=dt(i,"r",0),t.context.ellipse(p,_,x,x),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "rect":h=dt(i,"x",0),l=dt(i,"y",0),P=dt(i,"width",0),F=dt(i,"height",0),y=dt(i,"rx",0),b=dt(i,"ry",0),y||b?t.context.roundRect(h,l,P,F,y||b):t.context.rect(h,l,P,F),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "ellipse":p=dt(i,"cx",0),_=dt(i,"cy",0),y=dt(i,"rx",0),b=dt(i,"ry",0),t.context.beginPath(),t.context.ellipse(p,_,y,b),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "line":c=dt(i,"x1",0),u=dt(i,"y1",0),f=dt(i,"x2",0),d=dt(i,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(f,d),r&&t.context.stroke(r);break;case "polygon":v=i.getAttribute("points"),S=v.match(/\d+/g).map(G=>parseInt(G,10)),t.context.poly(S,true),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "polyline":v=i.getAttribute("points"),S=v.match(/\d+/g).map(G=>parseInt(G,10)),t.context.poly(S,false),r&&t.context.stroke(r);break;case "g":case "svg":break;default:{$(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let G=0;G<s.length;G++)lm(s[G],t,e,r);}var cm=m(()=>{kt();Xh();im();jh();am();});function oy(i){return q.isColorLike(i)}function um(i){return i instanceof Ue}function dm(i){return i instanceof Yt}function ny(i){return i instanceof U}function ay(i,t,e){let r=q.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=U.WHITE,{...e,...i}}function hy(i,t,e){return i.texture=t,{...e,...i}}function fm(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function pm(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 ly(i,t){let e={...t,...i},r=q.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Le(i,t){if(i==null)return null;let e={},r=i;return oy(i)?ay(e,i,t):ny(i)?hy(e,i,t):um(i)?fm(e,i,t):dm(i)?pm(e,i,t):r.fill&&um(r.fill)?fm(r,r.fill,t):r.fill&&dm(r.fill)?pm(r,r.fill,t):ly(r,t)}function ii(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=Le(i,h);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var Zh=m(()=>{Vt();Bt();Zr();tn();});var cy,mm,Qh,qt,Jh=m(()=>{$t();Vt();at();ae();Bt();Lt();St();he();Xh();cm();Zh();cy=new Z,mm=new E,Qh=class Be extends tt{constructor(){super(...arguments),this.uid=J("graphicsContext"),this.dirty=true,this.batchMode="auto",this.instructions=[],this._activePath=new qe,this._transform=new E,this._fillStyle={...Be.defaultFillStyle},this._strokeStyle={...Be.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new ft,this._boundsDirty=true;}clone(){let t=new Be;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=Le(t,Be.defaultFillStyle);}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ii(t,Be.defaultStrokeStyle);}setFillStyle(t){return this._fillStyle=Le(t,Be.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Le(t,Be.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?q.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new qe,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"&&(z(j,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Le(t,Be.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(Z.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=ii(t,Be.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++,hm(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 E?(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 E?(this._transform.append(t),this):(mm.set(t,e,r,s,o,n),this._transform.append(mm),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 c=0;c<l.length;c++){let u=l[c].shape;if(!h||!u)continue;let f=l[c].transform,d=f?f.applyInverse(t,cy):t;if(o.action==="fill")r=u.contains(d.x,d.y);else {let _=h;r=u.strokeContains(d.x,d.y,_.width,_.alignment);}let p=n.hole;if(p){let _=p.shapePath?.shapePrimitives;if(_)for(let x=0;x<_.length;x++)_[x].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;}};Qh.defaultFillStyle={color:16777215,alpha:1,texture:U.WHITE,matrix:null,fill:null,textureSpace:"local"};Qh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:U.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:false};qt=Qh;});function cn(i){let t=[],e=0;for(let r=0;r<gm.length;r++){let s=`_${gm[r]}`;t[e++]=i[s];}return e=xm(i._fill,t,e),e=uy(i._stroke,t,e),e=dy(i.dropShadow,t,e),t.join("-")}function xm(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function uy(i,t,e){return i&&(e=xm(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 dy(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=q.shared.setValue(i.color).toNumber()),e}var gm,tl=m(()=>{Vt();gm=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];});function fy(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=oe.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){z(j,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(q.isColorLike(e))r.color=e;else if(e instanceof Yt||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)){z(j,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=oe.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new Yt({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>q.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o);}),i.fill={fill:r};}}var el,oe,fs=m(()=>{$t();Vt();St();Zr();tn();Jh();Zh();tl();el=class si extends tt{constructor(t={}){super(),fy(t);let e={...si.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({...si.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...si.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({...qt.defaultFillStyle,...t},()=>{this._fill=Le({...this._originalFill},qt.defaultFillStyle);})),this._fill=Le(t===0?"black":t,qt.defaultFillStyle),this.update());}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...qt.defaultStrokeStyle,...t},()=>{this._stroke=ii({...this._originalStroke},qt.defaultStrokeStyle);})),this._stroke=ii(t,qt.defaultStrokeStyle),this.update());}_generateKey(){return this._styleKey=cn(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this);}reset(){let t=si.defaultTextStyle;for(let e in t)this[e]=t[e];}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new si({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&&!(q.isColorLike(t)||t instanceof Yt||t instanceof Ue)}};el.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};el.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};oe=el;});function un(i,t,e,r){let s=py;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=Gt.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 py,rl=m(()=>{Rr();he();py=new ft;});function vr(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)&&!my.includes(s)&&(s=`"${s}"`),e[r]=s;}return `${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var my,dn=m(()=>{my=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];});var il,fe,Fe,sl=m(()=>{ce();dn();il={willReadFrequently:true},fe=class I{static get experimentalLetterSpacingSupported(){let t=I._experimentalLetterSpacingSupported;if(t!==void 0){let e=pt.get().getCanvasRenderingContext2D().prototype;t=I._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=I._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(I._measurementCache[o])return I._measurementCache[o];let n=vr(e),a=I.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=I.__context;h.font=n;let c=(s?I._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),f=0;for(let b=0;b<c.length;b++){let S=I._measureText(c[b],e.letterSpacing,h);u[b]=S,f=Math.max(f,S);}let d=e._stroke?.width||0,p=f+d;e.dropShadow&&(p+=e.dropShadow.distance);let _=e.lineHeight||a.fontSize,x=Math.max(_,a.fontSize+d)+(c.length-1)*(_+e.leading);return e.dropShadow&&(x+=e.dropShadow.distance),new I(t,e,p,x,c,u,_+e.leading,f,a)}static _measureText(t,e,r){let s=false;I.experimentalLetterSpacingSupported&&(I.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 c=(I.graphemeSegmenter(t).length-1)*e;n+=c,l+=c;}return Math.max(n,l)}static _wordWrap(t,e,r=I._canvas){let s=r.getContext("2d",il),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=I._collapseSpaces(c),f=I._collapseNewlines(c),d=!u,p=e.wordWrapWidth+l,_=I._tokenize(t);for(let x=0;x<_.length;x++){let y=_[x];if(I._isNewline(y)){if(!f){a+=I._addLine(n),d=!u,n="",o=0;continue}y=" ";}if(u){let S=I.isBreakingSpace(y),v=I.isBreakingSpace(n[n.length-1]);if(S&&v)continue}let b=I._getFromCache(y,l,h,s);if(b>p)if(n!==""&&(a+=I._addLine(n),n="",o=0),I.canBreakWords(y,e.breakWords)){let S=I.wordWrapSplit(y);for(let v=0;v<S.length;v++){let M=S[v],T=M,P=1;for(;S[v+P];){let G=S[v+P];if(!I.canBreakChars(T,G,y,v,e.breakWords))M+=G;else break;T=G,P++;}v+=P-1;let F=I._getFromCache(M,l,h,s);F+o>p&&(a+=I._addLine(n),d=false,n="",o=0),n+=M,o+=F;}}else {n.length>0&&(a+=I._addLine(n),n="",o=0);let S=x===_.length-1;a+=I._addLine(y,!S),d=false,n="",o=0;}else b+o>p&&(d=false,a+=I._addLine(n),n="",o=0),(n.length>0||!I.isBreakingSpace(y)||d)&&(n+=y,o+=b);}return a+=I._addLine(n,false),a}static _addLine(t,e=true){return t=I._trimRight(t),t=e?`${t}
368
+ `:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=I._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(!I.isBreakingSpace(r))break;t=t.slice(0,-1);}return t}static _isNewline(t){return typeof t!="string"?false:I._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?false:I._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(I.isBreakingSpace(o,n)||I._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 I.graphemeSegmenter(t)}static measureFont(t){if(I._fonts[t])return I._fonts[t];let e=I._context;e.font=t;let r=e.measureText(I.METRICS_STRING+I.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return I._fonts[t]=s,s}static clearMetrics(t=""){t?delete I._fonts[t]:I._fonts={};}static get _canvas(){if(!I.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",il)?.measureText)return I.__canvas=e,e;t=pt.get().createCanvas();}catch{t=pt.get().createCanvas();}t.width=t.height=10,I.__canvas=t;}return I.__canvas}static get _context(){return I.__context||(I.__context=I._canvas.getContext("2d",il)),I.__context}};fe.METRICS_STRING="|\xC9q\xC5";fe.BASELINE_SYMBOL="M";fe.BASELINE_MULTIPLIER=1.4;fe.HEIGHT_MULTIPLIER=2;fe.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();fe.experimentalLetterSpacing=false;fe._fonts={};fe._newlines=[10,13];fe._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];fe._measurementCache={};Fe=fe;});function oi(i,t,e,r=0){if(i.texture===U.WHITE&&!i.fill)return q.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(E.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof Yt){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,c=false;if(o){let{start:u,end:f}=s;l=t.createLinearGradient(u.x*a,u.y*h,f.x*a,f.y*h),c=Math.abs(f.x-u.x)<Math.abs((f.y-u.y)*.1);}else {let{center:u,innerRadius:f,outerCenter:d,outerRadius:p}=s;l=t.createRadialGradient(u.x*a,u.y*h,f*a,d.x*a,d.y*h,p*a);}if(c&&n&&e){let u=e.lineHeight/h;for(let f=0;f<e.lines.length;f++){let d=(f*e.lineHeight+r/2)/h;s.colorStops.forEach(p=>{let _=d+p.offset*u;l.addColorStop(Math.floor(_*_m)/_m,q.shared.setValue(p.color).toHex());});}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,q.shared.setValue(u.color).toHex());});return l}}else {let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(E.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return $("FillStyle not recognised",i),"red"}var _m,ol=m(()=>{Vt();at();Bt();kt();Zr();tn();_m=1e5;});var ps,ym=m(()=>{Vt();D();Ri();cs();Rr();Fp();St();fs();rl();sl();dn();ol();ps=class{constructor(t){this._activeTextures={},this._renderer=t;}getTextureSize(t,e,r){let s=Fe.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=ke(o),n=ke(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(z("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof oe||(t.style=new oe(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),de.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=Fe.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=de.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,r,s,h);let c=un(l,n,a,s);if(r.trim){let u=Bp(l,s);c.frame.copyFrom(u),c.updateUvs();}return {texture:c,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",Gt.returnTexture(t);}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(de.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=vr(e),h=Fe.measureText(t||" ",e),l=h.lines,c=h.lineHeight,u=h.lineWidths,f=h.maxLineWidth,d=h.fontProperties,p=o.height;if(n.resetTransform(),n.scale(r,r),n.textBaseline=e.textBaseline,e._stroke?.width){let b=e._stroke;n.lineWidth=b.width,n.miterLimit=b.miterLimit,n.lineJoin=b.join,n.lineCap=b.cap;}n.font=a;let _,x,y=e.dropShadow?2:1;for(let b=0;b<y;++b){let S=e.dropShadow&&b===0,v=S?Math.ceil(Math.max(1,p)+e.padding*2):0,M=v*r;if(S){n.fillStyle="black",n.strokeStyle="black";let F=e.dropShadow,G=F.color,A=F.alpha;n.shadowColor=q.shared.setValue(G).setAlpha(A).toRgbaString();let B=F.blur*r,N=F.distance*r;n.shadowBlur=B,n.shadowOffsetX=Math.cos(F.angle)*N,n.shadowOffsetY=Math.sin(F.angle)*N+M;}else {if(n.fillStyle=e._fill?oi(e._fill,n,h):null,e._stroke?.width){let F=e._stroke.width*e._stroke.alignment;n.strokeStyle=oi(e._stroke,n,h,F);}n.shadowColor="black";}let T=(c-d.fontSize)/2;c-d.fontSize<0&&(T=0);let P=e._stroke?.width??0;for(let F=0;F<l.length;F++)_=P/2,x=P/2+F*c+d.ascent+T,e.align==="right"?_+=f-u[F]:e.align==="center"&&(_+=(f-u[F])/2),e._stroke?.width&&this._drawLetterSpacing(l[F],e,s,_+e.padding,x+e.padding-v,true),e._fill!==void 0&&this._drawLetterSpacing(l[F],e,s,_+e.padding,x+e.padding-v);}}_drawLetterSpacing(t,e,r,s,o,n=false){let{context:a}=r,h=e.letterSpacing,l=false;if(Fe.experimentalLetterSpacingSupported&&(Fe.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 c=s,u=Fe.graphemeSegmenter(t),f=a.measureText(t).width,d=0;for(let p=0;p<u.length;++p){let _=u[p];n?a.strokeText(_,c,o):a.fillText(_,c,o);let x="";for(let y=p+1;y<u.length;++y)x+=u[y];d=a.measureText(x).width,c+=f-d+h,f=d;}}destroy(){this._activeTextures=null;}};ps.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"canvasText"};});var nl=m(()=>{D();Cp();ym();O.add(ps);O.add(ls);});var fn,bm=m(()=>{St();Ca();Jh();fn=class i extends Ir{constructor(t){t instanceof qt&&(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 qt,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){z(j,"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){z(j,"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(){z(j,"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!==qt.defaultStrokeStyle.width||t.color!==qt.defaultStrokeStyle.color||t.alpha!==qt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return z(j,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return z(j,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return z(j,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return z(j,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return z(j,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return z(j,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}};});var vm,Sm,Tm=m(()=>{vm={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
- `}},yp={name:"local-uniform-msdf-bit",vertex:{header:`
395
+ `}},Sm={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 vp,Sp,Tp=p(()=>{vp={name:"msdf-bit",fragment:{header:`
411
+ `}};});var wm,Pm,Mm=m(()=>{wm={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
- `}},Sp={name:"msdf-bit",fragment:{header:`
438
+ `}},Pm={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 ch,uh,_o,wp=p(()=>{J();Cs();Us();na();la();Ws();ua();hi();ge();bp();Tp();_o=class extends Jt{constructor(){let t=new wt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new C,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=tr();ch??(ch=nr({name:"sdf-shader",bits:[Ls,zs(e),_p,vp,hr]})),uh??(uh=ar({name:"sdf-shader",bits:[Os,Hs(e),yp,Sp,lr]})),super({glProgram:uh,gpuProgram:ch,resources:{localUniforms:t,batchSamplers:Vs(e)}});}};});var yo,Pp=p(()=>{At();ct();yo=class extends ${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(H,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return I(H,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return I(H,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return I(H,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return I(H,"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 dh=p(()=>{});var Mp,fh,Ap=p(()=>{Pt();Et();yi();Ss();mt();ct();ah();go();hh();Si();Pp();dh();Mp=class Cp 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={...Cp.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=G.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=ze(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=ee.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,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*c,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=ee.measureText(_,a,s,false);y.lineHeight=y.height;let v=y.width*c,b=Math.ceil((a.fontStyle==="italic"?2:1)*v),P=y.height*c,S=b+u*2,w=P+u*2;if(d=false,_!==`
466
- `&&_!=="\r"&&_!==" "&&_!==" "&&(d=true,f=Math.ceil(Math.max(w,f))),h+S>m&&(l+=f,f=w,h=0,l+f>x)){n.update();let B=this._nextPage();s=B.canvasAndContext.canvas,o=B.canvasAndContext.context,n=B.texture.source,l=0;}let E=v/c-(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+u,l+u,c,a);let B=n.width*c,M=n.height*c,A=new K(h/B*n.width,l/M*n.height,S/B*n.width,w/M*n.height);this.chars[_].texture=new G({source:n,frame:A}),h+=Math.ceil(S);}}n.update(),this._currentX=h,this._currentY=l,this._skipKerning&&this._applyKerning(e,o);}get pageTextures(){return I(H,"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 c=e.measureText(o+a).width,u=c-(h+l);u&&(this.chars[o].kerning[a]=u),c=e.measureText(o+a).width,u=c-(h+l),u&&(this.chars[a].kerning[o]=u);}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=Nt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new G({source:new Kt({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=ze(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=br(s,t)),e._fill&&(t.fillStyle=br(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=V.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,c=(n._stroke?.width??0)*o,u=r+c/2,f=s-c/2,d=h.descent*o,m=e.lineHeight*o;n.stroke&&c&&t.strokeText(a,u,f+m-d),n._fill&&t.fillText(a,u,f+m-d);}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];Nt.returnCanvasAndContext(e),r.destroy(true);}this.pages=null;}};Mp.defaultOptions={textureSize:512,style:new Ut,mipmap:true};fh=Mp;});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;},c=()=>{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;},u=e.baseMeasurementFontSize/t.fontSize,f=t.letterSpacing*u,d=t.wordWrapWidth*u;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
- `||g){if(!a&&t.wordWrap&&o.width+h.width-f>d?(c(),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&&c();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 b=_.kerning[n]||0,P=_.xAdvance+b+f;h.positions[h.index++]=h.width+b,h.chars.push(x),h.width+=P;}n=x;}return c(),t.align==="center"?l_(s):t.align==="right"?c_(s):t.align==="justify"&&u_(s),s}function l_(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 c_(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 u_(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 c=0;c<r.charPositions.length;c++)c===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[c]+=n;}}var ph=p(()=>{});var So,mh,Ep,Bp=p(()=>{ri();ct();_t();Si();Ap();ph();dh();So=0,mh=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(!ht.has(r)){let n=new fh({style:e,overrideFill:s,overrideSize:true,...this.defaultOptions});So++,So>50&&O("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--,ht.remove(r);}),ht.set(r,n);}let o=ht.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(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 Ut?s:new Ut(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new fh({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:false}),h=bo(e.chars);return a.ensureCharacters(h.join("")),ht.set(`${r}-bitmap`,a),a.once("destroy",()=>ht.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=ht.get(e);r&&r.destroy();}},Ep=new mh;});function Fp(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,Rp=p(()=>{ri();R();It();xp();wp();Bp();ph();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);Fp(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);Fp(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t);}_updateContext(t,e){let{context:r}=e,s=Ep.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=W.get(_o)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,h=vo(o,n,s,true),l=0,c=n.padding,u=h.scale,f=h.width,d=h.height+h.offsetY;n._stroke&&(f+=n._stroke.width/u,d+=n._stroke.width/u),r.translate(-t._anchor._x*f-c,-t._anchor._y*d-c).scale(u,u);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++],v=s.chars[y];v?.texture&&r.texture(v.texture,m||"black",Math.round(g.charPositions[_]+v.xOffset),Math.round(a+v.yOffset));}a+=s.lineHeight;}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=W.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=ht.get(`${r}-bitmap`),{a:o,b:n,c:a,d:h}=t.groupTransform,l=Math.sqrt(o*o+n*n),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+Math.abs(c))/2,f=s.baseRenderedFontSize/t._style.fontSize,d=u*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:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"bitmapText"};});var gh=p(()=>{R();Rp();k.add(wi);});var Pi,Gp=p(()=>{R();mt();It();Oa();za();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),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,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:G.EMPTY,currentKey:"--",batchableSprite:W.get(mr),textureNeedsUploading:false,generatingTexture:false},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=G.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:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"htmlText"};});function kp(){let{userAgent:i}=st.get().getNavigator();return /^((?!chrome|android).)*safari/i.test(i)}var Ip=p(()=>{Wt();});var Dp,Up,vr,xh=p(()=>{Dp="http://www.w3.org/2000/svg",Up="http://www.w3.org/1999/xhtml",vr=class{constructor(){this.svgRoot=document.createElementNS(Dp,"svg"),this.foreignObject=document.createElementNS(Dp,"foreignObject"),this.domElement=document.createElementNS(Up,"div"),this.styleElement=document.createElementNS(Up,"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 zp(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?[Wp(t)]:[],...i.dropShadow?[Hp(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return d_(i.tagStyles,s),s.join(" ")}function Hp(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 Wp(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 d_(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)Op[o]?s.push(Op[o](r[o])):Lp[o]&&s.push(Lp[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`);}}var Lp,Op,Vp=p(()=>{Pt();Lp={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"},Op={fill:i=>`color: ${V.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:Wp,dropShadow:Hp};});var To,Np=p(()=>{_t();Si();ih();Vp();To=class i extends Ut{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=zp(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 Yp(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 $p=p(()=>{});async function Xp(i){let e=await(await st.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 jp=p(()=>{Wt();});async function _h(i,t){let e=await Xp(t);return `@font-face {
465
+ `}};});var al,hl,pn,Cm=m(()=>{at();To();ko();ih();nh();Lo();hh();Ji();Xe();Tm();Mm();pn=class extends Ee{constructor(){let t=new zt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new E,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=Or();al??(al=Yr({name:"sdf-shader",bits:[Go,Do(e),vm,wm,Xr]})),hl??(hl=$r({name:"sdf-shader",bits:[Io,Uo(e),Sm,Pm,jr]})),super({glProgram:hl,gpuProgram:al,resources:{localUniforms:t,batchSamplers:Oo(e)}});}};});var mn,Am=m(()=>{$t();St();mn=class extends tt{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=true,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100;}get font(){return z(j,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return z(j,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return z(j,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return z(j,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return z(j,"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 gn(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 ll=m(()=>{});var Em,cl,Fm=m(()=>{Vt();Xt();cs();_o();Bt();St();sl();dn();ol();fs();Am();ll();Em=class Bm extends mn{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={...Bm.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=U.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=vr(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=Fe.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize;}ensureCharacters(t){let e=gn(t).filter(x=>!this._currentChars.includes(x)).filter((x,y,b)=>b.indexOf(x)===y);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,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*c,f=0,d=false,p=s.width/this.resolution,_=s.height/this.resolution;for(let x=0;x<e.length;x++){let y=e[x],b=Fe.measureText(y,a,s,false);b.lineHeight=b.height;let S=b.width*c,v=Math.ceil((a.fontStyle==="italic"?2:1)*S),M=b.height*c,T=v+u*2,P=M+u*2;if(d=false,y!==`
466
+ `&&y!=="\r"&&y!==" "&&y!==" "&&(d=true,f=Math.ceil(Math.max(P,f))),h+T>p&&(l+=f,f=P,h=0,l+f>_)){n.update();let G=this._nextPage();s=G.canvasAndContext.canvas,o=G.canvasAndContext.context,n=G.texture.source,l=0;}let F=S/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[y]={id:y.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:F,kerning:{}},d){this._drawGlyph(o,b,h+u,l+u,c,a);let G=n.width*c,A=n.height*c,B=new it(h/G*n.width,l/A*n.height,T/G*n.width,P/A*n.height);this.chars[y].texture=new U({source:n,frame:B}),h+=Math.ceil(T);}}n.update(),this._currentX=h,this._currentY=l,this._skipKerning&&this._applyKerning(e,o);}get pageTextures(){return z(j,"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 c=e.measureText(o+a).width,u=c-(h+l);u&&(this.chars[o].kerning[a]=u),c=e.measureText(o+a).width,u=c-(h+l),u&&(this.chars[a].kerning[o]=u);}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=de.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new U({source:new Pe({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=vr(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=oi(s,t)),e._fill&&(t.fillStyle=oi(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=q.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,c=(n._stroke?.width??0)*o,u=r+c/2,f=s-c/2,d=h.descent*o,p=e.lineHeight*o;n.stroke&&c&&t.strokeText(a,u,f+p-d),n._fill&&t.fillText(a,u,f+p-d);}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];de.returnCanvasAndContext(e),r.destroy(true);}this.pages=null;}};Em.defaultOptions={textureSize:512,style:new oe,mipmap:true};cl=Em;});function xn(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=p=>{let _=o.width;for(let x=0;x<h.index;x++){let y=p.positions[x];o.chars.push(p.chars[x]),o.charPositions.push(y+_);}o.width+=p.width,a=false,h.width=0,h.index=0,h.chars.length=0;},c=()=>{let p=o.chars.length-1;if(r){let _=o.chars[p];for(;_===" ";)o.width-=e.chars[_].xAdvance,_=o.chars[--p];}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;},u=e.baseMeasurementFontSize/t.fontSize,f=t.letterSpacing*u,d=t.wordWrapWidth*u;for(let p=0;p<i.length+1;p++){let _,x=p===i.length;x||(_=i[p]);let y=e.chars[_]||e.chars[" "];if(/(?:\s)/.test(_)||_==="\r"||_===`
467
+ `||x){if(!a&&t.wordWrap&&o.width+h.width-f>d?(c(),l(h),x||o.charPositions.push(0)):(h.start=o.width,l(h),x||o.charPositions.push(0)),_==="\r"||_===`
468
+ `)o.width!==0&&c();else if(!x){let M=y.xAdvance+(y.kerning[n]||0)+f;o.width+=M,o.spaceWidth=M,o.spacesIndex.push(o.charPositions.length),o.chars.push(_);}}else {let v=y.kerning[n]||0,M=y.xAdvance+v+f;h.positions[h.index++]=h.width+v,h.chars.push(_),h.width+=M;}n=_;}return c(),t.align==="center"?gy(s):t.align==="right"?xy(s):t.align==="justify"&&_y(s),s}function gy(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 xy(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 _y(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 c=0;c<r.charPositions.length;c++)c===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[c]+=n;}}var ul=m(()=>{});var _n,dl,Rm,km=m(()=>{Xi();St();kt();fs();Fm();ul();ll();_n=0,dl=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(!_t.has(r)){let n=new cl({style:e,overrideFill:s,overrideSize:true,...this.defaultOptions});_n++,_n>50&&$("BitmapText",`You have dynamically created ${_n} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{_n--,_t.remove(r);}),_t.set(r,n);}let o=_t.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=true){let s=this.getFont(t,e);return xn([...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},z(j,"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 oe?s:new oe(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new cl({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:false}),h=gn(e.chars);return a.ensureCharacters(h.join("")),_t.set(`${r}-bitmap`,a),a.once("destroy",()=>_t.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=_t.get(e);r&&r.destroy();}},Rm=new dl;});function Gm(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 ms,Im=m(()=>{Xi();D();ie();bm();Cm();km();ul();ms=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);Gm(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&&(K.return(e.customShader),e.customShader=null),K.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null;}updateRenderable(t){let e=this._getGpuBitmapText(t);Gm(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t);}_updateContext(t,e){let{context:r}=e,s=Rm.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=K.get(pn)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,h=xn(o,n,s,true),l=0,c=n.padding,u=h.scale,f=h.width,d=h.height+h.offsetY;n._stroke&&(f+=n._stroke.width/u,d+=n._stroke.width/u),r.translate(-t._anchor._x*f-c,-t._anchor._y*d-c).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let _=0;_<h.lines.length;_++){let x=h.lines[_];for(let y=0;y<x.charPositions.length;y++){let b=o[l++],S=s.chars[b];S?.texture&&r.texture(S.texture,p||"black",Math.round(x.charPositions[y]+S.xOffset),Math.round(a+S.yOffset));}a+=s.lineHeight;}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=K.get(fn);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=_t.get(`${r}-bitmap`),{a:o,b:n,c:a,d:h}=t.groupTransform,l=Math.sqrt(o*o+n*n),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+Math.abs(c))/2,f=s.baseRenderedFontSize/t._style.fontSize,d=u*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;}};ms.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"bitmapText"};});var fl=m(()=>{D();Im();O.add(ms);});var gs,Dm=m(()=>{D();Bt();ie();Dh();Uh();gs=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),K.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,hs(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(),hs(n,t);}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:U.EMPTY,currentKey:"--",batchableSprite:K.get(ti),textureNeedsUploading:false,generatingTexture:false},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=U.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;}};gs.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"htmlText"};});function Um(){let{userAgent:i}=pt.get().getNavigator();return /^((?!chrome|android).)*safari/i.test(i)}var Lm=m(()=>{ce();});var Om,zm,ni,pl=m(()=>{Om="http://www.w3.org/2000/svg",zm="http://www.w3.org/1999/xhtml",ni=class{constructor(){this.svgRoot=document.createElementNS(Om,"svg"),this.foreignObject=document.createElementNS(Om,"foreignObject"),this.domElement=document.createElementNS(zm,"div"),this.styleElement=document.createElementNS(zm,"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 Vm(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${q.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?[Ym(t)]:[],...i.dropShadow?[Nm(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return yy(i.tagStyles,s),s.join(" ")}function Nm(i){let t=q.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 Ym(i){return [`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${q.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${q.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function yy(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)Wm[o]?s.push(Wm[o](r[o])):Hm[o]&&s.push(Hm[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`);}}var Hm,Wm,$m=m(()=>{Vt();Hm={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"},Wm={fill:i=>`color: ${q.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:Ym,dropShadow:Nm};});var yn,Xm=m(()=>{kt();fs();tl();$m();yn=class i extends oe{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=cn(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=Vm(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"&&$("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t;}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&$("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t;}};});function jm(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 Km=m(()=>{});async function qm(i){let e=await(await pt.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 Zm=m(()=>{ce();});async function ml(i,t){let e=await qm(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 Kp=p(()=>{jp();});async function qp(i,t,e){let r=i.filter(s=>ht.has(`${s}-and-url`)).map((s,o)=>{if(!wo.has(s)){let{url:n}=ht.get(`${s}-and-url`);o===0?wo.set(s,_h({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):wo.set(s,_h({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n));}return wo.get(s)});return (await Promise.all(r)).join(`
474
- `)}var wo,Zp=p(()=>{ri();Kp();wo=new Map;});function Qp(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 Jp=p(()=>{});function tm(i,t){let e=Nt.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 em=p(()=>{yi();});function rm(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 im=p(()=>{});function om(i,t,e,r){r||(r=sm||(sm=new vr));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 sm,nm=p(()=>{xh();});var Sr,am=p(()=>{R();yi();Xe();ai();Ip();_t();It();oh();xh();Np();$p();Zp();Jp();em();im();nm();Sr=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===Qt.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=W.get(vr),o=Yp(t,r),n=await qp(o,r,To.defaultTextStyle),a=om(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),c=s.image,u=2;c.width=(h|0)+u,c.height=(l|0)+u;let f=Qp(t,r,e,n,s);await rm(c,f,kp()&&o.length>0);let d=c,m;this._createCanvas&&(m=tm(c,e));let x=mo(m?m.canvas:d,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(x.source),Nt.returnCanvasAndContext(m)),W.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(()=>{O("HTMLTextSystem: Failed to clean texture");}),this._activeTextures[t]=null));}_cleanUp(t){yt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown";}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null;}};Sr.extension={type:[T.WebGLSystem,T.WebGPUSystem,T.CanvasSystem],name:"htmlText"};Sr.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"};});var yh=p(()=>{R();Gp();am();k.add(Sr);k.add(Pi);});var hm,Tr,Po=p(()=>{rr();er();ni();ct();hm=class lm extends Zt{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(I(H,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...lm.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 gt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:Z.VERTEX|Z.COPY_DST}),h=new gt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:Z.VERTEX|Z.COPY_DST}),l=new gt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:Z.INDEX|Z.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;}};hm.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:false};Tr=hm;});var Mi,cm,um=p(()=>{Mi={name:"local-uniform-bit",vertex:{header:`
473
+ }`}var Qm=m(()=>{Zm();});async function Jm(i,t,e){let r=i.filter(s=>_t.has(`${s}-and-url`)).map((s,o)=>{if(!bn.has(s)){let{url:n}=_t.get(`${s}-and-url`);o===0?bn.set(s,ml({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):bn.set(s,ml({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n));}return bn.get(s)});return (await Promise.all(r)).join(`
474
+ `)}var bn,tg=m(()=>{Xi();Qm();bn=new Map;});function eg(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 rg=m(()=>{});function ig(i,t){let e=de.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 sg=m(()=>{cs();});function og(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 ng=m(()=>{});function hg(i,t,e,r){r||(r=ag||(ag=new ni));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 ag,lg=m(()=>{pl();});var ai,cg=m(()=>{D();cs();Rr();Qi();Lm();kt();ie();rl();pl();Xm();Km();tg();rg();sg();ng();lg();ai=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===Ae.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=K.get(ni),o=jm(t,r),n=await Jm(o,r,yn.defaultTextStyle),a=hg(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),c=s.image,u=2;c.width=(h|0)+u,c.height=(l|0)+u;let f=eg(t,r,e,n,s);await og(c,f,Um()&&o.length>0);let d=c,p;this._createCanvas&&(p=ig(c,e));let _=un(p?p.canvas:d,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(_.source),de.returnCanvasAndContext(p)),K.return(s),_}_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(()=>{$("HTMLTextSystem: Failed to clean texture");}),this._activeTextures[t]=null));}_cleanUp(t){Gt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown";}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null;}};ai.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"htmlText"};ai.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"};});var gl=m(()=>{D();Dm();cg();O.add(ai);O.add(gs);});var ug,hi,vn=m(()=>{Hr();zr();Zi();St();ug=class dg extends Ce{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(z(j,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...dg.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 Ft({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:ot.VERTEX|ot.COPY_DST}),h=new Ft({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:ot.VERTEX|ot.COPY_DST}),l=new Ft({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:ot.INDEX|ot.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;}};ug.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:false};hi=ug;});var xs,fg,pg=m(()=>{xs={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
- `}},{...Mi,vertex:{...Mi.vertex,header:Mi.vertex.header.replace("group(1)","group(2)")}},cm={name:"local-uniform-bit",vertex:{header:`
491
+ `}},{...xs,vertex:{...xs.vertex,header:xs.vertex.header.replace("group(1)","group(2)")}},fg={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 dm,fm,pm=p(()=>{dm={name:"tiling-bit",vertex:{header:`
504
+ `}};});var mg,gg,xg=m(()=>{mg={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
- `}},fm={name:"tiling-bit",vertex:{header:`
547
+ `}},gg={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 bh,vh,Mo,mm=p(()=>{J();Us();um();Ws();hi();ge();mt();pm();Mo=class extends Jt{constructor(){bh??(bh=nr({name:"tiling-sprite-shader",bits:[Mi,dm,hr]})),vh??(vh=ar({name:"tiling-sprite-shader",bits:[cm,fm,lr]}));let t=new wt({uMapCoord:{value:new C,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 C,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:vh,gpuProgram:bh,resources:{localUniforms:new wt({uTransformMatrix:{value:new C,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:G.EMPTY.source,uSampler:G.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,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,gm=p(()=>{Po();Co=class extends Tr{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 xm(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 _m=p(()=>{});function ym(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+h*d+c,i[e+1]=a*f+l*d+u,e+=t,s++;}}var bm=p(()=>{});function vm(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=C.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),ym(t,2,0,a);}var Sm=p(()=>{J();bm();});var Ao,Ci,Tm=p(()=>{R();si();Qs();ai();di();Js();Po();mm();gm();_m();Sm();Ao=new Co,Ci=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 _e);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,xe(t.groupColorAlpha,r.uColor,0),this._state.blendMode=ne(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 Tr({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()),vm(t,r.uvs),xm(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===Qt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Ci.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"tilingSprite"};});var Sh=p(()=>{R();Tm();k.add(Ci);});var wm,Mm,Cm=p(()=>{ct();Po();wm=class Pm extends Tr{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={...Pm.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 u=0;u<e;u++){let f=u%this.verticesX,d=u/this.verticesX|0;r.push(f*h,d*l),s.push(f/n,d/a);}let c=n*a;for(let u=0;u<c;u++){let f=u%n,d=u/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();}};wm.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};Mm=wm;});var Am,Bm,Fm=p(()=>{Cm();Am=class Em extends Mm{constructor(t={}){t={...Em.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,c=s+o,u=e>c?1:e/c,f=n+a,d=r>f?1:r/f,m=Math.min(u,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();}};Am.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Bm=Am;});var Ai,Rm=p(()=>{R();It();Js();Fm();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];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(_e);return e.geometry=W.get(Bm),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:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"nineSliceSprite"};});var Th=p(()=>{R();Rm();k.add(Ai);});var Ei,Gm=p(()=>{R();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:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"filter"};});function km(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 Im=p(()=>{});var f_,Bi,Dm=p(()=>{R();J();Ot();ii();ni();ge();mt();Xe();ai();zt();Im();_t();f_=new Zt({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 wt({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 Dt({}),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?km(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,c=false,u=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)){u=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."),u=false;break}u=m.enabled||u,c||(c=m.blendRequired);}if(!u){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=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=yt.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=G.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),yt.returnTexture(r);else {let a=e.inputTexture,h=yt.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 u=a;a=h,h=u;}n[l].apply(this,a,e.previousRenderSurface,false),yt.returnTexture(a),yt.returnTexture(h);}e.blendRequired&&yt.returnTexture(o);}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=yt.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,c=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(u=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,x=m.uOutputFrame,g=m.uInputSize,_=m.uInputPixel,y=m.uInputClamp,v=m.uGlobalFrame,b=m.uOutputTexture;if(c){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;v[0]=h.x*u,v[1]=h.y*u,v[2]=P.source.width*u,v[3]=P.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof G?(b[0]=r.frame.width,b[1]=r.frame.height):(b[0]=S.width,b[1]=S.height),b[2]=S.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:f_,shader:t,state:t._state,topology:"triangle-list"}),o.type===Qt.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new it,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(C.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:[T.WebGLSystem,T.WebGPUSystem],name:"filter"};});var wh=p(()=>{R();Gm();Dm();k.add(Bi);k.add(Ei);});var p_={};var Um=p(()=>{xc();Sn();Pc();Cc();_s();ws();Ga();ka();La();lh();gh();yh();Sh();Th();wh();});var m_={};var Om=p(()=>{Sn();_s();ws();Ga();ka();La();lh();gh();yh();Sh();Th();wh();});var $t={};sg($t,{DistortionFilter:()=>Vi,EqualizerFilter:()=>Gt,Filter:()=>lt,MonoFilter:()=>Ni,ReverbFilter:()=>Yi,StereoFilter:()=>$i,StreamFilter:()=>Xi,TelephoneFilter:()=>ji});var Gh;function kh(i){return Gh=i,i}function X(){return Gh}var lt=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 lt{constructor(t=0){let e;if(!X().useLegacy){let{audioContext:r}=X().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,X().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 nt=class{static setParamValue(t,e){if(t.setValueAtTime){let r=X().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var j=class extends lt{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,h=0,l=0){let c=[],u=[{f:j.F32,type:"lowshelf",gain:i},{f:j.F64,type:"peaking",gain:t},{f:j.F125,type:"peaking",gain:e},{f:j.F250,type:"peaking",gain:r},{f:j.F500,type:"peaking",gain:s},{f:j.F1K,type:"peaking",gain:o},{f:j.F2K,type:"peaking",gain:n},{f:j.F4K,type:"peaking",gain:a},{f:j.F8K,type:"peaking",gain:h},{f:j.F16K,type:"highshelf",gain:l}];X().useLegacy||(c=u.map(f=>{let d=X().context.audioContext.createBiquadFilter();return d.type=f.type,nt.setParamValue(d.Q,1),d.frequency.value=f.f,nt.setParamValue(d.gain,f.gain),d})),super(c[0],c[c.length-1]),this.bands=c,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}`);nt.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(j.F32,i);}get f32(){return this.getGain(j.F32)}set f64(i){this.setGain(j.F64,i);}get f64(){return this.getGain(j.F64)}set f125(i){this.setGain(j.F125,i);}get f125(){return this.getGain(j.F125)}set f250(i){this.setGain(j.F250,i);}get f250(){return this.getGain(j.F250)}set f500(i){this.setGain(j.F500,i);}get f500(){return this.getGain(j.F500)}set f1k(i){this.setGain(j.F1K,i);}get f1k(){return this.getGain(j.F1K)}set f2k(i){this.setGain(j.F2K,i);}get f2k(){return this.getGain(j.F2K)}set f4k(i){this.setGain(j.F4K,i);}get f4k(){return this.getGain(j.F4K)}set f8k(i){this.setGain(j.F8K,i);}get f8k(){return this.getGain(j.F8K)}set f16k(i){this.setGain(j.F16K,i);}get f16k(){return this.getGain(j.F16K)}reset(){this.bands.forEach(i=>{nt.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},Gt=j;Gt.F32=32;Gt.F64=64;Gt.F125=125;Gt.F250=250;Gt.F500=500;Gt.F1K=1e3;Gt.F2K=2e3;Gt.F4K=4e3;Gt.F8K=8e3;Gt.F16K=16e3;var Ni=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:r}=X().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 Yi=class extends lt{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(X().useLegacy)return;let{audioContext:t}=X().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 $i=class extends lt{constructor(t=0){let e,r,s;if(!X().useLegacy){let{audioContext:o}=X().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?nt.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 lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:r}=X().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 lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:r}=X().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",nt.setParamValue(s.frequency,2e3),o.type="lowpass",nt.setParamValue(o.frequency,2e3),n.type="highpass",nt.setParamValue(n.frequency,500),a.type="highpass",nt.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};R();var Lm={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(Um(),p_));}};R();var zm={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Om(),m_));}};R();R();ws();_s();Fn();Wt();Wn();Yr();At();xs();Wi(_a());k.add(Lm,zm);var Fi=class extends ${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 x_=0,Ph=class extends ${constructor(i){super(),this.id=x_++,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-Ph.PADDING),this._end=Math.min(this._end+Ph.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),ut.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(){ut.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){ut.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=Ph;Eo.PADDING=.1;var Ri=class extends ${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 Gi=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"],Mh=["audio/mpeg","audio/ogg"],We={};function Hm(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);}Hm();var y_=0,ki=class extends ${constructor(t){super(),this.id=y_++,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);nt.setParamValue(this._gain.gain,o*s*r),nt.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:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let u=this._source.buffer.duration;this._duration=u,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){ut.shared.remove(this._updateListener,this),t&&ut.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 Wm=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(Wm.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,nt.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=Wm;Bo.BUFFER_SIZE=0;var Ne=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 ki(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 st.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 wr=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=X().useLegacy?new Ri:new Ne;return new wr(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:Mt.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 X().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 Gi(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(wr._pool.length>0){let i=wr._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),wr._pool.indexOf(i)<0&&wr._pool.push(i);}},be=wr;be._pool=[];var Pr=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 $,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 Fo=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new Pr),this._htmlAudioContext=new Fi,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 Pr.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 be)return this._sounds[t]=e,e;let r=this._getOptions(e),s=be.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 Vm=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=Mt.basename(t,Mt.extname(t))),e},Nm={extension:T.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:[T.LoadParser],priority:Ze.High},test(i){let t=Mt.extname(i).slice(1);return !!We[t]||Mh.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>be.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return X().add(Vm(t),e),e},async unload(i,t){X().remove(Vm(t));}}};k.add(Nm);kh(new Fo);({DistortionFilter:$t.DistortionFilter,EqualizerFilter:$t.EqualizerFilter,MonoFilter:$t.MonoFilter,ReverbFilter:$t.ReverbFilter,StereoFilter:$t.StereoFilter,StreamFilter:$t.StreamFilter,TelephoneFilter:$t.TelephoneFilter});var Ym={CHARACTER_CATEGORY_KEY:"___character___"};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||={});function Ro(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 Mr=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Xm=new Set,Ch=typeof process=="object"&&process?process:{},jm=(i,t,e,r)=>{typeof Ch.emitWarning=="function"?Ch.emitWarning(i,t,e,r):console.error(`[${e}] ${t}: ${i}`);},Go=globalThis.AbortController,$m=globalThis.AbortSignal;if(typeof Go>"u"){$m=class{onabort;_onabort=[];reason;aborted=false;addEventListener(r,s){this._onabort.push(s);}},Go=class{constructor(){t();}signal=new $m;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let i=Ch.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=false,jm("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var S_=i=>!Xm.has(i),ve=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Km=i=>ve(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?Cr:null:null,Cr=class extends Array{constructor(t){super(t),this.fill(0);}},Ah=class i{heap;length;static#h=false;static create(t){let e=Km(t);if(!e)return [];i.#h=true;let r=new i(t,e);return i.#h=false,r}constructor(t,e){if(!i.#h)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},ko=class i{#h;#u;#m;#C;#g;#F;#R;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#x;#i;#r;#t;#l;#d;#a;#o;#_;#n;#y;#b;#f;#v;#M;#c;#G;static unsafeExposeInternals(t){return {starts:t.#b,ttls:t.#f,sizes:t.#y,keyMap:t.#i,keyList:t.#r,valList:t.#t,next:t.#l,prev:t.#d,get head(){return t.#a},get tail(){return t.#o},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,r,s,o)=>t.#D(e,r,s,o),moveToTail:e=>t.#B(e),indexes:e=>t.#S(e),rindexes:e=>t.#T(e),isStale:e=>t.#p(e)}}get max(){return this.#h}get maxSize(){return this.#u}get calculatedSize(){return this.#x}get size(){return this.#s}get fetchMethod(){return this.#F}get memoMethod(){return this.#R}get dispose(){return this.#m}get onInsert(){return this.#C}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:m=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:S,ignoreFetchAbort:w}=t;if(e!==0&&!ve(e))throw new TypeError("max option must be a nonnegative integer");let E=e?Km(e):Array;if(!E)throw new Error("invalid max value: "+e);if(this.#h=e,this.#u=m,this.maxEntrySize=x||this.#u,this.sizeCalculation=g,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#R=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#F=_,this.#M=!!_,this.#i=new Map,this.#r=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new E(e),this.#d=new E(e),this.#a=0,this.#o=0,this.#_=Ah.create(e),this.#s=0,this.#x=0,typeof l=="function"&&(this.#m=l),typeof c=="function"&&(this.#C=c),typeof u=="function"?(this.#g=u,this.#n=[]):(this.#g=void 0,this.#n=void 0),this.#v=!!this.#m,this.#G=!!this.#C,this.#c=!!this.#g,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!w,this.maxEntrySize!==0){if(this.#u!==0&&!ve(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!ve(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V();}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=ve(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!ve(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#U();}if(this.#h===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#u){let B="LRU_CACHE_UNBOUNDED";S_(B)&&(Xm.add(B),jm("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",B,i));}}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#U(){let t=new Cr(this.#h),e=new Cr(this.#h);this.#f=t,this.#b=e,this.#L=(o,n,a=Mr.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#p(o)&&this.#w(this.#r[o],"expire");},n+1);h.unref&&h.unref();}},this.#A=o=>{e[o]=t[o]!==0?Mr.now():0;},this.#P=(o,n)=>{if(t[n]){let a=t[n],h=e[n];if(!a||!h)return;o.ttl=a,o.start=h,o.now=r||s();let l=o.now-h;o.remainingTTL=a-l;}};let r=0,s=()=>{let o=Mr.now();if(this.ttlResolution>0){r=o;let n=setTimeout(()=>r=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=this.#i.get(o);if(n===void 0)return 0;let a=t[n],h=e[n];if(!a||!h)return 1/0;let l=(r||s())-h;return a-l},this.#p=o=>{let n=e[o],a=t[o];return !!a&&!!n&&(r||s())-n>a};}#A=()=>{};#P=()=>{};#L=()=>{};#p=()=>false;#V(){let t=new Cr(this.#h);this.#x=0,this.#y=t,this.#E=e=>{this.#x-=t[e],t[e]=0;},this.#O=(e,r,s,o)=>{if(this.#e(r))return 0;if(!ve(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,e),!ve(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#k=(e,r,s)=>{if(t[e]=r,this.#u){let o=this.#u-t[e];for(;this.#x>o;)this.#I(true);}this.#x+=t[e],s&&(s.entrySize=r,s.totalCalculatedSize=this.#x);};}#E=t=>{};#k=(t,e,r)=>{};#O=(t,e,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#o;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#a));)e=this.#d[e];}*#T({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#a;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#o));)e=this.#l[e];}#z(t){return t!==void 0&&this.#i.get(this.#r[t])===t}*entries(){for(let t of this.#S())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*rentries(){for(let t of this.#T())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*keys(){for(let t of this.#S()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*rkeys(){for(let t of this.#T()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*values(){for(let t of this.#S())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}*rvalues(){for(let t of this.#T())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let r of this.#S()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#r[r],this))return this.get(this.#r[r],e)}}forEach(t,e=this){for(let r of this.#S()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[r],this);}}rforEach(t,e=this){for(let r of this.#T()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[r],this);}}purgeStale(){let t=false;for(let e of this.#T({allowStale:true}))this.#p(e)&&(this.#w(this.#r[e],"expire"),t=true);return t}info(t){let e=this.#i.get(t);if(e===void 0)return;let r=this.#t[e],s=this.#e(r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(this.#f&&this.#b){let n=this.#f[e],a=this.#b[e];if(n&&a){let h=n-(Mr.now()-a);o.ttl=h,o.start=Date.now();}}return this.#y&&(o.size=this.#y[e]),o}dump(){let t=[];for(let e of this.#S({allowStale:true})){let r=this.#r[e],s=this.#t[e],o=this.#e(s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let n={value:o};if(this.#f&&this.#b){n.ttl=this.#f[e];let a=Mr.now()-this.#b[e];n.start=Math.floor(Date.now()-a);}this.#y&&(n.size=this.#y[e]),t.unshift([r,n]);}return t}load(t){this.clear();for(let[e,r]of t){if(r.start){let s=Date.now()-r.start;r.start=Mr.now()-s;}this.set(e,r.value,r);}}set(t,e,r={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=r,{noUpdateTTL:l=this.noUpdateTTL}=r,c=this.#O(t,e,r.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),this.#w(t,"set"),this;let u=this.#s===0?void 0:this.#i.get(t);if(u===void 0)u=this.#s===0?this.#o:this.#_.length!==0?this.#_.pop():this.#s===this.#h?this.#I(false):this.#s,this.#r[u]=t,this.#t[u]=e,this.#i.set(t,u),this.#l[this.#o]=u,this.#d[u]=this.#o,this.#o=u,this.#s++,this.#k(u,c,h),h&&(h.set="add"),l=false,this.#G&&this.#C?.(e,t,"add");else {this.#B(u);let f=this.#t[u];if(e!==f){if(this.#M&&this.#e(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=f;d!==void 0&&!n&&(this.#v&&this.#m?.(d,t,"set"),this.#c&&this.#n?.push([d,t,"set"]));}else n||(this.#v&&this.#m?.(f,t,"set"),this.#c&&this.#n?.push([f,t,"set"]));if(this.#E(u),this.#k(u,c,h),this.#t[u]=e,h){h.set="replace";let d=f&&this.#e(f)?f.__staleWhileFetching:f;d!==void 0&&(h.oldValue=d);}}else h&&(h.set="update");this.#G&&this.onInsert?.(e,t,e===f?"update":"replace");}if(s!==0&&!this.#f&&this.#U(),this.#f&&(l||this.#L(u,s,o),h&&this.#P(h,u)),!n&&this.#c&&this.#n){let f=this.#n,d;for(;d=f?.shift();)this.#g?.(...d);}return this}pop(){try{for(;this.#s;){let t=this.#t[this.#a];if(this.#I(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#c&&this.#n){let t=this.#n,e;for(;e=t?.shift();)this.#g?.(...e);}}}#I(t){let e=this.#a,r=this.#r[e],s=this.#t[e];return this.#M&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(s,r,"evict"),this.#c&&this.#n?.push([s,r,"evict"])),this.#E(e),t&&(this.#r[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#s===1?(this.#a=this.#o=0,this.#_.length=0):this.#a=this.#l[e],this.#i.delete(r),this.#s--,e}has(t,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=e,o=this.#i.get(t);if(o!==void 0){let n=this.#t[o];if(this.#e(n)&&n.__staleWhileFetching===void 0)return false;if(this.#p(o))s&&(s.has="stale",this.#P(s,o));else return r&&this.#A(o),s&&(s.has="hit",this.#P(s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:r=this.allowStale}=e,s=this.#i.get(t);if(s===void 0||!r&&this.#p(s))return;let o=this.#t[s];return this.#e(o)?o.__staleWhileFetching:o}#D(t,e,r,s){let o=e===void 0?void 0:this.#t[e];if(this.#e(o))return o;let n=new Go,{signal:a}=r;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:r,context:s},l=(x,g=false)=>{let{aborted:_}=n.signal,y=r.ignoreFetchAbort&&x!==void 0;if(r.status&&(_&&!g?(r.status.fetchAborted=true,r.status.fetchError=n.signal.reason,y&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),_&&!y&&!g)return u(n.signal.reason);let v=d;return this.#t[e]===d&&(x===void 0?v.__staleWhileFetching?this.#t[e]=v.__staleWhileFetching:this.#w(t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,x,h.options))),x},c=x=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=x),u(x)),u=x=>{let{aborted:g}=n.signal,_=g&&r.allowStaleOnFetchAbort,y=_||r.allowStaleOnFetchRejection,v=y||r.noDeleteOnFetchRejection,b=d;if(this.#t[e]===d&&(!v||b.__staleWhileFetching===void 0?this.#w(t,"fetch"):_||(this.#t[e]=b.__staleWhileFetching)),y)return r.status&&b.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),b.__staleWhileFetching;if(b.__returned===b)throw x},f=(x,g)=>{let _=this.#F?.(t,o,h);_&&_ instanceof Promise&&_.then(y=>x(y===void 0?void 0:y),g),n.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(x(void 0),r.allowStaleOnFetchAbort&&(x=y=>l(y,true)));});};r.status&&(r.status.fetchDispatched=true);let d=new Promise(f).then(l,c),m=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,m,{...h.options,status:void 0}),e=this.#i.get(t)):this.#t[e]=m,m}#e(t){if(!this.#M)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Go}async fetch(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:x,forceRefresh:g=false,status:_,signal:y}=e;if(!this.#M)return _&&(_.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:_});let v={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:m,ignoreFetchAbort:d,status:_,signal:y},b=this.#i.get(t);if(b===void 0){_&&(_.fetch="miss");let P=this.#D(t,b,v,x);return P.__returned=P}else {let P=this.#t[b];if(this.#e(P)){let M=r&&P.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",M&&(_.returnedStale=true)),M?P.__staleWhileFetching:P.__returned=P}let S=this.#p(b);if(!g&&!S)return _&&(_.fetch="hit"),this.#B(b),s&&this.#A(b),_&&this.#P(_,b),P;let w=this.#D(t,b,v,x),B=w.__staleWhileFetching!==void 0&&r;return _&&(_.fetch=S?"stale":"refresh",B&&S&&(_.returnedStale=true)),B?w.__staleWhileFetching:w.__returned=w}}async forceFetch(t,e={}){let r=await this.fetch(t,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,e={}){let r=this.#R;if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let h=r(t,a,{options:n,context:s});return this.set(t,h,n),h}get(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=this.#i.get(t);if(a!==void 0){let h=this.#t[a],l=this.#e(h);return n&&this.#P(n,a),this.#p(a)?(n&&(n.get="stale"),l?(n&&r&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),r?h.__staleWhileFetching:void 0):(o||this.#w(t,"expire"),n&&r&&(n.returnedStale=true),r?h:void 0)):(n&&(n.get="hit"),l?h.__staleWhileFetching:(this.#B(a),s&&this.#A(a),h))}else n&&(n.get="miss");}#H(t,e){this.#d[e]=t,this.#l[t]=e;}#B(t){t!==this.#o&&(t===this.#a?this.#a=this.#l[t]:this.#H(this.#d[t],this.#l[t]),this.#H(this.#o,t),this.#o=t);}delete(t){return this.#w(t,"delete")}#w(t,e){let r=false;if(this.#s!==0){let s=this.#i.get(t);if(s!==void 0)if(r=true,this.#s===1)this.#W(e);else {this.#E(s);let o=this.#t[s];if(this.#e(o)?o.__abortController.abort(new Error("deleted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(o,t,e),this.#c&&this.#n?.push([o,t,e])),this.#i.delete(t),this.#r[s]=void 0,this.#t[s]=void 0,s===this.#o)this.#o=this.#d[s];else if(s===this.#a)this.#a=this.#l[s];else {let n=this.#d[s];this.#l[n]=this.#l[s];let a=this.#l[s];this.#d[a]=this.#d[s];}this.#s--,this.#_.push(s);}}if(this.#c&&this.#n?.length){let s=this.#n,o;for(;o=s?.shift();)this.#g?.(...o);}return r}clear(){return this.#W("delete")}#W(t){for(let e of this.#T({allowStale:true})){let r=this.#t[e];if(this.#e(r))r.__abortController.abort(new Error("deleted"));else {let s=this.#r[e];this.#v&&this.#m?.(r,s,t),this.#c&&this.#n?.push([r,s,t]);}}if(this.#i.clear(),this.#t.fill(void 0),this.#r.fill(void 0),this.#f&&this.#b&&(this.#f.fill(0),this.#b.fill(0)),this.#y&&this.#y.fill(0),this.#a=0,this.#o=0,this.#_.length=0,this.#x=0,this.#s=0,this.#c&&this.#n){let e=this.#n,r;for(;r=e?.shift();)this.#g?.(...r);}}};var Se=class{cache;map=new Map;constructor(t){this.cache=new ko({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}keys(){return this.map.keys()}get values(){return this.map.values}};var U=class i{static storage=new Se({cacheSize:20});static startingStorage=[];static flags=Array();static tempStorage=new Map;static tempStorageDeadlines=new Map;constructor(){}static clearOldTempVariables(t){i.tempStorageDeadlines.forEach((e,r)=>{e>t&&(i.tempStorage.delete(r),i.tempStorageDeadlines.delete(r),i.storage.cache.delete(r));});}static setVariable(t,e){let r=i.tempStorage.has(t);e==null?(i.storage.map.delete(t),!r&&i.storage.cache.delete(t)):(i.storage.map.set(t,e),!r&&i.storage.cache.set(t,e));}static getVariable(t){let e=i.storage.cache.get(t);return e===void 0&&(e=i.tempStorage.get(t)),e===void 0&&(e=i.storage.map.get(t)),Ro(e)}static removeVariable(t){i.storage.delete(t);}static setFlag(t,e){if(e)this.flags.includes(t)||this.flags.push(t);else {let r=this.flags.indexOf(t);r>-1&&this.flags.splice(r,1);}}static getFlag(t){return this.flags.includes(t)}};var Ar=class{constructor(t,e){this.categoryId=t,this._id=e;}_id;get id(){return this._id}categoryId;setStorageProperty(t,e){let r=U.getVariable(this.categoryId);r||(r={}),r.hasOwnProperty(this.id)||(r[this.id]={}),e==null?r[this.id].hasOwnProperty(t)&&delete r[this.id][t]:r[this.id]={...r[this.id],[t]:e},Object.keys(r[this.id]).length===0&&delete r[this.id],U.setVariable(this.categoryId,r);}getStorageProperty(t,e=this.id){let r=U.getVariable(this.categoryId);if(r&&r.hasOwnProperty(e)&&r[e].hasOwnProperty(t))return r[e][t]}};var T_="@",Er=class extends Ar{sourceId;constructor(t,e=""){super(Ym.CHARACTER_CATEGORY_KEY,t+(e?T_+e:"")),this.sourceId=t;}getStorageProperty(t){let e=super.getStorageProperty(t);return e===void 0&&(e=super.getStorageProperty(t,this.sourceId)),e}};var Io=class extends Er{constructor(t,e){super(typeof t=="string"?t:t.id,typeof t=="string"?"":t.emotion),this.defaultName=e.name,this.defaultSurname=e.surname,this.defaultAge=e.age,this._icon=e.icon,this._color=e.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(t){this.setStorageProperty("name",t);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(t){this.setStorageProperty("surname",t);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(t){this.setStorageProperty("age",t);}_icon;get icon(){return this._icon}_color;get color(){return this._color}};var Ui=new Se({cacheSize:10});function w_(i){return Li.add(i)}function P_(i){return Li.get(i)}function M_(){return Li.values()}var Li;(s=>{function i(o){try{let n=Ui.get(o);if(!n){rt.warn(`Character "${o}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return n}catch(n){rt.error(`Error while getting Character "${o}"`,n);return}}s.get=i;function t(o){if(Array.isArray(o)){o.forEach(n=>t(n));return}Ui.get(o.id)&&rt.info(`Character id "${o.id}" already exists, it will be overwritten`),Ui.set(o.id,o);}s.add=t;function e(){return Array.from(Ui.values())}s.values=e;function r(o){return Ui.has(o)}s.has=r;})(Li||={});var C_=Li;exports.CharacterBaseModel=Io;exports.CharacterStoredClass=Er;exports.RegisteredCharacters=C_;exports.getAllCharacters=M_;exports.getCharacterById=P_;exports.saveCharacter=w_;
569
+ `}};});var xl,_l,Sn,_g=m(()=>{at();ko();pg();Lo();Ji();Xe();Bt();xg();Sn=class extends Ee{constructor(){xl??(xl=Yr({name:"tiling-sprite-shader",bits:[xs,mg,Xr]})),_l??(_l=$r({name:"tiling-sprite-shader",bits:[fg,gg,jr]}));let t=new zt({uMapCoord:{value:new E,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 E,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:_l,gpuProgram:xl,resources:{localUniforms:new zt({uTransformMatrix:{value:new E,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:U.EMPTY.source,uSampler:U.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,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 Tn,yg=m(()=>{vn();Tn=class extends hi{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 bg(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 vg=m(()=>{});function Sg(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+h*d+c,i[e+1]=a*f+l*d+u,e+=t,s++;}}var Tg=m(()=>{});function wg(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=E.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),Sg(t,2,0,a);}var Pg=m(()=>{at();Tg();});var wn,_s,Mg=m(()=>{D();Ki();jo();Qi();is();Ko();vn();_g();yg();vg();Pg();wn=new Tn,_s=class{constructor(t){this._state=yr.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 Ke);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 Sn),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,je(t.groupColorAlpha,r.uColor,0),this._state.blendMode=De(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:wn,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 hi({indices:wn.indices,positions:wn.positions.slice(),uvs:wn.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()),wg(t,r.uvs),bg(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===Ae.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};_s.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"tilingSprite"};});var yl=m(()=>{D();Mg();O.add(_s);});var Cg,Eg,Bg=m(()=>{St();vn();Cg=class Ag extends hi{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(z(j,"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={...Ag.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 u=0;u<e;u++){let f=u%this.verticesX,d=u/this.verticesX|0;r.push(f*h,d*l),s.push(f/n,d/a);}let c=n*a;for(let u=0;u<c;u++){let f=u%n,d=u/n|0,p=d*this.verticesX+f,_=d*this.verticesX+f+1,x=(d+1)*this.verticesX+f,y=(d+1)*this.verticesX+f+1;o.push(p,_,x,_,y,x);}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();}};Cg.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};Eg=Cg;});var Fg,kg,Gg=m(()=>{Bg();Fg=class Rg extends Eg{constructor(t={}){t={...Rg.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,c=s+o,u=e>c?1:e/c,f=n+a,d=r>f?1:r/f,p=Math.min(u,d),_=h*e,x=l*r;t[0]=t[8]=t[16]=t[24]=-_,t[2]=t[10]=t[18]=t[26]=s*p-_,t[4]=t[12]=t[20]=t[28]=e-o*p-_,t[6]=t[14]=t[22]=t[30]=e-_,t[1]=t[3]=t[5]=t[7]=-x,t[9]=t[11]=t[13]=t[15]=n*p-x,t[17]=t[19]=t[21]=t[23]=r-a*p-x,t[25]=t[27]=t[29]=t[31]=r-x,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();}};Fg.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};kg=Fg;});var ys,Ig=m(()=>{D();ie();Ko();Gg();ys=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];K.return(e.geometry),K.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=K.get(Ke);return e.geometry=K.get(kg),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;}};ys.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"nineSliceSprite"};});var bl=m(()=>{D();Ig();O.add(ys);});var bs,Dg=m(()=>{D();bs=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;}};bs.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"filter"};});function Ug(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 Lg=m(()=>{});var by,vs,Og=m(()=>{D();at();ae();ji();Zi();Xe();Bt();Rr();Qi();he();Lg();kt();by=new Ce({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])}),vs=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new zt({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 se({}),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?Ug(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 p=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p);}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=true,c=false,u=false,f=true;for(let d=0;d<r.length;d++){let p=r[d];if(a=Math.min(a,p.resolution==="inherit"?n._resolution:p.resolution),h+=p.padding,p.antialias==="off"?l=false:p.antialias==="inherit"&&l&&(l=n.antialias),p.clipToViewport||(f=false),!!!(p.compatibleRenderers&e.type)){u=false;break}if(p.blendRequired&&!(e.backBuffer?.useBackBuffer??true)){$("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=false;break}u=p.enabled||u,c||(c=p.blendRequired);}if(!u){s.skip=true;return}if(f){let d=e.renderTarget.rootViewPort,p=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/p,0,d.height/p);}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=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=Gt.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=U.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),Gt.returnTexture(r);else {let a=e.inputTexture,h=Gt.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 u=a;a=h,h=u;}n[l].apply(this,a,e.previousRenderSurface,false),Gt.returnTexture(a),Gt.returnTexture(h);}e.blendRequired&&Gt.returnTexture(o);}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=Gt.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=Z.shared,c=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(u=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,p=d.uniforms,_=p.uOutputFrame,x=p.uInputSize,y=p.uInputPixel,b=p.uInputClamp,S=p.uGlobalFrame,v=p.uOutputTexture;if(c){let P=this._filterStackIndex;for(;P>0;){P--;let F=this._filterStack[this._filterStackIndex-1];if(!F.skip){h.x=F.bounds.minX,h.y=F.bounds.minY;break}}_[0]=a.minX-h.x,_[1]=a.minY-h.y;}else _[0]=0,_[1]=0;_[2]=e.frame.width,_[3]=e.frame.height,x[0]=e.source.width,x[1]=e.source.height,x[2]=1/x[0],x[3]=1/x[1],y[0]=e.source.pixelWidth,y[1]=e.source.pixelHeight,y[2]=1/y[0],y[3]=1/y[1],b[0]=.5*y[2],b[1]=.5*y[3],b[2]=e.frame.width*x[2]-.5*y[2],b[3]=e.frame.height*x[3]-.5*y[3];let M=this.renderer.renderTarget.rootRenderTarget.colorTexture;S[0]=h.x*u,S[1]=h.y*u,S[2]=M.source.width*u,S[3]=M.source.height*u;let T=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof U?(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 P=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(P,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:by,shader:t,state:t._state,topology:"triangle-list"}),o.type===Ae.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new ft,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(E.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}};vs.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"filter"};});var vl=m(()=>{D();Dg();Og();O.add(vs);O.add(bs);});var vy={};var zg=m(()=>{bu();ya();Au();Bu();po();bo();Bh();Fh();Ih();nl();fl();gl();yl();bl();vl();});var Sy={};var Wg=m(()=>{ya();po();bo();Bh();Fh();Ih();nl();fl();gl();yl();bl();vl();});var Se={};ux(Se,{DistortionFilter:()=>Ls,EqualizerFilter:()=>ee,Filter:()=>vt,MonoFilter:()=>Os,ReverbFilter:()=>zs,StereoFilter:()=>Hs,StreamFilter:()=>Ws,TelephoneFilter:()=>Vs});var Dl;function Ul(i){return Dl=i,i}function et(){return Dl}var vt=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 Ls=class extends vt{constructor(t=0){let e;if(!et().useLegacy){let{audioContext:r}=et().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,et().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 gt=class{static setParamValue(t,e){if(t.setValueAtTime){let r=et().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var rt=class extends vt{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,h=0,l=0){let c=[],u=[{f:rt.F32,type:"lowshelf",gain:i},{f:rt.F64,type:"peaking",gain:t},{f:rt.F125,type:"peaking",gain:e},{f:rt.F250,type:"peaking",gain:r},{f:rt.F500,type:"peaking",gain:s},{f:rt.F1K,type:"peaking",gain:o},{f:rt.F2K,type:"peaking",gain:n},{f:rt.F4K,type:"peaking",gain:a},{f:rt.F8K,type:"peaking",gain:h},{f:rt.F16K,type:"highshelf",gain:l}];et().useLegacy||(c=u.map(f=>{let d=et().context.audioContext.createBiquadFilter();return d.type=f.type,gt.setParamValue(d.Q,1),d.frequency.value=f.f,gt.setParamValue(d.gain,f.gain),d})),super(c[0],c[c.length-1]),this.bands=c,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}`);gt.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(rt.F32,i);}get f32(){return this.getGain(rt.F32)}set f64(i){this.setGain(rt.F64,i);}get f64(){return this.getGain(rt.F64)}set f125(i){this.setGain(rt.F125,i);}get f125(){return this.getGain(rt.F125)}set f250(i){this.setGain(rt.F250,i);}get f250(){return this.getGain(rt.F250)}set f500(i){this.setGain(rt.F500,i);}get f500(){return this.getGain(rt.F500)}set f1k(i){this.setGain(rt.F1K,i);}get f1k(){return this.getGain(rt.F1K)}set f2k(i){this.setGain(rt.F2K,i);}get f2k(){return this.getGain(rt.F2K)}set f4k(i){this.setGain(rt.F4K,i);}get f4k(){return this.getGain(rt.F4K)}set f8k(i){this.setGain(rt.F8K,i);}get f8k(){return this.getGain(rt.F8K)}set f16k(i){this.setGain(rt.F16K,i);}get f16k(){return this.getGain(rt.F16K)}reset(){this.bands.forEach(i=>{gt.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},ee=rt;ee.F32=32;ee.F64=64;ee.F125=125;ee.F250=250;ee.F500=500;ee.F1K=1e3;ee.F2K=2e3;ee.F4K=4e3;ee.F8K=8e3;ee.F16K=16e3;var Os=class extends vt{constructor(){let t,e;if(!et().useLegacy){let{audioContext:r}=et().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 zs=class extends vt{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(et().useLegacy)return;let{audioContext:t}=et().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 Hs=class extends vt{constructor(t=0){let e,r,s;if(!et().useLegacy){let{audioContext:o}=et().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?gt.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 Ws=class extends vt{constructor(){let t,e;if(!et().useLegacy){let{audioContext:r}=et().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 Vs=class extends vt{constructor(){let t,e;if(!et().useLegacy){let{audioContext:r}=et().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",gt.setParamValue(s.frequency,2e3),o.type="lowpass",gt.setParamValue(o.frequency,2e3),n.type="highpass",gt.setParamValue(n.frequency,500),a.type="highpass",gt.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};D();var Hg={extension:{type:w.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(zg(),vy));}};D();var Vg={extension:{type:w.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Wg(),Sy));}};D();D();bo();po();Aa();ce();Oa();Di();$t();fo();Ds(mh());O.add(Hg,Vg);var Ss=class extends tt{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 wy=0,Sl=class extends tt{constructor(i){super(),this.id=wy++,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-Sl.PADDING),this._end=Math.min(this._end+Sl.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),Tt.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(){Tt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){Tt.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}]`}},Pn=Sl;Pn.PADDING=.1;var Ts=class extends tt{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Pn(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 ws=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 Sr=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Tl=["audio/mpeg","audio/ogg"],Tr={};function Ng(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$/;Sr.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(Tr,r);}Ng();var My=0,Ps=class extends tt{constructor(t){super(),this.id=My++,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);gt.setParamValue(this._gain.gain,o*s*r),gt.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:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let u=this._source.buffer.duration;this._duration=u,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){Tt.shared.remove(this._updateListener,this),t&&Tt.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 wr=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 Yg=class extends wr{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(Yg.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,gt.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}},Mn=Yg;Mn.BUFFER_SIZE=0;var Pr=class{init(t){this.parent=t,this._nodes=new Mn(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 Ps(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 pt.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 li=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=et().useLegacy?new Ts:new Pr;return new li(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:Nt.extname(e).slice(1)})).filter(({ext:e})=>Tr[e]).sort((e,r)=>Sr.indexOf(e.ext)-Sr.indexOf(r.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return et().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 ws(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(li._pool.length>0){let i=li._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),li._pool.indexOf(i)<0&&li._pool.push(i);}},Ze=li;Ze._pool=[];var ci=class i extends wr{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 tt,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 Cn=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new ci),this._htmlAudioContext=new Ss,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 ci.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 Ze)return this._sounds[t]=e,e;let r=this._getOptions(e),s=Ze.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 $g=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=Nt.basename(t,Nt.extname(t))),e},Xg={extension:w.Asset,detection:{test:async()=>true,add:async i=>[...i,...Sr.filter(t=>Tr[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[w.LoadParser],priority:Dr.High},test(i){let t=Nt.extname(i).slice(1);return !!Tr[t]||Tl.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>Ze.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return et().add($g(t),e),e},async unload(i,t){et().remove($g(t));}}};O.add(Xg);Ul(new Cn);({DistortionFilter:Se.DistortionFilter,EqualizerFilter:Se.EqualizerFilter,MonoFilter:Se.MonoFilter,ReverbFilter:Se.ReverbFilter,StereoFilter:Se.StereoFilter,StreamFilter:Se.StreamFilter,TelephoneFilter:Se.TelephoneFilter});var jg={CHARACTER_CATEGORY_KEY:"___character___"};var ht;(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)))(ht||(ht={}));var H=class H{static init(t){H._getStepCounter=t.getStepCounter,H._setStepCounter=t.setStepCounter,H._getCurrentGameStepState=t.getCurrentGameStepState,H._restoreGameStepState=t.restoreGameStepState,H._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(H._onGoNextEnd=t.onGoNextEnd),H._getVariable=t.getVariable,H._setVariable=t.setVariable,H._removeVariable=t.removeVariable,H._getFlag=t.getFlag,H._setFlag=t.setFlag,t.onLabelClosing&&(H._onLabelClosing=t.onLabelClosing),H._addHistoryItem=t.addHistoryItem,H._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,H._getCharacter=t.getCharacter;}static get stepCounter(){return H._getStepCounter()}static set stepCounter(t){H._setStepCounter(t);}static get currentGameStepState(){return H._getCurrentGameStepState()}static get restoreGameStepState(){return H._restoreGameStepState}static get openedLabels(){return H._getOpenedLabels()}static get onGoNextEnd(){return H._onGoNextEnd}static get getVariable(){return H._getVariable}static get setVariable(){return H._setVariable}static get removeVariable(){return H._removeVariable}static get getFlag(){return H._getFlag}static get setFlag(){return H._setFlag}static get onLabelClosing(){return H._onLabelClosing}static get addHistoryItem(){return H._addHistoryItem}static get currentStepsRunningNumber(){return H._getCurrentStepsRunningNumber()}static get getCharacter(){return H._getCharacter}};k(H,"_getStepCounter",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_setStepCounter",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_getCurrentGameStepState",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_restoreGameStepState",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_getOpenedLabels",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_onGoNextEnd",async()=>{}),k(H,"_getVariable",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_setVariable",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_removeVariable",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_getFlag",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_setFlag",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_onLabelClosing",()=>{}),k(H,"_addHistoryItem",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_getCurrentStepsRunningNumber",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),k(H,"_getCharacter",()=>{throw ht.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")}),k(H,"onEnd"),k(H,"onError");function An(i){try{if(typeof i>"u")return i;let t=JSON.stringify(i);return JSON.parse(t)}catch(t){throw ht.error("Error creating exportable element",i,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var ui=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Qg=new Set,wl=typeof process=="object"&&process?process:{},Jg=(i,t,e,r)=>{typeof wl.emitWarning=="function"?wl.emitWarning(i,t,e,r):console.error(`[${e}] ${t}: ${i}`);},Fn=globalThis.AbortController,Kg=globalThis.AbortSignal;if(typeof Fn>"u"){Kg=class{constructor(){k(this,"onabort");k(this,"_onabort",[]);k(this,"reason");k(this,"aborted",false);}addEventListener(r,s){this._onabort.push(s);}},Fn=class{constructor(){k(this,"signal",new Kg);t();}abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let i=wl.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=false,Jg("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var Ey=i=>!Qg.has(i),Qe=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),tx=i=>Qe(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?di:null:null,di=class extends Array{constructor(t){super(t),this.fill(0);}},fi,Mr=class Mr{constructor(t,e){k(this,"heap");k(this,"length");if(!g(Mr,fi))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}static create(t){let e=tx(t);if(!e)return [];L(Mr,fi,true);let r=new Mr(t,e);return L(Mr,fi,false),r}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};fi=new WeakMap,Q(Mr,fi,false);var Pl=Mr,qg,Zg,pe,Zt,me,Cr,ge,pi,mi,wt,xe,yt,ct,Y,Ht,Qt,It,Mt,_e,Ct,ye,be,Jt,ve,rr,Wt,gi,C,Ml,Ar,Oe,As,te,ex,Er,xi,Es,Je,tr,Cl,En,Bn,lt,Al,Cs,er,El,Bl=class Bl{constructor(t){Q(this,C);Q(this,pe);Q(this,Zt);Q(this,me);Q(this,Cr);Q(this,ge);Q(this,pi);Q(this,mi);k(this,"ttl");k(this,"ttlResolution");k(this,"ttlAutopurge");k(this,"updateAgeOnGet");k(this,"updateAgeOnHas");k(this,"allowStale");k(this,"noDisposeOnSet");k(this,"noUpdateTTL");k(this,"maxEntrySize");k(this,"sizeCalculation");k(this,"noDeleteOnFetchRejection");k(this,"noDeleteOnStaleGet");k(this,"allowStaleOnFetchAbort");k(this,"allowStaleOnFetchRejection");k(this,"ignoreFetchAbort");Q(this,wt);Q(this,xe);Q(this,yt);Q(this,ct);Q(this,Y);Q(this,Ht);Q(this,Qt);Q(this,It);Q(this,Mt);Q(this,_e);Q(this,Ct);Q(this,ye);Q(this,be);Q(this,Jt);Q(this,ve);Q(this,rr);Q(this,Wt);Q(this,gi);Q(this,Ar,()=>{});Q(this,Oe,()=>{});Q(this,As,()=>{});Q(this,te,()=>false);Q(this,Er,t=>{});Q(this,xi,(t,e,r)=>{});Q(this,Es,(t,e,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});k(this,qg,"LRUCache");let{max:e=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:p=0,maxEntrySize:_=0,sizeCalculation:x,fetchMethod:y,memoMethod:b,noDeleteOnFetchRejection:S,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:T,ignoreFetchAbort:P}=t;if(e!==0&&!Qe(e))throw new TypeError("max option must be a nonnegative integer");let F=e?tx(e):Array;if(!F)throw new Error("invalid max value: "+e);if(L(this,pe,e),L(this,Zt,p),this.maxEntrySize=_||g(this,Zt),this.sizeCalculation=x,this.sizeCalculation){if(!g(this,Zt)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(L(this,mi,b),y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(L(this,pi,y),L(this,rr,!!y),L(this,yt,new Map),L(this,ct,new Array(e).fill(void 0)),L(this,Y,new Array(e).fill(void 0)),L(this,Ht,new F(e)),L(this,Qt,new F(e)),L(this,It,0),L(this,Mt,0),L(this,_e,Pl.create(e)),L(this,wt,0),L(this,xe,0),typeof l=="function"&&L(this,me,l),typeof c=="function"&&L(this,Cr,c),typeof u=="function"?(L(this,ge,u),L(this,Ct,[])):(L(this,ge,void 0),L(this,Ct,void 0)),L(this,ve,!!g(this,me)),L(this,gi,!!g(this,Cr)),L(this,Wt,!!g(this,ge)),this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!S,this.allowStaleOnFetchRejection=!!M,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(g(this,Zt)!==0&&!Qe(g(this,Zt)))throw new TypeError("maxSize must be a positive integer if specified");if(!Qe(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");R(this,C,ex).call(this);}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=Qe(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!Qe(this.ttl))throw new TypeError("ttl must be a positive integer if specified");R(this,C,Ml).call(this);}if(g(this,pe)===0&&this.ttl===0&&g(this,Zt)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!g(this,pe)&&!g(this,Zt)){let G="LRU_CACHE_UNBOUNDED";Ey(G)&&(Qg.add(G),Jg("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",G,Bl));}}static unsafeExposeInternals(t){return {starts:g(t,be),ttls:g(t,Jt),sizes:g(t,ye),keyMap:g(t,yt),keyList:g(t,ct),valList:g(t,Y),next:g(t,Ht),prev:g(t,Qt),get head(){return g(t,It)},get tail(){return g(t,Mt)},free:g(t,_e),isBackgroundFetch:e=>{var r;return R(r=t,C,lt).call(r,e)},backgroundFetch:(e,r,s,o)=>{var n;return R(n=t,C,Bn).call(n,e,r,s,o)},moveToTail:e=>{var r;return R(r=t,C,Cs).call(r,e)},indexes:e=>{var r;return R(r=t,C,Je).call(r,e)},rindexes:e=>{var r;return R(r=t,C,tr).call(r,e)},isStale:e=>{var r;return g(r=t,te).call(r,e)}}}get max(){return g(this,pe)}get maxSize(){return g(this,Zt)}get calculatedSize(){return g(this,xe)}get size(){return g(this,wt)}get fetchMethod(){return g(this,pi)}get memoMethod(){return g(this,mi)}get dispose(){return g(this,me)}get onInsert(){return g(this,Cr)}get disposeAfter(){return g(this,ge)}getRemainingTTL(t){return g(this,yt).has(t)?1/0:0}*entries(){for(let t of R(this,C,Je).call(this))g(this,Y)[t]!==void 0&&g(this,ct)[t]!==void 0&&!R(this,C,lt).call(this,g(this,Y)[t])&&(yield [g(this,ct)[t],g(this,Y)[t]]);}*rentries(){for(let t of R(this,C,tr).call(this))g(this,Y)[t]!==void 0&&g(this,ct)[t]!==void 0&&!R(this,C,lt).call(this,g(this,Y)[t])&&(yield [g(this,ct)[t],g(this,Y)[t]]);}*keys(){for(let t of R(this,C,Je).call(this)){let e=g(this,ct)[t];e!==void 0&&!R(this,C,lt).call(this,g(this,Y)[t])&&(yield e);}}*rkeys(){for(let t of R(this,C,tr).call(this)){let e=g(this,ct)[t];e!==void 0&&!R(this,C,lt).call(this,g(this,Y)[t])&&(yield e);}}*values(){for(let t of R(this,C,Je).call(this))g(this,Y)[t]!==void 0&&!R(this,C,lt).call(this,g(this,Y)[t])&&(yield g(this,Y)[t]);}*rvalues(){for(let t of R(this,C,tr).call(this))g(this,Y)[t]!==void 0&&!R(this,C,lt).call(this,g(this,Y)[t])&&(yield g(this,Y)[t]);}[(Zg=Symbol.iterator,qg=Symbol.toStringTag,Zg)](){return this.entries()}find(t,e={}){for(let r of R(this,C,Je).call(this)){let s=g(this,Y)[r],o=R(this,C,lt).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,g(this,ct)[r],this))return this.get(g(this,ct)[r],e)}}forEach(t,e=this){for(let r of R(this,C,Je).call(this)){let s=g(this,Y)[r],o=R(this,C,lt).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,g(this,ct)[r],this);}}rforEach(t,e=this){for(let r of R(this,C,tr).call(this)){let s=g(this,Y)[r],o=R(this,C,lt).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,g(this,ct)[r],this);}}purgeStale(){let t=false;for(let e of R(this,C,tr).call(this,{allowStale:true}))g(this,te).call(this,e)&&(R(this,C,er).call(this,g(this,ct)[e],"expire"),t=true);return t}info(t){let e=g(this,yt).get(t);if(e===void 0)return;let r=g(this,Y)[e],s=R(this,C,lt).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(g(this,Jt)&&g(this,be)){let n=g(this,Jt)[e],a=g(this,be)[e];if(n&&a){let h=n-(ui.now()-a);o.ttl=h,o.start=Date.now();}}return g(this,ye)&&(o.size=g(this,ye)[e]),o}dump(){let t=[];for(let e of R(this,C,Je).call(this,{allowStale:true})){let r=g(this,ct)[e],s=g(this,Y)[e],o=R(this,C,lt).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let n={value:o};if(g(this,Jt)&&g(this,be)){n.ttl=g(this,Jt)[e];let a=ui.now()-g(this,be)[e];n.start=Math.floor(Date.now()-a);}g(this,ye)&&(n.size=g(this,ye)[e]),t.unshift([r,n]);}return t}load(t){this.clear();for(let[e,r]of t){if(r.start){let s=Date.now()-r.start;r.start=ui.now()-s;}this.set(e,r.value,r);}}set(t,e,r={}){var f,d,p,_;if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=r,{noUpdateTTL:l=this.noUpdateTTL}=r,c=g(this,Es).call(this,t,e,r.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),R(this,C,er).call(this,t,"set"),this;let u=g(this,wt)===0?void 0:g(this,yt).get(t);if(u===void 0)u=g(this,wt)===0?g(this,Mt):g(this,_e).length!==0?g(this,_e).pop():g(this,wt)===g(this,pe)?R(this,C,En).call(this,false):g(this,wt),g(this,ct)[u]=t,g(this,Y)[u]=e,g(this,yt).set(t,u),g(this,Ht)[g(this,Mt)]=u,g(this,Qt)[u]=g(this,Mt),L(this,Mt,u),Us(this,wt)._++,g(this,xi).call(this,u,c,h),h&&(h.set="add"),l=false,g(this,gi)&&((f=g(this,Cr))==null||f.call(this,e,t,"add"));else {R(this,C,Cs).call(this,u);let x=g(this,Y)[u];if(e!==x){if(g(this,rr)&&R(this,C,lt).call(this,x)){x.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:y}=x;y!==void 0&&!n&&(g(this,ve)&&((d=g(this,me))==null||d.call(this,y,t,"set")),g(this,Wt)&&g(this,Ct)?.push([y,t,"set"]));}else n||(g(this,ve)&&((p=g(this,me))==null||p.call(this,x,t,"set")),g(this,Wt)&&g(this,Ct)?.push([x,t,"set"]));if(g(this,Er).call(this,u),g(this,xi).call(this,u,c,h),g(this,Y)[u]=e,h){h.set="replace";let y=x&&R(this,C,lt).call(this,x)?x.__staleWhileFetching:x;y!==void 0&&(h.oldValue=y);}}else h&&(h.set="update");g(this,gi)&&this.onInsert?.(e,t,e===x?"update":"replace");}if(s!==0&&!g(this,Jt)&&R(this,C,Ml).call(this),g(this,Jt)&&(l||g(this,As).call(this,u,s,o),h&&g(this,Oe).call(this,h,u)),!n&&g(this,Wt)&&g(this,Ct)){let x=g(this,Ct),y;for(;y=x?.shift();)(_=g(this,ge))==null||_.call(this,...y);}return this}pop(){var t;try{for(;g(this,wt);){let e=g(this,Y)[g(this,It)];if(R(this,C,En).call(this,!0),R(this,C,lt).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(g(this,Wt)&&g(this,Ct)){let e=g(this,Ct),r;for(;r=e?.shift();)(t=g(this,ge))==null||t.call(this,...r);}}}has(t,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=e,o=g(this,yt).get(t);if(o!==void 0){let n=g(this,Y)[o];if(R(this,C,lt).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(g(this,te).call(this,o))s&&(s.has="stale",g(this,Oe).call(this,s,o));else return r&&g(this,Ar).call(this,o),s&&(s.has="hit",g(this,Oe).call(this,s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:r=this.allowStale}=e,s=g(this,yt).get(t);if(s===void 0||!r&&g(this,te).call(this,s))return;let o=g(this,Y)[s];return R(this,C,lt).call(this,o)?o.__staleWhileFetching:o}async fetch(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:_,forceRefresh:x=false,status:y,signal:b}=e;if(!g(this,rr))return y&&(y.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:y});let S={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:p,ignoreFetchAbort:d,status:y,signal:b},v=g(this,yt).get(t);if(v===void 0){y&&(y.fetch="miss");let M=R(this,C,Bn).call(this,t,v,S,_);return M.__returned=M}else {let M=g(this,Y)[v];if(R(this,C,lt).call(this,M)){let A=r&&M.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",A&&(y.returnedStale=true)),A?M.__staleWhileFetching:M.__returned=M}let T=g(this,te).call(this,v);if(!x&&!T)return y&&(y.fetch="hit"),R(this,C,Cs).call(this,v),s&&g(this,Ar).call(this,v),y&&g(this,Oe).call(this,y,v),M;let P=R(this,C,Bn).call(this,t,v,S,_),G=P.__staleWhileFetching!==void 0&&r;return y&&(y.fetch=T?"stale":"refresh",G&&T&&(y.returnedStale=true)),G?P.__staleWhileFetching:P.__returned=P}}async forceFetch(t,e={}){let r=await this.fetch(t,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,e={}){let r=g(this,mi);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let h=r(t,a,{options:n,context:s});return this.set(t,h,n),h}get(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=g(this,yt).get(t);if(a!==void 0){let h=g(this,Y)[a],l=R(this,C,lt).call(this,h);return n&&g(this,Oe).call(this,n,a),g(this,te).call(this,a)?(n&&(n.get="stale"),l?(n&&r&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),r?h.__staleWhileFetching:void 0):(o||R(this,C,er).call(this,t,"expire"),n&&r&&(n.returnedStale=true),r?h:void 0)):(n&&(n.get="hit"),l?h.__staleWhileFetching:(R(this,C,Cs).call(this,a),s&&g(this,Ar).call(this,a),h))}else n&&(n.get="miss");}delete(t){return R(this,C,er).call(this,t,"delete")}clear(){return R(this,C,El).call(this,"delete")}};pe=new WeakMap,Zt=new WeakMap,me=new WeakMap,Cr=new WeakMap,ge=new WeakMap,pi=new WeakMap,mi=new WeakMap,wt=new WeakMap,xe=new WeakMap,yt=new WeakMap,ct=new WeakMap,Y=new WeakMap,Ht=new WeakMap,Qt=new WeakMap,It=new WeakMap,Mt=new WeakMap,_e=new WeakMap,Ct=new WeakMap,ye=new WeakMap,be=new WeakMap,Jt=new WeakMap,ve=new WeakMap,rr=new WeakMap,Wt=new WeakMap,gi=new WeakMap,C=new WeakSet,Ml=function(){let t=new di(g(this,pe)),e=new di(g(this,pe));L(this,Jt,t),L(this,be,e),L(this,As,(o,n,a=ui.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let h=setTimeout(()=>{g(this,te).call(this,o)&&R(this,C,er).call(this,g(this,ct)[o],"expire");},n+1);h.unref&&h.unref();}}),L(this,Ar,o=>{e[o]=t[o]!==0?ui.now():0;}),L(this,Oe,(o,n)=>{if(t[n]){let a=t[n],h=e[n];if(!a||!h)return;o.ttl=a,o.start=h,o.now=r||s();let l=o.now-h;o.remainingTTL=a-l;}});let r=0,s=()=>{let o=ui.now();if(this.ttlResolution>0){r=o;let n=setTimeout(()=>r=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=g(this,yt).get(o);if(n===void 0)return 0;let a=t[n],h=e[n];if(!a||!h)return 1/0;let l=(r||s())-h;return a-l},L(this,te,o=>{let n=e[o],a=t[o];return !!a&&!!n&&(r||s())-n>a});},Ar=new WeakMap,Oe=new WeakMap,As=new WeakMap,te=new WeakMap,ex=function(){let t=new di(g(this,pe));L(this,xe,0),L(this,ye,t),L(this,Er,e=>{L(this,xe,g(this,xe)-t[e]),t[e]=0;}),L(this,Es,(e,r,s,o)=>{if(R(this,C,lt).call(this,r))return 0;if(!Qe(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,e),!Qe(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s}),L(this,xi,(e,r,s)=>{if(t[e]=r,g(this,Zt)){let o=g(this,Zt)-t[e];for(;g(this,xe)>o;)R(this,C,En).call(this,true);}L(this,xe,g(this,xe)+t[e]),s&&(s.entrySize=r,s.totalCalculatedSize=g(this,xe));});},Er=new WeakMap,xi=new WeakMap,Es=new WeakMap,Je=function*({allowStale:t=this.allowStale}={}){if(g(this,wt))for(let e=g(this,Mt);!(!R(this,C,Cl).call(this,e)||((t||!g(this,te).call(this,e))&&(yield e),e===g(this,It)));)e=g(this,Qt)[e];},tr=function*({allowStale:t=this.allowStale}={}){if(g(this,wt))for(let e=g(this,It);!(!R(this,C,Cl).call(this,e)||((t||!g(this,te).call(this,e))&&(yield e),e===g(this,Mt)));)e=g(this,Ht)[e];},Cl=function(t){return t!==void 0&&g(this,yt).get(g(this,ct)[t])===t},En=function(t){var o;let e=g(this,It),r=g(this,ct)[e],s=g(this,Y)[e];return g(this,rr)&&R(this,C,lt).call(this,s)?s.__abortController.abort(new Error("evicted")):(g(this,ve)||g(this,Wt))&&(g(this,ve)&&((o=g(this,me))==null||o.call(this,s,r,"evict")),g(this,Wt)&&g(this,Ct)?.push([s,r,"evict"])),g(this,Er).call(this,e),t&&(g(this,ct)[e]=void 0,g(this,Y)[e]=void 0,g(this,_e).push(e)),g(this,wt)===1?(L(this,It,L(this,Mt,0)),g(this,_e).length=0):L(this,It,g(this,Ht)[e]),g(this,yt).delete(r),Us(this,wt)._--,e},Bn=function(t,e,r,s){let o=e===void 0?void 0:g(this,Y)[e];if(R(this,C,lt).call(this,o))return o;let n=new Fn,{signal:a}=r;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:r,context:s},l=(_,x=false)=>{let{aborted:y}=n.signal,b=r.ignoreFetchAbort&&_!==void 0;if(r.status&&(y&&!x?(r.status.fetchAborted=true,r.status.fetchError=n.signal.reason,b&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),y&&!b&&!x)return u(n.signal.reason);let S=d;return g(this,Y)[e]===d&&(_===void 0?S.__staleWhileFetching?g(this,Y)[e]=S.__staleWhileFetching:R(this,C,er).call(this,t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,_,h.options))),_},c=_=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=_),u(_)),u=_=>{let{aborted:x}=n.signal,y=x&&r.allowStaleOnFetchAbort,b=y||r.allowStaleOnFetchRejection,S=b||r.noDeleteOnFetchRejection,v=d;if(g(this,Y)[e]===d&&(!S||v.__staleWhileFetching===void 0?R(this,C,er).call(this,t,"fetch"):y||(g(this,Y)[e]=v.__staleWhileFetching)),b)return r.status&&v.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),v.__staleWhileFetching;if(v.__returned===v)throw _},f=(_,x)=>{var b;let y=(b=g(this,pi))==null?void 0:b.call(this,t,o,h);y&&y instanceof Promise&&y.then(S=>_(S===void 0?void 0:S),x),n.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(_(void 0),r.allowStaleOnFetchAbort&&(_=S=>l(S,true)));});};r.status&&(r.status.fetchDispatched=true);let d=new Promise(f).then(l,c),p=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,p,{...h.options,status:void 0}),e=g(this,yt).get(t)):g(this,Y)[e]=p,p},lt=function(t){if(!g(this,rr))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Fn},Al=function(t,e){g(this,Qt)[e]=t,g(this,Ht)[t]=e;},Cs=function(t){t!==g(this,Mt)&&(t===g(this,It)?L(this,It,g(this,Ht)[t]):R(this,C,Al).call(this,g(this,Qt)[t],g(this,Ht)[t]),R(this,C,Al).call(this,g(this,Mt),t),L(this,Mt,t));},er=function(t,e){var s,o;let r=false;if(g(this,wt)!==0){let n=g(this,yt).get(t);if(n!==void 0)if(r=true,g(this,wt)===1)R(this,C,El).call(this,e);else {g(this,Er).call(this,n);let a=g(this,Y)[n];if(R(this,C,lt).call(this,a)?a.__abortController.abort(new Error("deleted")):(g(this,ve)||g(this,Wt))&&(g(this,ve)&&((s=g(this,me))==null||s.call(this,a,t,e)),g(this,Wt)&&g(this,Ct)?.push([a,t,e])),g(this,yt).delete(t),g(this,ct)[n]=void 0,g(this,Y)[n]=void 0,n===g(this,Mt))L(this,Mt,g(this,Qt)[n]);else if(n===g(this,It))L(this,It,g(this,Ht)[n]);else {let h=g(this,Qt)[n];g(this,Ht)[h]=g(this,Ht)[n];let l=g(this,Ht)[n];g(this,Qt)[l]=g(this,Qt)[n];}Us(this,wt)._--,g(this,_e).push(n);}}if(g(this,Wt)&&g(this,Ct)?.length){let n=g(this,Ct),a;for(;a=n?.shift();)(o=g(this,ge))==null||o.call(this,...a);}return r},El=function(t){var e,r;for(let s of R(this,C,tr).call(this,{allowStale:true})){let o=g(this,Y)[s];if(R(this,C,lt).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=g(this,ct)[s];g(this,ve)&&((e=g(this,me))==null||e.call(this,o,n,t)),g(this,Wt)&&g(this,Ct)?.push([o,n,t]);}}if(g(this,yt).clear(),g(this,Y).fill(void 0),g(this,ct).fill(void 0),g(this,Jt)&&g(this,be)&&(g(this,Jt).fill(0),g(this,be).fill(0)),g(this,ye)&&g(this,ye).fill(0),L(this,It,0),L(this,Mt,0),g(this,_e).length=0,L(this,xe,0),L(this,wt,0),g(this,Wt)&&g(this,Ct)){let s=g(this,Ct),o;for(;o=s?.shift();)(r=g(this,ge))==null||r.call(this,...o);}};var Rn=Bl;var ir=class{constructor(t){k(this,"cache");k(this,"map",new Map);this.cache=new Rn({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}keys(){return this.map.keys()}get values(){return this.map.values}};var bt=class bt{constructor(){}static clearOldTempVariables(t){bt.tempStorageDeadlines.forEach((e,r)=>{e>t&&(bt.tempStorage.delete(r),bt.tempStorageDeadlines.delete(r),bt.storage.cache.delete(r));});}static setVariable(t,e){let r=bt.tempStorage.has(t);e==null?(bt.storage.map.delete(t),!r&&bt.storage.cache.delete(t)):(bt.storage.map.set(t,e),!r&&bt.storage.cache.set(t,e));}static getVariable(t){let e=bt.storage.cache.get(t);return e===void 0&&(e=bt.tempStorage.get(t)),e===void 0&&(e=bt.storage.map.get(t)),An(e)}static removeVariable(t){bt.storage.delete(t);}static setFlag(t,e){if(e)this.flags.includes(t)||this.flags.push(t);else {let r=this.flags.indexOf(t);r>-1&&this.flags.splice(r,1);}}static getFlag(t){return this.flags.includes(t)}};k(bt,"storage",new ir({cacheSize:20})),k(bt,"startingStorage",[]),k(bt,"flags",Array()),k(bt,"tempStorage",new Map),k(bt,"tempStorageDeadlines",new Map);var V=bt;var _i=class{constructor(t,e){k(this,"_id");k(this,"categoryId");this.categoryId=t,this._id=e;}get id(){return this._id}setStorageProperty(t,e){let r=V.getVariable(this.categoryId);r||(r={}),r.hasOwnProperty(this.id)||(r[this.id]={}),e==null?r[this.id].hasOwnProperty(t)&&delete r[this.id][t]:r[this.id]={...r[this.id],[t]:e},Object.keys(r[this.id]).length===0&&delete r[this.id],V.setVariable(this.categoryId,r);}getStorageProperty(t,e=this.id){let r=V.getVariable(this.categoryId);if(r&&r.hasOwnProperty(e)&&r[e].hasOwnProperty(t))return r[e][t]}};var By="@",yi=class extends _i{constructor(e,r=""){super(jg.CHARACTER_CATEGORY_KEY,e+(r?By+r:""));k(this,"sourceId");this.sourceId=e;}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var kn=class extends yi{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion);k(this,"defaultName");k(this,"defaultSurname");k(this,"defaultAge");k(this,"_icon");k(this,"_color");this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this._icon=r.icon,this._color=r.color;}get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}get icon(){return this._icon}get color(){return this._color}};var Fs=new ir({cacheSize:10});function Fy(i){return bi.add(i)}function Ry(i){return bi.get(i)}function ky(){return bi.values()}var bi;(s=>{function i(o){try{let n=Fs.get(o);if(!n){ht.warn(`Character "${o}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return n}catch(n){ht.error(`Error while getting Character "${o}"`,n);return}}s.get=i;function t(o){if(Array.isArray(o)){o.forEach(n=>t(n));return}Fs.get(o.id)&&ht.info(`Character id "${o.id}" already exists, it will be overwritten`),Fs.set(o.id,o);}s.add=t;function e(){return Array.from(Fs.values())}s.values=e;function r(o){return Fs.has(o)}s.has=r;})(bi||(bi={}));var Gy=bi;exports.CharacterBaseModel=kn;exports.CharacterStoredClass=yi;exports.RegisteredCharacters=Gy;exports.getAllCharacters=ky;exports.getCharacterById=Ry;exports.saveCharacter=Fy;