@drincs/pixi-vn 1.3.13 → 1.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/{classes/index.d.cts → CachedMap-DZLvJAnA.d.cts} +1 -1
  2. package/dist/{classes/index.d.ts → CachedMap-DZLvJAnA.d.ts} +1 -1
  3. package/dist/{OpenedLabel-DxlOwJKw.d.ts → HistoryChoiceMenuOption-BjnxDyK5.d.cts} +47 -2
  4. package/dist/{OpenedLabel-Dgkgemkv.d.cts → HistoryChoiceMenuOption-ZdrL_kYX.d.ts} +47 -2
  5. package/dist/{StorageElementType-DTGcnkzF.d.ts → StorageElementType-dAIVJeiw.d.cts} +1 -1
  6. package/dist/{StorageElementType-DTGcnkzF.d.cts → StorageElementType-dAIVJeiw.d.ts} +1 -1
  7. package/dist/history.cjs +1 -0
  8. package/dist/{history/index.d.ts → history.d.cts} +14 -8
  9. package/dist/{history/index.d.cts → history.d.ts} +14 -8
  10. package/dist/history.mjs +1 -0
  11. package/dist/index.cjs +143 -143
  12. package/dist/index.d.cts +3076 -216
  13. package/dist/index.d.ts +3076 -216
  14. package/dist/index.mjs +143 -143
  15. package/dist/narration.cjs +2 -0
  16. package/dist/{index-_rD16ks5.d.ts → narration.d.cts} +27 -44
  17. package/dist/{index-Bl9hiHQR.d.cts → narration.d.ts} +27 -44
  18. package/dist/narration.mjs +2 -0
  19. package/dist/storage.cjs +1 -0
  20. package/dist/{storage/index.d.ts → storage.d.cts} +75 -6
  21. package/dist/{storage/index.d.cts → storage.d.ts} +75 -6
  22. package/dist/storage.mjs +1 -0
  23. package/dist/unifier.cjs +1 -0
  24. package/dist/unifier.d.cts +230 -0
  25. package/dist/unifier.d.ts +230 -0
  26. package/dist/unifier.mjs +1 -0
  27. package/package.json +29 -2
  28. package/dist/ContainerMemory-CrY9QSo2.d.cts +0 -106
  29. package/dist/ContainerMemory-DrijxCcD.d.ts +0 -106
  30. package/dist/HistoryChoiceMenuOption-Kj_P28ke.d.ts +0 -49
  31. package/dist/HistoryChoiceMenuOption-unaLLfKR.d.cts +0 -49
  32. package/dist/HistoryGameState-i_gx3rGM.d.ts +0 -12
  33. package/dist/HistoryGameState-qeIMl_DH.d.cts +0 -12
  34. package/dist/NarrationGameState-CqDh48n_.d.ts +0 -24
  35. package/dist/NarrationGameState-Cu-OYzph.d.cts +0 -24
  36. package/dist/SoundGameState-BG_iPwjt.d.cts +0 -85
  37. package/dist/SoundGameState-BG_iPwjt.d.ts +0 -85
  38. package/dist/StorageGameState-B2kz-u_2.d.cts +0 -19
  39. package/dist/StorageGameState-Cnfj75sk.d.ts +0 -19
  40. package/dist/StoredClassModel-CjdhvNgB.d.cts +0 -56
  41. package/dist/StoredClassModel-CjdhvNgB.d.ts +0 -56
  42. package/dist/TickersSequence-Cf1Vcu22.d.cts +0 -133
  43. package/dist/TickersSequence-Cf1Vcu22.d.ts +0 -133
  44. package/dist/canvas/index.cjs +0 -3316
  45. package/dist/canvas/index.d.cts +0 -8
  46. package/dist/canvas/index.d.ts +0 -8
  47. package/dist/canvas/index.mjs +0 -3316
  48. package/dist/canvas/tickers/index.cjs +0 -3316
  49. package/dist/canvas/tickers/index.d.cts +0 -467
  50. package/dist/canvas/tickers/index.d.ts +0 -467
  51. package/dist/canvas/tickers/index.mjs +0 -3316
  52. package/dist/character/index.cjs +0 -572
  53. package/dist/character/index.d.cts +0 -3
  54. package/dist/character/index.d.ts +0 -3
  55. package/dist/character/index.mjs +0 -572
  56. package/dist/classes/index.cjs +0 -1
  57. package/dist/classes/index.mjs +0 -1
  58. package/dist/history/index.cjs +0 -1
  59. package/dist/history/index.mjs +0 -1
  60. package/dist/index-B4F3XaWz.d.cts +0 -1767
  61. package/dist/index-Cax-mGq_.d.cts +0 -216
  62. package/dist/index-Cvdua0o-.d.ts +0 -216
  63. package/dist/index-Czfdktw9.d.ts +0 -93
  64. package/dist/index-DZ1shoNp.d.cts +0 -93
  65. package/dist/index-DvpfJ2VQ.d.ts +0 -1767
  66. package/dist/interfaces/index.cjs +0 -1
  67. package/dist/interfaces/index.d.cts +0 -55
  68. package/dist/interfaces/index.d.ts +0 -55
  69. package/dist/interfaces/index.mjs +0 -0
  70. package/dist/narration/index.cjs +0 -573
  71. package/dist/narration/index.d.cts +0 -8
  72. package/dist/narration/index.d.ts +0 -8
  73. package/dist/narration/index.mjs +0 -573
  74. package/dist/sound/index.cjs +0 -572
  75. package/dist/sound/index.d.cts +0 -3
  76. package/dist/sound/index.d.ts +0 -3
  77. package/dist/sound/index.mjs +0 -572
  78. package/dist/storage/index.cjs +0 -1
  79. package/dist/storage/index.mjs +0 -1
  80. package/dist/utils/index.cjs +0 -1
  81. package/dist/utils/index.d.cts +0 -8
  82. package/dist/utils/index.d.ts +0 -8
  83. package/dist/utils/index.mjs +0 -1
@@ -1,572 +0,0 @@
1
- var mx=Object.create;var zs=Object.defineProperty;var gx=Object.getOwnPropertyDescriptor;var xx=Object.getOwnPropertyNames;var _x=Object.getPrototypeOf,yx=Object.prototype.hasOwnProperty;var Il=i=>{throw TypeError(i)};var bx=(i,t,e)=>t in i?zs(i,t,{enumerable:true,configurable:true,writable:true,value:e}):i[t]=e;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var Dl=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),vx=(i,t)=>{for(var e in t)zs(i,e,{get:t[e],enumerable:true});},Sx=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of xx(t))!yx.call(i,s)&&s!==e&&zs(i,s,{get:()=>t[s],enumerable:!(r=gx(t,s))||r.enumerable});return i};var Ll=(i,t,e)=>(e=i!=null?mx(_x(i)):{},Sx(zs(e,"default",{value:i,enumerable:true}),i));var G=(i,t,e)=>bx(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)),K=(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),O=(i,t,e,r)=>(Dn(i,t,"write to private field"),t.set(i,e),e),k=(i,t,e)=>(Dn(i,t,"access private method"),e);var Ws=(i,t,e,r)=>({set _(s){O(i,t,s);},get _(){return g(i,t,r)}});var w,Ln,Fi,z,D=p(()=>{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||{}),Ln=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},Fi=(i,t)=>Ln(i).priority??t,z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Ln).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t));}),this},add(...i){return i.map(Ln).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)=>Fi(n.value,e)-Fi(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)=>Fi(o,e)-Fi(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 Wl=Dl((Eb,Un)=>{var Tx=Object.prototype.hasOwnProperty,Lt="~";function Bi(){}Object.create&&(Bi.prototype=Object.create(null),new Bi().__proto__||(Lt=false));function wx(i,t,e){this.fn=i,this.context=t,this.once=e||false;}function zl(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new wx(e,r||i,s),n=Lt?Lt+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 js(i,t){--i._eventsCount===0?i._events=new Bi:delete i._events[t];}function Gt(){this._events=new Bi,this._eventsCount=0;}Gt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)Tx.call(e,r)&&t.push(Lt?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Gt.prototype.listeners=function(t){var e=Lt?Lt+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};Gt.prototype.listenerCount=function(t){var e=Lt?Lt+t:t,r=this._events[e];return r?r.fn?1:r.length:0};Gt.prototype.emit=function(t,e,r,s,o,n){var a=Lt?Lt+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};Gt.prototype.on=function(t,e,r){return zl(this,t,e,r,false)};Gt.prototype.once=function(t,e,r){return zl(this,t,e,r,true)};Gt.prototype.removeListener=function(t,e,r,s){var o=Lt?Lt+t:t;if(!this._events[o])return this;if(!e)return js(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&js(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:js(this,o);}return this};Gt.prototype.removeAllListeners=function(t){var e;return t?(e=Lt?Lt+t:t,this._events[e]&&js(this,e)):(this._events=new Bi,this._eventsCount=0),this};Gt.prototype.off=Gt.prototype.removeListener;Gt.prototype.addListener=Gt.prototype.on;Gt.prefixed=Lt;Gt.EventEmitter=Gt;typeof Un<"u"&&(Un.exports=Gt);});var Vl,q,Nt=p(()=>{Vl=Ll(Wl()),q=Vl.default;});var Px,ke,Mt,se,ql,Nl,On,Mx,Ks,Zl,Ql,Hl,Yl,Xl,ki,Cx,Ax,Ex,Fx,Vn,$l,Bx,zn,Wn,jl,Nn,ae,Kl,Jl,tc=p(()=>{Px={grad:.9,turn:360,rad:360/(2*Math.PI)},ke=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},Mt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},se=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},ql=function(i){return (i=isFinite(i)?i%360:0)>0?i:i+360},Nl=function(i){return {r:se(i.r,0,255),g:se(i.g,0,255),b:se(i.b,0,255),a:se(i.a)}},On=function(i){return {r:Mt(i.r),g:Mt(i.g),b:Mt(i.b),a:Mt(i.a,3)}},Mx=/^#([0-9a-f]{3,8})$/i,Ks=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Zl=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}},Hl=function(i){return {h:ql(i.h),s:se(i.s,0,100),l:se(i.l,0,100),a:se(i.a)}},Yl=function(i){return {h:Mt(i.h),s:Mt(i.s),l:Mt(i.l),a:Mt(i.a,3)}},Xl=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;},ki=function(i){return {h:(t=Zl(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;},Cx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ax=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ex=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Fx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Vn={string:[[function(i){var t=Mx.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?Mt(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?Mt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Ex.exec(i)||Fx.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Nl({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=Cx.exec(i)||Ax.exec(i);if(!t)return null;var e,r,s=Hl({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(Px[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Xl(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 ke(t)&&ke(e)&&ke(r)?Nl({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(!ke(t)||!ke(e)||!ke(r))return null;var n=Hl({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Xl(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!ke(t)||!ke(e)||!ke(r))return null;var n=(function(a){return {h:ql(a.h),s:se(a.s,0,100),v:se(a.v,0,100),a:se(a.a)}})({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Ql(n)},"hsv"]]},$l=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]},Bx=function(i){return typeof i=="string"?$l(i.trim(),Vn.string):typeof i=="object"&&i!==null?$l(i,Vn.object):[null,void 0]},zn=function(i,t){var e=ki(i);return {h:e.h,s:se(e.s+100*t,0,100),l:e.l,a:e.a}},Wn=function(i){return (299*i.r+587*i.g+114*i.b)/1e3/255},jl=function(i,t){var e=ki(i);return {h:e.h,s:e.s,l:se(e.l+100*t,0,100),a:e.a}},Nn=(function(){function i(t){this.parsed=Bx(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 Mt(Wn(this.rgba),2)},i.prototype.isDark=function(){return Wn(this.rgba)<.5},i.prototype.isLight=function(){return Wn(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?Ks(Mt(255*o)):"","#"+Ks(e)+Ks(r)+Ks(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 Yl(ki(this.rgba))},i.prototype.toHslString=function(){return t=Yl(ki(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=Zl(this.rgba),{h:Mt(t.h),s:Mt(t.s),v:Mt(t.v),a:Mt(t.a,3)};var t;},i.prototype.invert=function(){return ae({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),ae(zn(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),ae(zn(this.rgba,-t))},i.prototype.grayscale=function(){return ae(zn(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),ae(jl(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),ae(jl(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"?ae({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):Mt(this.rgba.a,3);var e;},i.prototype.hue=function(t){var e=ki(this.rgba);return typeof t=="number"?ae({h:t,s:e.s,l:e.l,a:e.a}):Mt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===ae(t).toHex()},i})(),ae=function(i){return i instanceof Nn?i:new Nn(i)},Kl=[],Jl=function(i){i.forEach(function(t){Kl.indexOf(t)<0&&(t(Nn,Vn),Kl.push(t));});};});function ec(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 x in e){var y=(a=c,h=o[x],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));y<u&&(u=y,f=x);}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 rc=p(()=>{});var Gr,it,jt=p(()=>{tc();rc();Jl([ec]);Gr=class Gi{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 Gi)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]=Gi._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=Gi.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`);}let n=ae(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 Gi||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}};Gr.shared=new Gr;Gr._temp=new Gr;Gr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;it=Gr;});var ic,sc=p(()=>{ic={cullArea:null,cullable:false,cullableChildren:true};});var oc,nc,ac,Hn=p(()=>{oc=Math.PI*2,nc=180/Math.PI,ac=Math.PI/180;});var Z,Yn,be=p(()=>{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,kx,Gx,ht=p(()=>{Hn();be();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(oc-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 Gx.identity()}static get shared(){return kx.identity()}},kx=new E,Gx=new E;});var Ct,Xn=p(()=>{Ct=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=${this._x} y=${this._y} 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 Q(i="default"){return $n[i]===void 0&&($n[i]=-1),++$n[i]}var $n,Ut=p(()=>{$n={default:-1};});function R(i,t,e=3){if(hc[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
2
- Deprecated since v${i}`):(r=r.split(`
3
- `).splice(e).join(`
4
- `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
5
- Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
6
- Deprecated since v${i}`),console.warn(r))),hc[t]=true;}var hc,j,lc,gt=p(()=>{hc={},j="8.0.0",lc="8.3.4";});function X(...i){jn!==cc&&(jn++,jn===cc?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i));}var jn,cc,Rt=p(()=>{jn=0,cc=500;});var lr,Kn=p(()=>{lr=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 qn,Tt,cr=p(()=>{Kn();qn=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 lr(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}},Tt=new qn;});var uc,dc=p(()=>{gt();uc={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){R("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i);}};});function qs(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 Zn=p(()=>{});var fc,pc=p(()=>{Zn();gt();fc={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);}qs(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||R(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},replaceChild(i,t){i.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(i)),t.setFromMatrix(i.localTransform),t.updateLocalTransform(),this.removeChild(i);}};});var mc,gc=p(()=>{mc={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 Ri,xc=p(()=>{Ri=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 Qn,Zs,_c=p(()=>{D();cr();Qn=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 Tt.get(r.maskClass,t)}return t}returnMaskEffect(t){Tt.return(t);}},Zs=new Qn;z.handleByList(w.MaskEffect,Zs._effectClasses);});var yc,bc=p(()=>{xc();_c();yc={_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),Zs.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=Zs.getMaskEffect(i),this.addEffect(this._maskEffect)));},get mask(){return this._maskEffect?.mask},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged();},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Ri);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 Ri),this._filterEffect.filterArea=i;},get filterArea(){return this._filterEffect?.filterArea}};});var vc,Sc=p(()=>{gt();vc={label:null,get name(){return R(j,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){R(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 Qs,J,Ht=p(()=>{be();Qs=[new Z,new Z,new Z,new Z],J=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,x=h+n+l,y=a+c,m=a+o-c,_=h+c,b=h+n-c;return t>=u&&t<=f&&e>=d&&e<=x&&!(t>y&&t<m&&e>_&&e<b)}intersects(t,e){if(!e){let U=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=U)return false;let F=this.y<t.y?t.y:this.y;return (this.bottom>t.bottom?t.bottom:this.bottom)>F}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return false;let a=Qs[0].set(t.left,t.top),h=Qs[1].set(t.left,t.bottom),l=Qs[2].set(t.right,t.top),c=Qs[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),x=f*r+d*o,y=f*s+d*o,m=f*r+d*n,_=f*s+d*n;if(Math.max(x,y,m,_)<=f*a.x+d*a.y||Math.min(x,y,m,_)>=f*c.x+d*c.y)return false;let b=u*(a.y-l.y),v=u*(l.x-a.x),S=b*r+v*o,M=b*s+v*o,T=b*r+v*n,P=b*s+v*n;return !(Math.max(S,M,T,P)<=b*a.x+v*a.y||Math.min(S,M,T,P)>=b*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}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,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}set(t,e,r,s){return this.x=t,this.y=e,this.width=r,this.height=s,this}toString(){return `[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}};});var Tc,ft,he=p(()=>{ht();Ht();Tc=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=Tc,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 J);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=Tc,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,x=this.maxX,y=this.maxY,m=n*t+h*e+c,_=a*t+l*e+u;m<f&&(f=m),_<d&&(d=_),m>x&&(x=m),_>y&&(y=_),m=n*r+h*e+c,_=a*r+l*e+u,m<f&&(f=m),_<d&&(d=_),m>x&&(x=m),_>y&&(y=_),m=n*t+h*s+c,_=a*t+l*s+u,m<f&&(f=m),_<d&&(d=_),m>x&&(x=m),_>y&&(y=_),m=n*r+h*s+c,_=a*r+l*s+u,m<f&&(f=m),_<d&&(d=_),m>x&&(x=m),_>y&&(y=_),this.minX=f,this.minY=d,this.maxX=x,this.maxY=y;}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,x=s.ty;for(let y=e;y<r;y+=2){let m=t[y],_=t[y+1],b=l*m+u*_+d,v=c*m+f*_+x;o=b<o?b:o,n=v<n?v:n,a=b>a?b: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 _t,Kt,ur=p(()=>{ht();Kn();he();_t=new lr(E),Kt=new lr(ft);});var Rx,wc,Pc=p(()=>{ht();he();ur();Rx=new E,wc={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=Kt.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(Rx).invert()),t.addBounds(r),Kt.return(r);}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Kt.return(r));}};});function Js(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=_t.get().identity(),r=to(i,s)):r=E.IDENTITY,Mc(i,e,r,t),s&&_t.return(s),e.isValid||e.set(0,0,0,0),e}function Mc(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=_t.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=Kt.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++)Mc(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),Kt.return(t);}r||_t.return(s);}function to(i,t){let e=i.parent;return e&&(to(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var eo=p(()=>{ht();ur();});function ro(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 Jn=p(()=>{});function ta(i,t){return i===Cc?t:t===Cc?i:ro(i,t)}var Cc,Ac=p(()=>{Jn();Cc=16777215;});function Ii(i){return ((i&255)<<16)+(i&65280)+(i>>16&255)}var Ec,Fc=p(()=>{ht();eo();ur();Ac();Ec={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=new E,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=to(this,_t.get().identity());return i.appendFrom(this.localTransform,e),_t.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?Ii(this.renderGroup.worldColor):this.parentRenderGroup?Ii(ta(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=ta(t,e.localColor),e=e.parent;return Ii(t)}};});function io(i,t,e){return t.clear(),e||(e=E.IDENTITY),Bc(i,t,e,i,true),t.isValid||t.set(0,0,0,0),t}function Bc(i,t,e,r,s){let o;if(s)o=_t.get(),o=e.copyTo(o);else {if(!i.visible||!i.measurable)return;i.updateLocalTransform();let h=i.localTransform;o=_t.get(),o.appendFrom(h,e);}let n=t,a=!!i.effects.length;if(a&&(t=Kt.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++)Bc(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),Kt.return(t);}_t.return(o);}var ea=p(()=>{ht();ur();});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 kc=p(()=>{});var Ix,Gc,Rc=p(()=>{ht();he();eo();ea();kc();Ix=new E,Gc={_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&&io(this,i.localBounds,Ix),i.localBounds},getBounds(i,t){return Js(this,i,t||new ft)}};});var Ic,Dc=p(()=>{Ic={_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 Dx(i,t){return i._zIndex-t._zIndex}var Lc,Uc=p(()=>{Lc={_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(Dx));}};});var Oc,zc=p(()=>{be();ur();Oc={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(_t.get(),e);return t=r.apply(i,t),_t.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(_t.get(),r);return e=s.applyInverse(i,e),_t.return(s),e}};});var Rr,ia=p(()=>{Ut();Rr=class{constructor(){this.uid=Q("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 Ge(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 Di=p(()=>{});function so(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var oa=p(()=>{});function Lx(i){let t=Wc[i];return t===void 0&&(Wc[i]=Q("resource")),t}var Wc,Vc,oe,Ir=p(()=>{Nt();Ut();gt();Wc=Object.create(null);Vc=class Nc extends q{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=false,t={...Nc.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){R(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=Lx(t),this._resourceId}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners();}};Vc.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};oe=Vc;});var Hc,wt,Re=p(()=>{Nt();Di();oa();Ut();Ir();Hc=class Yc extends q{constructor(t={}){super(),this.options=t,this.uid=Q("textureSource"),this._resourceType="textureSource",this._resourceId=Q("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={...Yc.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 oe(so(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());}set maxAnisotropy(t){this._style.maxAnisotropy=t;}get maxAnisotropy(){return this._style.maxAnisotropy}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=Q("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=Q("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")}};Hc.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:false,sampleCount:1,antialias:false,autoGarbageCollect:false};wt=Hc;});function Ux(){for(let i=0;i<16;i++){let t=[];na.push(t);for(let e=0;e<16;e++){let r=oo(dr[i]*dr[e]+pr[i]*fr[e]),s=oo(fr[i]*dr[e]+mr[i]*fr[e]),o=oo(dr[i]*pr[e]+pr[i]*mr[e]),n=oo(fr[i]*pr[e]+mr[i]*mr[e]);for(let a=0;a<16;a++)if(dr[a]===r&&fr[a]===s&&pr[a]===o&&mr[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new E;t.set(dr[i],fr[i],pr[i],mr[i],0,0),Xc.push(t);}}var dr,fr,pr,mr,na,Xc,oo,ot,$c=p(()=>{ht();dr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],fr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],pr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],mr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],na=[],Xc=[],oo=Math.sign;Ux();ot={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=>dr[i],uY:i=>fr[i],vX:i=>pr[i],vY:i=>mr[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>na[i][t],sub:(i,t)=>na[i][ot.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?ot.S:ot.N:Math.abs(t)*2<=Math.abs(i)?i>0?ot.E:ot.W:t>0?i>0?ot.SE:ot.SW:i>0?ot.NE:ot.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Xc[ot.inv(t)];s.tx=e,s.ty=r,i.append(s);},transformRectCoords:(i,t,e,r)=>{let{x:s,y:o,width:n,height:a}=i,{x:h,y:l,width:c,height:u}=t;return e===ot.E?(r.set(s+h,o+l,n,a),r):e===ot.S?r.set(c-o-a+h,s+l,a,n):e===ot.W?r.set(c-s-n+h,u-o-a+l,n,a):e===ot.N?r.set(o+h,u-s-n+l,a,n):r.set(s+h,o+l,n,a)}};});var aa,jc=p(()=>{aa=()=>{};});var gr,ha=p(()=>{D();Re();gr=class extends wt{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}};gr.extension=w.TextureSource;});var Kc,no,qc=p(()=>{ht();Kc=new E,no=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&&(Kc.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Kc));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 I,Bt=p(()=>{Nt();$c();Ht();Ut();gt();jc();ha();Re();qc();I=class extends q{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=Q("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new J,this.noFrame=false,this.dynamic=false,this.isTexture=true,this.label=e,this.source=t?.source??new wt,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 no(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=ot.add(l,ot.NW),t.x0=f+c*ot.uX(l),t.y0=d+u*ot.uY(l),l=ot.add(l,2),t.x1=f+c*ot.uX(l),t.y1=d+u*ot.uY(l),l=ot.add(l,2),t.x2=f+c*ot.uX(l),t.y2=d+u*ot.uY(l),l=ot.add(l,2),t.x3=f+c*ot.uX(l),t.y3=d+u*ot.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 R(j,"Texture.baseTexture is now Texture.source"),this._source}};I.EMPTY=new I({label:"EMPTY",source:new wt({label:"EMPTY"})});I.EMPTY.destroy=aa;I.WHITE=new I({source:new gr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});I.WHITE.destroy=aa;});var Ox,la,It,Dr=p(()=>{Di();Re();Bt();Ir();Ox=0,la=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=false,this.textureStyle=new oe(this.textureOptions);}createTexture(t,e,r){let s=new wt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:false});return new I({source:s,label:`texturePool_${Ox++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=Ge(o),n=Ge(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,e=false){let r=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[r].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={};}},It=new la;});var ao,Zc=p(()=>{ht();ia();Dr();ao=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 Rr,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&&(It.returnTexture(this.texture,true),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 Jc=p(()=>{});var ca,ho,ua,lo,tu,zx,da,le,Li=p(()=>{Nt();jt();sc();D();ht();Hn();Xn();Ut();gt();Rt();cr();dc();pc();gc();bc();Sc();Pc();Fc();Rc();Dc();Uc();zc();Zc();Jc();ca=new Ct(null),ho=new Ct(null),ua=new Ct(null,1,1),lo=new Ct(null),tu=1,zx=2,da=4,le=class i extends q{constructor(t={}){super(),this.uid=Q("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 Ct(this,0,0),this._scale=ua,this._pivot=ho,this._origin=lo,this._skew=ca,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){R("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),z.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||R(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=Tt.get(ao,this),this.groupTransform=E.IDENTITY,t?.addChild(this),this._updateIsSimple();}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),Tt.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*nc}set angle(t){this.rotation=t*ac;}get pivot(){return this._pivot===ho&&(this._pivot=new Ct(this,0,0)),this._pivot}set pivot(t){this._pivot===ho&&(this._pivot=new Ct(this,0,0),this._origin!==lo&&X("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t);}get skew(){return this._skew===ca&&(this._skew=new Ct(this,0,0)),this._skew}set skew(t){this._skew===ca&&(this._skew=new Ct(this,0,0)),this._skew.copyFrom(t);}get scale(){return this._scale===ua&&(this._scale=new Ct(this,1,1)),this._scale}set scale(t){this._scale===ua&&(this._scale=new Ct(this,0,0)),typeof t=="string"&&(t=parseFloat(t)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t);}get origin(){return this._origin===lo&&(this._origin=new Ct(this,0,0)),this._origin}set origin(t){this._origin===lo&&(this._origin=new Ct(this,0,0),this._pivot!==ho&&X("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._origin.set(t):this._origin.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.origin.set(typeof t.originX=="number"?t.originX:this.origin.x,typeof t.originY=="number"?t.originY:this.origin.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._origin,n=this._position,a=r._x,h=r._y,l=s._x,c=s._y,u=-o._x,f=-o._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*h,e.d=this._sy*h,e.tx=n._x-(l*e.a+c*e.c)+(u*e.a+f*e.c)-u,e.ty=n._y-(l*e.b+c*e.d)+(u*e.b+f*e.d)-f;}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=tu,this._onUpdate());}get alpha(){return this.localAlpha}set tint(t){let r=it.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=tu,this._onUpdate());}get tint(){return Ii(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=true),this._updateFlags|=zx,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|=da,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|=da,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|=da,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._origin=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;}};z.mixin(le,fc,wc,Oc,Ic,Gc,yc,vc,Lc,ic,uc,Ec,mc);});var ve,Ui=p(()=>{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 Lr,eu=p(()=>{Lr=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 ru,mt,Ur=p(()=>{Ui();eu();ru=class qt{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 Lr(null,null,1/0),this.deltaMS=1/qt.targetFPMS,this.elapsedMS=1/qt.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 Lr(t,e,r))}addOnce(t,e,r=ve.NORMAL){return this._addListener(new Lr(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*qt.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,qt.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(!qt._shared){let t=qt._shared=new qt;t.autoStart=true,t._protected=true;}return qt._shared}static get system(){if(!qt._system){let t=qt._system=new qt;t.autoStart=true,t._protected=true;}return qt._system}};ru.targetFPMS=.06;mt=ru;});var Or,fa=p(()=>{Ui();Ur();Or=class{constructor(t){this._lastTransform="",this._observer=null,this._tickerAttached=false,this.updateTranslation=()=>{if(!this._canvas)return;let e=this._canvas.getBoundingClientRect(),r=this._canvas.width,s=this._canvas.height,o=e.width/r*this._renderer.resolution,n=e.height/s*this._renderer.resolution,a=e.left,h=e.top,l=`translate(${a}px, ${h}px) scale(${o}, ${n})`;l!==this._lastTransform&&(this._domElement.style.transform=l,this._lastTransform=l);},this._domElement=t.domElement,this._renderer=t.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver());}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation());}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(t=>{for(let e of t){if(e.target!==this._canvas)continue;let r=this.canvas.width,s=this.canvas.height,o=e.contentRect.width/r*this._renderer.resolution,n=e.contentRect.height/s*this._renderer.resolution;(this._lastScaleX!==o||this._lastScaleY!==n)&&(this.updateTranslation(),this._lastScaleX=o,this._lastScaleY=n);}}),this._observer.observe(this._canvas)):this._tickerAttached||mt.shared.add(this.updateTranslation,this,ve.HIGH);}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&mt.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=false,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null;}};});var He,co=p(()=>{be();He=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 Wx(i){return function(t){return t.test(i)}}function Oi(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=Wx(e),o={apple:{phone:s(pa)&&!s(Ie),ipod:s(iu),tablet:!s(pa)&&(s(su)||fu(t))&&!s(Ie),universal:s(ou),device:(s(pa)||s(iu)||s(su)||s(ou)||fu(t))&&!s(Ie)},amazon:{phone:s(zr),tablet:!s(zr)&&s(uo),device:s(zr)||s(uo)},android:{phone:!s(Ie)&&s(zr)||!s(Ie)&&s(ma),tablet:!s(Ie)&&!s(zr)&&!s(ma)&&(s(uo)||s(nu)),device:!s(Ie)&&(s(zr)||s(uo)||s(ma)||s(nu))||s(/\bokhttp\b/i)},windows:{phone:s(Ie),tablet:s(au),device:s(Ie)||s(au)},other:{blackberry:s(hu),blackberry10:s(lu),opera:s(cu),firefox:s(du),chrome:s(uu),device:s(hu)||s(lu)||s(cu)||s(du)||s(uu)},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 pa,iu,su,ou,ma,nu,zr,uo,Ie,au,hu,lu,cu,uu,du,fu,ga=p(()=>{pa=/iPhone/i,iu=/iPod/i,su=/iPad/i,ou=/\biOS-universal(?:.+)Mac\b/i,ma=/\bAndroid(?:.+)Mobile\b/i,nu=/Android/i,zr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,uo=/Silk/i,Ie=/Windows Phone/i,au=/\bWindows(?:.+)ARM\b/i,hu=/BlackBerry/i,lu=/BB10/i,cu=/Opera Mini/i,uu=/\b(CriOS|Chrome)(?:.+)Mobile/i,du=/Mobile(?:.+)Firefox\b/i,fu=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};});var pu=p(()=>{ga();ga();});var Vx,mu,gu=p(()=>{pu();Vx=Oi.default??Oi,mu=Vx(globalThis.navigator);});var Nx,xu,Hx,Yx,_u,yu,Xx,$x,jx,xa,vu,Su=p(()=>{fa();co();D();gu();Zn();Nx=9,xu=100,Hx=0,Yx=0,_u=2,yu=1,Xx=-1e3,$x=-1e3,jx=2,xa=class bu{constructor(t,e=mu){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=`${yu}px`,t.style.height=`${yu}px`,t.style.position="absolute",t.style.top=`${Xx}px`,t.style.left=`${$x}px`,t.style.zIndex=jx.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.position="absolute",this._div.style.top=`${Hx}px`,this._div.style.left=`${Yx}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=_u.toString(),this._canvasObserver=new Or({domElement:this._div,renderer:this._renderer})),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)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else {let e=new MutationObserver(()=>{t.parentNode&&(e.disconnect(),this._canvasObserver.ensureAttached(),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:{...bu.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,qs(this._children,r,1));}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();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;o.style.left=`${a.tx+n.x*a.a}px`,o.style.top=`${a.ty+n.y*a.d}px`,o.style.width=`${n.width*a.a}px`,o.style.height=`${n.height*a.d}px`;}else this._capHitArea(n),o.style.left=`${n.x}px`,o.style.top=`${n.y}px`,o.style.width=`${n.width}px`,o.style.height=`${n.height}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
- color: transparent;
8
- pointer-events: none;
9
- padding: 0;
10
- margin: 0;
11
- border: 0;
12
- outline: 0;
13
- background: transparent;
14
- box-sizing: border-box;
15
- user-select: none;
16
- -webkit-user-select: none;
17
- -moz-user-select: none;
18
- -ms-user-select: none;
19
- `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${xu}px`,e.style.height=`${xu}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=_u.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 He(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!==Nx||!this._activateOnTab||this._activate();}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate();}destroy(){this._deactivate(),this._destroyTouchHook(),this._canvasObserver?.destroy(),this._canvasObserver=null,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();}};xa.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"accessibility"};xa.defaultOptions={enabledByDefault:false,debug:false,activateOnTab:true,deactivateOnMouseMove:true};vu=xa;});var Tu,wu=p(()=>{Tu={accessible:false,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:true,_accessibleActive:false,_accessibleDiv:null,_renderId:-1};});var Pu=p(()=>{D();Li();Su();wu();z.add(vu);z.mixin(le,Tu);});var zi,Mu=p(()=>{D();zi=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;}};zi.extension=w.Application;});var Wi,Cu=p(()=>{D();Ui();Ur();Wi=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?mt.shared:new mt,t.autoStart&&this.start();}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy();}}};Wi.extension=w.Application;});var _a=p(()=>{D();Mu();Cu();z.add(zi);z.add(Wi);});var ya,Se,ba=p(()=>{Ui();Ur();ya=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t;}addTickerListener(){this._tickerAdded||!this.domElement||(mt.system.add(this._tickerUpdate,this,ve.INTERACTION),this._tickerAdded=true);}removeTickerListener(){this._tickerAdded&&(mt.system.remove(this._tickerUpdate,this),this._tickerAdded=false);}pointerMoved(){this._didMove=true;}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=false;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}):new MouseEvent("mousemove",{clientX:t.clientX,clientY:t.clientY}));}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update());}},Se=new ya;});var De,fo=p(()=>{be();co();De=class extends He{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,x,y){throw new Error("Method not implemented.")}};});var Ot,va=p(()=>{fo();Ot=class extends De{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 Te,Sa=p(()=>{fo();Te=class extends De{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2;}};Te.DOM_DELTA_PIXEL=0;Te.DOM_DELTA_LINE=1;Te.DOM_DELTA_PAGE=2;});var Kx,qx,Vi,po,Au=p(()=>{Nt();be();Rt();ba();fo();va();Sa();Kx=2048,qx=new Z,Vi=new Z,po=class{constructor(t){this.dispatch=new q,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 X(`[EventBoundary]: Event mapping not defined for ${t.type}`);}hitTest(t,e){Se.pauseUpdate=true;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,qx.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<Kx&&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")&&(Se.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 x=t.isInteractive();(d.length>0||x)&&(x&&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")&&(Se.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,Vi),!t.hitArea.contains(Vi.x,Vi.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,Vi),t.containsPoint(Vi)):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)){X("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)){X("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)){X("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)){X("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)){X("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)){X("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 Te)){X("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(Te);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 De&&e instanceof De&&(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 Zx,Qx,wa,mo,Pa=p(()=>{D();Au();ba();va();Sa();Zx=1,Qx={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},wa=class Ta{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new po(null),Se.init(this),this.autoPreventDefault=true,this._eventsAdded=false,this._rootPointerEvent=new Ot(null),this._rootWheelEvent=new Te(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Ta.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,Ta._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,Se.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,Se.domElement=t,this._addEvents();}_addEvents(){if(this._eventsAdded||!this.domElement)return;Se.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;Se.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=Zx),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=Qx[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;}};wa.extension={name:"events",type:[w.WebGLSystem,w.CanvasSystem,w.WebGPUSystem],priority:-1};wa.defaultEventFeatures={move:true,globalMove:true,click:true,wheel:true};mo=wa;});var Eu,Fu=p(()=>{Pa();co();Eu={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??mo.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 He))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 Bu=p(()=>{D();Li();Pa();Fu();z.add(mo);z.mixin(le,Eu);});var Ni,ku=p(()=>{D();fa();Ni=class{constructor(t){this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._renderer.runners.init.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000";}init(){this._canvasObserver=new Or({domElement:this._domElement,renderer:this._renderer});}addRenderable(t,e){this._attachedDomElements.includes(t)||this._attachedDomElements.push(t);}updateRenderable(t){}validateRenderable(t){return true}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}this._canvasObserver.ensureAttached();for(let e=0;e<t.length;e++){let r=t[e],s=r.element;if(!r.parent||r.globalDisplayStatus<7)s?.remove(),t.splice(e,1),e--;else {this._domElement.contains(s)||(s.style.position="absolute",s.style.pointerEvents="auto",this._domElement.appendChild(s));let o=r.worldTransform,n=r._anchor,a=r.width*n.x,h=r.height*n.y;s.style.transformOrigin=`${a}px ${h}px`,s.style.transform=`matrix(${o.a}, ${o.b}, ${o.c}, ${o.d}, ${o.tx-a}, ${o.ty-h})`,s.style.opacity=r.groupAlpha.toString();}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++)this._attachedDomElements[t].element?.remove();this._attachedDomElements.length=0,this._domElement.remove(),this._canvasObserver.destroy(),this._renderer=null;}};Ni.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"dom"};});var Wr,Ma=p(()=>{he();Li();Wr=class extends le{constructor(t){super(t),this.canBundle=true,this.allowChildren=false,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),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;for(let e in this._gpuData)this._gpuData[e].destroy?.();this._gpuData=null;}collectRenderablesSimple(t,e,r){let{renderPipes:s}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),this.didViewUpdate=false;let n=this.children,a=n.length;for(let h=0;h<a;h++)n[h].collectRenderables(t,e,r);}};});var Gu=p(()=>{D();ku();z.add(Ni);});var Vr,Ca=p(()=>{Vr=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Vr||{});});var Ru,Iu=p(()=>{Ru={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},createImage:()=>new Image,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 Du,nt,Zt=p(()=>{Iu();Du=Ru,nt={get(){return Du},set(i){Du=i;}};});function ce(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Hi(i){return i.split("?")[0].split("#")[0]}function Jx(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function t_(i,t,e){return i.replace(new RegExp(Jx(t),"g"),e)}function e_(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 Yt,go=p(()=>{Zt();Yt={toPosix(i){return t_(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){ce(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(ce(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=Hi(this.toPosix(t??nt.get().getBaseUrl())),s=Hi(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?Yt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(ce(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=e_(i),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return ce(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(ce(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(ce(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){ce(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){ce(i),t&&ce(t),i=Hi(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){ce(i),i=Hi(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){ce(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Hi(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 Ye,Aa=p(()=>{Ye=(i,t,e=false)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i);});function Lu(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?Lu(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a));}}function Uu(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);}),Lu(i,s,0,e,r);}else r.push(i);return r}var Ou=p(()=>{});var Ea,zu=p(()=>{Ea=i=>!Array.isArray(i);});function r_(i){return i.split(".").pop().split("?").shift().split("#").shift()}var Yi,Wu=p(()=>{Rt();go();Aa();Ou();zu();Yi=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 Ye(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&&X("[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)&&X(`[Resolver] already has key: ${o} overwriting`);},Ye(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l,parser:c}=o,u=Ye(n).map(x=>typeof x=="string"?Uu(x):Array.isArray(x)?x:[x]),f=this.getAlias(o);Array.isArray(f)?f.forEach(r):r(f);let d=[];u.forEach(x=>{x.forEach(y=>{let m={};if(typeof y!="object"){m.src=y;for(let _=0;_<this._parsers.length;_++){let b=this._parsers[_];if(b.test(y)){m=b.parse(y);break}}}else a=y.data??a,h=y.format??h,(y.loadParser||y.parser)&&(l=y.loadParser??l,c=y.parser??c),m={...m,...y};if(!f)throw new Error(`[Resolver] alias is undefined for this asset: ${m.src}`);m=this._buildResolvedAsset(m,{aliases:f,data:a,format:h,loadParser:l,parser:c}),d.push(m);});}),f.forEach(x=>{this._assetMap[x]=d;});});}resolveBundle(t){let e=Ea(t);t=Ye(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=Ea(t);t=Ye(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,parser:n,format:a}=e;return (this._basePath||this._rootPath)&&(t.src=Yt.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.parser=n??t.parser,t.format=a??t.format??r_(t.src),t}};Yi.RETINA_PREFIX=/@([0-9\.]+)x/;});var Fa,Vu=p(()=>{Fa=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i};});var Nu,Ba,Hu=p(()=>{Ht();Re();Bt();Nu=class Xi{constructor(t,e){this.linkedSheets=[];let r=t;t?.source instanceof wt&&(r={texture:t,data:e});let{texture:s,data:o,cachePrefix:n=""}=r;this.cachePrefix=n,this._texture=s instanceof I?s:null,this.textureSource=s.source,this.textures={},this.animations={},this.data=o;let a=parseFloat(o.meta.scale);a?(this.resolution=a,s.source.resolution=this.resolution):this.resolution=s.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<=Xi.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch();})}_processFrames(t){let e=t,r=Xi.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 J(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new J(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 J(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 J(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 I({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*Xi.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Xi.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=[];}};Nu.BATCH_SIZE=1e3;Ba=Nu;});function Yu(i,t,e){let r={};if(i.forEach(s=>{r[s]=t;}),Object.keys(t.textures).forEach(s=>{r[`${t.cachePrefix}${s}`]=t.textures[s];}),!e){let s=Yt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Yu([`${s}/${t.data.meta.related_multi_packs[n]}`],o,true);Object.assign(r,a);});}return r}var i_,Xu,$u=p(()=>{Ca();Wu();Vu();D();Bt();go();Hu();i_=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Xu={extension:w.Asset,cache:{test:i=>i instanceof Ba,getCacheableAssets:(i,t)=>Yu(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"&&i_.includes(s)},parse:i=>{let t=i.split(".");return {resolution:parseFloat(Yi.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:w.LoadParser,priority:Vr.Normal,name:"spritesheetLoader"},async testParse(i,t){return Yt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o,cachePrefix:n}=t?.data??{},a=Yt.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let h;if(r instanceof I)h=r;else {let u=Fa(a+(s??i.meta.image),t.src);h=(await e.load([{src:u,data:o}]))[u];}let l=new Ba({texture:h.source,data:i,cachePrefix:n});await l.parse();let c=i?.meta?.related_multi_packs;if(Array.isArray(c)){let u=[];for(let d of c){if(typeof d!="string")continue;let x=a+d;t.data?.ignoreMultiPack||(x=Fa(x,t.src),u.push(e.load({src:x,data:{textureOptions:o,ignoreMultiPack:true}})));}let f=await Promise.all(u);l.linkedSheets=f,f.forEach(d=>{d.linkedSheets=[l].concat(l.linkedSheets.filter(x=>x!==d));});}return l},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(false);}}};});var xo=p(()=>{D();$u();z.add(Xu);});function _o(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=p(()=>{});var $i,ju=p(()=>{Xn();Bt();ka();gt();Ma();$i=class i extends Wr{constructor(t=I.EMPTY){t instanceof I&&(t={texture:t});let{texture:e=I.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 Ct({_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 I?new i(t):new i(I.from(t,e))}set texture(t){t||(t=I.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 _o(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return R("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,this._gpuData=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 yo(i,t,e){let r=s_;i.measurable=true,Js(i,e,r),t.addBoundsMask(r),i.measurable=false;}var s_,Ga=p(()=>{he();eo();s_=new ft;});function bo(i,t,e){let r=Kt.get();i.measurable=true;let s=_t.get().identity(),o=Ku(i,e,s);io(i,r,o),i.measurable=false,t.addBoundsMask(r),_t.return(s),Kt.return(r);}function Ku(i,t,e){return i?(i!==t&&(Ku(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(X("Mask bounds, renderable is not inside the root container"),e)}var Ra=p(()=>{ea();ur();Rt();});var ji,qu=p(()=>{D();ju();Ga();Ra();ji=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 $i),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||yo(this.mask,t,e);}addLocalBounds(t,e){bo(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof $i}};ji.extension=w.MaskEffect;});var Ki,Zu=p(()=>{D();Ki=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"}};Ki.extension=w.MaskEffect;});var qi,Qu=p(()=>{D();Li();Ga();Ra();qi=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){yo(this.mask,t,e);}addLocalBounds(t,e){bo(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}};qi.extension=w.MaskEffect;});var Nr,Ju=p(()=>{Zt();D();Re();Nr=class extends wt{constructor(t){t.resource||(t.resource=nt.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"))}};Nr.extension=w.TextureSource;});var we,vo=p(()=>{D();Re();we=class extends wt{constructor(t){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}};we.extension=w.TextureSource;});async function td(){return Ia??(Ia=(async()=>{let t=nt.get().createCanvas(1,1).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"})()),Ia}var Ia,ed=p(()=>{Zt();});var So,id,sd=p(()=>{D();Ur();ed();Re();So=class rd extends wt{constructor(t){super(t),this.isReady=false,this.uploadMethodId="video",t={...rd.defaultOptions,...t},this._autoUpdate=true,this._isConnectedToTicker=false,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==false,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==false&&this.load();}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=mt.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t);}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update();}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback);}get isValid(){return !!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return (t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=true),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,true)),this.alphaMode=await td(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`));})),t.load());}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,true),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null);}_isSourcePlaying(){let t=this.resource;return !t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate();}_onPlayStop(){this._configureAutoUpdate();}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0);}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady();}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady();}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=true,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play();}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,true),t.pause(),t.src="",t.load()),super.destroy();}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate());}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate());}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(mt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(mt.shared.add(this.updateFrame,this),this._isConnectedToTicker=true,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(mt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0));}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};So.extension=w.TextureSource;So.defaultOptions={...wt.defaultOptions,autoLoad:true,autoPlay:true,updateFPS:0,crossorigin:true,loop:false,muted:true,playsinline:true,preload:false};So.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};id=So;});var Da,yt,Zi=p(()=>{Rt();Aa();Da=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||X(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Ye(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&&X("[Cache] already has key:",h),this._cache.set(h,o.get(h));});}remove(t){if(!this._cacheMap.has(t)){X(`[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}},yt=new Da;});function od(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 nd(i={},t=false){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&yt.has(r))return yt.get(r);let o=new I({source:od(s)});return o.on("destroy",()=>{yt.has(r)&&yt.remove(r);}),t||yt.set(r,o),o}function ad(i,t=false){return typeof i=="string"?yt.get(i):i instanceof wt?new I({source:i}):nd(i,t)}var La,Ua=p(()=>{Zi();D();Re();Bt();La=[];z.handleByList(w.TextureSource,La);I.from=ad;wt.from=od;});var To=p(()=>{D();qu();Zu();Qu();ha();Ju();vo();sd();Ua();z.add(ji,Ki,qi,id,we,Nr,gr);});var ne,Qi=p(()=>{ne=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 ld(i,t,e){let r=2166136261;for(let s=0;s<t;s++)r^=i[s].uid,r=Math.imul(r,16777619),r>>>=0;return hd[r]||o_(i,t,r,e)}function o_(i,t,e,r){let s={},o=0;for(let a=0;a<r;a++){let h=a<t?i[a]:I.EMPTY.source;s[o++]=h.source,s[o++]=h.style;}let n=new ne(s);return hd[e]=n,n}var hd,cd=p(()=>{Qi();Bt();hd={};});var Pe,Oa=p(()=>{Pe=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 za(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 ud=p(()=>{});var dd,fd=p(()=>{dd={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};});function Le(i,t){return t.alphaMode==="no-premultiply-alpha"&&dd[i]||i}var Ji=p(()=>{fd();});function Po(){return (!wo||wo?.isContextLost())&&(wo=nt.get().createCanvas().getContext("webgl",{})),wo}var wo,Wa=p(()=>{Zt();});function a_(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 pd(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=n_.replace(/%forloop%/gi,a_(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 n_,md=p(()=>{n_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
- `);});function gd(){if(Hr)return Hr;let i=Po();return Hr=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),Hr=pd(Hr,i),i.getExtension("WEBGL_lose_context")?.loseContext(),Hr}var Hr,xd=p(()=>{Wa();md();Hr=null;});var Mo,_d=p(()=>{Mo=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 yd(){return Na>0?vd[--Na]:new Va}function bd(i){vd[Na++]=i;}var Va,vd,Na,ts,Sd,wd,Pd=p(()=>{Ut();Oa();gt();ud();Ji();xd();_d();Va=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Mo,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=true;}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null;}},vd=[],Na=0;ts=0,Sd=class Td{constructor(t){this.uid=Q("batcher"),this.dirty=true,this.batchIndex=0,this.batches=[],this._elements=[],t={...Td.defaultOptions,...t},t.maxTextures||(R("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=gd());let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Pe(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++)bd(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=yd(),s=r.textures;s.clear();let o=e[this.elementStart],n=Le(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer,u=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",x=this.maxTextures;for(let y=this.elementStart;y<this.elementSize;++y){let m=e[y];e[y]=null;let b=m.texture._source,v=Le(m.blendMode,b),S=n!==v||a!==m.topology;if(b._batchTick===ts&&!S){m._textureId=b._textureBindLocation,u+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,h,l,m._attributeStart,m._textureId),this.packQuadIndex(c,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,h,l,m._attributeStart,m._textureId),this.packIndex(m,c,m._indexStart,m._attributeStart/this.vertexSize)),m._batch=r;continue}b._batchTick=ts,(s.count>=x||S)&&(this._finishBatch(r,f,u-f,s,n,a,t,d),d="renderBatch",f=u,n=v,a=m.topology,r=yd(),s=r.textures,s.clear(),++ts),m._textureId=b._textureBindLocation=s.count,s.ids[b.uid]=s.count,s.textures[s.count++]=b,m._batch=r,u+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,h,l,m._attributeStart,m._textureId),this.packQuadIndex(c,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,h,l,m._attributeStart,m._textureId),this.packIndex(m,c,m._indexStart,m._attributeStart/this.vertexSize));}s.count>0&&(this._finishBatch(r,f,u-f,s,n,a,t,d),f=u,++ts),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,++ts,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 Pe(e);za(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 za(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++)bd(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;}};Sd.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};wd=Sd;});var st,Yr=p(()=>{st=(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))(st||{});});var kt,Xr=p(()=>{Nt();Ut();Yr();kt=class extends q{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=Q("buffer"),this._resourceType="buffer",this._resourceId=Q("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&st.STATIC)}set static(t){t?this.descriptor.usage|=st.STATIC:this.descriptor.usage&=~st.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=Q("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 Ha(i,t){if(!(i instanceof kt)){let e=t?st.INDEX:st.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=st.INDEX|st.COPY_DST):(i=new Float32Array(i),e=st.VERTEX|st.COPY_DST)),i=new kt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e});}return i}var Md=p(()=>{Xr();Yr();});function Cd(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||8)/l;for(let f=c;f<s.length;f+=u){let d=s[f],x=s[f+1];d>a&&(a=d),x>h&&(h=x),d<o&&(o=d),x<n&&(n=x);}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=h,e}var Ad=p(()=>{});function h_(i){return (i instanceof kt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Ha(i.buffer,false),i}var Me,es=p(()=>{Nt();he();Ut();Xr();Md();Ad();Me=class extends q{constructor(t={}){super(),this.uid=Q("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=h_(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=Ha(t,true),this.buffers.push(this.indexBuffer);}get bounds(){return this._boundsDirty?(this._boundsDirty=false,Cd(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 l_,c_,Co,Ed=p(()=>{Xr();Yr();es();l_=new Float32Array(1),c_=new Uint32Array(1),Co=class extends Me{constructor(){let e=new kt({data:l_,label:"attribute-batch-buffer",usage:st.VERTEX|st.COPY_DST,shrinkToFit:false}),r=new kt({data:c_,label:"index-batch-buffer",usage:st.INDEX|st.COPY_DST,shrinkToFit:false}),s=24;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:16},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:20}},indexBuffer:r});}};});function $r(i,t){let e=Fd[i];return e===void 0&&(Ya[t]===void 0&&(Ya[t]=1),Fd[i]=e=Ya[t]++),e}var Ya,Fd,Ao=p(()=>{Ya=Object.create(null),Fd=Object.create(null);});function Bd(){if(!Eo){Eo="mediump";let i=Po();i&&i.getShaderPrecisionFormat&&(Eo=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump");}return Eo}var Eo,kd=p(()=>{Wa();});function Gd(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
22
-
23
- #ifdef GL_ES // This checks if it is WebGL1
24
- #define in varying
25
- #define finalColor gl_FragColor
26
- #define texture texture2D
27
- #endif
28
- ${i}
29
- `):`
30
-
31
- #ifdef GL_ES // This checks if it is WebGL1
32
- #define in attribute
33
- #define out varying
34
- #endif
35
- ${i}
36
- `}var Rd=p(()=>{});function Id(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 Dd=p(()=>{});function Ld(i,t){return t?`#version 300 es
38
- ${i}`:i}var Ud=p(()=>{});function Od(i,{name:t="pixi-program"},e=true){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?u_:d_;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 u_,d_,zd=p(()=>{u_={},d_={};});function Wd(i,t){return t?i.replace("#version 300 es",""):i}var Vd=p(()=>{});var Xa,$a,Nd,jr,Fo=p(()=>{Ao();kd();Rd();Dd();Ud();zd();Vd();Xa={stripVersion:Wd,ensurePrecision:Id,addProgramDefines:Gd,setProgramName:Od,insertVersion:Ld},$a=Object.create(null),Nd=class ja{constructor(t){t={...ja.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Bd()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(Xa).forEach(n=>{let a=r[n];s=Xa[n](s,a,true),o=Xa[n](o,a,false);}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=$r(`${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 $a[e]||($a[e]=new ja(t)),$a[e]}};Nd.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};jr=Nd;});function xr(i){return Hd[i]??Hd.float32}var Hd,Bo=p(()=>{Hd={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 Yd({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=f_[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:h,stride:xr(h).stride,offset:0,instance:false,start:0};}}}return e}var f_,Xd=p(()=>{Bo();f_={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 ko(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((x,y)=>{let[m,_]=y.split(":");return x[m.trim()]=_.trim(),x},{});return d?{name:f,members:d}:null}).filter(({name:u})=>l.some(f=>f.type===u))??[];return {groups:l,structs:c}}var $d=p(()=>{});var Kr,jd=p(()=>{Kr=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(Kr||{});});function Kd({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:Kr.VERTEX|Kr.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:Kr.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:Kr.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:false}});}return t}var qd=p(()=>{jd();});function Zd({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 Qd=p(()=>{});function Jd(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 tf=p(()=>{});var Ka,Xe,Go=p(()=>{Ao();Xd();$d();qd();Qd();tf();Ka=Object.create(null),Xe=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=ko(e.source);this.structsAndGroups=a;}else {let a=ko(r.source),h=ko(e.source);this.structsAndGroups=Jd(a,h);}this.layout=s??Zd(this.structsAndGroups),this.gpuLayout=o??Kd(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=$r(r,"program");}get attributeData(){return this._attributeData??(this._attributeData=Yd(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 Ka[e]||(Ka[e]=new i(t)),Ka[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 X(`${r} placement hook does not exist in shader`);}}var ef=p(()=>{Rt();});function Za(i){let t={};return (i.match(p_)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[];}),t}var p_,rf=p(()=>{p_=/\{\{(.*?)\}\}/g;});function sf(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function Qa(i,t,e=false){let r=[];sf(t,r),i.forEach(a=>{a.header&&sf(a.header,r);});let s=r;e&&s.sort();let o=s.map((a,h)=>` @location(${h}) ${a},`).join(`
40
- `),n=t.replace(/@in\s+[^;]+;\s*/g,"");return n=n.replace("{{in}}",`
41
- ${o}
42
- `),n}var of=p(()=>{});function nf(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1]);}function m_(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function g_(i){let t=/@.*?\s+/g;return i.replace(t,"")}function af(i,t){let e=[];nf(t,e),i.forEach(h=>{h.header&&nf(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 ${g_(h)};`).join(`
44
- `),n=`return VSOutput(
45
- ${e.sort().map(h=>` ${m_(h)}`).join(`,
46
- `)});`,a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
47
- ${s}
48
- `),a=a.replace("{{start}}",`
49
- ${o}
50
- `),a=a.replace("{{return}}",`
51
- ${n}
52
- `),a}var hf=p(()=>{});function Ja(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
53
- `).length?e=e.replace(`{{${r}}}`,`//-----${r} START-----//
54
- ${s.join(`
55
- `)}
56
- //----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"");}return e}var lf=p(()=>{});function cf({template:i,bits:t}){let e=df(i,t);if($e[e])return $e[e];let{vertex:r,fragment:s}=__(i,t);return $e[e]=ff(r,s,t),$e[e]}function uf({template:i,bits:t}){let e=df(i,t);return $e[e]||($e[e]=ff(i.vertex,i.fragment,t)),$e[e]}function __(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=Qa(e,i.vertex,true);s=af(e,s);let o=Qa(r,i.fragment,true);return {vertex:s,fragment:o}}function df(i,t){return t.map(e=>(th.has(e)||th.set(e,x_++),th.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function ff(i,t,e){let r=Za(i),s=Za(t);return e.forEach(o=>{qa(o.vertex,r,o.name),qa(o.fragment,s,o.name);}),{vertex:Ja(i,r),fragment:Ja(t,s)}}var $e,th,x_,pf=p(()=>{ef();rf();of();hf();lf();$e=Object.create(null),th=new Map,x_=0;});var mf,gf,xf,_f,yf=p(()=>{mf=`
57
- @in aPosition: vec2<f32>;
58
- @in aUV: vec2<f32>;
59
-
60
- @out @builtin(position) vPosition: vec4<f32>;
61
- @out vUV : vec2<f32>;
62
- @out vColor : vec4<f32>;
63
-
64
- {{header}}
65
-
66
- struct VSOutput {
67
- {{struct}}
68
- };
69
-
70
- @vertex
71
- fn main( {{in}} ) -> VSOutput {
72
-
73
- var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
74
- var modelMatrix = mat3x3<f32>(
75
- 1.0, 0.0, 0.0,
76
- 0.0, 1.0, 0.0,
77
- 0.0, 0.0, 1.0
78
- );
79
- var position = aPosition;
80
- var uv = aUV;
81
-
82
- {{start}}
83
-
84
- vColor = vec4<f32>(1., 1., 1., 1.);
85
-
86
- {{main}}
87
-
88
- vUV = uv;
89
-
90
- var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
91
-
92
- vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
93
-
94
- vColor *= globalUniforms.uWorldColorAlpha;
95
-
96
- {{end}}
97
-
98
- {{return}}
99
- };
100
- `,gf=`
101
- @in vUV : vec2<f32>;
102
- @in vColor : vec4<f32>;
103
-
104
- {{header}}
105
-
106
- @fragment
107
- fn main(
108
- {{in}}
109
- ) -> @location(0) vec4<f32> {
110
-
111
- {{start}}
112
-
113
- var outColor:vec4<f32>;
114
-
115
- {{main}}
116
-
117
- var finalColor:vec4<f32> = outColor * vColor;
118
-
119
- {{end}}
120
-
121
- return finalColor;
122
- };
123
- `,xf=`
124
- in vec2 aPosition;
125
- in vec2 aUV;
126
-
127
- out vec4 vColor;
128
- out vec2 vUV;
129
-
130
- {{header}}
131
-
132
- void main(void){
133
-
134
- mat3 worldTransformMatrix = uWorldTransformMatrix;
135
- mat3 modelMatrix = mat3(
136
- 1.0, 0.0, 0.0,
137
- 0.0, 1.0, 0.0,
138
- 0.0, 0.0, 1.0
139
- );
140
- vec2 position = aPosition;
141
- vec2 uv = aUV;
142
-
143
- {{start}}
144
-
145
- vColor = vec4(1.);
146
-
147
- {{main}}
148
-
149
- vUV = uv;
150
-
151
- mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
152
-
153
- gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
154
-
155
- vColor *= uWorldColorAlpha;
156
-
157
- {{end}}
158
- }
159
- `,_f=`
160
-
161
- in vec4 vColor;
162
- in vec2 vUV;
163
-
164
- out vec4 finalColor;
165
-
166
- {{header}}
167
-
168
- void main(void) {
169
-
170
- {{start}}
171
-
172
- vec4 outColor;
173
-
174
- {{main}}
175
-
176
- finalColor = outColor * vColor;
177
-
178
- {{end}}
179
- }
180
- `;});var bf,vf,Sf=p(()=>{bf={name:"global-uniforms-bit",vertex:{header:`
181
- struct GlobalUniforms {
182
- uProjectionMatrix:mat3x3<f32>,
183
- uWorldTransformMatrix:mat3x3<f32>,
184
- uWorldColorAlpha: vec4<f32>,
185
- uResolution: vec2<f32>,
186
- }
187
-
188
- @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
189
- `}},vf={name:"global-uniforms-bit",vertex:{header:`
190
- uniform mat3 uProjectionMatrix;
191
- uniform mat3 uWorldTransformMatrix;
192
- uniform vec4 uWorldColorAlpha;
193
- uniform vec2 uResolution;
194
- `}};});function qr({bits:i,name:t}){let e=cf({template:{fragment:gf,vertex:mf},bits:[bf,...i]});return Xe.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Zr({bits:i,name:t}){return new jr({name:t,...uf({template:{vertex:xf,fragment:_f},bits:[vf,...i]})})}var Ro=p(()=>{Fo();Go();pf();yf();Sf();});var Io,Do,eh=p(()=>{Io={name:"color-bit",vertex:{header:`
195
- @in aColor: vec4<f32>;
196
- `,main:`
197
- vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
198
- `}},Do={name:"color-bit",vertex:{header:`
199
- in vec4 aColor;
200
- `,main:`
201
- vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
202
- `}};});function y_(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 b_(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 Lo(i){return rh[i]||(rh[i]={name:"texture-batch-bit",vertex:{header:`
205
- @in aTextureIdAndRound: vec2<u32>;
206
- @out @interpolate(flat) vTextureId : u32;
207
- `,main:`
208
- vTextureId = aTextureIdAndRound.y;
209
- `,end:`
210
- if(aTextureIdAndRound.x == 1)
211
- {
212
- vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
213
- }
214
- `},fragment:{header:`
215
- @in @interpolate(flat) vTextureId: u32;
216
-
217
- ${y_(i)}
218
- `,main:`
219
- var uvDx = dpdx(vUV);
220
- var uvDy = dpdy(vUV);
221
-
222
- ${b_(i)}
223
- `}}),rh[i]}function v_(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 ih[i]||(ih[i]={name:"texture-batch-bit",vertex:{header:`
225
- in vec2 aTextureIdAndRound;
226
- out float vTextureId;
227
-
228
- `,main:`
229
- vTextureId = aTextureIdAndRound.y;
230
- `,end:`
231
- if(aTextureIdAndRound.x == 1.)
232
- {
233
- gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
234
- }
235
- `},fragment:{header:`
236
- in float vTextureId;
237
-
238
- uniform sampler2D uTextures[${i}];
239
-
240
- `,main:`
241
-
242
- ${v_(i)}
243
- `}}),ih[i]}var rh,ih,sh=p(()=>{rh={};ih={};});var Qr,Jr,Oo=p(()=>{Qr={name:"round-pixels-bit",vertex:{header:`
244
- fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
245
- {
246
- return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
247
- }
248
- `}},Jr={name:"round-pixels-bit",vertex:{header:`
249
- vec2 roundPixels(vec2 position, vec2 targetSize)
250
- {
251
- return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
252
- }
253
- `}};});var oh,Tf,wf=p(()=>{oh=["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>"],Tf=oh.reduce((i,t)=>(i[t]=true,i),{});});function Pf(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 Mf=p(()=>{});var Cf,zt,je=p(()=>{Ut();Ao();wf();Mf();Cf=class Af{constructor(t,e){this._touched=0,this.uid=Q("uniform"),this._resourceType="uniformGroup",this._resourceId=Q("resource"),this.isUniformGroup=true,this._dirtyId=0,this.destroyed=false,e={...Af.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,!Tf[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${oh.join(", ")}`);o.value??(o.value=Pf(o.type,o.size)),r[s]=o.value;}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=$r(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group");}update(){this._dirtyId++;}};Cf.defaultOptions={ubo:false,isStatic:false};zt=Cf;});function zo(i){let t=Ef[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=Ef[i]=new zt({uTextures:{value:e,type:"i32",size:i}},{isStatic:true}),t}var Ef,nh=p(()=>{je();Ef={};});var Ce,rs=p(()=>{Ce=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(Ce||{});});var Ae,is=p(()=>{Nt();Ut();Fo();Qi();Go();rs();je();Ae=class i extends q{constructor(t){super(),this.uid=Q("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|=Ce.WEBGPU),r&&(n|=Ce.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 ne,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 ne,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 ne,this._ownedBindGroups.push(this.groups[e]));}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding);}});}return r}destroy(t=false){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy();}),this._ownedBindGroups=null,this.resources=null,this.groups=null;}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=Xe.from(e)),r&&(n=jr.from(r)),new i({gpuProgram:o,glProgram:n,...s})}};});var Wo,Ff=p(()=>{Ro();eh();sh();Oo();nh();is();Wo=class extends Ae{constructor(t){let e=Zr({name:"batch",bits:[Do,Uo(t),Jr]}),r=qr({name:"batch",bits:[Io,Lo(t),Qr]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:zo(t)}});}};});var ah,Bf,Gf,Rf=p(()=>{D();Pd();Ed();Ff();ah=null,Bf=class kf extends wd{constructor(t){super(t),this.geometry=new Co,this.name=kf.extension.name,this.vertexSize=6,ah??(ah=new Wo(t.maxTextures)),this.shader=ah;}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:x,uvs:y}=t,m=t.color,_=t.attributeOffset,b=_+t.attributeSize;for(let v=_;v<b;v++){let S=v*2,M=x[S],T=x[S+1];e[s++]=h*M+c*T+f,e[s++]=u*T+l*M+d,e[s++]=y[S],e[s++]=y[S+1],r[s++]=m,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,x=t.bounds,y=x.maxX,m=x.minX,_=x.maxY,b=x.minY,v=n.uvs,S=t.color,M=o<<16|t.roundPixels&65535;e[s+0]=h*m+c*b+f,e[s+1]=u*b+l*m+d,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=S,r[s+5]=M,e[s+6]=h*y+c*b+f,e[s+7]=u*b+l*y+d,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=S,r[s+11]=M,e[s+12]=h*y+c*_+f,e[s+13]=u*_+l*y+d,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=S,r[s+17]=M,e[s+18]=h*m+c*_+f,e[s+19]=u*_+l*m+d,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=S,r[s+23]=M;}};Bf.extension={type:[w.Batcher],name:"default"};Gf=Bf;});function If(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,x=a.ty;for(;h<n;){let y=i[e],m=i[e+1];r[s]=l*y+u*m+d,r[s+1]=c*y+f*m+x,s+=o,e+=t,h++;}}function Df(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++;}var Lf=p(()=>{});function hh(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],x=i[u+1];i[u]=o*d+a*x+l,i[u+1]=n*d+h*x+c,u+=r;}}var Uf=p(()=>{});var S_,_r,lh=p(()=>{ht();Jn();S_=new E,_r=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.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?ro(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||S_}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 ti,Of,zf,Wf=p(()=>{D();ti={extension:{type:w.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let S=i;if(n=a=S.radius,n<=0)return false;e=S.x,r=S.y,s=o=0;}else if(i.type==="ellipse"){let S=i;if(n=S.halfWidth,a=S.halfHeight,n<=0||a<=0)return false;e=S.x,r=S.y,s=o=0;}else {let S=i,M=S.width/2,T=S.height/2;e=S.x+M,r=S.y+T,n=a=Math.max(0,Math.min(S.radius,Math.min(M,T))),s=M-n,o=T-a;}if(s<0||o<0)return false;let h=Math.ceil(2.3*Math.sqrt(n+a)),l=h*8+(s?4:0)+(o?4:0);if(l===0)return false;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,true;let c=0,u=h*4+(s?2:0)+2,f=u,d=l,x=s+n,y=o,m=e+x,_=e-x,b=r+y;if(t[c++]=m,t[c++]=b,t[--u]=b,t[--u]=_,o){let S=r-y;t[f++]=_,t[f++]=S,t[--d]=S,t[--d]=m;}for(let S=1;S<h;S++){let M=Math.PI/2*(S/h),T=s+Math.cos(M)*n,P=o+Math.sin(M)*a,U=e+T,A=e-T,F=r+P,B=r-P;t[c++]=U,t[c++]=F,t[--u]=F,t[--u]=A,t[f++]=A,t[f++]=B,t[--d]=B,t[--d]=U;}x=s,y=o+a,m=e+x,_=e-x,b=r+y;let v=r-y;return t[c++]=m,t[c++]=b,t[--d]=v,t[--d]=m,s&&(t[c++]=_,t[c++]=b,t[--d]=v,t[--d]=_),true},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;}},Of={...ti,extension:{...ti.extension,name:"ellipse"}},zf={...ti,extension:{...ti.extension,name:"roundedRectangle"}};});function Vf(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 Nf=p(()=>{});function Hf(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 x=h+f,y=l+d,m=c+f,_=u+d;return a.push(x,y),a.push(m,_),2}function yr(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,x=Math.abs(d),y=Math.sqrt(h*h+l*l),m=(15*x*Math.sqrt(y)/Math.PI>>0)+1,_=d/m;if(f+=_,a){n.push(i,t),n.push(e,r);for(let b=1,v=f;b<m;b++,v+=_)n.push(i,t),n.push(i+Math.sin(v)*y,t+Math.cos(v)*y);n.push(i,t),n.push(s,o);}else {n.push(e,r),n.push(i,t);for(let b=1,v=f;b<m;b++,v+=_)n.push(i+Math.sin(v)*y,t+Math.cos(v)*y),n.push(i,t);n.push(s,o),n.push(i,t);}return m*2}function Yf(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 at=Vf(i);h=(h-.5)*at+.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 at=(l.x+c.x)*.5,Ne=(c.y+l.y)*.5;i.unshift(at,Ne),i.push(at,Ne);}let d=s,x=i.length/2,y=i.length,m=d.length/2,_=a.width/2,b=_*_,v=a.miterLimit*a.miterLimit,S=i[0],M=i[1],T=i[2],P=i[3],U=0,A=0,F=-(M-P),B=S-T,Y=0,tt=0,Ft=Math.sqrt(F*F+B*B);F/=Ft,B/=Ft,F*=_,B*=_;let Pi=h,N=(1-Pi)*2,$=Pi*2;u||(a.cap==="round"?y+=yr(S-F*(N-$)*.5,M-B*(N-$)*.5,S-F*N,M-B*N,S+F*$,M+B*$,d,true)+2:a.cap==="square"&&(y+=Hf(S,M,F,B,N,$,true,d))),d.push(S-F*N,M-B*N),d.push(S+F*$,M+B*$);for(let at=1;at<x-1;++at){S=i[(at-1)*2],M=i[(at-1)*2+1],T=i[at*2],P=i[at*2+1],U=i[(at+1)*2],A=i[(at+1)*2+1],F=-(M-P),B=S-T,Ft=Math.sqrt(F*F+B*B),F/=Ft,B/=Ft,F*=_,B*=_,Y=-(P-A),tt=T-U,Ft=Math.sqrt(Y*Y+tt*tt),Y/=Ft,tt/=Ft,Y*=_,tt*=_;let Ne=T-S,Mi=M-P,Ci=T-U,Ai=A-P,Bl=Ne*Ci+Mi*Ai,Ls=Mi*Ci-Ai*Ne,Ei=Ls<0;if(Math.abs(Ls)<.001*Math.abs(Bl)){d.push(T-F*N,P-B*N),d.push(T+F*$,P+B*$),Bl>=0&&(a.join==="round"?y+=yr(T,P,T-F*N,P-B*N,T-Y*N,P-tt*N,d,false)+4:y+=2,d.push(T-Y*$,P-tt*$),d.push(T+Y*N,P+tt*N));continue}let kl=(-F+S)*(-B+P)-(-F+T)*(-B+M),Gl=(-Y+U)*(-tt+P)-(-Y+T)*(-tt+A),Us=(Ne*Gl-Ci*kl)/Ls,Os=(Ai*kl-Mi*Gl)/Ls,In=(Us-T)*(Us-T)+(Os-P)*(Os-P),or=T+(Us-T)*N,nr=P+(Os-P)*N,ar=T-(Us-T)*$,hr=P-(Os-P)*$,fx=Math.min(Ne*Ne+Mi*Mi,Ci*Ci+Ai*Ai),Rl=Ei?N:$,px=fx+Rl*Rl*b;In<=px?a.join==="bevel"||In/b>v?(Ei?(d.push(or,nr),d.push(T+F*$,P+B*$),d.push(or,nr),d.push(T+Y*$,P+tt*$)):(d.push(T-F*N,P-B*N),d.push(ar,hr),d.push(T-Y*N,P-tt*N),d.push(ar,hr)),y+=2):a.join==="round"?Ei?(d.push(or,nr),d.push(T+F*$,P+B*$),y+=yr(T,P,T+F*$,P+B*$,T+Y*$,P+tt*$,d,true)+4,d.push(or,nr),d.push(T+Y*$,P+tt*$)):(d.push(T-F*N,P-B*N),d.push(ar,hr),y+=yr(T,P,T-F*N,P-B*N,T-Y*N,P-tt*N,d,false)+4,d.push(T-Y*N,P-tt*N),d.push(ar,hr)):(d.push(or,nr),d.push(ar,hr)):(d.push(T-F*N,P-B*N),d.push(T+F*$,P+B*$),a.join==="round"?Ei?y+=yr(T,P,T+F*$,P+B*$,T+Y*$,P+tt*$,d,true)+2:y+=yr(T,P,T-F*N,P-B*N,T-Y*N,P-tt*N,d,false)+2:a.join==="miter"&&In/b<=v&&(Ei?(d.push(ar,hr),d.push(ar,hr)):(d.push(or,nr),d.push(or,nr)),y+=2),d.push(T-Y*N,P-tt*N),d.push(T+Y*$,P+tt*$),y+=2);}S=i[(x-2)*2],M=i[(x-2)*2+1],T=i[(x-1)*2],P=i[(x-1)*2+1],F=-(M-P),B=S-T,Ft=Math.sqrt(F*F+B*B),F/=Ft,B/=Ft,F*=_,B*=_,d.push(T-F*N,P-B*N),d.push(T+F*$,P+B*$),u||(a.cap==="round"?y+=yr(T-F*(N-$)*.5,P-B*(N-$)*.5,T-F*N,P-B*N,T+F*$,P+B*$,d,false)+2:a.cap==="square"&&(y+=Hf(T,P,F,B,N,$,false,d)));let dx=1e-4*1e-4;for(let at=m;at<y+m-2;++at)S=d[at*2],M=d[at*2+1],T=d[(at+1)*2],P=d[(at+1)*2+1],U=d[(at+2)*2],A=d[(at+2)*2+1],!(Math.abs(S*(P-A)+T*(A-M)+U*(M-P))<dx)&&o.push(at,at+1,at+2);}var Xf=p(()=>{be();Nf();});function $f(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 jf=p(()=>{});function Ho(i,t,e=2){let r=t&&t.length,s=r?t[0]*e:i.length,o=qf(i,0,s,e,true),n=[];if(!o||o.next===o.prev)return n;let a,h,l;if(r&&(o=E_(i,t,o,e)),i.length>80*e){a=i[0],h=i[1];let c=a,u=h;for(let f=e;f<s;f+=e){let d=i[f],x=i[f+1];d<a&&(a=d),x<h&&(h=x),d>c&&(c=d),x>u&&(u=x);}l=Math.max(c-a,u-h),l=l!==0?32767/l:0;}return os(o,n,e,a,h,l,0),n}function qf(i,t,e,r,s){let o;if(s===z_(i,t,e,r)>0)for(let n=t;n<e;n+=r)o=Kf(n/r|0,i[n],i[n+1],o);else for(let n=e-r;n>=t;n-=r)o=Kf(n/r|0,i[n],i[n+1],o);return o&&ei(o,o.next)&&(as(o),o=o.next),o}function br(i,t){if(!i)return i;t||(t=i);let e=i,r;do if(r=false,!e.steiner&&(ei(e,e.next)||pt(e.prev,e,e.next)===0)){if(as(e),e=t=e.prev,e===e.next)break;r=true;}else e=e.next;while(r||e!==t);return t}function os(i,t,e,r,s,o,n){if(!i)return;!n&&o&&R_(i,r,s,o);let a=i;for(;i.prev!==i.next;){let h=i.prev,l=i.next;if(o?M_(i,r,s,o):P_(i)){t.push(h.i,i.i,l.i),as(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=C_(br(i),t),os(i,t,e,r,s,o,2)):n===2&&A_(i,t,e,r,s,o):os(br(i),t,e,r,s,o,1);break}}}function P_(i){let t=i.prev,e=i,r=i.next;if(pt(t,e,r)>=0)return false;let s=t.x,o=e.x,n=r.x,a=t.y,h=e.y,l=r.y,c=Math.min(s,o,n),u=Math.min(a,h,l),f=Math.max(s,o,n),d=Math.max(a,h,l),x=r.next;for(;x!==t;){if(x.x>=c&&x.x<=f&&x.y>=u&&x.y<=d&&ss(s,a,o,h,n,l,x.x,x.y)&&pt(x.prev,x,x.next)>=0)return false;x=x.next;}return true}function M_(i,t,e,r){let s=i.prev,o=i,n=i.next;if(pt(s,o,n)>=0)return false;let a=s.x,h=o.x,l=n.x,c=s.y,u=o.y,f=n.y,d=Math.min(a,h,l),x=Math.min(c,u,f),y=Math.max(a,h,l),m=Math.max(c,u,f),_=ch(d,x,t,e,r),b=ch(y,m,t,e,r),v=i.prevZ,S=i.nextZ;for(;v&&v.z>=_&&S&&S.z<=b;){if(v.x>=d&&v.x<=y&&v.y>=x&&v.y<=m&&v!==s&&v!==n&&ss(a,c,h,u,l,f,v.x,v.y)&&pt(v.prev,v,v.next)>=0||(v=v.prevZ,S.x>=d&&S.x<=y&&S.y>=x&&S.y<=m&&S!==s&&S!==n&&ss(a,c,h,u,l,f,S.x,S.y)&&pt(S.prev,S,S.next)>=0))return false;S=S.nextZ;}for(;v&&v.z>=_;){if(v.x>=d&&v.x<=y&&v.y>=x&&v.y<=m&&v!==s&&v!==n&&ss(a,c,h,u,l,f,v.x,v.y)&&pt(v.prev,v,v.next)>=0)return false;v=v.prevZ;}for(;S&&S.z<=b;){if(S.x>=d&&S.x<=y&&S.y>=x&&S.y<=m&&S!==s&&S!==n&&ss(a,c,h,u,l,f,S.x,S.y)&&pt(S.prev,S,S.next)>=0)return false;S=S.nextZ;}return true}function C_(i,t){let e=i;do{let r=e.prev,s=e.next.next;!ei(r,s)&&Qf(r,e,e.next,s)&&ns(r,s)&&ns(s,r)&&(t.push(r.i,e.i,s.i),as(e),as(e.next),e=i=s),e=e.next;}while(e!==i);return br(e)}function A_(i,t,e,r,s,o){let n=i;do{let a=n.next.next;for(;a!==n.prev;){if(n.i!==a.i&&L_(n,a)){let h=Jf(n,a);n=br(n,n.next),h=br(h,h.next),os(n,t,e,r,s,o,0),os(h,t,e,r,s,o,0);return}a=a.next;}n=n.next;}while(n!==i)}function E_(i,t,e,r){let s=[];for(let o=0,n=t.length;o<n;o++){let a=t[o]*r,h=o<n-1?t[o+1]*r:i.length,l=qf(i,a,h,r,false);l===l.next&&(l.steiner=true),s.push(D_(l));}s.sort(F_);for(let o=0;o<s.length;o++)e=B_(s[o],e);return e}function F_(i,t){let e=i.x-t.x;if(e===0&&(e=i.y-t.y,e===0)){let r=(i.next.y-i.y)/(i.next.x-i.x),s=(t.next.y-t.y)/(t.next.x-t.x);e=r-s;}return e}function B_(i,t){let e=k_(i,t);if(!e)return t;let r=Jf(e,i);return br(r,r.next),br(e,e.next)}function k_(i,t){let e=t,r=i.x,s=i.y,o=-1/0,n;if(ei(i,e))return e;do{if(ei(i,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let u=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(u<=r&&u>o&&(o=u,n=e.x<e.next.x?e:e.next,u===r))return n}e=e.next;}while(e!==t);if(!n)return null;let a=n,h=n.x,l=n.y,c=1/0;e=n;do{if(r>=e.x&&e.x>=h&&r!==e.x&&Zf(s<l?r:o,s,h,l,s<l?o:r,s,e.x,e.y)){let u=Math.abs(s-e.y)/(r-e.x);ns(e,i)&&(u<c||u===c&&(e.x>n.x||e.x===n.x&&G_(n,e)))&&(n=e,c=u);}e=e.next;}while(e!==a);return n}function G_(i,t){return pt(i.prev,i,t.prev)<0&&pt(t.next,i,i.next)<0}function R_(i,t,e,r){let s=i;do s.z===0&&(s.z=ch(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,I_(s);}function I_(i){let t,e=1;do{let r=i,s;i=null;let o=null;for(t=0;r;){t++;let n=r,a=0;for(let l=0;l<e&&(a++,n=n.nextZ,!!n);l++);let h=e;for(;a>0||h>0&&n;)a!==0&&(h===0||!n||r.z<=n.z)?(s=r,r=r.nextZ,a--):(s=n,n=n.nextZ,h--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;r=n;}o.nextZ=null,e*=2;}while(t>1);return i}function ch(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 D_(i){let 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 Zf(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 ss(i,t,e,r,s,o,n,a){return !(i===n&&t===a)&&Zf(i,t,e,r,s,o,n,a)}function L_(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!U_(i,t)&&(ns(i,t)&&ns(t,i)&&O_(i,t)&&(pt(i.prev,i,t.prev)||pt(i,t.prev,t))||ei(i,t)&&pt(i.prev,i,i.next)>0&&pt(t.prev,t,t.next)>0)}function pt(i,t,e){return (t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function ei(i,t){return i.x===t.x&&i.y===t.y}function Qf(i,t,e,r){let s=No(pt(i,t,e)),o=No(pt(i,t,r)),n=No(pt(e,r,i)),a=No(pt(e,r,t));return !!(s!==o&&n!==a||s===0&&Vo(i,e,t)||o===0&&Vo(i,r,t)||n===0&&Vo(e,i,r)||a===0&&Vo(e,t,r))}function Vo(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 No(i){return i>0?1:i<0?-1:0}function U_(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Qf(e,e.next,i,t))return true;e=e.next;}while(e!==i);return false}function ns(i,t){return pt(i.prev,i,i.next)<0?pt(i,t,i.next)>=0&&pt(i,i.prev,t)>=0:pt(i,t,i.prev)<0||pt(i,i.next,t)<0}function O_(i,t){let 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 Jf(i,t){let e=uh(i.i,i.x,i.y),r=uh(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 Kf(i,t,e,r){let s=uh(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 as(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 uh(i,t,e){return {i,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:false}}function z_(i,t,e,r){let s=0;for(let o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}var tp=p(()=>{});var ep,rp=p(()=>{tp();Nt();ep=Ho.default||Ho;});function Yo(i,t,e,r,s,o,n){let a=ep(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 dh=p(()=>{rp();});var W_,ip,sp=p(()=>{D();dh();W_=[],ip={extension:{type:w.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return true},triangulate(i,t,e,r,s,o){Yo(i,W_,t,e,r,s,o);}};});var op,np=p(()=>{D();op={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,true):false},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 ap,hp=p(()=>{D();ap={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,true},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 cp(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color);}}function up(i,t){let e=nt.get().createCanvas(i,t),r=e.getContext("2d");return {canvas:e,context:r}}function V_(i){let t=i[0]??{};return (typeof t=="number"||i[1])&&(R("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]??Xt.defaultLinearOptions.textureSize}),t}var lp,ph,Xt,ri=p(()=>{jt();Zt();ht();vo();Bt();Ut();gt();oa();lp=[{offset:0,color:"white"},{offset:1,color:"black"}],ph=class fh{constructor(...t){this.uid=Q("fillGradient"),this.type="linear",this.colorStops=[];let e=V_(t);e={...e.type==="radial"?fh.defaultRadialOptions:fh.defaultLinearOptions,...so(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:it.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 m=t;t=r,r=m,o*=-1;}if(n<0){let m=e;e=s,s=m,n*=-1;}}let h=this.colorStops.length?this.colorStops:lp,l=this._textureSize,{canvas:c,context:u}=up(l,1),f=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);cp(f,h),u.fillStyle=f,u.fillRect(0,0,l,1),this.texture=new I({source:new we({resource:c,addressMode:this._wrapMode})});let d=Math.sqrt(o*o+n*n),x=Math.atan2(n,o),y=new E;y.scale(d/l,1),y.rotate(x),y.translate(t,e),this.textureSpace==="local"&&y.scale(l,l),this.transform=y;}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient();}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:lp,e=this._textureSize,{canvas:r,context:s}=up(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),x=(o-u)*d,y=(n-f)*d,m=s.createRadialGradient(x,y,l*d,(a-u)*d,(h-f)*d,c*d);cp(m,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=m,s.translate(x,y),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-x,-y),s.fillRect(0,0,e,e),this.texture=new I({source:new we({resource:r,addressMode:this._wrapMode})});let _=new E;_.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,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null;}};ph.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};ph.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Xt=ph;});function dp(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(H_);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,x=s.b,y=s.c,m=s.d;s.a*=l,s.b*=l,s.c*=c,s.d*=c,s.tx=u*d+f*y+s.tx,s.ty=u*x+f*m+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 Xt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(N_.copyFrom(r).invert()),s}var N_,H_,fp=p(()=>{ht();Ht();ri();N_=new E,H_=new J;});function mp(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")$_(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&&pp(l.shapePath,h,true,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),pp(a,h,n,r,e);}}}function $_(i,t,e){let r=[],s=Xo.rectangle,o=Y_;o.x=i.dx,o.y=i.dy,o.width=i.dw,o.height=i.dh;let n=i.transform;if(!s.build(o,r))return;let{vertices:a,uvs:h,indices:l}=e,c=l.length,u=a.length/2;n&&hh(r,n),s.triangulate(r,a,2,u,l,c);let f=i.image,d=f.uvs;h.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);let x=Tt.get(_r);x.indexOffset=c,x.indexSize=l.length-c,x.attributeOffset=u,x.attributeSize=a.length/2-u,x.baseColor=i.style,x.alpha=i.alpha,x.texture=f,x.geometryData=e,t.push(x);}function pp(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{let u=[],f=Xo[h.type];if(!f.build(h,u))return;let d=a.length,x=o.length/2,y="triangle-list";if(l&&hh(u,l),e){let v=h.closePath??true,S=t;S.pixelLine?($f(u,v,o,a),y="line-list"):Yf(u,S,false,v,o,a);}else if(c){let v=[],S=u.slice();j_(c).forEach(T=>{v.push(S.length/2),S.push(...T);}),Yo(S,v,o,2,x,a,d);}else f.triangulate(u,o,2,x,a,d);let m=n.length/2,_=t.texture;if(_!==I.WHITE){let v=dp(X_,t,h,l);If(o,2,x,n,m,2,o.length/2-x,v);}else Df(n,m,2,o.length/2-x);let b=Tt.get(_r);b.indexOffset=d,b.indexSize=a.length-d,b.attributeOffset=x,b.attributeSize=o.length/2-x,b.baseColor=t.color,b.alpha=t.alpha,b.texture=_,b.geometryData=s,b.topology=y,r.push(b);});}function j_(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];Xo[r.type].build(r,s)&&t.push(s);}return t}var Xo,Y_,X_,gp=p(()=>{D();ht();Ht();Lf();Uf();Bt();cr();lh();Wf();Xf();jf();sp();np();hp();fp();dh();Xo={};z.handleByMap(w.ShapeBuilder,Xo);z.add(op,ip,ap,ti,Of,zf);Y_=new J,X_=new E;});var mh,gh,_h,ii,$o=p(()=>{D();cd();Rf();ia();gt();cr();gp();mh=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]};}},gh=class{constructor(){this.instructions=new Rr;}init(t){this.batcher=new Gf({maxTextures:t}),this.instructions.reset();}get geometry(){return R(lc,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},_h=class xh{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash");}init(t){xh.defaultOptions.bezierSmoothness=t?.bezierSmoothness??xh.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),mp(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=false:r==="auto"?e.isBatchable=e.geometryData.vertices.length<400:e.isBatchable=true,t.dirty=false;}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=Tt.get(gh,{maxTextures:this._renderer.limits.maxBatchableTextures}),{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=ld(u.textures.textures,u.textures.count,this._renderer.limits.maxBatchableTextures);}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new mh;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]&&(Tt.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{Tt.return(r);});}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context);}};_h.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"graphicsContext"};_h.defaultOptions={bezierSmoothness:.5};ii=_h;});var K_,yh,bh,vh,Sh,Th,wh,Ph,vr,jo=p(()=>{K_={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},yh=0,bh=1,vh=2,Sh=3,Th=4,wh=5,Ph=class xp{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=true,this.depthMask=true;}get blend(){return !!(this.data&1<<yh)}set blend(t){!!(this.data&1<<yh)!==t&&(this.data^=1<<yh);}get offsets(){return !!(this.data&1<<bh)}set offsets(t){!!(this.data&1<<bh)!==t&&(this.data^=1<<bh);}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<<vh)}set culling(t){!!(this.data&1<<vh)!==t&&(this.data^=1<<vh);}get depthTest(){return !!(this.data&1<<Sh)}set depthTest(t){!!(this.data&1<<Sh)!==t&&(this.data^=1<<Sh);}get depthMask(){return !!(this.data&1<<wh)}set depthMask(t){!!(this.data&1<<wh)!==t&&(this.data^=1<<wh);}get clockwiseFrontFace(){return !!(this.data&1<<Th)}set clockwiseFrontFace(t){!!(this.data&1<<Th)!==t&&(this.data^=1<<Th);}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=K_[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 xp;return t.depthTest=false,t.blend=true,t}};Ph.default2d=Ph.for2d();vr=Ph;});function Ke(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 hs=p(()=>{});var Mh,ls,_p=p(()=>{D();jo();cr();hs();lh();Mh=class{constructor(){this.batches=[],this.batched=false;}destroy(){this.batches.forEach(t=>{Tt.return(t);}),this.batches.length=0;}},ls=class{constructor(t,e){this.state=vr.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this);}contextChange(){this._adaptor.contextChange(this.renderer);}validateRenderable(t){let e=t.context,r=!!t._gpuData,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 r=this._getGpuDataForRenderable(t).batches;for(let s=0;s<r.length;s++){let o=r[s];o._batcher.updateElement(o);}}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,Ke(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t);}_rebuild(t){let e=this._getGpuDataForRenderable(t),r=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),r.isBatchable&&this._updateBatchesForRenderable(t,e);}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getGpuDataForRenderable(t).batches;for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e);}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){let e=new Mh;return t._gpuData[this.renderer.uid]=e,e}_updateBatchesForRenderable(t,e){let r=t.context,s=this.renderer.graphicsContext.getGpuContext(r),o=this.renderer._roundPixels|t._roundPixels;e.batches=s.batches.map(n=>{let a=Tt.get(_r);return n.copyTo(a),a.renderable=t,a.roundPixels=o,a});}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;}};ls.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"graphics"};});var Ch=p(()=>{D();$o();_p();z.add(ls);z.add(ii);});var qe,Ko=p(()=>{qe=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 qo,cs,yp=p(()=>{D();ht();Qi();je();Ji();hs();Ko();qo=class{destroy(){}},cs=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 ne({0:this.localUniforms}),this.renderer=t,this._adaptor=e,this._adaptor.init();}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,s=this._getMeshData(t);if(t.didViewUpdate&&(s.indexSize=t._geometry.indices?.length,s.vertexSize=t._geometry.positions?.length),s.batched){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._getBatchableMesh(t);e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e);}}execute(t){if(!t.isRenderable)return;t.state.blendMode=Le(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Ke(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t);}_getMeshData(t){var e,r;return (e=t._gpuData)[r=this.renderer.uid]||(e[r]=new qo),t._gpuData[this.renderer.uid].meshData||this._initMeshData(t)}_initMeshData(t){return t._gpuData[this.renderer.uid].meshData={batched:t.batched,indexSize:0,vertexSize:0},t._gpuData[this.renderer.uid].meshData}_getBatchableMesh(t){var e,r;return (e=t._gpuData)[r=this.renderer.uid]||(e[r]=new qo),t._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=new qe;return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,t._gpuData[this.renderer.uid].batchableMesh=e,e}destroy(){this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null;}};cs.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"mesh"};});var Ah=p(()=>{D();yp();z.add(cs);});var Zo,bp=p(()=>{Zo=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 Eh(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 vp=p(()=>{});function Tp(i){return {dynamicUpdate:Sp(i,true),staticUpdate:Sp(i,false)}}function Sp(i,t){let e=[];e.push(`
254
-
255
- var index = 0;
256
-
257
- for (let i = 0; i < ps.length; ++i)
258
- {
259
- const p = ps[i];
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=xr(n.format);r+=a.stride/4;}e.push(`
262
- index += stride * 4;
263
- }
264
- `),e.unshift(`
265
- var stride = ${r};
266
- `);let s=e.join(`
267
- `);return new Function("ps","f32v","u32v",s)}var wp=p(()=>{Bo();});function q_(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 Qo,Pp=p(()=>{Xr();Yr();es();Bo();Oa();vp();wp();Qo=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=xr(u.format);u.dynamic?o+=f.stride:s+=f.stride;}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Pe(e*4*s),this.dynamicAttributeBuffer=new Pe(e*4*o),this.indexBuffer=Eh(e);let n=new Me,a=0,h=0;this._staticBuffer=new kt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:false,usage:st.VERTEX|st.COPY_DST}),this._dynamicBuffer=new kt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:false,usage:st.VERTEX|st.COPY_DST});for(let c in r){let u=r[c],f=xr(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=q_(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return Tp(t)}update(t,e){t.length>this._size&&(e=true,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Pe(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Pe(this._size*this._dynamicStride*4*4),this.indexBuffer=Eh(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 Mp,Cp=p(()=>{Mp=`varying vec2 vUV;
268
- varying vec4 vColor;
269
-
270
- uniform sampler2D uTexture;
271
-
272
- void main(void){
273
- vec4 color = texture2D(uTexture, vUV) * vColor;
274
- gl_FragColor = color;
275
- }`;});var Ap,Ep=p(()=>{Ap=`attribute vec2 aVertex;
276
- attribute vec2 aUV;
277
- attribute vec4 aColor;
278
-
279
- attribute vec2 aPosition;
280
- attribute float aRotation;
281
-
282
- uniform mat3 uTranslationMatrix;
283
- uniform float uRound;
284
- uniform vec2 uResolution;
285
- uniform vec4 uColor;
286
-
287
- varying vec2 vUV;
288
- varying vec4 vColor;
289
-
290
- vec2 roundPixels(vec2 position, vec2 targetSize)
291
- {
292
- return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
293
- }
294
-
295
- void main(void){
296
- float cosRotation = cos(aRotation);
297
- float sinRotation = sin(aRotation);
298
- float x = aVertex.x * cosRotation - aVertex.y * sinRotation;
299
- float y = aVertex.x * sinRotation + aVertex.y * cosRotation;
300
-
301
- vec2 v = vec2(x, y);
302
- v = v + aPosition;
303
-
304
- gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
305
-
306
- if(uRound == 1.0)
307
- {
308
- gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
309
- }
310
-
311
- vUV = aUV;
312
- vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
313
- }
314
- `;});var Fh,Fp=p(()=>{Fh=`
315
- struct ParticleUniforms {
316
- uProjectionMatrix:mat3x3<f32>,
317
- uColor:vec4<f32>,
318
- uResolution:vec2<f32>,
319
- uRoundPixels:f32,
320
- };
321
-
322
- @group(0) @binding(0) var<uniform> uniforms: ParticleUniforms;
323
-
324
- @group(1) @binding(0) var uTexture: texture_2d<f32>;
325
- @group(1) @binding(1) var uSampler : sampler;
326
-
327
- struct VSOutput {
328
- @builtin(position) position: vec4<f32>,
329
- @location(0) uv : vec2<f32>,
330
- @location(1) color : vec4<f32>,
331
- };
332
- @vertex
333
- fn mainVertex(
334
- @location(0) aVertex: vec2<f32>,
335
- @location(1) aPosition: vec2<f32>,
336
- @location(2) aUV: vec2<f32>,
337
- @location(3) aColor: vec4<f32>,
338
- @location(4) aRotation: f32,
339
- ) -> VSOutput {
340
-
341
- let v = vec2(
342
- aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation),
343
- aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation)
344
- ) + aPosition;
345
-
346
- let position = vec4((uniforms.uProjectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
347
-
348
- let vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uniforms.uColor;
349
-
350
- return VSOutput(
351
- position,
352
- aUV,
353
- vColor,
354
- );
355
- }
356
-
357
- @fragment
358
- fn mainFragment(
359
- @location(0) uv: vec2<f32>,
360
- @location(1) color: vec4<f32>,
361
- @builtin(position) position: vec4<f32>,
362
- ) -> @location(0) vec4<f32> {
363
-
364
- var sample = textureSample(uTexture, uSampler, uv) * color;
365
-
366
- return sample;
367
- }`;});var Jo,Bp=p(()=>{jt();ht();Fo();Go();is();Bt();Ir();Cp();Ep();Fp();Jo=class extends Ae{constructor(){let t=jr.from({vertex:Ap,fragment:Mp}),e=Xe.from({fragment:{source:Fh,entryPoint:"mainFragment"},vertex:{source:Fh,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:I.WHITE.source,uSampler:new oe({}),uniforms:{uTranslationMatrix:{value:new E,type:"mat3x3<f32>"},uColor:{value:new it(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}});}};});var si,Bh=p(()=>{ht();je();Ji();jo();hs();Pp();Bp();si=class{constructor(t,e){this.state=vr.for2d(),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 Jo,this.state=vr.for2d();}validateRenderable(t){return false}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t);}getBuffers(t){return t._gpuData[this.renderer.uid]||this._initBuffer(t)}_initBuffer(t){return t._gpuData[this.renderer.uid]=new Qo({size:t.particleChildren.length,properties:t._properties}),t._gpuData[this.renderer.uid]}updateRenderable(t){}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=false,o.blendMode=Le(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Ke(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t);}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null);}};});var us,kp=p(()=>{D();bp();Bh();us=class extends si{constructor(t){super(t,new Zo);}};us.extension={type:[w.WebGLPipes],name:"particle"};});var tn,Gp=p(()=>{tn=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 ds,Rp=p(()=>{D();Gp();Bh();ds=class extends si{constructor(t){super(t,new tn);}};ds.extension={type:[w.WebGPUPipes],name:"particle"};});var kh=p(()=>{D();kp();Rp();z.add(us);z.add(ds);});function fs(i,t){let{texture:e,bounds:r}=i,s=t._style._getFinalPadding();_o(r,t._anchor,e);let o=t._anchor._x*s*2,n=t._anchor._y*s*2;r.minX-=s-o,r.minY-=s-n,r.maxX-=s-o,r.maxY-=s-n;}var Gh=p(()=>{ka();});var oi,Rh=p(()=>{oi=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;}destroy(){}};});var en,Ip=p(()=>{Rh();en=class extends oi{constructor(t){super(),this._renderer=t,t.runners.resolutionChange.add(this);}resolutionChange(){let t=this.renderable;t._autoResolution&&t.onViewUpdate();}destroy(){this._renderer.canvasText.returnTexture(this.texture),this._renderer=null;}};});var ps,Dp=p(()=>{D();Gh();Ip();ps=class{constructor(t){this._renderer=t;}validateRenderable(t){return t._didTextUpdate}addRenderable(t,e){let r=this._getGpuText(t);t._didTextUpdate&&(this._updateGpuText(t),t._didTextUpdate=false),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e);}_updateGpuText(t){let e=this._getGpuText(t);e.texture&&this._renderer.canvasText.returnTexture(e.texture),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=this._renderer.canvasText.getTexture(t),fs(e,t);}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new en(this._renderer);return e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null;}};ps.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"text"};});var Lp,Ue,rn=p(()=>{ht();Ut();Lp={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=Q("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=Lp[e].addressModeU,t.source.style.addressModeV=Lp[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)}destroy(){this.texture.destroy(true),this.texture=null,this._styleKey=null;}};});var Op=Dl((dE,Up)=>{Up.exports=Q_;var Ih={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 Q_(i){var t=[];return i.replace(Z_,function(e,r,s){var o=r.toLowerCase();for(s=ty(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Ih[o])return s.unshift(r),t.push(s);if(s.length<Ih[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Ih[o])));}}),t}var J_=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function ty(i){var t=i.match(J_);return t?t.map(Number):[]}});function Wp(i,t){let e=(0, zp.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:X(`Unknown SVG path command: ${l}`);}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s));}return t}var zp,Vp=p(()=>{zp=Ll(Op());Rt();});var sn,Np=p(()=>{Ht();sn=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 J),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 on,Hp=p(()=>{Ht();on=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,x=e-this.y,y=d*d/(l*l)+x*x/(c*c),m=d*d/(u*u)+x*x/(f*f);return y>1&&m<=1}getBounds(t){return t||(t=new J),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 Yp(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,x;f<0?(d=e,x=r):f>1?(d=s,x=o):(d=e+f*h,x=r+f*l);let y=i-d,m=t-x;return y*y+m*m}var Xp=p(()=>{});var ey,ry,ni,$p=p(()=>{gt();Xp();Ht();ni=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(ey),r=t.getBounds(ry);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],x=h[(c+3)%h.length],y=Yp(t,e,u,f,d,x),m=Math.sign((d-u)*(e-f)-(x-f)*(t-u));if(y<=(m<0?a:n))return true}return false}getBounds(t){t||(t=new J);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 R("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return R("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}};});var nn,an,jp=p(()=>{Ht();nn=(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},an=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 J),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,x=a-l*2,y=h-l*2,m=o+a,_=n+h;return (t>=o-c&&t<=o+u||t>=m-u&&t<=m+c)&&e>=d&&e<=d+y||(e>=n-c&&e<=n+u||e>=_-u&&e<=_+c)&&t>=f&&t<=f+x?true:t<f&&e<d&&nn(t,e,f,d,l,u,c)||t>m-l&&e<d&&nn(t,e,m-l,d,l,u,c)||t>m-l&&e>_-l&&nn(t,e,m-l,_-l,l,u,c)||t<f&&e>_-l&&nn(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 ln(i,t,e,r,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??ii.defaultOptions.bezierSmoothness)),f=(sy-u)/1;return f*=f,oy(t,e,r,s,o,n,a,h,i,f),i}function oy(i,t,e,r,s,o,n,a,h,l){Lh(i,t,e,r,s,o,n,a,h,l,0),h.push(n,a);}function Lh(i,t,e,r,s,o,n,a,h,l,c){if(c>iy)return;let u=Math.PI,f=(i+e)/2,d=(t+r)/2,x=(e+s)/2,y=(r+o)/2,m=(s+n)/2,_=(o+a)/2,b=(f+x)/2,v=(d+y)/2,S=(x+m)/2,M=(y+_)/2,T=(b+S)/2,P=(v+M)/2;if(c>0){let U=n-i,A=a-t,F=Math.abs((e-n)*A-(r-a)*U),B=Math.abs((s-n)*A-(o-a)*U),Y,tt;if(F>hn&&B>hn){if((F+B)*(F+B)<=l*(U*U+A*A)){if(ai<Dh){h.push(T,P);return}let Ft=Math.atan2(o-r,s-e);if(Y=Math.abs(Ft-Math.atan2(r-t,e-i)),tt=Math.abs(Math.atan2(a-o,n-s)-Ft),Y>=u&&(Y=2*u-Y),tt>=u&&(tt=2*u-tt),Y+tt<ai){h.push(T,P);return}if(Sr!==0){if(Y>Sr){h.push(e,r);return}if(tt>Sr){h.push(s,o);return}}}}else if(F>hn){if(F*F<=l*(U*U+A*A)){if(ai<Dh){h.push(T,P);return}if(Y=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),Y>=u&&(Y=2*u-Y),Y<ai){h.push(e,r),h.push(s,o);return}if(Sr!==0&&Y>Sr){h.push(e,r);return}}}else if(B>hn){if(B*B<=l*(U*U+A*A)){if(ai<Dh){h.push(T,P);return}if(Y=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),Y>=u&&(Y=2*u-Y),Y<ai){h.push(e,r),h.push(s,o);return}if(Sr!==0&&Y>Sr){h.push(s,o);return}}}else if(U=T-(i+n)/2,A=P-(t+a)/2,U*U+A*A<=l){h.push(T,P);return}}Lh(i,t,f,d,b,v,T,P,h,l,c+1),Lh(T,P,S,M,m,_,n,a,h,l,c+1);}var iy,hn,sy,Dh,ai,Sr,Uh=p(()=>{$o();iy=8,hn=11920929e-14,sy=1,Dh=.01,ai=0,Sr=0;});function qp(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??ii.defaultOptions.bezierSmoothness)),c=(hy-l)/1;return c*=c,cy(t,e,r,s,o,n,i,c),i}function cy(i,t,e,r,s,o,n,a){Oh(n,i,t,e,r,s,o,a,0),n.push(s,o);}function Oh(i,t,e,r,s,o,n,a,h){if(h>ny)return;let l=Math.PI,c=(t+r)/2,u=(e+s)/2,f=(r+o)/2,d=(s+n)/2,x=(c+f)/2,y=(u+d)/2,m=o-t,_=n-e,b=Math.abs((r-o)*_-(s-n)*m);if(b>ay){if(b*b<=a*(m*m+_*_)){if(Kp<ly){i.push(x,y);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<Kp){i.push(x,y);return}}}else if(m=x-(t+o)/2,_=y-(e+n)/2,m*m+_*_<=a){i.push(x,y);return}Oh(i,t,e,c,u,x,y,a,h+1),Oh(i,x,y,f,d,o,n,a,h+1);}var ny,ay,hy,ly,Kp,Zp=p(()=>{$o();ny=8,ay=11920929e-14,hy=1,ly=.01,Kp=0;});function cn(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),x=t+f*r,y=e+d*r;i.push(x,y),c+=l;}}var zh=p(()=>{});function Qp(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,x=c*c+u*u,y=h*c+l*u,m=o*Math.sqrt(d)/f,_=o*Math.sqrt(x)/f,b=m*y/d,v=_*y/x,S=m*u+_*l,M=m*c+_*h,T=l*(_+b),P=h*(_+b),U=u*(m+v),A=c*(m+v),F=Math.atan2(P-M,T-S),B=Math.atan2(A-M,U-S);cn(i,S+t,M+e,o,F,B,l*c>u*h);}var Jp=p(()=>{zh();});function uy(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 em(i,t,e,r,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*ms/360),u=Math.cos(a*ms/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 x=Math.pow(f,2)/Math.pow(o,2)+Math.pow(d,2)/Math.pow(n,2);x>1&&(o*=Math.sqrt(x),n*=Math.sqrt(x)),dy(t,e,r,s,o,n,h,l,c,u,f,d,Wh);let{ang1:y,ang2:m}=Wh,{centerX:_,centerY:b}=Wh,v=Math.abs(m)/(ms/4);Math.abs(1-v)<1e-7&&(v=1);let S=Math.max(Math.ceil(v),1);m/=S;let M=i[i.length-2],T=i[i.length-1],P={x:0,y:0};for(let U=0;U<S;U++){let A=uy(y,m),{x:F,y:B}=Vh(A[0],o,n,u,c,_,b,P),{x:Y,y:tt}=Vh(A[1],o,n,u,c,_,b,P),{x:Ft,y:Pi}=Vh(A[2],o,n,u,c,_,b,P);ln(i,M,T,F,B,Y,tt,Ft,Pi),M=Ft,T=Pi,y+=m;}}var ms,Wh,Vh,tm,dy,rm=p(()=>{Uh();ms=Math.PI*2,Wh={centerX:0,centerY:0,ang1:0,ang2:0},Vh=({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};tm=(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)},dy=(i,t,e,r,s,o,n,a,h,l,c,u,f)=>{let d=Math.pow(s,2),x=Math.pow(o,2),y=Math.pow(c,2),m=Math.pow(u,2),_=d*x-d*m-x*y;_<0&&(_=0),_/=d*m+x*y,_=Math.sqrt(_)*(n===a?-1:1);let b=_*s/o*u,v=_*-o/s*c,S=l*b-h*v+(i+e)/2,M=h*b+l*v+(t+r)/2,T=(c-b)/s,P=(u-v)/o,U=(-c-b)/s,A=(-u-v)/o,F=tm(1,0,T,P),B=tm(T,P,U,A);a===0&&B>0&&(B-=ms),a===1&&B<0&&(B+=ms),f.centerX=S,f.centerY=M,f.ang1=F,f.ang2=B;};});function im(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,x=false;c.nx*u.nx-c.ny*-u.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,x=true):f>0&&(d=-1,x=true);let y=f/2,m,_=Math.abs(Math.cos(y)*h/Math.sin(y));_>Math.min(c.len/2,u.len/2)?(_=Math.min(c.len/2,u.len/2),m=Math.abs(_*Math.sin(y)/Math.cos(y))):m=h;let b=a.x+u.nx*_+-u.ny*m*d,v=a.y+u.ny*_+u.nx*m*d,S=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(S)*m,v+Math.sin(S)*m),i.arc(b,v,m,S,M,x),o=a;}}function sm(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 m=Math.min(f/2,l);d=o(h,c,m/f);}let x=s(u,h),y;if(x<1e-4)y=h;else {let m=Math.min(x/2,l);y=o(h,u,m/x);}a===0?i.moveTo(d.x,d.y):i.lineTo(d.x,d.y),i.quadraticCurveTo(h.x,h.y,y.x,y.y,r);}}var om=p(()=>{});var fy,un,nm=p(()=>{Np();Hp();$p();Ht();jp();he();Uh();Zp();zh();Jp();rm();om();fy=new J,un=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 cn(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Qp(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let h=this._currentPoly.points;return em(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 ln(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 qp(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 J(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new sn(t,e,r),s),this}poly(t,e,r){let s=new ni(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,x=t+r*Math.cos(d),y=e+r*Math.sin(d),m=d+Math.PI+u,_=d-Math.PI-u,b=x+o*Math.cos(m),v=y+o*Math.sin(m),S=x+o*Math.cos(_),M=y+o*Math.sin(_);f===0?this.moveTo(b,v):this.lineTo(b,v),this.quadraticCurveTo(x,y,S,M,a);}return this.closePath()}roundShape(t,e,r=false,s){return t.length<3?this:(r?sm(this,t,e,s):im(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 on(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new an(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 ni,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 ni,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(fy);s.transform?t.addRect(o,s.transform):t.addRect(o);}return t}};});function gs(i,t){return i?i.prepend(t):t.clone()}var Ze,Nh=p(()=>{be();Ut();Rt();Vp();nm();Ze=class i{constructor(t,e=false){this.instructions=[],this.uid=Q("graphicsPath"),this._dirty=true,this.checkForHoles=e,typeof t=="string"?Wp(t,this):this.instructions=t?.slice()??[];}get shapePath(){return this._shapePath||(this._shapePath=new un(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,x=f*c+h;u.push(t+d*Math.cos(x),e+d*Math.sin(x));}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,x=0,y=0;for(let m=0;m<this.instructions.length;m++){let _=this.instructions[m],b=_.data;switch(_.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],x=b[0],y=b[1],b[0]=e*x+s*y,b[1]=r*x+o*y,b[5]=e*h+s*l+n,b[6]=r*h+o*l+a;break;case "circle":b[4]=gs(b[3],t);break;case "rect":b[4]=gs(b[4],t);break;case "ellipse":b[8]=gs(b[8],t);break;case "roundRect":b[5]=gs(b[5],t);break;case "addPath":b[0].transform(t);break;case "poly":b[2]=gs(b[2],t);break;default:X("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 dt(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var Hh=p(()=>{});function am(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]=py(n);break;case "radialgradient":t.defs[n.id]=my();break;}}}}function py(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 Xt(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=it.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c);}return n}function my(i){return X("[SVG Parser] Radial gradients are not yet supported"),new Xt(0,0,1,0)}var hm=p(()=>{jt();Rt();ri();Hh();});function Yh(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var lm=p(()=>{});function Xh(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:false,useStroke:false};for(let n in cm){let a=i.getAttribute(n);a&&um(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(":");cm[l]&&um(t,o,l,c.trim());}}return {strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function um(i,t,e,r){switch(e){case "stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Yh(r);t.strokeStyle.fill=i.defs[s];}else t.strokeStyle.color=it.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=Yh(r);t.fillStyle.fill=i.defs[s];}else t.fillStyle.color=it.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 cm,dm=p(()=>{jt();lm();cm={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 fm(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 Ze};am(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=Xh(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&pm(a,e,s,o);}return t}function pm(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=Xh(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,x,y,m,_,b,v,S,M,T,P,U;switch(i.nodeName.toLowerCase()){case "path":M=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&X("SVG Evenodd fill rule not supported, your svg may render incorrectly"),T=new Ze(M,true),t.context.path(T),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "circle":x=dt(i,"cx",0),y=dt(i,"cy",0),m=dt(i,"r",0),t.context.ellipse(x,y,m,m),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),U=dt(i,"height",0),_=dt(i,"rx",0),b=dt(i,"ry",0),_||b?t.context.roundRect(h,l,P,U,_||b):t.context.rect(h,l,P,U),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "ellipse":x=dt(i,"cx",0),y=dt(i,"cy",0),_=dt(i,"rx",0),b=dt(i,"ry",0),t.context.beginPath(),t.context.ellipse(x,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":S=i.getAttribute("points"),v=S.match(/\d+/g).map(A=>parseInt(A,10)),t.context.poly(v,true),e&&t.context.fill(e),r&&t.context.stroke(r);break;case "polyline":S=i.getAttribute("points"),v=S.match(/\d+/g).map(A=>parseInt(A,10)),t.context.poly(v,false),r&&t.context.stroke(r);break;case "g":case "svg":break;default:{X(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let A=0;A<s.length;A++)pm(s[A],t,e,r);}var mm=p(()=>{Rt();Nh();hm();Hh();dm();});function gy(i){return it.isColorLike(i)}function gm(i){return i instanceof Ue}function xm(i){return i instanceof Xt}function xy(i){return i instanceof I}function _y(i,t,e){let r=it.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=I.WHITE,{...e,...i}}function yy(i,t,e){return i.texture=t,{...e,...i}}function _m(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function ym(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 by(i,t){let e={...t,...i},r=it.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Oe(i,t){if(i==null)return null;let e={},r=i;return gy(i)?_y(e,i,t):xy(i)?yy(e,i,t):gm(i)?_m(e,i,t):xm(i)?ym(e,i,t):r.fill&&gm(r.fill)?_m(r,r.fill,t):r.fill&&xm(r.fill)?ym(r,r.fill,t):by(r,t)}function hi(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=Oe(i,h);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var $h=p(()=>{jt();Bt();ri();rn();});var vy,bm,jh,Qt,Kh=p(()=>{Nt();jt();ht();be();Bt();Ut();gt();he();Nh();mm();$h();vy=new Z,bm=new E,jh=class Ee extends q{constructor(){super(...arguments),this.uid=Q("graphicsContext"),this.dirty=true,this.batchMode="auto",this.instructions=[],this._activePath=new Ze,this._transform=new E,this._fillStyle={...Ee.defaultFillStyle},this._strokeStyle={...Ee.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new ft,this._boundsDirty=true;}clone(){let t=new Ee;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=Oe(t,Ee.defaultFillStyle);}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=hi(t,Ee.defaultStrokeStyle);}setFillStyle(t){return this._fillStyle=Oe(t,Ee.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Oe(t,Ee.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?it.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Ze,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"&&(R(j,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Oe(t,Ee.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=hi(t,Ee.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++,fm(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):(bm.set(t,e,r,s,o,n),this._transform.append(bm),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,vy):t;if(o.action==="fill")r=u.contains(d.x,d.y);else {let y=h;r=u.strokeContains(d.x,d.y,y.width,y.alignment);}let x=n.hole;if(x){let y=x.shapePath?.shapePrimitives;if(y)for(let m=0;m<y.length;m++)y[m].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.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(r)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():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;}};jh.defaultFillStyle={color:16777215,alpha:1,texture:I.WHITE,matrix:null,fill:null,textureSpace:"local"};jh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:I.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:false};Qt=jh;});function Sm(i){let t=[],e=0;for(let r=0;r<vm.length;r++){let s=`_${vm[r]}`;t[e++]=i[s];}return e=Tm(i._fill,t,e),e=Ty(i._stroke,t,e),e=wy(i.dropShadow,t,e),e=Sy(i.filters,t,e),t.join("-")}function Sy(i,t,e){if(!i)return e;for(let r of i)t[e++]=r.uid;return e}function Tm(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function Ty(i,t,e){return i&&(e=Tm(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 wy(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=it.shared.setValue(i.color).toNumber()),e}var vm,wm=p(()=>{jt();vm=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];});function Py(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=ze.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){R(j,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(it.isColorLike(e))r.color=e;else if(e instanceof Xt||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)){if(R(j,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(t.fill)||t.fill.length===0)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");t.fill.length!==t.fillGradientStops.length&&X("The number of fill colors must match the number of fill gradient stops.");let e=new Xt({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),r=t.fillGradientStops.slice(),s=t.fill.map(o=>it.shared.setValue(o).toNumber());r.forEach((o,n)=>{e.addColorStop(o,s[n]);}),i.fill={fill:e};}}var qh,ze,dn=p(()=>{Nt();jt();gt();Rt();ri();rn();Kh();$h();wm();qh=class li extends q{constructor(t={}){super(),Py(t);let e={...li.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({...li.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...li.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 filters(){return this._filters}set filters(t){this._filters=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=Oe({...this._originalFill},Qt.defaultFillStyle);})),this._fill=Oe(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=hi({...this._originalStroke},Qt.defaultStrokeStyle);})),this._stroke=hi(t,Qt.defaultStrokeStyle),this.update());}_generateKey(){return this._styleKey=Sm(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this);}reset(){let t=li.defaultTextStyle;for(let e in t)this[e]=t[e];}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new li({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0})}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}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&&!(it.isColorLike(t)||t instanceof Xt||t instanceof Ue)}};qh.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};qh.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};ze=qh;});function fn(i,t,e,r){let s=My;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=It.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 My,Zh=p(()=>{Dr();he();My=new ft;});var Qh,Fe,xs=p(()=>{Zt();Di();Qh=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=false;}_createCanvasAndContext(t,e){let r=nt.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=Ge(t),e=Ge(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.resetTransform(),t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t);}clear(){this._canvasPool={};}},Fe=new Qh;});function Cy(i,t){Tr||(Tr=nt.get().createCanvas(256,128),We=Tr.getContext("2d",{willReadFrequently:true}),We.globalCompositeOperation="copy",We.globalAlpha=1),(Tr.width<i||Tr.height<t)&&(Tr.width=Ge(i),Tr.height=Ge(t));}function Pm(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 Mm(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 Cm(...i){let t=i[0];t.canvas||(t={canvas:i[0],resolution:i[1]});let{canvas:e}=t,r=Math.min(t.resolution??1,1),s=t.width??e.width,o=t.height??e.height,n=t.output;if(Cy(s,o),!We)throw new TypeError("Failed to get canvas 2D context");We.drawImage(e,0,0,s,o,0,0,s*r,o*r);let h=We.getImageData(0,0,s,o).data,l=0,c=0,u=s-1,f=o-1;for(;c<o&&Pm(h,s,c);)++c;if(c===o)return J.EMPTY;for(;Pm(h,s,f);)--f;for(;Mm(h,s,l,c,f);)++l;for(;Mm(h,s,u,c,f);)--u;return ++u,++f,We.globalCompositeOperation="source-over",We.strokeRect(l,c,u-l,f-c),We.globalCompositeOperation="copy",n??(n=new J),n.set(l/r,c/r,(u-l)/r,(f-c)/r),n}var Tr,We,Am=p(()=>{Zt();Di();Ht();Tr=null,We=null;});function wr(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)&&!Ay.includes(s)&&(s=`"${s}"`),e[r]=s;}return `${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var Ay,pn=p(()=>{Ay=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];});var Jh,Be,$t,_s=p(()=>{Zt();pn();Jh={willReadFrequently:true},Be=class L{static get experimentalLetterSpacingSupported(){let t=L._experimentalLetterSpacingSupported;if(t===void 0){let e=nt.get().getCanvasRenderingContext2D().prototype;t=L._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=L._canvas,s=e.wordWrap){let o=wr(e),n=L.measureFont(o);n.fontSize===0&&(n.fontSize=e.fontSize,n.ascent=e.fontSize);let a=L.__context;a.font=o;let l=(s?L._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),c=new Array(l.length),u=0;for(let _=0;_<l.length;_++){let b=L._measureText(l[_],e.letterSpacing,a);c[_]=b,u=Math.max(u,b);}let f=e._stroke?.width||0,d=u+f;e.dropShadow&&(d+=e.dropShadow.distance);let x=e.lineHeight||n.fontSize,y=Math.max(x,n.fontSize+f)+(l.length-1)*(x+e.leading);return e.dropShadow&&(y+=e.dropShadow.distance),new L(t,e,d,y,l,c,x+e.leading,u,n)}static _measureText(t,e,r){let s=false;L.experimentalLetterSpacingSupported&&(L.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=(L.graphemeSegmenter(t).length-1)*e;n+=c,l+=c;}return Math.max(n,l)}static _wordWrap(t,e,r=L._canvas){let s=r.getContext("2d",Jh),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=L._collapseSpaces(c),f=L._collapseNewlines(c),d=!u,x=e.wordWrapWidth+l,y=L._tokenize(t);for(let m=0;m<y.length;m++){let _=y[m];if(L._isNewline(_)){if(!f){a+=L._addLine(n),d=!u,n="",o=0;continue}_=" ";}if(u){let v=L.isBreakingSpace(_),S=L.isBreakingSpace(n[n.length-1]);if(v&&S)continue}let b=L._getFromCache(_,l,h,s);if(b>x)if(n!==""&&(a+=L._addLine(n),n="",o=0),L.canBreakWords(_,e.breakWords)){let v=L.wordWrapSplit(_);for(let S=0;S<v.length;S++){let M=v[S],T=M,P=1;for(;v[S+P];){let A=v[S+P];if(!L.canBreakChars(T,A,_,S,e.breakWords))M+=A;else break;T=A,P++;}S+=P-1;let U=L._getFromCache(M,l,h,s);U+o>x&&(a+=L._addLine(n),d=false,n="",o=0),n+=M,o+=U;}}else {n.length>0&&(a+=L._addLine(n),n="",o=0);let v=m===y.length-1;a+=L._addLine(_,!v),d=false,n="",o=0;}else b+o>x&&(d=false,a+=L._addLine(n),n="",o=0),(n.length>0||!L.isBreakingSpace(_)||d)&&(n+=_,o+=b);}return a+=L._addLine(n,false),a}static _addLine(t,e=true){return t=L._trimRight(t),t=e?`${t}
368
- `:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=L._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(!L.isBreakingSpace(r))break;t=t.slice(0,-1);}return t}static _isNewline(t){return typeof t!="string"?false:L._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?false:L._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(L.isBreakingSpace(o,n)||L._isNewline(o)){r!==""&&(e.push(r),r=""),o==="\r"&&n===`
369
- `?(e.push(`\r
370
- `),s++):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 L.graphemeSegmenter(t)}static measureFont(t){if(L._fonts[t])return L._fonts[t];let e=L._context;e.font=t;let r=e.measureText(L.METRICS_STRING+L.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return L._fonts[t]=s,s}static clearMetrics(t=""){t?delete L._fonts[t]:L._fonts={};}static get _canvas(){if(!L.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",Jh)?.measureText)return L.__canvas=e,e;t=nt.get().createCanvas();}catch{t=nt.get().createCanvas();}t.width=t.height=10,L.__canvas=t;}return L.__canvas}static get _context(){return L.__context||(L.__context=L._canvas.getContext("2d",Jh)),L.__context}};Be.METRICS_STRING="|\xC9q\xC5";Be.BASELINE_SYMBOL="M";Be.BASELINE_MULTIPLIER=1.4;Be.HEIGHT_MULTIPLIER=2;Be.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>{let e=i.segment(t),r=[],s=0;for(let o of e)r[s++]=o.segment;return r}}return i=>[...i]})();Be.experimentalLetterSpacing=false;Be._fonts={};Be._newlines=[10,13];Be._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];$t=Be;});function ci(i,t,e,r=0){if(i.texture===I.WHITE&&!i.fill)return it.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 Xt){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:x}=s;l=t.createRadialGradient(u.x*a,u.y*h,f*a,d.x*a,d.y*h,x*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(x=>{let y=d+x.offset*u;l.addColorStop(Math.floor(y*Em)/Em,it.shared.setValue(x.color).toHex());});}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,it.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 X("FillStyle not recognised",i),"red"}var Em,tl=p(()=>{jt();ht();Bt();Rt();ri();rn();Em=1e5;});var Fm,el,mn,Bm=p(()=>{jt();Ht();xs();Am();_s();pn();tl();Fm=new J,el=class{getCanvasAndContext(t){let{text:e,style:r,resolution:s=1}=t,o=r._getFinalPadding(),n=$t.measureText(e||" ",r),a=Math.ceil(Math.ceil(Math.max(1,n.width)+o*2)*s),h=Math.ceil(Math.ceil(Math.max(1,n.height)+o*2)*s),l=Fe.getOptimalCanvasAndContext(a,h);this._renderTextToCanvas(e,r,o,s,l);let c=r.trim?Cm({canvas:l.canvas,width:a,height:h,resolution:1,output:Fm}):Fm.set(0,0,a,h);return {canvasAndContext:l,frame:c}}returnCanvasAndContext(t){Fe.returnCanvasAndContext(t);}_renderTextToCanvas(t,e,r,s,o){let{canvas:n,context:a}=o,h=wr(e),l=$t.measureText(t||" ",e),c=l.lines,u=l.lineHeight,f=l.lineWidths,d=l.maxLineWidth,x=l.fontProperties,y=n.height;if(a.resetTransform(),a.scale(s,s),a.textBaseline=e.textBaseline,e._stroke?.width){let v=e._stroke;a.lineWidth=v.width,a.miterLimit=v.miterLimit,a.lineJoin=v.join,a.lineCap=v.cap;}a.font=h;let m,_,b=e.dropShadow?2:1;for(let v=0;v<b;++v){let S=e.dropShadow&&v===0,M=S?Math.ceil(Math.max(1,y)+r*2):0,T=M*s;if(S){a.fillStyle="black",a.strokeStyle="black";let A=e.dropShadow,F=A.color,B=A.alpha;a.shadowColor=it.shared.setValue(F).setAlpha(B).toRgbaString();let Y=A.blur*s,tt=A.distance*s;a.shadowBlur=Y,a.shadowOffsetX=Math.cos(A.angle)*tt,a.shadowOffsetY=Math.sin(A.angle)*tt+T;}else {if(a.fillStyle=e._fill?ci(e._fill,a,l,r*2):null,e._stroke?.width){let A=e._stroke.width*.5+r*2;a.strokeStyle=ci(e._stroke,a,l,A);}a.shadowColor="black";}let P=(u-x.fontSize)/2;u-x.fontSize<0&&(P=0);let U=e._stroke?.width??0;for(let A=0;A<c.length;A++)m=U/2,_=U/2+A*u+x.ascent+P,e.align==="right"?m+=d-f[A]:e.align==="center"&&(m+=(d-f[A])/2),e._stroke?.width&&this._drawLetterSpacing(c[A],e,o,m+r,_+r-M,true),e._fill!==void 0&&this._drawLetterSpacing(c[A],e,o,m+r,_+r-M);}}_drawLetterSpacing(t,e,r,s,o,n=false){let{context:a}=r,h=e.letterSpacing,l=false;if($t.experimentalLetterSpacingSupported&&($t.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=$t.graphemeSegmenter(t),f=a.measureText(t).width,d=0;for(let x=0;x<u.length;++x){let y=u[x];n?a.strokeText(y,c,o):a.fillText(y,c,o);let m="";for(let _=x+1;_<u.length;++_)m+=u[_];d=a.measureText(m).width,c+=f-d+h,f=d;}}},mn=new el;});var ys,km=p(()=>{D();Dr();Ir();gt();dn();Zh();Bm();ys=class{constructor(t){this._renderer=t;}getTexture(t,e,r,s){typeof t=="string"&&(R("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof ze||(t.style=new ze(t.style)),t.textureStyle instanceof oe||(t.textureStyle=new oe(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());let{text:o,style:n,textureStyle:a}=t,h=t.resolution??this._renderer.resolution,{frame:l,canvasAndContext:c}=mn.getCanvasAndContext({text:o,style:n,resolution:h}),u=fn(c.canvas,l.width,l.height,h);if(a&&(u.source.style=a),n.trim&&(l.pad(n.padding),u.frame.copyFrom(l),u.frame.scale(1/h),u.updateUvs()),n.filters){let f=this._applyFilters(u,n.filters);return this.returnTexture(u),mn.returnCanvasAndContext(c),f}return this._renderer.texture.initSource(u._source),mn.returnCanvasAndContext(c),u}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",It.returnTexture(t,true);}renderTextToCanvas(){R("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead");}_applyFilters(t,e){let r=this._renderer.renderTarget.renderTarget,s=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(r,false),s}destroy(){this._renderer=null;}};ys.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"canvasText"};});var rl=p(()=>{D();Dp();km();z.add(ys);z.add(ps);});var gn,Gm=p(()=>{gt();Ma();Kh();gn=class i extends Wr{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.didViewUpdate=true,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){R(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){R(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(){R(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 R(j,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return R(j,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return R(j,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return R(j,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return R(j,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return R(j,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}};});var Rm,Im,Dm=p(()=>{Rm={name:"local-uniform-msdf-bit",vertex:{header:`
371
- struct LocalUniforms {
372
- uColor:vec4<f32>,
373
- uTransformMatrix:mat3x3<f32>,
374
- uDistance: f32,
375
- uRound:f32,
376
- }
377
-
378
- @group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
379
- `,main:`
380
- vColor *= localUniforms.uColor;
381
- modelMatrix *= localUniforms.uTransformMatrix;
382
- `,end:`
383
- if(localUniforms.uRound == 1)
384
- {
385
- vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
386
- }
387
- `},fragment:{header:`
388
- struct LocalUniforms {
389
- uColor:vec4<f32>,
390
- uTransformMatrix:mat3x3<f32>,
391
- uDistance: f32
392
- }
393
-
394
- @group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
395
- `,main:`
396
- outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
397
- `}},Im={name:"local-uniform-msdf-bit",vertex:{header:`
398
- uniform mat3 uTransformMatrix;
399
- uniform vec4 uColor;
400
- uniform float uRound;
401
- `,main:`
402
- vColor *= uColor;
403
- modelMatrix *= uTransformMatrix;
404
- `,end:`
405
- if(uRound == 1.)
406
- {
407
- gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
408
- }
409
- `},fragment:{header:`
410
- uniform float uDistance;
411
- `,main:`
412
- outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
413
- `}};});var Lm,Um,Om=p(()=>{Lm={name:"msdf-bit",fragment:{header:`
414
- fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
415
-
416
- // MSDF
417
- var median = msdfColor.r + msdfColor.g + msdfColor.b -
418
- min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
419
- max(msdfColor.r, max(msdfColor.g, msdfColor.b));
420
-
421
- // SDF
422
- median = min(median, msdfColor.a);
423
-
424
- var screenPxDistance = distance * (median - 0.5);
425
- var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
426
- if (median < 0.01) {
427
- alpha = 0.0;
428
- } else if (median > 0.99) {
429
- alpha = 1.0;
430
- }
431
-
432
- // Gamma correction for coverage-like alpha
433
- var luma: f32 = dot(shapeColor.rgb, vec3<f32>(0.299, 0.587, 0.114));
434
- var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);
435
- var coverage: f32 = pow(shapeColor.a * alpha, gamma);
436
-
437
- return coverage;
438
-
439
- }
440
- `}},Um={name:"msdf-bit",fragment:{header:`
441
- float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
442
-
443
- // MSDF
444
- float median = msdfColor.r + msdfColor.g + msdfColor.b -
445
- min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
446
- max(msdfColor.r, max(msdfColor.g, msdfColor.b));
447
-
448
- // SDF
449
- median = min(median, msdfColor.a);
450
-
451
- float screenPxDistance = distance * (median - 0.5);
452
- float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
453
-
454
- if (median < 0.01) {
455
- alpha = 0.0;
456
- } else if (median > 0.99) {
457
- alpha = 1.0;
458
- }
459
-
460
- // Gamma correction for coverage-like alpha
461
- float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
462
- float gamma = mix(1.0, 1.0 / 2.2, luma);
463
- float coverage = pow(shapeColor.a * alpha, gamma);
464
-
465
- return coverage;
466
- }
467
- `}};});var il,sl,xn,zm=p(()=>{ht();Ro();eh();sh();Oo();nh();is();je();Dm();Om();xn=class extends Ae{constructor(t){let e=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"}});il??(il=qr({name:"sdf-shader",bits:[Io,Lo(t),Rm,Lm,Qr]})),sl??(sl=Zr({name:"sdf-shader",bits:[Do,Uo(t),Im,Um,Jr]})),super({glProgram:sl,gpuProgram:il,resources:{localUniforms:e,batchSamplers:zo(t)}});}};});var _n,Wm=p(()=>{Nt();gt();_n=class extends q{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 R(j,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return R(j,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return R(j,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return R(j,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return R(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);}};});var Vm,ol,Hm=p(()=>{jt();Ht();xs();vo();Bt();Ir();gt();_s();pn();tl();dn();Wm();Vm=class Nm extends _n{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._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=false;let e={...Nm.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=I.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=wr(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,e.textureStyle&&(this._textureStyle=e.textureStyle instanceof oe?e.textureStyle:new oe(e.textureStyle)),this.fontMetrics=$t.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize;}ensureCharacters(t){let e=$t.graphemeSegmenter(t).filter(m=>!this._currentChars.includes(m)).filter((m,_,b)=>b.indexOf(m)===_);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._currentMaxCharHeight,u=this.baseRenderedFontSize/this.baseMeasurementFontSize,f=this._padding*u,d=false,x=s.width/this.resolution,y=s.height/this.resolution;for(let m=0;m<e.length;m++){let _=e[m],b=$t.measureText(_,a,s,false);b.lineHeight=b.height;let v=b.width*u,S=Math.ceil((a.fontStyle==="italic"?2:1)*v),M=b.height*u,T=S+f*2,P=M+f*2;if(d=false,_!==`
468
- `&&_!=="\r"&&_!==" "&&_!==" "&&(d=true,c=Math.ceil(Math.max(P,c))),h+T>x&&(l+=c,c=P,h=0,l+c>y)){n.update();let A=this._nextPage();s=A.canvasAndContext.canvas,o=A.canvasAndContext.context,n=A.texture.source,h=0,l=0,c=0;}let U=v/u-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:U,kerning:{}},d){this._drawGlyph(o,b,h+f,l+f,u,a);let A=n.width*u,F=n.height*u,B=new J(h/A*n.width,l/F*n.height,T/A*n.width,P/F*n.height);this.chars[_].texture=new I({source:n,frame:B}),h+=Math.ceil(T);}}n.update(),this._currentX=h,this._currentY=l,this._currentMaxCharHeight=c,this._skipKerning&&this._applyKerning(e,o);}get pageTextures(){return R(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=Fe.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new I({source:new we({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(s.source.style=this._textureStyle);let 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=wr(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=ci(s,t)),e._fill&&(t.fillStyle=ci(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=it.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,x=e.lineHeight*o,y=false;n.stroke&&c&&(y=true,t.strokeText(a,u,f+x-d));let{shadowBlur:m,shadowOffsetX:_,shadowOffsetY:b}=t;n._fill&&(y&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.fillText(a,u,f+x-d)),y&&(t.shadowBlur=m,t.shadowOffsetX=_,t.shadowOffsetY=b);}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];Fe.returnCanvasAndContext(e),r.destroy(true);}this.pages=null;}};Vm.defaultOptions={textureSize:512,style:new ze,mipmap:true};ol=Vm;});function yn(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=e.baseMeasurementFontSize/t.fontSize,c=t.letterSpacing*l,u=t.wordWrapWidth*l,f=t.lineHeight?t.lineHeight*l:e.lineHeight,d=t.wordWrap&&t.breakWords,x=_=>{let b=o.width;for(let v=0;v<h.index;v++){let S=_.positions[v];o.chars.push(_.chars[v]),o.charPositions.push(S+b);}o.width+=_.width,a=false,h.width=0,h.index=0,h.chars.length=0;},y=()=>{let _=o.chars.length-1;if(r){let b=o.chars[_];for(;b===" ";)o.width-=e.chars[b].xAdvance,b=o.chars[--_];}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=true,s.lines.push(o),s.height+=f;},m=_=>_-c>u;for(let _=0;_<i.length+1;_++){let b,v=_===i.length;v||(b=i[_]);let S=e.chars[b]||e.chars[" "];if(/(?:\s)/.test(b)||b==="\r"||b===`
469
- `||v){if(!a&&t.wordWrap&&m(o.width+h.width)?(y(),x(h),v||o.charPositions.push(0)):(h.start=o.width,x(h),v||o.charPositions.push(0)),b==="\r"||b===`
470
- `)o.width!==0&&y();else if(!v){let U=S.xAdvance+(S.kerning[n]||0)+c;o.width+=U,o.spaceWidth=U,o.spacesIndex.push(o.charPositions.length),o.chars.push(b);}}else {let P=S.kerning[n]||0,U=S.xAdvance+P+c;d&&m(o.width+h.width+U)&&(x(h),y()),h.positions[h.index++]=h.width+P,h.chars.push(b),h.width+=U;}n=b;}return y(),t.align==="center"?Ey(s):t.align==="right"?Fy(s):t.align==="justify"&&By(s),s}function Ey(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 Fy(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 By(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 nl=p(()=>{});function Ym(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 Xm=p(()=>{});var bn,al,$m,jm=p(()=>{Zi();gt();Rt();_s();dn();Hm();nl();Xm();bn=0,al=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,textureStyle:null};}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(!yt.has(r)){let n=Object.create(e);n.lineHeight=0;let a=new ol({style:n,overrideFill:s,overrideSize:true,...this.defaultOptions});bn++,bn>50&&X("BitmapText",`You have dynamically created ${bn} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),a.once("destroy",()=>{bn--,yt.remove(r);}),yt.set(r,a);}let o=yt.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=true){let s=this.getFont(t,e),o=$t.graphemeSegmenter(t);return yn(o,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},R(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 ze?s:new ze(s),n=e.dynamicFill??this._canUseTintForStyle(o),a=new ol({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:false,textureStyle:e.textureStyle}),h=Ym(e.chars);return a.ensureCharacters(h.join("")),yt.set(`${r}-bitmap`,a),a.once("destroy",()=>yt.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=yt.get(e);r&&r.destroy();}_canUseTintForStyle(t){return !t._stroke&&(!t.dropShadow||t.dropShadow.color===0)&&!t._fill.fill&&t._fill.color===16777215}},$m=new al;});function Km(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 hl,bs,qm=p(()=>{Zi();D();Gm();_s();zm();jm();nl();hl=class extends gn{destroy(){this.context.customShader&&this.context.customShader.destroy(),super.destroy();}},bs=class{constructor(t){this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText");}validateRenderable(t){let e=this._getGpuBitmapText(t);return this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);Km(t,r),t._didTextUpdate&&(t._didTextUpdate=false,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t);}updateRenderable(t){let e=this._getGpuBitmapText(t);Km(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t);}_updateContext(t,e){let{context:r}=e,s=$m.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=new xn(this._renderer.limits.maxBatchableTextures)));let o=$t.graphemeSegmenter(t.text),n=t._style,a=s.baseLineOffset,h=yn(o,n,s,true),l=n.padding,c=h.scale,u=h.width,f=h.height+h.offsetY;n._stroke&&(u+=n._stroke.width/c,f+=n._stroke.width/c),r.translate(-t._anchor._x*u-l,-t._anchor._y*f-l).scale(c,c);let d=s.applyFillAsTint?n._fill.color:16777215,x=s.fontMetrics.fontSize,y=s.lineHeight;n.lineHeight&&(x=n.fontSize/c,y=n.lineHeight/c);let m=(y-x)/2;m-s.baseLineOffset<0&&(m=0);for(let _=0;_<h.lines.length;_++){let b=h.lines[_];for(let v=0;v<b.charPositions.length;v++){let S=b.chars[v],M=s.chars[S];if(M?.texture){let T=M.texture;r.texture(T,d||"black",Math.round(b.charPositions[v]+M.xOffset),Math.round(a+M.yOffset+m),T.orig.width,T.orig.height);}}a+=y;}}_getGpuBitmapText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new hl;return t._gpuData[this._renderer.uid]=e,this._updateContext(t,e),e}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=yt.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(){this._renderer=null;}};bs.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"bitmapText"};});var ll=p(()=>{D();qm();z.add(bs);});var vn,Zm=p(()=>{Rh();vn=class extends oi{constructor(t){super(),this.generatingTexture=false,this._renderer=t,t.runners.resolutionChange.add(this);}resolutionChange(){let t=this.renderable;t._autoResolution&&t.onViewUpdate();}destroy(){this._renderer.htmlText.returnTexturePromise(this.texturePromise),this.texturePromise=null,this._renderer=null;}};});var vs,Qm=p(()=>{D();Bt();Gh();Zm();vs=class{constructor(t){this._renderer=t;}validateRenderable(t){return t._didTextUpdate}addRenderable(t,e){let r=this._getGpuText(t);t._didTextUpdate&&(this._updateGpuText(t).catch(s=>{console.error(s);}),t._didTextUpdate=false,fs(r,t)),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e);}async _updateGpuText(t){t._didTextUpdate=false;let e=this._getGpuText(t);if(e.generatingTexture)return;e.texturePromise&&(this._renderer.htmlText.returnTexturePromise(e.texturePromise),e.texturePromise=null),e.generatingTexture=true,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let r=this._renderer.htmlText.getTexturePromise(t);e.texturePromise=r,e.texture=await r;let s=t.renderGroup||t.parentRenderGroup;s&&(s.structureDidChange=true),e.generatingTexture=false,fs(e,t);}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new vn(this._renderer);return e.renderable=t,e.transform=t.groupTransform,e.texture=I.EMPTY,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null;}};vs.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"htmlText"};});function Jm(){let{userAgent:i}=nt.get().getNavigator();return /^((?!chrome|android).)*safari/i.test(i)}var tg=p(()=>{Zt();});var eg,rg,ui,cl=p(()=>{Zt();eg="http://www.w3.org/2000/svg",rg="http://www.w3.org/1999/xhtml",ui=class{constructor(){this.svgRoot=document.createElementNS(eg,"svg"),this.foreignObject=document.createElementNS(eg,"foreignObject"),this.domElement=document.createElementNS(rg,"div"),this.styleElement=document.createElementNS(rg,"style");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),this.image=nt.get().createImage();}};});function ig(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 sg=p(()=>{});async function og(i){let e=await(await nt.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 ng=p(()=>{Zt();});async function ag(i,t){let e=await og(t);return `@font-face {
471
- font-family: "${i.fontFamily}";
472
- font-weight: ${i.fontWeight};
473
- font-style: ${i.fontStyle};
474
- src: url('${e}');
475
- }`}var hg=p(()=>{ng();});async function lg(i){let t=i.filter(e=>yt.has(`${e}-and-url`)).map(e=>{if(!ul.has(e)){let{entries:r}=yt.get(`${e}-and-url`),s=[];r.forEach(o=>{let n=o.url,h=o.faces.map(l=>({weight:l.weight,style:l.style}));s.push(...h.map(l=>ag({fontWeight:l.weight,fontStyle:l.style,fontFamily:e},n)));}),ul.set(e,Promise.all(s).then(o=>o.join(`
476
- `)));}return ul.get(e)});return (await Promise.all(t)).join(`
477
- `)}var ul,cg=p(()=>{Zi();hg();ul=new Map;});function ug(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 dg=p(()=>{});function fg(i,t){let e=Fe.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 pg=p(()=>{xs();});function mg(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 gg=p(()=>{});function _g(i,t,e,r){r||(r=xg||(xg=new ui));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 xg,yg=p(()=>{cl();});var Ss,bg=p(()=>{D();xs();Dr();rs();tg();Rt();cr();Zh();cl();sg();cg();dg();pg();gg();yg();Ss=class{constructor(t){this._renderer=t,this._createCanvas=t.type===Ce.WEBGPU;}getTexture(t){return this.getTexturePromise(t)}getTexturePromise(t){return this._buildTexturePromise(t)}async _buildTexturePromise(t){let{text:e,style:r,resolution:s,textureStyle:o}=t,n=Tt.get(ui),a=ig(e,r),h=await lg(a),l=_g(e,r,h,n),c=Math.ceil(Math.ceil(Math.max(1,l.width)+r.padding*2)*s),u=Math.ceil(Math.ceil(Math.max(1,l.height)+r.padding*2)*s),f=n.image,d=2;f.width=(c|0)+d,f.height=(u|0)+d;let x=ug(e,r,s,h,n);await mg(f,x,Jm()&&a.length>0);let y=f,m;this._createCanvas&&(m=fg(f,s));let _=fn(m?m.canvas:y,f.width-d,f.height-d,s);return o&&(_.source.style=o),this._createCanvas&&(this._renderer.texture.initSource(_.source),Fe.returnCanvasAndContext(m)),Tt.return(n),_}returnTexturePromise(t){t.then(e=>{this._cleanUp(e);}).catch(()=>{X("HTMLTextSystem: Failed to clean texture");});}_cleanUp(t){It.returnTexture(t,true),t.source.resource=null,t.source.uploadMethodId="unknown";}destroy(){this._renderer=null;}};Ss.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"htmlText"};});var dl=p(()=>{D();Qm();bg();z.add(Ss);z.add(vs);});var vg,di,Sn=p(()=>{Xr();Yr();es();gt();vg=class Sg extends Me{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(R(j,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...Sg.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 kt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:st.VERTEX|st.COPY_DST}),h=new kt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:st.VERTEX|st.COPY_DST}),l=new kt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:st.INDEX|st.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:8,offset:0},aUV:{buffer:h,format:"float32x2",stride:8,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;}};vg.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:false};di=vg;});var Ts,Tg,wg=p(()=>{Ts={name:"local-uniform-bit",vertex:{header:`
478
-
479
- struct LocalUniforms {
480
- uTransformMatrix:mat3x3<f32>,
481
- uColor:vec4<f32>,
482
- uRound:f32,
483
- }
484
-
485
- @group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
486
- `,main:`
487
- vColor *= localUniforms.uColor;
488
- modelMatrix *= localUniforms.uTransformMatrix;
489
- `,end:`
490
- if(localUniforms.uRound == 1)
491
- {
492
- vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
493
- }
494
- `}},{...Ts,vertex:{...Ts.vertex,header:Ts.vertex.header.replace("group(1)","group(2)")}},Tg={name:"local-uniform-bit",vertex:{header:`
495
-
496
- uniform mat3 uTransformMatrix;
497
- uniform vec4 uColor;
498
- uniform float uRound;
499
- `,main:`
500
- vColor *= uColor;
501
- modelMatrix = uTransformMatrix;
502
- `,end:`
503
- if(uRound == 1.)
504
- {
505
- gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
506
- }
507
- `}};});var Pg,Mg,Cg=p(()=>{Pg={name:"tiling-bit",vertex:{header:`
508
- struct TilingUniforms {
509
- uMapCoord:mat3x3<f32>,
510
- uClampFrame:vec4<f32>,
511
- uClampOffset:vec2<f32>,
512
- uTextureTransform:mat3x3<f32>,
513
- uSizeAnchor:vec4<f32>
514
- };
515
-
516
- @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
517
- @group(2) @binding(1) var uTexture: texture_2d<f32>;
518
- @group(2) @binding(2) var uSampler: sampler;
519
- `,main:`
520
- uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
521
-
522
- position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
523
- `},fragment:{header:`
524
- struct TilingUniforms {
525
- uMapCoord:mat3x3<f32>,
526
- uClampFrame:vec4<f32>,
527
- uClampOffset:vec2<f32>,
528
- uTextureTransform:mat3x3<f32>,
529
- uSizeAnchor:vec4<f32>
530
- };
531
-
532
- @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
533
- @group(2) @binding(1) var uTexture: texture_2d<f32>;
534
- @group(2) @binding(2) var uSampler: sampler;
535
- `,main:`
536
-
537
- var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
538
- coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
539
- var unclamped = coord;
540
- coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
541
-
542
- var bias = 0.;
543
-
544
- if(unclamped.x == coord.x && unclamped.y == coord.y)
545
- {
546
- bias = -32.;
547
- }
548
-
549
- outColor = textureSampleBias(uTexture, uSampler, coord, bias);
550
- `}},Mg={name:"tiling-bit",vertex:{header:`
551
- uniform mat3 uTextureTransform;
552
- uniform vec4 uSizeAnchor;
553
-
554
- `,main:`
555
- uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
556
-
557
- position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
558
- `},fragment:{header:`
559
- uniform sampler2D uTexture;
560
- uniform mat3 uMapCoord;
561
- uniform vec4 uClampFrame;
562
- uniform vec2 uClampOffset;
563
- `,main:`
564
-
565
- vec2 coord = vUV + ceil(uClampOffset - vUV);
566
- coord = (uMapCoord * vec3(coord, 1.0)).xy;
567
- vec2 unclamped = coord;
568
- coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
569
-
570
- outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
571
-
572
- `}};});var fl,pl,Tn,Ag=p(()=>{ht();Ro();wg();Oo();is();je();Bt();Cg();Tn=class extends Ae{constructor(){fl??(fl=qr({name:"tiling-sprite-shader",bits:[Ts,Pg,Qr]})),pl??(pl=Zr({name:"tiling-sprite-shader",bits:[Tg,Mg,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:pl,gpuProgram:fl,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:I.EMPTY.source,uSampler:I.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 wn,Eg=p(()=>{Sn();wn=class extends di{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 Fg(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 Bg=p(()=>{});function kg(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 Gg=p(()=>{});function Rg(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),kg(t,2,0,a);}var Ig=p(()=>{ht();Gg();});var Pn,ml,ws,Dg=p(()=>{D();Ji();jo();rs();hs();Ko();Sn();Ag();Eg();Bg();Ig();Pn=new wn,ml=class{constructor(){this.canBatch=true,this.geometry=new di({indices:Pn.indices.slice(),positions:Pn.positions.slice(),uvs:Pn.uvs.slice()});}destroy(){this.geometry.destroy(),this.shader?.destroy();}},ws=class{constructor(t){this._state=vr.default2d,this._renderer=t;}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 qe);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 Tn),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._getTilingSpriteData(t);e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Ke(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Le(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Pn,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);}}_getTilingSpriteData(t){return t._gpuData[this._renderer.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new ml;return e.renderable=t,t._gpuData[this._renderer.uid]=e,e}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),Rg(t,r.uvs),Fg(t,r.positions);}destroy(){this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=true;return this._renderer.type===Ce.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};ws.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"tilingSprite"};});var gl=p(()=>{D();Dg();z.add(ws);});var Lg,Og,zg=p(()=>{gt();Sn();Lg=class Ug extends di{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(R(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={...Ug.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,x=d*this.verticesX+f,y=d*this.verticesX+f+1,m=(d+1)*this.verticesX+f,_=(d+1)*this.verticesX+f+1;o.push(x,y,m,y,_,m);}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();}};Lg.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};Og=Lg;});var Wg,Ng,Hg=p(()=>{zg();Wg=class Vg extends Og{constructor(t={}){t={...Vg.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,x=Math.min(u,d),y=h*e,m=l*r;t[0]=t[8]=t[16]=t[24]=-y,t[2]=t[10]=t[18]=t[26]=s*x-y,t[4]=t[12]=t[20]=t[28]=e-o*x-y,t[6]=t[14]=t[22]=t[30]=e-y,t[1]=t[3]=t[5]=t[7]=-m,t[9]=t[11]=t[13]=t[15]=n*x-m,t[17]=t[19]=t[21]=t[23]=r-a*x-m,t[25]=t[27]=t[29]=t[31]=r-m,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();}};Wg.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Ng=Wg;});var xl,Ps,Yg=p(()=>{D();Ko();Hg();xl=class extends qe{constructor(){super(),this.geometry=new Ng;}destroy(){this.geometry.destroy();}},Ps=class{constructor(t){this._renderer=t;}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=t._gpuData[this._renderer.uid]=new xl,r=e;return r.renderable=t,r.transform=t.groupTransform,r.texture=t._texture,r.roundPixels=this._renderer._roundPixels|t._roundPixels,t.didViewUpdate||this._updateBatchableSprite(t,r),e}destroy(){this._renderer=null;}};Ps.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"nineSliceSprite"};});var _l=p(()=>{D();Yg();z.add(Ps);});var Ms,Xg=p(()=>{D();Ms=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;}};Ms.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"filter"};});function $g(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 jg=p(()=>{});var ky,yl,Cs,Kg=p(()=>{D();ht();Qi();es();je();Bt();Dr();rs();he();jg();Rt();ky=new Me({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),yl=class{constructor(){this.skip=false,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new ft,this.container=null,this.blendRequired=false,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0};}},Cs=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 ne({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters,s=this._pushFilterData();s.skip=false,s.filters=r,s.container=t.container,s.outputRenderSurface=e.renderTarget.renderSurface;let o=e.renderTarget.renderTarget.colorTexture.source,n=o.resolution,a=o.antialias;if(r.length===0){s.skip=true;return}let h=s.bounds;if(this._calculateFilterArea(t,h),this._calculateFilterBounds(s,e.renderTarget.rootViewPort,a,n,1),s.skip)return;let l=this._getPreviousFilterData(),c=this._findFilterResolution(n),u=0,f=0;l&&(u=l.bounds.minX,f=l.bounds.minY),this._calculateGlobalFrame(s,u,f,c,o.width,o.height),this._setupFilterTextures(s,h,e,l);}generateFilteredTexture({texture:t,filters:e}){let r=this._pushFilterData();this._activeFilterData=r,r.skip=false,r.filters=e;let s=t.source,o=s.resolution,n=s.antialias;if(e.length===0)return r.skip=true,t;let a=r.bounds;if(a.addRect(t.frame),this._calculateFilterBounds(r,a.rectangle,n,o,0),r.skip)return t;let h=o;this._calculateGlobalFrame(r,0,0,h,s.width,s.height),r.outputRenderSurface=It.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=I.EMPTY,r.inputTexture=t,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,true);let f=r.outputRenderSurface;return f.source.alphaMode="premultiplied-alpha",f}pop(){let t=this.renderer,e=this._popFilterData();e.skip||(t.globalUniforms.pop(),t.renderTarget.finishRenderPass(),this._activeFilterData=e,this._applyFiltersToTexture(e,false),e.blendRequired&&It.returnTexture(e.backTexture),It.returnTexture(e.inputTexture));}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=It.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._activeFilterData,h=n.outputRenderSurface===r,l=o.renderTarget.rootRenderTarget.colorTexture.source._resolution,c=this._findFilterResolution(l),u=0,f=0;if(h){let d=this._findPreviousFilterOffset();u=d.x,f=d.y;}this._updateFilterUniforms(e,r,n,u,f,c,h,s),this._setupBindGroupsAndRender(t,e,o);}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.orig.width,1/e.texture.orig.height),s.translate(e.anchor.x,e.anchor.y),s}destroy(){}_setupBindGroupsAndRender(t,e,r){if(r.renderPipes.uniformBatch){let s=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(s,0);}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:ky,shader:t,state:t._state,topology:"triangle-list"}),r.type===Ce.WEBGL&&r.renderTarget.finishRenderPass();}_setupFilterTextures(t,e,r,s){if(t.backTexture=I.EMPTY,t.blendRequired){r.renderTarget.finishRenderPass();let o=r.renderTarget.getRenderTarget(t.outputRenderSurface);t.backTexture=this.getBackTexture(o,e,s?.bounds);}t.inputTexture=It.getOptimalTexture(e.width,e.height,t.resolution,t.antialias),r.renderTarget.bind(t.inputTexture,true),r.globalUniforms.push({offset:e});}_calculateGlobalFrame(t,e,r,s,o,n){let a=t.globalFrame;a.x=e*s,a.y=r*s,a.width=o*s,a.height=n*s;}_updateFilterUniforms(t,e,r,s,o,n,a,h){let l=this._filterGlobalUniforms.uniforms,c=l.uOutputFrame,u=l.uInputSize,f=l.uInputPixel,d=l.uInputClamp,x=l.uGlobalFrame,y=l.uOutputTexture;a?(c[0]=r.bounds.minX-s,c[1]=r.bounds.minY-o):(c[0]=0,c[1]=0),c[2]=t.frame.width,c[3]=t.frame.height,u[0]=t.source.width,u[1]=t.source.height,u[2]=1/u[0],u[3]=1/u[1],f[0]=t.source.pixelWidth,f[1]=t.source.pixelHeight,f[2]=1/f[0],f[3]=1/f[1],d[0]=.5*f[2],d[1]=.5*f[3],d[2]=t.frame.width*u[2]-.5*f[2],d[3]=t.frame.height*u[3]-.5*f[3];let m=this.renderer.renderTarget.rootRenderTarget.colorTexture;x[0]=s*n,x[1]=o*n,x[2]=m.source.width*n,x[3]=m.source.height*n,e instanceof I&&(e.source.resource=null);let _=this.renderer.renderTarget.getRenderTarget(e);this.renderer.renderTarget.bind(e,!!h),e instanceof I?(y[0]=e.frame.width,y[1]=e.frame.height):(y[0]=_.width,y[1]=_.height),y[2]=_.isRoot?-1:1,this._filterGlobalUniforms.update();}_findFilterResolution(t){let e=this._filterStackIndex-1;for(;e>0&&this._filterStack[e].skip;)--e;return e>0&&this._filterStack[e].inputTexture?this._filterStack[e].inputTexture.source._resolution:t}_findPreviousFilterOffset(){let t=0,e=0,r=this._filterStackIndex;for(;r>0;){r--;let s=this._filterStack[r];if(!s.skip){t=s.bounds.minX,e=s.bounds.minY;break}}return {x:t,y:e}}_calculateFilterArea(t,e){if(t.renderables?$g(t.renderables,e):t.filterEffect.filterArea?(e.clear(),e.addRect(t.filterEffect.filterArea),e.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,e),t.container){let s=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;s&&e.applyMatrix(s);}}_applyFiltersToTexture(t,e){let r=t.inputTexture,s=t.bounds,o=t.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(t.backTexture.source,3),o.length===1)o[0].apply(this,r,t.outputRenderSurface,e);else {let n=t.inputTexture,a=It.getOptimalTexture(s.width,s.height,n.source._resolution,false),h=a,l=0;for(l=0;l<o.length-1;++l){o[l].apply(this,n,h,true);let u=n;n=h,h=u;}o[l].apply(this,n,t.outputRenderSurface,e),It.returnTexture(a);}}_calculateFilterBounds(t,e,r,s,o){let n=this.renderer,a=t.bounds,h=t.filters,l=1/0,c=0,u=true,f=false,d=false,x=true;for(let y=0;y<h.length;y++){let m=h[y];if(l=Math.min(l,m.resolution==="inherit"?s:m.resolution),c+=m.padding,m.antialias==="off"?u=false:m.antialias==="inherit"&&u&&(u=r),m.clipToViewport||(x=false),!!!(m.compatibleRenderers&n.type)){d=false;break}if(m.blendRequired&&!(n.backBuffer?.useBackBuffer??true)){X("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),d=false;break}d=m.enabled||d,f||(f=m.blendRequired);}if(!d){t.skip=true;return}if(x&&a.fitBounds(0,e.width/s,0,e.height/s),a.scale(l).ceil().scale(1/l).pad((c|0)*o),!a.isPositive){t.skip=true;return}t.antialias=u,t.resolution=l,t.blendRequired=f;}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let t,e=this._filterStackIndex-1;for(;e>1&&(e--,t=this._filterStack[e],!!t.skip););return t}_pushFilterData(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new yl),this._filterStackIndex++,t}};Cs.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"filter"};});var bl=p(()=>{D();Xg();Kg();z.add(Cs);z.add(Ms);});var Gy={};var qg=p(()=>{Pu();_a();Bu();Gu();xo();To();Ch();Ah();kh();rl();ll();dl();gl();_l();bl();});var Ry={};var Qg=p(()=>{_a();xo();To();Ch();Ah();kh();rl();ll();dl();gl();_l();bl();});var ye={};vx(ye,{DistortionFilter:()=>Vs,EqualizerFilter:()=>ie,Filter:()=>St,MonoFilter:()=>Ns,ReverbFilter:()=>Hs,StereoFilter:()=>Ys,StreamFilter:()=>Xs,TelephoneFilter:()=>$s});var Ul;function Ol(i){return Ul=i,i}function et(){return Ul}var St=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 Vs=class extends St{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 xt=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 St{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,xt.setParamValue(d.Q,1),d.frequency.value=f.f,xt.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}`);xt.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=>{xt.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},ie=rt;ie.F32=32;ie.F64=64;ie.F125=125;ie.F250=250;ie.F500=500;ie.F1K=1e3;ie.F2K=2e3;ie.F4K=4e3;ie.F8K=8e3;ie.F16K=16e3;var Ns=class extends St{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 Hs=class extends St{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 Ys=class extends St{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?xt.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 Xs=class extends St{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 $s=class extends St{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",xt.setParamValue(s.frequency,2e3),o.type="lowpass",xt.setParamValue(o.frequency,2e3),n.type="highpass",xt.setParamValue(n.frequency,500),a.type="highpass",xt.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};D();var Zg={extension:{type:w.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(qg(),Gy));}};D();var Jg={extension:{type:w.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Qg(),Ry));}};D();D();To();xo();Ca();Zt();Ua();Ur();Nt();go();z.add(Zg,Jg);var As=class extends q{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 Iy=0,vl=class extends q{constructor(i){super(),this.id=Iy++,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-vl.PADDING),this._end=Math.min(this._end+vl.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),mt.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){mt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){mt.shared.remove(this._onUpdate,this),this.removeAllListeners();let i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Mn=vl;Mn.PADDING=.1;var Es=class extends q{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Mn(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 Fs=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 Pr=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Sl=["audio/mpeg","audio/ogg"],Mr={};function tx(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$/;Pr.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(Mr,r);}tx();var Ly=0,Bs=class extends q{constructor(t){super(),this.id=Ly++,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);xt.setParamValue(this._gain.gain,o*s*r),xt.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){mt.shared.remove(this._updateListener,this),t&&mt.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),r=e-this._lastUpdate;if(r>0||t){let s=this._source.playbackRate.value;this._elapsed+=r*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Cr=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 ex=class extends Cr{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(ex.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,xt.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}},Cn=ex;Cn.BUFFER_SIZE=0;var Ar=class{init(t){this.parent=t,this._nodes=new Cn(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 Bs(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 nt.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 fi=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 Es:new Ar;return new fi(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:Yt.extname(e).slice(1)})).filter(({ext:e})=>Mr[e]).sort((e,r)=>Pr.indexOf(e.ext)-Pr.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 Fs(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(fi._pool.length>0){let i=fi._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),fi._pool.indexOf(i)<0&&fi._pool.push(i);}},Qe=fi;Qe._pool=[];var pi=class i extends Cr{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 q,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 An=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new pi),this._htmlAudioContext=new As,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 pi.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 Qe)return this._sounds[t]=e,e;let r=this._getOptions(e),s=Qe.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 rx=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=Yt.basename(t,Yt.extname(t))),e},ix={extension:w.Asset,detection:{test:async()=>true,add:async i=>[...i,...Pr.filter(t=>Mr[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[w.LoadParser],priority:Vr.High},test(i){let t=Yt.extname(i).slice(1);return !!Mr[t]||Sl.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>Qe.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return et().add(rx(t),e),e},async unload(i,t){et().remove(rx(t));}}};z.add(ix);Ol(new An);({DistortionFilter:ye.DistortionFilter,EqualizerFilter:ye.EqualizerFilter,MonoFilter:ye.MonoFilter,ReverbFilter:ye.ReverbFilter,StereoFilter:ye.StereoFilter,StreamFilter:ye.StreamFilter,TelephoneFilter:ye.TelephoneFilter});var sx={CHARACTER_CATEGORY_KEY:"___character___"};var lt;(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)))(lt||(lt={}));var W=class W{static init(t){W._getStepCounter=t.getStepCounter,W._setStepCounter=t.setStepCounter,W._getCurrentGameStepState=t.getCurrentGameStepState,W._restoreGameStepState=t.restoreGameStepState,W._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(W._onGoNextEnd=t.onGoNextEnd),W._getVariable=t.getVariable,W._setVariable=t.setVariable,W._removeVariable=t.removeVariable,W._getFlag=t.getFlag,W._setFlag=t.setFlag,t.onLabelClosing&&(W._onLabelClosing=t.onLabelClosing),W._addHistoryItem=t.addHistoryItem,W._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,W._getCharacter=t.getCharacter;}static get stepCounter(){return W._getStepCounter()}static set stepCounter(t){W._setStepCounter(t);}static get currentGameStepState(){return W._getCurrentGameStepState()}static get restoreGameStepState(){return W._restoreGameStepState}static get openedLabels(){return W._getOpenedLabels()}static get onGoNextEnd(){return W._onGoNextEnd}static get getVariable(){return W._getVariable}static get setVariable(){return W._setVariable}static get removeVariable(){return W._removeVariable}static get getFlag(){return W._getFlag}static get setFlag(){return W._setFlag}static get onLabelClosing(){return W._onLabelClosing}static get addHistoryItem(){return W._addHistoryItem}static get currentStepsRunningNumber(){return W._getCurrentStepsRunningNumber()}static get getCharacter(){return W._getCharacter}};G(W,"_getStepCounter",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_setStepCounter",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_getCurrentGameStepState",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_restoreGameStepState",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_getOpenedLabels",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_onGoNextEnd",async()=>{}),G(W,"_getVariable",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_setVariable",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_removeVariable",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_getFlag",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_setFlag",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_onLabelClosing",()=>{}),G(W,"_addHistoryItem",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_getCurrentStepsRunningNumber",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),G(W,"_getCharacter",()=>{throw lt.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")}),G(W,"onEnd"),G(W,"onError");function En(i){try{if(typeof i>"u")return i;let t=JSON.stringify(i);return JSON.parse(t)}catch(t){throw lt.error("Error creating exportable element",i,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var gi=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,hx=new Set,Tl=typeof process=="object"&&process?process:{},lx=(i,t,e,r)=>{typeof Tl.emitWarning=="function"?Tl.emitWarning(i,t,e,r):console.error(`[${e}] ${t}: ${i}`);},kn=globalThis.AbortController,ox=globalThis.AbortSignal;if(typeof kn>"u"){ox=class{constructor(){G(this,"onabort");G(this,"_onabort",[]);G(this,"reason");G(this,"aborted",false);}addEventListener(r,s){this._onabort.push(s);}},kn=class{constructor(){G(this,"signal",new ox);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=Tl.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=false,lx("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 zy=i=>!hx.has(i),Je=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),cx=i=>Je(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?xi:null:null,xi=class extends Array{constructor(t){super(t),this.fill(0);}},_i,Er=class Er{constructor(t,e){G(this,"heap");G(this,"length");if(!g(Er,_i))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}static create(t){let e=cx(t);if(!e)return [];O(Er,_i,true);let r=new Er(t,e);return O(Er,_i,false),r}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};_i=new WeakMap,K(Er,_i,false);var wl=Er,nx,ax,ue,Jt,de,Fr,fe,yi,bi,Pt,pe,bt,ut,H,Wt,te,Dt,At,me,Et,ge,xe,ee,_e,ir,Vt,vi,C,Pl,Br,Ve,Gs,re,ux,kr,Si,Rs,tr,er,Ml,Fn,Bn,ct,Cl,ks,rr,Al,El=class El{constructor(t){K(this,C);K(this,ue);K(this,Jt);K(this,de);K(this,Fr);K(this,fe);K(this,yi);K(this,bi);G(this,"ttl");G(this,"ttlResolution");G(this,"ttlAutopurge");G(this,"updateAgeOnGet");G(this,"updateAgeOnHas");G(this,"allowStale");G(this,"noDisposeOnSet");G(this,"noUpdateTTL");G(this,"maxEntrySize");G(this,"sizeCalculation");G(this,"noDeleteOnFetchRejection");G(this,"noDeleteOnStaleGet");G(this,"allowStaleOnFetchAbort");G(this,"allowStaleOnFetchRejection");G(this,"ignoreFetchAbort");K(this,Pt);K(this,pe);K(this,bt);K(this,ut);K(this,H);K(this,Wt);K(this,te);K(this,Dt);K(this,At);K(this,me);K(this,Et);K(this,ge);K(this,xe);K(this,ee);K(this,_e);K(this,ir);K(this,Vt);K(this,vi);K(this,Br,()=>{});K(this,Ve,()=>{});K(this,Gs,()=>{});K(this,re,()=>false);K(this,kr,t=>{});K(this,Si,(t,e,r)=>{});K(this,Rs,(t,e,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});G(this,nx,"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:x=0,maxEntrySize:y=0,sizeCalculation:m,fetchMethod:_,memoMethod:b,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:T,ignoreFetchAbort:P}=t;if(e!==0&&!Je(e))throw new TypeError("max option must be a nonnegative integer");let U=e?cx(e):Array;if(!U)throw new Error("invalid max value: "+e);if(O(this,ue,e),O(this,Jt,x),this.maxEntrySize=y||g(this,Jt),this.sizeCalculation=m,this.sizeCalculation){if(!g(this,Jt)&&!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(O(this,bi,b),_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(O(this,yi,_),O(this,ir,!!_),O(this,bt,new Map),O(this,ut,new Array(e).fill(void 0)),O(this,H,new Array(e).fill(void 0)),O(this,Wt,new U(e)),O(this,te,new U(e)),O(this,Dt,0),O(this,At,0),O(this,me,wl.create(e)),O(this,Pt,0),O(this,pe,0),typeof l=="function"&&O(this,de,l),typeof c=="function"&&O(this,Fr,c),typeof u=="function"?(O(this,fe,u),O(this,Et,[])):(O(this,fe,void 0),O(this,Et,void 0)),O(this,_e,!!g(this,de)),O(this,vi,!!g(this,Fr)),O(this,Vt,!!g(this,fe)),this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!M,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(g(this,Jt)!==0&&!Je(g(this,Jt)))throw new TypeError("maxSize must be a positive integer if specified");if(!Je(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");k(this,C,ux).call(this);}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=Je(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!Je(this.ttl))throw new TypeError("ttl must be a positive integer if specified");k(this,C,Pl).call(this);}if(g(this,ue)===0&&this.ttl===0&&g(this,Jt)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!g(this,ue)&&!g(this,Jt)){let A="LRU_CACHE_UNBOUNDED";zy(A)&&(hx.add(A),lx("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",A,El));}}static unsafeExposeInternals(t){return {starts:g(t,xe),ttls:g(t,ee),sizes:g(t,ge),keyMap:g(t,bt),keyList:g(t,ut),valList:g(t,H),next:g(t,Wt),prev:g(t,te),get head(){return g(t,Dt)},get tail(){return g(t,At)},free:g(t,me),isBackgroundFetch:e=>{var r;return k(r=t,C,ct).call(r,e)},backgroundFetch:(e,r,s,o)=>{var n;return k(n=t,C,Bn).call(n,e,r,s,o)},moveToTail:e=>{var r;return k(r=t,C,ks).call(r,e)},indexes:e=>{var r;return k(r=t,C,tr).call(r,e)},rindexes:e=>{var r;return k(r=t,C,er).call(r,e)},isStale:e=>{var r;return g(r=t,re).call(r,e)}}}get max(){return g(this,ue)}get maxSize(){return g(this,Jt)}get calculatedSize(){return g(this,pe)}get size(){return g(this,Pt)}get fetchMethod(){return g(this,yi)}get memoMethod(){return g(this,bi)}get dispose(){return g(this,de)}get onInsert(){return g(this,Fr)}get disposeAfter(){return g(this,fe)}getRemainingTTL(t){return g(this,bt).has(t)?1/0:0}*entries(){for(let t of k(this,C,tr).call(this))g(this,H)[t]!==void 0&&g(this,ut)[t]!==void 0&&!k(this,C,ct).call(this,g(this,H)[t])&&(yield [g(this,ut)[t],g(this,H)[t]]);}*rentries(){for(let t of k(this,C,er).call(this))g(this,H)[t]!==void 0&&g(this,ut)[t]!==void 0&&!k(this,C,ct).call(this,g(this,H)[t])&&(yield [g(this,ut)[t],g(this,H)[t]]);}*keys(){for(let t of k(this,C,tr).call(this)){let e=g(this,ut)[t];e!==void 0&&!k(this,C,ct).call(this,g(this,H)[t])&&(yield e);}}*rkeys(){for(let t of k(this,C,er).call(this)){let e=g(this,ut)[t];e!==void 0&&!k(this,C,ct).call(this,g(this,H)[t])&&(yield e);}}*values(){for(let t of k(this,C,tr).call(this))g(this,H)[t]!==void 0&&!k(this,C,ct).call(this,g(this,H)[t])&&(yield g(this,H)[t]);}*rvalues(){for(let t of k(this,C,er).call(this))g(this,H)[t]!==void 0&&!k(this,C,ct).call(this,g(this,H)[t])&&(yield g(this,H)[t]);}[(ax=Symbol.iterator,nx=Symbol.toStringTag,ax)](){return this.entries()}find(t,e={}){for(let r of k(this,C,tr).call(this)){let s=g(this,H)[r],o=k(this,C,ct).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,g(this,ut)[r],this))return this.get(g(this,ut)[r],e)}}forEach(t,e=this){for(let r of k(this,C,tr).call(this)){let s=g(this,H)[r],o=k(this,C,ct).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,g(this,ut)[r],this);}}rforEach(t,e=this){for(let r of k(this,C,er).call(this)){let s=g(this,H)[r],o=k(this,C,ct).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,g(this,ut)[r],this);}}purgeStale(){let t=false;for(let e of k(this,C,er).call(this,{allowStale:true}))g(this,re).call(this,e)&&(k(this,C,rr).call(this,g(this,ut)[e],"expire"),t=true);return t}info(t){let e=g(this,bt).get(t);if(e===void 0)return;let r=g(this,H)[e],s=k(this,C,ct).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(g(this,ee)&&g(this,xe)){let n=g(this,ee)[e],a=g(this,xe)[e];if(n&&a){let h=n-(gi.now()-a);o.ttl=h,o.start=Date.now();}}return g(this,ge)&&(o.size=g(this,ge)[e]),o}dump(){let t=[];for(let e of k(this,C,tr).call(this,{allowStale:true})){let r=g(this,ut)[e],s=g(this,H)[e],o=k(this,C,ct).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let n={value:o};if(g(this,ee)&&g(this,xe)){n.ttl=g(this,ee)[e];let a=gi.now()-g(this,xe)[e];n.start=Math.floor(Date.now()-a);}g(this,ge)&&(n.size=g(this,ge)[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=gi.now()-s;}this.set(e,r.value,r);}}set(t,e,r={}){var f,d,x,y;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,Rs).call(this,t,e,r.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),k(this,C,rr).call(this,t,"set"),this;let u=g(this,Pt)===0?void 0:g(this,bt).get(t);if(u===void 0)u=g(this,Pt)===0?g(this,At):g(this,me).length!==0?g(this,me).pop():g(this,Pt)===g(this,ue)?k(this,C,Fn).call(this,false):g(this,Pt),g(this,ut)[u]=t,g(this,H)[u]=e,g(this,bt).set(t,u),g(this,Wt)[g(this,At)]=u,g(this,te)[u]=g(this,At),O(this,At,u),Ws(this,Pt)._++,g(this,Si).call(this,u,c,h),h&&(h.set="add"),l=false,g(this,vi)&&((f=g(this,Fr))==null||f.call(this,e,t,"add"));else {k(this,C,ks).call(this,u);let m=g(this,H)[u];if(e!==m){if(g(this,ir)&&k(this,C,ct).call(this,m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:_}=m;_!==void 0&&!n&&(g(this,_e)&&((d=g(this,de))==null||d.call(this,_,t,"set")),g(this,Vt)&&g(this,Et)?.push([_,t,"set"]));}else n||(g(this,_e)&&((x=g(this,de))==null||x.call(this,m,t,"set")),g(this,Vt)&&g(this,Et)?.push([m,t,"set"]));if(g(this,kr).call(this,u),g(this,Si).call(this,u,c,h),g(this,H)[u]=e,h){h.set="replace";let _=m&&k(this,C,ct).call(this,m)?m.__staleWhileFetching:m;_!==void 0&&(h.oldValue=_);}}else h&&(h.set="update");g(this,vi)&&this.onInsert?.(e,t,e===m?"update":"replace");}if(s!==0&&!g(this,ee)&&k(this,C,Pl).call(this),g(this,ee)&&(l||g(this,Gs).call(this,u,s,o),h&&g(this,Ve).call(this,h,u)),!n&&g(this,Vt)&&g(this,Et)){let m=g(this,Et),_;for(;_=m?.shift();)(y=g(this,fe))==null||y.call(this,..._);}return this}pop(){var t;try{for(;g(this,Pt);){let e=g(this,H)[g(this,Dt)];if(k(this,C,Fn).call(this,!0),k(this,C,ct).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(g(this,Vt)&&g(this,Et)){let e=g(this,Et),r;for(;r=e?.shift();)(t=g(this,fe))==null||t.call(this,...r);}}}has(t,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=e,o=g(this,bt).get(t);if(o!==void 0){let n=g(this,H)[o];if(k(this,C,ct).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(g(this,re).call(this,o))s&&(s.has="stale",g(this,Ve).call(this,s,o));else return r&&g(this,Br).call(this,o),s&&(s.has="hit",g(this,Ve).call(this,s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:r=this.allowStale}=e,s=g(this,bt).get(t);if(s===void 0||!r&&g(this,re).call(this,s))return;let o=g(this,H)[s];return k(this,C,ct).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:x=this.allowStaleOnFetchAbort,context:y,forceRefresh:m=false,status:_,signal:b}=e;if(!g(this,ir))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:x,ignoreFetchAbort:d,status:_,signal:b},S=g(this,bt).get(t);if(S===void 0){_&&(_.fetch="miss");let M=k(this,C,Bn).call(this,t,S,v,y);return M.__returned=M}else {let M=g(this,H)[S];if(k(this,C,ct).call(this,M)){let F=r&&M.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",F&&(_.returnedStale=true)),F?M.__staleWhileFetching:M.__returned=M}let T=g(this,re).call(this,S);if(!m&&!T)return _&&(_.fetch="hit"),k(this,C,ks).call(this,S),s&&g(this,Br).call(this,S),_&&g(this,Ve).call(this,_,S),M;let P=k(this,C,Bn).call(this,t,S,v,y),A=P.__staleWhileFetching!==void 0&&r;return _&&(_.fetch=T?"stale":"refresh",A&&T&&(_.returnedStale=true)),A?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,bi);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,bt).get(t);if(a!==void 0){let h=g(this,H)[a],l=k(this,C,ct).call(this,h);return n&&g(this,Ve).call(this,n,a),g(this,re).call(this,a)?(n&&(n.get="stale"),l?(n&&r&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),r?h.__staleWhileFetching:void 0):(o||k(this,C,rr).call(this,t,"expire"),n&&r&&(n.returnedStale=true),r?h:void 0)):(n&&(n.get="hit"),l?h.__staleWhileFetching:(k(this,C,ks).call(this,a),s&&g(this,Br).call(this,a),h))}else n&&(n.get="miss");}delete(t){return k(this,C,rr).call(this,t,"delete")}clear(){return k(this,C,Al).call(this,"delete")}};ue=new WeakMap,Jt=new WeakMap,de=new WeakMap,Fr=new WeakMap,fe=new WeakMap,yi=new WeakMap,bi=new WeakMap,Pt=new WeakMap,pe=new WeakMap,bt=new WeakMap,ut=new WeakMap,H=new WeakMap,Wt=new WeakMap,te=new WeakMap,Dt=new WeakMap,At=new WeakMap,me=new WeakMap,Et=new WeakMap,ge=new WeakMap,xe=new WeakMap,ee=new WeakMap,_e=new WeakMap,ir=new WeakMap,Vt=new WeakMap,vi=new WeakMap,C=new WeakSet,Pl=function(){let t=new xi(g(this,ue)),e=new xi(g(this,ue));O(this,ee,t),O(this,xe,e),O(this,Gs,(o,n,a=gi.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let h=setTimeout(()=>{g(this,re).call(this,o)&&k(this,C,rr).call(this,g(this,ut)[o],"expire");},n+1);h.unref&&h.unref();}}),O(this,Br,o=>{e[o]=t[o]!==0?gi.now():0;}),O(this,Ve,(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=gi.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,bt).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},O(this,re,o=>{let n=e[o],a=t[o];return !!a&&!!n&&(r||s())-n>a});},Br=new WeakMap,Ve=new WeakMap,Gs=new WeakMap,re=new WeakMap,ux=function(){let t=new xi(g(this,ue));O(this,pe,0),O(this,ge,t),O(this,kr,e=>{O(this,pe,g(this,pe)-t[e]),t[e]=0;}),O(this,Rs,(e,r,s,o)=>{if(k(this,C,ct).call(this,r))return 0;if(!Je(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,e),!Je(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}),O(this,Si,(e,r,s)=>{if(t[e]=r,g(this,Jt)){let o=g(this,Jt)-t[e];for(;g(this,pe)>o;)k(this,C,Fn).call(this,true);}O(this,pe,g(this,pe)+t[e]),s&&(s.entrySize=r,s.totalCalculatedSize=g(this,pe));});},kr=new WeakMap,Si=new WeakMap,Rs=new WeakMap,tr=function*({allowStale:t=this.allowStale}={}){if(g(this,Pt))for(let e=g(this,At);!(!k(this,C,Ml).call(this,e)||((t||!g(this,re).call(this,e))&&(yield e),e===g(this,Dt)));)e=g(this,te)[e];},er=function*({allowStale:t=this.allowStale}={}){if(g(this,Pt))for(let e=g(this,Dt);!(!k(this,C,Ml).call(this,e)||((t||!g(this,re).call(this,e))&&(yield e),e===g(this,At)));)e=g(this,Wt)[e];},Ml=function(t){return t!==void 0&&g(this,bt).get(g(this,ut)[t])===t},Fn=function(t){var o;let e=g(this,Dt),r=g(this,ut)[e],s=g(this,H)[e];return g(this,ir)&&k(this,C,ct).call(this,s)?s.__abortController.abort(new Error("evicted")):(g(this,_e)||g(this,Vt))&&(g(this,_e)&&((o=g(this,de))==null||o.call(this,s,r,"evict")),g(this,Vt)&&g(this,Et)?.push([s,r,"evict"])),g(this,kr).call(this,e),t&&(g(this,ut)[e]=void 0,g(this,H)[e]=void 0,g(this,me).push(e)),g(this,Pt)===1?(O(this,Dt,O(this,At,0)),g(this,me).length=0):O(this,Dt,g(this,Wt)[e]),g(this,bt).delete(r),Ws(this,Pt)._--,e},Bn=function(t,e,r,s){let o=e===void 0?void 0:g(this,H)[e];if(k(this,C,ct).call(this,o))return o;let n=new kn,{signal:a}=r;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:r,context:s},l=(y,m=false)=>{let{aborted:_}=n.signal,b=r.ignoreFetchAbort&&y!==void 0;if(r.status&&(_&&!m?(r.status.fetchAborted=true,r.status.fetchError=n.signal.reason,b&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),_&&!b&&!m)return u(n.signal.reason);let v=d;return g(this,H)[e]===d&&(y===void 0?v.__staleWhileFetching?g(this,H)[e]=v.__staleWhileFetching:k(this,C,rr).call(this,t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,y,h.options))),y},c=y=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=y),u(y)),u=y=>{let{aborted:m}=n.signal,_=m&&r.allowStaleOnFetchAbort,b=_||r.allowStaleOnFetchRejection,v=b||r.noDeleteOnFetchRejection,S=d;if(g(this,H)[e]===d&&(!v||S.__staleWhileFetching===void 0?k(this,C,rr).call(this,t,"fetch"):_||(g(this,H)[e]=S.__staleWhileFetching)),b)return r.status&&S.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),S.__staleWhileFetching;if(S.__returned===S)throw y},f=(y,m)=>{var b;let _=(b=g(this,yi))==null?void 0:b.call(this,t,o,h);_&&_ instanceof Promise&&_.then(v=>y(v===void 0?void 0:v),m),n.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(y(void 0),r.allowStaleOnFetchAbort&&(y=v=>l(v,true)));});};r.status&&(r.status.fetchDispatched=true);let d=new Promise(f).then(l,c),x=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,x,{...h.options,status:void 0}),e=g(this,bt).get(t)):g(this,H)[e]=x,x},ct=function(t){if(!g(this,ir))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof kn},Cl=function(t,e){g(this,te)[e]=t,g(this,Wt)[t]=e;},ks=function(t){t!==g(this,At)&&(t===g(this,Dt)?O(this,Dt,g(this,Wt)[t]):k(this,C,Cl).call(this,g(this,te)[t],g(this,Wt)[t]),k(this,C,Cl).call(this,g(this,At),t),O(this,At,t));},rr=function(t,e){var s,o;let r=false;if(g(this,Pt)!==0){let n=g(this,bt).get(t);if(n!==void 0)if(r=true,g(this,Pt)===1)k(this,C,Al).call(this,e);else {g(this,kr).call(this,n);let a=g(this,H)[n];if(k(this,C,ct).call(this,a)?a.__abortController.abort(new Error("deleted")):(g(this,_e)||g(this,Vt))&&(g(this,_e)&&((s=g(this,de))==null||s.call(this,a,t,e)),g(this,Vt)&&g(this,Et)?.push([a,t,e])),g(this,bt).delete(t),g(this,ut)[n]=void 0,g(this,H)[n]=void 0,n===g(this,At))O(this,At,g(this,te)[n]);else if(n===g(this,Dt))O(this,Dt,g(this,Wt)[n]);else {let h=g(this,te)[n];g(this,Wt)[h]=g(this,Wt)[n];let l=g(this,Wt)[n];g(this,te)[l]=g(this,te)[n];}Ws(this,Pt)._--,g(this,me).push(n);}}if(g(this,Vt)&&g(this,Et)?.length){let n=g(this,Et),a;for(;a=n?.shift();)(o=g(this,fe))==null||o.call(this,...a);}return r},Al=function(t){var e,r;for(let s of k(this,C,er).call(this,{allowStale:true})){let o=g(this,H)[s];if(k(this,C,ct).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=g(this,ut)[s];g(this,_e)&&((e=g(this,de))==null||e.call(this,o,n,t)),g(this,Vt)&&g(this,Et)?.push([o,n,t]);}}if(g(this,bt).clear(),g(this,H).fill(void 0),g(this,ut).fill(void 0),g(this,ee)&&g(this,xe)&&(g(this,ee).fill(0),g(this,xe).fill(0)),g(this,ge)&&g(this,ge).fill(0),O(this,Dt,0),O(this,At,0),g(this,me).length=0,O(this,pe,0),O(this,Pt,0),g(this,Vt)&&g(this,Et)){let s=g(this,Et),o;for(;o=s?.shift();)(r=g(this,fe))==null||r.call(this,...o);}};var Gn=El;var sr=class{constructor(t){G(this,"cache");G(this,"map",new Map);this.cache=new Gn({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}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var vt=class vt{constructor(){}static clearOldTempVariables(t){vt.tempStorageDeadlines.forEach((e,r)=>{e>t&&(vt.tempStorage.delete(r),vt.tempStorageDeadlines.delete(r),vt.storage.cache.delete(r));});}static setVariable(t,e){let r=vt.tempStorage.has(t);e==null?(vt.storage.map.delete(t),!r&&vt.storage.cache.delete(t)):(vt.storage.map.set(t,e),!r&&vt.storage.cache.set(t,e));}static getVariable(t){let e=vt.storage.cache.get(t);return e===void 0&&(e=vt.tempStorage.get(t)),e===void 0&&(e=vt.storage.map.get(t)),En(e)}static removeVariable(t){vt.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)}};G(vt,"storage",new sr({cacheSize:20})),G(vt,"startingStorage",[]),G(vt,"flags",Array()),G(vt,"tempStorage",new Map),G(vt,"tempStorageDeadlines",new Map);var V=vt;var Ti=class{constructor(t,e){G(this,"_id");G(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 Wy="@",wi=class extends Ti{constructor(e,r=""){super(sx.CHARACTER_CATEGORY_KEY,e+(r?Wy+r:""));G(this,"sourceId");this.sourceId=e;}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var Rn=class extends wi{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion);G(this,"defaultName");G(this,"defaultSurname");G(this,"defaultAge");G(this,"_icon");G(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 Ds=new sr({cacheSize:10}),Fl;(s=>{function i(o){try{let n=Ds.get(o);if(!n){lt.warn(`Character "${o}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return n}catch(n){lt.error(`Error while getting Character "${o}"`,n);return}}s.get=i;function t(o){if(Array.isArray(o)){o.forEach(n=>t(n));return}Ds.get(o.id)&&lt.info(`Character id "${o.id}" already exists, it will be overwritten`),Ds.set(o.id,o);}s.add=t;function e(){return Array.from(Ds.values())}s.values=e;function r(o){return Ds.has(o)}s.has=r;})(Fl||(Fl={}));var Vy=Fl;export{Rn as CharacterBaseModel,wi as CharacterStoredClass,Vy as RegisteredCharacters};