route-graphics 0.0.2-rc21 → 0.0.2-rc22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- var w0=Object.create;var $a=Object.defineProperty;var P0=Object.getOwnPropertyDescriptor;var A0=Object.getOwnPropertyNames;var E0=Object.getPrototypeOf,C0=Object.prototype.hasOwnProperty;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var Ya=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),$u=(i,t)=>{for(var e in t)$a(i,e,{get:t[e],enumerable:!0})},M0=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of A0(t))!C0.call(i,s)&&s!==e&&$a(i,s,{get:()=>t[s],enumerable:!(r=P0(t,s))||r.enumerable});return i};var Io=(i,t,e)=>(e=i!=null?w0(E0(i)):{},M0(t||!i||!i.__esModule?$a(e,"default",{value:i,enumerable:!0}):e,i));var x,ja,Di,k,w=p(()=>{"use strict";x=(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))(x||{}),ja=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},Di=(i,t)=>ja(i).priority??t,k={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(ja).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(ja).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)=>Di(n.value,e)-Di(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)=>Di(o,e)-Di(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 ju=Ya((tP,Ka)=>{"use strict";var B0=Object.prototype.hasOwnProperty,Ut="~";function Oi(){}Object.create&&(Oi.prototype=Object.create(null),new Oi().__proto__||(Ut=!1));function R0(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function Yu(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new R0(e,r||i,s),n=Ut?Ut+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 Fo(i,t){--i._eventsCount===0?i._events=new Oi:delete i._events[t]}function Gt(){this._events=new Oi,this._eventsCount=0}Gt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)B0.call(e,r)&&t.push(Ut?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Gt.prototype.listeners=function(t){var e=Ut?Ut+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=Ut?Ut+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=Ut?Ut+t:t;if(!this._events[a])return!1;var c=this._events[a],l=arguments.length,h,u;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,r),!0;case 4:return c.fn.call(c.context,e,r,s),!0;case 5:return c.fn.call(c.context,e,r,s,o),!0;case 6:return c.fn.call(c.context,e,r,s,o,n),!0}for(u=1,h=new Array(l-1);u<l;u++)h[u-1]=arguments[u];c.fn.apply(c.context,h)}else{var d=c.length,f;for(u=0;u<d;u++)switch(c[u].once&&this.removeListener(t,c[u].fn,void 0,!0),l){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,e);break;case 3:c[u].fn.call(c[u].context,e,r);break;case 4:c[u].fn.call(c[u].context,e,r,s);break;default:if(!h)for(f=1,h=new Array(l-1);f<l;f++)h[f-1]=arguments[f];c[u].fn.apply(c[u].context,h)}}return!0};Gt.prototype.on=function(t,e,r){return Yu(this,t,e,r,!1)};Gt.prototype.once=function(t,e,r){return Yu(this,t,e,r,!0)};Gt.prototype.removeListener=function(t,e,r,s){var o=Ut?Ut+t:t;if(!this._events[o])return this;if(!e)return Fo(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&Fo(this,o);else{for(var a=0,c=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&c.push(n[a]);c.length?this._events[o]=c.length===1?c[0]:c:Fo(this,o)}return this};Gt.prototype.removeAllListeners=function(t){var e;return t?(e=Ut?Ut+t:t,this._events[e]&&Fo(this,e)):(this._events=new Oi,this._eventsCount=0),this};Gt.prototype.off=Gt.prototype.removeListener;Gt.prototype.addListener=Gt.prototype.on;Gt.prefixed=Ut;Gt.EventEmitter=Gt;typeof Ka<"u"&&(Ka.exports=Gt)});var Ku,nt,kt=p(()=>{Ku=Io(ju(),1),nt=Ku.default});var G0,Be,St,re,id,qu,qa,k0,Uo,sd,od,Zu,Qu,Ju,Li,I0,F0,U0,D0,Ja,td,O0,Za,Qa,ed,tc,ue,rd,nd,ad=p(()=>{G0={grad:.9,turn:360,rad:360/(2*Math.PI)},Be=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},St=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},re=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},id=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},qu=function(i){return{r:re(i.r,0,255),g:re(i.g,0,255),b:re(i.b,0,255),a:re(i.a)}},qa=function(i){return{r:St(i.r),g:St(i.g),b:St(i.b),a:St(i.a,3)}},k0=/^#([0-9a-f]{3,8})$/i,Uo=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},sd=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}},od=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),c=r*(1-(1-t+o)*e),l=o%6;return{r:255*[r,a,n,n,c,r][l],g:255*[c,r,r,a,n,n][l],b:255*[n,n,c,r,r,a][l],a:s}},Zu=function(i){return{h:id(i.h),s:re(i.s,0,100),l:re(i.l,0,100),a:re(i.a)}},Qu=function(i){return{h:St(i.h),s:St(i.s),l:St(i.l),a:St(i.a,3)}},Ju=function(i){return od((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},Li=function(i){return{h:(t=sd(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},I0=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,F0=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,U0=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,D0=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ja={string:[[function(i){var t=k0.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?St(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?St(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=U0.exec(i)||D0.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:qu({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=I0.exec(i)||F0.exec(i);if(!t)return null;var e,r,s=Zu({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(G0[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Ju(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 Be(t)&&Be(e)&&Be(r)?qu({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(!Be(t)||!Be(e)||!Be(r))return null;var n=Zu({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Ju(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Be(t)||!Be(e)||!Be(r))return null;var n=function(a){return{h:id(a.h),s:re(a.s,0,100),v:re(a.v,0,100),a:re(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return od(n)},"hsv"]]},td=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]},O0=function(i){return typeof i=="string"?td(i.trim(),Ja.string):typeof i=="object"&&i!==null?td(i,Ja.object):[null,void 0]},Za=function(i,t){var e=Li(i);return{h:e.h,s:re(e.s+100*t,0,100),l:e.l,a:e.a}},Qa=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},ed=function(i,t){var e=Li(i);return{h:e.h,s:e.s,l:re(e.l+100*t,0,100),a:e.a}},tc=function(){function i(t){this.parsed=O0(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 St(Qa(this.rgba),2)},i.prototype.isDark=function(){return Qa(this.rgba)<.5},i.prototype.isLight=function(){return Qa(this.rgba)>=.5},i.prototype.toHex=function(){return t=qa(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?Uo(St(255*o)):"","#"+Uo(e)+Uo(r)+Uo(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return qa(this.rgba)},i.prototype.toRgbString=function(){return t=qa(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 Qu(Li(this.rgba))},i.prototype.toHslString=function(){return t=Qu(Li(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=sd(this.rgba),{h:St(t.h),s:St(t.s),v:St(t.v),a:St(t.a,3)};var t},i.prototype.invert=function(){return ue({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),ue(Za(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),ue(Za(this.rgba,-t))},i.prototype.grayscale=function(){return ue(Za(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),ue(ed(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),ue(ed(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"?ue({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):St(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=Li(this.rgba);return typeof t=="number"?ue({h:t,s:e.s,l:e.l,a:e.a}):St(e.h)},i.prototype.isEqual=function(t){return this.toHex()===ue(t).toHex()},i}(),ue=function(i){return i instanceof tc?i:new tc(i)},rd=[],nd=function(i){i.forEach(function(t){rd.indexOf(t)<0&&(t(tc,Ja),rd.push(t))})}});function cd(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,c,l=r[this.toHex()];if(l)return l;if(n?.closest){var h=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new i(e[f]).toRgb();for(var m in e){var _=(a=h,c=o[m],Math.pow(a.r-c.r,2)+Math.pow(a.g-c.g,2)+Math.pow(a.b-c.b,2));_<u&&(u=_,d=m)}return d}},t.string.push([function(n){var a=n.toLowerCase(),c=a==="transparent"?"#0000":e[a];return c?new i(c).toRgb():null},"name"])}var ld=p(()=>{});var Gr,X,Mt=p(()=>{ad();ld();nd([cd]);Gr=class Ni{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 Ni)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!1;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?!1: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?!1: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]=Ni._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=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let 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=Ni.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=ue(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 Ni||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;X=Gr});var hd,ud=p(()=>{"use strict";hd={cullArea:null,cullable:!1,cullableChildren:!0}});var dd,fd,pd,ec=p(()=>{"use strict";dd=Math.PI*2,fd=180/Math.PI,pd=Math.PI/180});var K,rc,ie=p(()=>{"use strict";K=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 rc.x=0,rc.y=0,rc}},rc=new K});var G,L0,N0,Z=p(()=>{ec();ie();G=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 K;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 K;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,c=this.ty,l=1/(r*n+o*-s),h=t.x,u=t.y;return e.x=n*l*h+-o*l*u+(c*o-a*n)*l,e.y=r*l*u+-s*l*h+(-c*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,c=t.ty,l=e.a,h=e.b,u=e.c,d=e.d;return this.a=r*l+s*u,this.b=r*h+s*d,this.c=o*l+n*u,this.d=o*h+n*d,this.tx=a*l+c*u+e.tx,this.ty=a*h+c*d+e.ty,this}setTransform(t,e,r,s,o,n,a,c,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-c)*n,this.d=Math.cos(a-c)*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),c=Math.atan2(r,e),l=Math.abs(a+c);return l<1e-5||Math.abs(dd-l)<1e-5?(t.rotation=c,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=c),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 N0.identity()}static get shared(){return L0.identity()}},L0=new G,N0=new G});var Bt,Do=p(()=>{"use strict";Bt=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function j(i="default"){return ic[i]===void 0&&(ic[i]=-1),++ic[i]}var ic,Rt=p(()=>{"use strict";ic={default:-1}});function D(i,t,e=3){if(md[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1
+ var w0=Object.create;var $a=Object.defineProperty;var P0=Object.getOwnPropertyDescriptor;var A0=Object.getOwnPropertyNames;var E0=Object.getPrototypeOf,C0=Object.prototype.hasOwnProperty;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var Ya=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),$u=(i,t)=>{for(var e in t)$a(i,e,{get:t[e],enumerable:!0})},M0=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of A0(t))!C0.call(i,s)&&s!==e&&$a(i,s,{get:()=>t[s],enumerable:!(r=P0(t,s))||r.enumerable});return i};var Io=(i,t,e)=>(e=i!=null?w0(E0(i)):{},M0(t||!i||!i.__esModule?$a(e,"default",{value:i,enumerable:!0}):e,i));var x,ja,Di,I,P=p(()=>{"use strict";x=(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))(x||{}),ja=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},Di=(i,t)=>ja(i).priority??t,I={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(ja).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(ja).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)=>Di(n.value,e)-Di(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)=>Di(o,e)-Di(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 ju=Ya((tP,Ka)=>{"use strict";var B0=Object.prototype.hasOwnProperty,Ut="~";function Oi(){}Object.create&&(Oi.prototype=Object.create(null),new Oi().__proto__||(Ut=!1));function R0(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function Yu(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new R0(e,r||i,s),n=Ut?Ut+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 Fo(i,t){--i._eventsCount===0?i._events=new Oi:delete i._events[t]}function Gt(){this._events=new Oi,this._eventsCount=0}Gt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)B0.call(e,r)&&t.push(Ut?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Gt.prototype.listeners=function(t){var e=Ut?Ut+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=Ut?Ut+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=Ut?Ut+t:t;if(!this._events[a])return!1;var c=this._events[a],l=arguments.length,h,u;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,r),!0;case 4:return c.fn.call(c.context,e,r,s),!0;case 5:return c.fn.call(c.context,e,r,s,o),!0;case 6:return c.fn.call(c.context,e,r,s,o,n),!0}for(u=1,h=new Array(l-1);u<l;u++)h[u-1]=arguments[u];c.fn.apply(c.context,h)}else{var f=c.length,d;for(u=0;u<f;u++)switch(c[u].once&&this.removeListener(t,c[u].fn,void 0,!0),l){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,e);break;case 3:c[u].fn.call(c[u].context,e,r);break;case 4:c[u].fn.call(c[u].context,e,r,s);break;default:if(!h)for(d=1,h=new Array(l-1);d<l;d++)h[d-1]=arguments[d];c[u].fn.apply(c[u].context,h)}}return!0};Gt.prototype.on=function(t,e,r){return Yu(this,t,e,r,!1)};Gt.prototype.once=function(t,e,r){return Yu(this,t,e,r,!0)};Gt.prototype.removeListener=function(t,e,r,s){var o=Ut?Ut+t:t;if(!this._events[o])return this;if(!e)return Fo(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&Fo(this,o);else{for(var a=0,c=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&c.push(n[a]);c.length?this._events[o]=c.length===1?c[0]:c:Fo(this,o)}return this};Gt.prototype.removeAllListeners=function(t){var e;return t?(e=Ut?Ut+t:t,this._events[e]&&Fo(this,e)):(this._events=new Oi,this._eventsCount=0),this};Gt.prototype.off=Gt.prototype.removeListener;Gt.prototype.addListener=Gt.prototype.on;Gt.prefixed=Ut;Gt.EventEmitter=Gt;typeof Ka<"u"&&(Ka.exports=Gt)});var Ku,nt,kt=p(()=>{Ku=Io(ju(),1),nt=Ku.default});var G0,Be,St,re,id,qu,qa,k0,Uo,sd,od,Zu,Qu,Ju,Li,I0,F0,U0,D0,Ja,td,O0,Za,Qa,ed,tc,ue,rd,nd,ad=p(()=>{G0={grad:.9,turn:360,rad:360/(2*Math.PI)},Be=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},St=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},re=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},id=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},qu=function(i){return{r:re(i.r,0,255),g:re(i.g,0,255),b:re(i.b,0,255),a:re(i.a)}},qa=function(i){return{r:St(i.r),g:St(i.g),b:St(i.b),a:St(i.a,3)}},k0=/^#([0-9a-f]{3,8})$/i,Uo=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},sd=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}},od=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),c=r*(1-(1-t+o)*e),l=o%6;return{r:255*[r,a,n,n,c,r][l],g:255*[c,r,r,a,n,n][l],b:255*[n,n,c,r,r,a][l],a:s}},Zu=function(i){return{h:id(i.h),s:re(i.s,0,100),l:re(i.l,0,100),a:re(i.a)}},Qu=function(i){return{h:St(i.h),s:St(i.s),l:St(i.l),a:St(i.a,3)}},Ju=function(i){return od((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},Li=function(i){return{h:(t=sd(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},I0=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,F0=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,U0=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,D0=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ja={string:[[function(i){var t=k0.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?St(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?St(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=U0.exec(i)||D0.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:qu({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=I0.exec(i)||F0.exec(i);if(!t)return null;var e,r,s=Zu({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(G0[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Ju(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 Be(t)&&Be(e)&&Be(r)?qu({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(!Be(t)||!Be(e)||!Be(r))return null;var n=Zu({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Ju(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Be(t)||!Be(e)||!Be(r))return null;var n=function(a){return{h:id(a.h),s:re(a.s,0,100),v:re(a.v,0,100),a:re(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return od(n)},"hsv"]]},td=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]},O0=function(i){return typeof i=="string"?td(i.trim(),Ja.string):typeof i=="object"&&i!==null?td(i,Ja.object):[null,void 0]},Za=function(i,t){var e=Li(i);return{h:e.h,s:re(e.s+100*t,0,100),l:e.l,a:e.a}},Qa=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},ed=function(i,t){var e=Li(i);return{h:e.h,s:e.s,l:re(e.l+100*t,0,100),a:e.a}},tc=function(){function i(t){this.parsed=O0(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 St(Qa(this.rgba),2)},i.prototype.isDark=function(){return Qa(this.rgba)<.5},i.prototype.isLight=function(){return Qa(this.rgba)>=.5},i.prototype.toHex=function(){return t=qa(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?Uo(St(255*o)):"","#"+Uo(e)+Uo(r)+Uo(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return qa(this.rgba)},i.prototype.toRgbString=function(){return t=qa(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 Qu(Li(this.rgba))},i.prototype.toHslString=function(){return t=Qu(Li(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=sd(this.rgba),{h:St(t.h),s:St(t.s),v:St(t.v),a:St(t.a,3)};var t},i.prototype.invert=function(){return ue({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),ue(Za(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),ue(Za(this.rgba,-t))},i.prototype.grayscale=function(){return ue(Za(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),ue(ed(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),ue(ed(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"?ue({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):St(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=Li(this.rgba);return typeof t=="number"?ue({h:t,s:e.s,l:e.l,a:e.a}):St(e.h)},i.prototype.isEqual=function(t){return this.toHex()===ue(t).toHex()},i}(),ue=function(i){return i instanceof tc?i:new tc(i)},rd=[],nd=function(i){i.forEach(function(t){rd.indexOf(t)<0&&(t(tc,Ja),rd.push(t))})}});function cd(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,c,l=r[this.toHex()];if(l)return l;if(n?.closest){var h=this.toRgb(),u=1/0,f="black";if(!o.length)for(var d in e)o[d]=new i(e[d]).toRgb();for(var m in e){var g=(a=h,c=o[m],Math.pow(a.r-c.r,2)+Math.pow(a.g-c.g,2)+Math.pow(a.b-c.b,2));g<u&&(u=g,f=m)}return f}},t.string.push([function(n){var a=n.toLowerCase(),c=a==="transparent"?"#0000":e[a];return c?new i(c).toRgb():null},"name"])}var ld=p(()=>{});var kr,X,Mt=p(()=>{ad();ld();nd([cd]);kr=class Ni{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 Ni)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!1;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?!1: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?!1: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]=Ni._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=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let 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=Ni.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=ue(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 Ni||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}};kr.shared=new kr;kr._temp=new kr;kr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;X=kr});var hd,ud=p(()=>{"use strict";hd={cullArea:null,cullable:!1,cullableChildren:!0}});var dd,fd,pd,ec=p(()=>{"use strict";dd=Math.PI*2,fd=180/Math.PI,pd=Math.PI/180});var K,rc,ie=p(()=>{"use strict";K=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 rc.x=0,rc.y=0,rc}},rc=new K});var G,L0,N0,Q=p(()=>{ec();ie();G=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 K;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 K;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,c=this.ty,l=1/(r*n+o*-s),h=t.x,u=t.y;return e.x=n*l*h+-o*l*u+(c*o-a*n)*l,e.y=r*l*u+-s*l*h+(-c*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,c=t.ty,l=e.a,h=e.b,u=e.c,f=e.d;return this.a=r*l+s*u,this.b=r*h+s*f,this.c=o*l+n*u,this.d=o*h+n*f,this.tx=a*l+c*u+e.tx,this.ty=a*h+c*f+e.ty,this}setTransform(t,e,r,s,o,n,a,c,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-c)*n,this.d=Math.cos(a-c)*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),c=Math.atan2(r,e),l=Math.abs(a+c);return l<1e-5||Math.abs(dd-l)<1e-5?(t.rotation=c,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=c),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 N0.identity()}static get shared(){return L0.identity()}},L0=new G,N0=new G});var Bt,Do=p(()=>{"use strict";Bt=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function Y(i="default"){return ic[i]===void 0&&(ic[i]=-1),++ic[i]}var ic,Rt=p(()=>{"use strict";ic={default:-1}});function O(i,t,e=3){if(md[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
2
2
  Deprecated since v${i}`):(r=r.split(`
3
3
  `).splice(e).join(`
4
4
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
5
5
  Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
6
- Deprecated since v${i}`),console.warn(r))),md[t]=!0}var md,W,gd,dt=p(()=>{"use strict";md={},W="8.0.0",gd="8.3.4"});var hr,sc=p(()=>{"use strict";hr=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var oc,z,Dt=p(()=>{sc();oc=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new hr(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},z=new oc});var xd,_d=p(()=>{dt();xd={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){D("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function Oo(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 nc=p(()=>{"use strict"});var yd,bd=p(()=>{nc();dt();yd={allowChildren:!0,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)}Oo(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||D(W,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=!0),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=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}}});var vd,Td=p(()=>{"use strict";vd={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 Re,Lo=p(()=>{"use strict";Re=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 ac,No,Sd=p(()=>{w();Dt();ac=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,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 z.get(r.maskClass,t)}return t}returnMaskEffect(t){z.return(t)}},No=new ac;k.handleByList(x.MaskEffect,No._effectClasses)});var wd,Pd=p(()=>{Lo();Sd();wd={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},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),No.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=No.getMaskEffect(i),this.addEffect(this._maskEffect)))},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Re);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 Re),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var Ad,Ed=p(()=>{dt();Ad={label:null,get name(){return D(W,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){D(W,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){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,!0);if(o)return o}return null},getChildrenByLabel(i,t=!1,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,!0,e);return e}}});var Ho,V,bt=p(()=>{ie();Ho=[new K,new K,new K,new K],V=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?!1: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!1;let a=this.x,c=this.y,l=r*(1-s),h=r-l,u=a-l,d=a+o+l,f=c-l,m=c+n+l,_=a+h,g=a+o-h,b=c+h,y=c+n-h;return t>=u&&t<=d&&e>=f&&e<=m&&!(t>_&&t<g&&e>b&&e<y)}intersects(t,e){if(!e){let A=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=A)return!1;let E=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>E}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=Ho[0].set(t.left,t.top),c=Ho[1].set(t.left,t.bottom),l=Ho[2].set(t.right,t.top),h=Ho[3].set(t.right,t.bottom);if(l.x<=a.x||c.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(c,c),e.apply(l,l),e.apply(h,h),Math.max(a.x,c.x,l.x,h.x)<=r||Math.min(a.x,c.x,l.x,h.x)>=s||Math.max(a.y,c.y,l.y,h.y)<=o||Math.min(a.y,c.y,l.y,h.y)>=n))return!1;let d=u*(c.y-a.y),f=u*(a.x-c.x),m=d*r+f*o,_=d*s+f*o,g=d*r+f*n,b=d*s+f*n;if(Math.max(m,_,g,b)<=d*a.x+f*a.y||Math.min(m,_,g,b)>=d*h.x+f*h.y)return!1;let y=u*(a.y-l.y),v=u*(l.x-a.x),T=y*r+v*o,R=y*s+v*o,S=y*r+v*n,P=y*s+v*n;return!(Math.max(T,R,S,P)<=y*a.x+v*a.y||Math.min(T,R,S,P)>=y*h.x+v*h.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var Cd,rt,Xt=p(()=>{Z();bt();Cd=new G,rt=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=Cd,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 V);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=Cd,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,c=o.c,l=o.d,h=o.tx,u=o.ty,d=this.minX,f=this.minY,m=this.maxX,_=this.maxY,g=n*t+c*e+h,b=a*t+l*e+u;g<d&&(d=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),g=n*r+c*e+h,b=a*r+l*e+u,g<d&&(d=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),g=n*t+c*s+h,b=a*t+l*s+u,g<d&&(d=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),g=n*r+c*s+h,b=a*r+l*s+u,g<d&&(d=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),this.minX=d,this.minY=f,this.maxX=m,this.maxY=_}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c,d:l,tx:h,ty:u}=t,d=n*e+c*r+h,f=a*e+l*r+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+c*r+h,f=a*s+l*r+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+c*o+h,f=a*e+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+c*o+h,f=a*s+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f: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,c=this.maxY;s||(s=this.matrix);let l=s.a,h=s.b,u=s.c,d=s.d,f=s.tx,m=s.ty;for(let _=e;_<r;_+=2){let g=t[_],b=t[_+1],y=l*g+u*b+f,v=h*g+d*b+m;o=y<o?y:o,n=v<n?v:n,a=y>a?y:a,c=v>c?v:c}this.minX=o,this.minY=n,this.maxX=a,this.maxY=c}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,Qt,ur=p(()=>{Z();sc();Xt();_t=new hr(G),Qt=new hr(rt)});var H0,Md,Bd=p(()=>{Z();Xt();ur();H0=new G,Md={getFastGlobalBounds(i,t){t||(t=new rt),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=Qt.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=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,!0));o&&(r.applyMatrix(n.worldTransform.copyTo(H0).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),Qt.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Qt.return(r))}}});function kr(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=_t.get().identity(),r=Wo(i,s)):r=G.IDENTITY,Rd(i,e,r,t),s&&_t.return(s),e.isValid||e.set(0,0,0,0),e}function Rd(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=Qt.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++)Rd(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,G.IDENTITY),Qt.return(t)}r||_t.return(s)}function Wo(i,t){let e=i.parent;return e&&(Wo(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var Hi=p(()=>{Z();ur()});function zo(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,c=e*o/255|0,l=r*n/255|0,h=s*a/255|0;return(c<<16)+(l<<8)+h}var cc=p(()=>{"use strict"});function Ir(i,t){return i===Gd?t:t===Gd?i:zo(i,t)}var Gd,lc=p(()=>{cc();Gd=16777215});function Wi(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var kd,Id=p(()=>{Hi();ur();lc();kd={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=Wo(this,_t.get().identity());return i.appendFrom(this.localTransform,e),_t.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?Wi(this.renderGroup.worldColor):this.parentRenderGroup?Wi(Ir(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Ir(t,e.localColor),e=e.parent;return Wi(t)}}});function F(...i){hc!==Fd&&(hc++,hc===Fd?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var hc,Fd,it=p(()=>{"use strict";hc=0,Fd=500});function Fr(i,t,e){return t.clear(),e||(e=G.IDENTITY),Ud(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function Ud(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 c=i.localTransform;o=_t.get(),o.appendFrom(c,e)}let n=t,a=!!i.effects.length;if(a&&(t=Qt.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else{i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let c=i.children;for(let l=0;l<c.length;l++)Ud(c[l],t,o,r,!1)}if(a){for(let c=0;c<i.effects.length;c++)i.effects[c].addLocalBounds?.(t,r);n.addBounds(t,G.IDENTITY),Qt.return(t)}_t.return(o)}var Vo=p(()=>{Z();ur()});function uc(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=!0),t.index=a+2,s.children.length&&uc(s,t)}return t.didChange}var Dd=p(()=>{"use strict"});var W0,Od,Ld=p(()=>{Z();Xt();Hi();Vo();Dd();W0=new G,Od={_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:!1,localBounds:new rt});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),uc(this,i),i.didChange&&Fr(this,i.localBounds,W0),i.localBounds},getBounds(i,t){return kr(this,i,t||new rt)}}});var Nd,Hd=p(()=>{"use strict";Nd={_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 z0(i,t){return i._zIndex-t._zIndex}var Wd,zd=p(()=>{"use strict";Wd={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(z0))}}});var Vd,Xd=p(()=>{ie();ur();Vd={getGlobalPosition(i=new K,t=!1){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=!1){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 Ur,dc=p(()=>{Rt();Ur=class{constructor(){this.uid=j("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function 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 fc(i){return!(i&i-1)&&!!i}var zi=p(()=>{"use strict"});function Xo(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var pc=p(()=>{"use strict"});function V0(i){let t=$d[i];return t===void 0&&($d[i]=j("resource")),t}var $d,Yd,$o,mc=p(()=>{kt();Rt();dt();$d=Object.create(null);Yd=class jd extends nt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...jd.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){D(W,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=V0(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Yd.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};$o=Yd});var Kd,tt,$t=p(()=>{kt();zi();pc();Rt();mc();Kd=class qd extends nt{constructor(t={}){super(),this.options=t,this.uid=j("textureSource"),this._resourceType="textureSource",this._resourceId=j("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...qd.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 $o(Xo(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=j("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=j("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=fc(this.pixelWidth)&&fc(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Kd.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};tt=Kd});function X0(){for(let i=0;i<16;i++){let t=[];gc.push(t);for(let e=0;e<16;e++){let r=Yo(dr[i]*dr[e]+pr[i]*fr[e]),s=Yo(fr[i]*dr[e]+mr[i]*fr[e]),o=Yo(dr[i]*pr[e]+pr[i]*mr[e]),n=Yo(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 G;t.set(dr[i],fr[i],pr[i],mr[i],0,0),Zd.push(t)}}var dr,fr,pr,mr,gc,Zd,Yo,ht,Qd=p(()=>{Z();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],gc=[],Zd=[],Yo=Math.sign;X0();ht={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)=>gc[i][t],sub:(i,t)=>gc[i][ht.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?ht.S:ht.N:Math.abs(t)*2<=Math.abs(i)?i>0?ht.E:ht.W:t>0?i>0?ht.SE:ht.SW:i>0?ht.NE:ht.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Zd[ht.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var xc,Jd=p(()=>{"use strict";xc=()=>{}});var gr,_c=p(()=>{w();$t();gr=class extends tt{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":(e instanceof Int8Array,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=x.TextureSource});var tf,Dr,yc=p(()=>{Z();tf=new G,Dr=class{constructor(t,e){this.mapCoord=new G,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=!1,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&&(tf.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(tf));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,c=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+c)/o.width,n[1]=(t.frame.y+a+c)/o.height,n[2]=(t.frame.x+t.frame.width-a+c)/o.width,n[3]=(t.frame.y+t.frame.height-a+c)/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,!0}}});var C,et=p(()=>{kt();Qd();bt();Rt();dt();Jd();_c();$t();yc();C=class extends nt{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:c,dynamic:l}={}){if(super(),this.uid=j("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new V,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new tt,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=c??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,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 Dr(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,c=e.height/s,l=this.rotate;if(l){let h=a/2,u=c/2,d=o+h,f=n+u;l=ht.add(l,ht.NW),t.x0=d+h*ht.uX(l),t.y0=f+u*ht.uY(l),l=ht.add(l,2),t.x1=d+h*ht.uX(l),t.y1=f+u*ht.uY(l),l=ht.add(l,2),t.x2=d+h*ht.uX(l),t.y2=f+u*ht.uY(l),l=ht.add(l,2),t.x3=d+h*ht.uX(l),t.y3=f+u*ht.uY(l)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+c,t.x3=o,t.y3=n+c}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return D(W,"Texture.baseTexture is now Texture.source"),this._source}};C.EMPTY=new C({label:"EMPTY",source:new tt({label:"EMPTY"})});C.EMPTY.destroy=xc;C.WHITE=new C({source:new gr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});C.WHITE.destroy=xc});var $0,bc,ft,We=p(()=>{zi();$t();et();$0=0,bc=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new tt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new C({source:s,label:`texturePool_${$0++}`})}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 c=this._texturePool[a].pop();return c||(c=this.createTexture(o,n,s)),c.source._resolution=r,c.source.width=o/r,c.source.height=n/r,c.source.pixelWidth=o,c.source.pixelHeight=n,c.frame.x=0,c.frame.y=0,c.frame.width=t,c.frame.height=e,c.updateUvs(),this._poolKeyHash[c.uid]=a,c}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,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(!0)}this._texturePool={}}},ft=new bc});var jo,ef=p(()=>{Z();dc();We();jo=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new G,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=!0,this.instructionSet=new Ur,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;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=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(ft.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}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=!0,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=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,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=!0,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=!1)}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 G),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new G),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 G),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 rf(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var sf=p(()=>{"use strict"});var vc,Tc,Sc,Or,Vi,xr,at,de=p(()=>{kt();Mt();ud();w();Z();ec();Do();Rt();dt();Dt();_d();bd();Td();Pd();Ed();Bd();Id();Ld();Hd();zd();Xd();ef();sf();vc=new Bt(null),Tc=new Bt(null),Sc=new Bt(null,1,1),Or=1,Vi=2,xr=4,at=class i extends nt{constructor(t={}){super(),this.uid=j("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new G,this.relativeGroupTransform=new G,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Bt(this,0,0),this._scale=Sc,this._pivot=Tc,this._skew=vc,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=[],rf(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){D("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),k.mixin(i,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||D(W,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,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=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=z.get(jo,this),this.groupTransform=G.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),z.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 G),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*fd}set angle(t){this.rotation=t*pd}get pivot(){return this._pivot===Tc&&(this._pivot=new Bt(this,0,0)),this._pivot}set pivot(t){this._pivot===Tc&&(this._pivot=new Bt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===vc&&(this._skew=new Bt(this,0,0)),this._skew}set skew(t){this._skew===vc&&(this._skew=new Bt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Sc&&(this._scale=new Bt(this,1,1)),this._scale}set scale(t){this._scale===Sc&&(this._scale=new Bt(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,c=s._x,l=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(c*e.a+l*e.c),e.ty=o._y-(c*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Or,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=X.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Or,this._onUpdate())}get tint(){return Wi(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Vi,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=!0),this._updateFlags|=xr,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=!0),this._updateFlags|=xr,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|=xr,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};k.mixin(at,yd,Md,Vd,Nd,Od,wd,Ad,Wd,hd,xd,kd,vd)});var ze,Ko=p(()=>{ie();ze=class i{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=i.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new K,this.page=new K,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=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function Y0(i){return function(t){return t.test(i)}}function Xi(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=Y0(e),o={apple:{phone:s(wc)&&!s(ke),ipod:s(of),tablet:!s(wc)&&(s(nf)||mf(t))&&!s(ke),universal:s(af),device:(s(wc)||s(of)||s(nf)||s(af)||mf(t))&&!s(ke)},amazon:{phone:s(Lr),tablet:!s(Lr)&&s(qo),device:s(Lr)||s(qo)},android:{phone:!s(ke)&&s(Lr)||!s(ke)&&s(Pc),tablet:!s(ke)&&!s(Lr)&&!s(Pc)&&(s(qo)||s(cf)),device:!s(ke)&&(s(Lr)||s(qo)||s(Pc)||s(cf))||s(/\bokhttp\b/i)},windows:{phone:s(ke),tablet:s(lf),device:s(ke)||s(lf)},other:{blackberry:s(hf),blackberry10:s(uf),opera:s(df),firefox:s(pf),chrome:s(ff),device:s(hf)||s(uf)||s(df)||s(pf)||s(ff)},any:!1,phone:!1,tablet:!1};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 wc,of,nf,af,Pc,cf,Lr,qo,ke,lf,hf,uf,df,ff,pf,mf,Ac=p(()=>{wc=/iPhone/i,of=/iPod/i,nf=/iPad/i,af=/\biOS-universal(?:.+)Mac\b/i,Pc=/\bAndroid(?:.+)Mobile\b/i,cf=/Android/i,Lr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,qo=/Silk/i,ke=/Windows Phone/i,lf=/\bWindows(?:.+)ARM\b/i,hf=/BlackBerry/i,uf=/BB10/i,df=/Opera Mini/i,ff=/\b(CriOS|Chrome)(?:.+)Mobile/i,pf=/Mobile(?:.+)Firefox\b/i,mf=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var gf=p(()=>{Ac();Ac()});var j0,xf,_f=p(()=>{gf();j0=Xi.default??Xi,xf=j0(globalThis.navigator)});var K0,Zo,q0,Z0,yf,bf,Q0,J0,tT,Ec,Tf,Sf=p(()=>{Ko();w();_f();nc();K0=9,Zo=100,q0=0,Z0=0,yf=2,bf=1,Q0=-1e3,J0=-1e3,tT=2,Ec=class vf{constructor(t,e=xf){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,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=`${bf}px`,t.style.height=`${bf}px`,t.style.position="absolute",t.style.top=`${Q0}px`,t.style.left=`${J0}px`,t.style.zIndex=tT.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${Zo}px`,this._div.style.height=`${Zo}px`,this._div.style.position="absolute",this._div.style.top=`${q0}px`,this._div.style.left=`${Z0}px`,this._div.style.zIndex=yf.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),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=!1;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:{...vf.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,!1)),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=!1,Oo(this._children,r,1))}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,c=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*c}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*c}px`,o.style.height=`${n.height*a.d*l}px`}else{this._capHitArea(n);let a=this._renderer.resolution,c=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*c}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*c}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
6
+ Deprecated since v${i}`),console.warn(r))),md[t]=!0}var md,W,gd,dt=p(()=>{"use strict";md={},W="8.0.0",gd="8.3.4"});var ur,sc=p(()=>{"use strict";ur=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 oc,z,Dt=p(()=>{sc();oc=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 ur(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}},z=new oc});var xd,_d=p(()=>{dt();xd={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){O("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function Oo(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 nc=p(()=>{"use strict"});var yd,bd=p(()=>{nc();dt();yd={allowChildren:!0,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)}Oo(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||O(W,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=!0),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=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}}});var vd,Td=p(()=>{"use strict";vd={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 Re,Lo=p(()=>{"use strict";Re=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 ac,No,Sd=p(()=>{P();Dt();ac=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,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 z.get(r.maskClass,t)}return t}returnMaskEffect(t){z.return(t)}},No=new ac;I.handleByList(x.MaskEffect,No._effectClasses)});var wd,Pd=p(()=>{Lo();Sd();wd={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},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),No.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=No.getMaskEffect(i),this.addEffect(this._maskEffect)))},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Re);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 Re),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var Ad,Ed=p(()=>{dt();Ad={label:null,get name(){return O(W,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){O(W,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){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,!0);if(o)return o}return null},getChildrenByLabel(i,t=!1,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,!0,e);return e}}});var Ho,V,bt=p(()=>{ie();Ho=[new K,new K,new K,new K],V=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?!1: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!1;let a=this.x,c=this.y,l=r*(1-s),h=r-l,u=a-l,f=a+o+l,d=c-l,m=c+n+l,g=a+h,_=a+o-h,b=c+h,y=c+n-h;return t>=u&&t<=f&&e>=d&&e<=m&&!(t>g&&t<_&&e>b&&e<y)}intersects(t,e){if(!e){let M=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=M)return!1;let w=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>w}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=Ho[0].set(t.left,t.top),c=Ho[1].set(t.left,t.bottom),l=Ho[2].set(t.right,t.top),h=Ho[3].set(t.right,t.bottom);if(l.x<=a.x||c.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(c,c),e.apply(l,l),e.apply(h,h),Math.max(a.x,c.x,l.x,h.x)<=r||Math.min(a.x,c.x,l.x,h.x)>=s||Math.max(a.y,c.y,l.y,h.y)<=o||Math.min(a.y,c.y,l.y,h.y)>=n))return!1;let f=u*(c.y-a.y),d=u*(a.x-c.x),m=f*r+d*o,g=f*s+d*o,_=f*r+d*n,b=f*s+d*n;if(Math.max(m,g,_,b)<=f*a.x+d*a.y||Math.min(m,g,_,b)>=f*h.x+d*h.y)return!1;let y=u*(a.y-l.y),v=u*(l.x-a.x),T=y*r+v*o,C=y*s+v*o,S=y*r+v*n,A=y*s+v*n;return!(Math.max(T,C,S,A)<=y*a.x+v*a.y||Math.min(T,C,S,A)>=y*h.x+v*h.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var Cd,it,Xt=p(()=>{Q();bt();Cd=new G,it=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Cd,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 V);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=Cd,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,c=o.c,l=o.d,h=o.tx,u=o.ty,f=this.minX,d=this.minY,m=this.maxX,g=this.maxY,_=n*t+c*e+h,b=a*t+l*e+u;_<f&&(f=_),b<d&&(d=b),_>m&&(m=_),b>g&&(g=b),_=n*r+c*e+h,b=a*r+l*e+u,_<f&&(f=_),b<d&&(d=b),_>m&&(m=_),b>g&&(g=b),_=n*t+c*s+h,b=a*t+l*s+u,_<f&&(f=_),b<d&&(d=b),_>m&&(m=_),b>g&&(g=b),_=n*r+c*s+h,b=a*r+l*s+u,_<f&&(f=_),b<d&&(d=b),_>m&&(m=_),b>g&&(g=b),this.minX=f,this.minY=d,this.maxX=m,this.maxY=g}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,d:l,tx:h,ty:u}=t,f=n*e+c*r+h,d=a*e+l*r+u;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=n*s+c*r+h,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+c*o+h,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+c*o+h,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,c=this.maxY;s||(s=this.matrix);let l=s.a,h=s.b,u=s.c,f=s.d,d=s.tx,m=s.ty;for(let g=e;g<r;g+=2){let _=t[g],b=t[g+1],y=l*_+u*b+d,v=h*_+f*b+m;o=y<o?y:o,n=v<n?v:n,a=y>a?y:a,c=v>c?v:c}this.minX=o,this.minY=n,this.maxX=a,this.maxY=c}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,Qt,dr=p(()=>{Q();sc();Xt();_t=new ur(G),Qt=new ur(it)});var H0,Md,Bd=p(()=>{Q();Xt();dr();H0=new G,Md={getFastGlobalBounds(i,t){t||(t=new it),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=Qt.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=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,!0));o&&(r.applyMatrix(n.worldTransform.copyTo(H0).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),Qt.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Qt.return(r))}}});function Ir(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=_t.get().identity(),r=Wo(i,s)):r=G.IDENTITY,Rd(i,e,r,t),s&&_t.return(s),e.isValid||e.set(0,0,0,0),e}function Rd(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=Qt.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++)Rd(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,G.IDENTITY),Qt.return(t)}r||_t.return(s)}function Wo(i,t){let e=i.parent;return e&&(Wo(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var Hi=p(()=>{Q();dr()});function zo(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,c=e*o/255|0,l=r*n/255|0,h=s*a/255|0;return(c<<16)+(l<<8)+h}var cc=p(()=>{"use strict"});function Fr(i,t){return i===Gd?t:t===Gd?i:zo(i,t)}var Gd,lc=p(()=>{cc();Gd=16777215});function Wi(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var kd,Id=p(()=>{Hi();dr();lc();kd={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=Wo(this,_t.get().identity());return i.appendFrom(this.localTransform,e),_t.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?Wi(this.renderGroup.worldColor):this.parentRenderGroup?Wi(Fr(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Fr(t,e.localColor),e=e.parent;return Wi(t)}}});function F(...i){hc!==Fd&&(hc++,hc===Fd?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var hc,Fd,st=p(()=>{"use strict";hc=0,Fd=500});function Ur(i,t,e){return t.clear(),e||(e=G.IDENTITY),Ud(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function Ud(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 c=i.localTransform;o=_t.get(),o.appendFrom(c,e)}let n=t,a=!!i.effects.length;if(a&&(t=Qt.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else{i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let c=i.children;for(let l=0;l<c.length;l++)Ud(c[l],t,o,r,!1)}if(a){for(let c=0;c<i.effects.length;c++)i.effects[c].addLocalBounds?.(t,r);n.addBounds(t,G.IDENTITY),Qt.return(t)}_t.return(o)}var Vo=p(()=>{Q();dr()});function uc(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=!0),t.index=a+2,s.children.length&&uc(s,t)}return t.didChange}var Dd=p(()=>{"use strict"});var W0,Od,Ld=p(()=>{Q();Xt();Hi();Vo();Dd();W0=new G,Od={_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:!1,localBounds:new it});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),uc(this,i),i.didChange&&Ur(this,i.localBounds,W0),i.localBounds},getBounds(i,t){return Ir(this,i,t||new it)}}});var Nd,Hd=p(()=>{"use strict";Nd={_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 z0(i,t){return i._zIndex-t._zIndex}var Wd,zd=p(()=>{"use strict";Wd={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(z0))}}});var Vd,Xd=p(()=>{ie();dr();Vd={getGlobalPosition(i=new K,t=!1){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=!1){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 Dr,dc=p(()=>{Rt();Dr=class{constructor(){this.uid=Y("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function 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 fc(i){return!(i&i-1)&&!!i}var zi=p(()=>{"use strict"});function Xo(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var pc=p(()=>{"use strict"});function V0(i){let t=$d[i];return t===void 0&&($d[i]=Y("resource")),t}var $d,Yd,$o,mc=p(()=>{kt();Rt();dt();$d=Object.create(null);Yd=class jd extends nt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...jd.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){O(W,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=V0(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Yd.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};$o=Yd});var Kd,et,$t=p(()=>{kt();zi();pc();Rt();mc();Kd=class qd extends nt{constructor(t={}){super(),this.options=t,this.uid=Y("textureSource"),this._resourceType="textureSource",this._resourceId=Y("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...qd.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 $o(Xo(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=Y("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=Y("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=fc(this.pixelWidth)&&fc(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Kd.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};et=Kd});function X0(){for(let i=0;i<16;i++){let t=[];gc.push(t);for(let e=0;e<16;e++){let r=Yo(fr[i]*fr[e]+mr[i]*pr[e]),s=Yo(pr[i]*fr[e]+gr[i]*pr[e]),o=Yo(fr[i]*mr[e]+mr[i]*gr[e]),n=Yo(pr[i]*mr[e]+gr[i]*gr[e]);for(let a=0;a<16;a++)if(fr[a]===r&&pr[a]===s&&mr[a]===o&&gr[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new G;t.set(fr[i],pr[i],mr[i],gr[i],0,0),Zd.push(t)}}var fr,pr,mr,gr,gc,Zd,Yo,ht,Qd=p(()=>{Q();fr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],pr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],mr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],gr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],gc=[],Zd=[],Yo=Math.sign;X0();ht={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=>fr[i],uY:i=>pr[i],vX:i=>mr[i],vY:i=>gr[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>gc[i][t],sub:(i,t)=>gc[i][ht.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?ht.S:ht.N:Math.abs(t)*2<=Math.abs(i)?i>0?ht.E:ht.W:t>0?i>0?ht.SE:ht.SW:i>0?ht.NE:ht.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Zd[ht.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var xc,Jd=p(()=>{"use strict";xc=()=>{}});var xr,_c=p(()=>{P();$t();xr=class extends et{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,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}};xr.extension=x.TextureSource});var tf,Or,yc=p(()=>{Q();tf=new G,Or=class{constructor(t,e){this.mapCoord=new G,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=!1,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&&(tf.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(tf));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,c=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+c)/o.width,n[1]=(t.frame.y+a+c)/o.height,n[2]=(t.frame.x+t.frame.width-a+c)/o.width,n[3]=(t.frame.y+t.frame.height-a+c)/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,!0}}});var E,rt=p(()=>{kt();Qd();bt();Rt();dt();Jd();_c();$t();yc();E=class extends nt{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:c,dynamic:l}={}){if(super(),this.uid=Y("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new V,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new et,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=c??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,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 Or(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,c=e.height/s,l=this.rotate;if(l){let h=a/2,u=c/2,f=o+h,d=n+u;l=ht.add(l,ht.NW),t.x0=f+h*ht.uX(l),t.y0=d+u*ht.uY(l),l=ht.add(l,2),t.x1=f+h*ht.uX(l),t.y1=d+u*ht.uY(l),l=ht.add(l,2),t.x2=f+h*ht.uX(l),t.y2=d+u*ht.uY(l),l=ht.add(l,2),t.x3=f+h*ht.uX(l),t.y3=d+u*ht.uY(l)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+c,t.x3=o,t.y3=n+c}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return O(W,"Texture.baseTexture is now Texture.source"),this._source}};E.EMPTY=new E({label:"EMPTY",source:new et({label:"EMPTY"})});E.EMPTY.destroy=xc;E.WHITE=new E({source:new xr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});E.WHITE.destroy=xc});var $0,bc,ft,We=p(()=>{zi();$t();rt();$0=0,bc=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new et({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new E({source:s,label:`texturePool_${$0++}`})}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 c=this._texturePool[a].pop();return c||(c=this.createTexture(o,n,s)),c.source._resolution=r,c.source.width=o/r,c.source.height=n/r,c.source.pixelWidth=o,c.source.pixelHeight=n,c.frame.x=0,c.frame.y=0,c.frame.width=t,c.frame.height=e,c.updateUvs(),this._poolKeyHash[c.uid]=a,c}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,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(!0)}this._texturePool={}}},ft=new bc});var jo,ef=p(()=>{Q();dc();We();jo=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new G,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=!0,this.instructionSet=new Dr,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;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=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(ft.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}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=!0,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=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,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=!0,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=!1)}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 G),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new G),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 G),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 rf(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var sf=p(()=>{"use strict"});var vc,Tc,Sc,Lr,Vi,_r,at,de=p(()=>{kt();Mt();ud();P();Q();ec();Do();Rt();dt();Dt();_d();bd();Td();Pd();Ed();Bd();Id();Ld();Hd();zd();Xd();ef();sf();vc=new Bt(null),Tc=new Bt(null),Sc=new Bt(null,1,1),Lr=1,Vi=2,_r=4,at=class i extends nt{constructor(t={}){super(),this.uid=Y("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new G,this.relativeGroupTransform=new G,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Bt(this,0,0),this._scale=Sc,this._pivot=Tc,this._skew=vc,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=[],rf(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){O("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),I.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||O(W,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,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=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=z.get(jo,this),this.groupTransform=G.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),z.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 G),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*fd}set angle(t){this.rotation=t*pd}get pivot(){return this._pivot===Tc&&(this._pivot=new Bt(this,0,0)),this._pivot}set pivot(t){this._pivot===Tc&&(this._pivot=new Bt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===vc&&(this._skew=new Bt(this,0,0)),this._skew}set skew(t){this._skew===vc&&(this._skew=new Bt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Sc&&(this._scale=new Bt(this,1,1)),this._scale}set scale(t){this._scale===Sc&&(this._scale=new Bt(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,c=s._x,l=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(c*e.a+l*e.c),e.ty=o._y-(c*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Lr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=X.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Lr,this._onUpdate())}get tint(){return Wi(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Vi,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=!0),this._updateFlags|=_r,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=!0),this._updateFlags|=_r,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|=_r,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};I.mixin(at,yd,Md,Vd,Nd,Od,wd,Ad,Wd,hd,xd,kd,vd)});var ze,Ko=p(()=>{ie();ze=class i{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=i.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new K,this.page=new K,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=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function Y0(i){return function(t){return t.test(i)}}function Xi(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=Y0(e),o={apple:{phone:s(wc)&&!s(ke),ipod:s(of),tablet:!s(wc)&&(s(nf)||mf(t))&&!s(ke),universal:s(af),device:(s(wc)||s(of)||s(nf)||s(af)||mf(t))&&!s(ke)},amazon:{phone:s(Nr),tablet:!s(Nr)&&s(qo),device:s(Nr)||s(qo)},android:{phone:!s(ke)&&s(Nr)||!s(ke)&&s(Pc),tablet:!s(ke)&&!s(Nr)&&!s(Pc)&&(s(qo)||s(cf)),device:!s(ke)&&(s(Nr)||s(qo)||s(Pc)||s(cf))||s(/\bokhttp\b/i)},windows:{phone:s(ke),tablet:s(lf),device:s(ke)||s(lf)},other:{blackberry:s(hf),blackberry10:s(uf),opera:s(df),firefox:s(pf),chrome:s(ff),device:s(hf)||s(uf)||s(df)||s(pf)||s(ff)},any:!1,phone:!1,tablet:!1};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 wc,of,nf,af,Pc,cf,Nr,qo,ke,lf,hf,uf,df,ff,pf,mf,Ac=p(()=>{wc=/iPhone/i,of=/iPod/i,nf=/iPad/i,af=/\biOS-universal(?:.+)Mac\b/i,Pc=/\bAndroid(?:.+)Mobile\b/i,cf=/Android/i,Nr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,qo=/Silk/i,ke=/Windows Phone/i,lf=/\bWindows(?:.+)ARM\b/i,hf=/BlackBerry/i,uf=/BB10/i,df=/Opera Mini/i,ff=/\b(CriOS|Chrome)(?:.+)Mobile/i,pf=/Mobile(?:.+)Firefox\b/i,mf=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var gf=p(()=>{Ac();Ac()});var j0,xf,_f=p(()=>{gf();j0=Xi.default??Xi,xf=j0(globalThis.navigator)});var K0,Zo,q0,Z0,yf,bf,Q0,J0,tT,Ec,Tf,Sf=p(()=>{Ko();P();_f();nc();K0=9,Zo=100,q0=0,Z0=0,yf=2,bf=1,Q0=-1e3,J0=-1e3,tT=2,Ec=class vf{constructor(t,e=xf){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,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=`${bf}px`,t.style.height=`${bf}px`,t.style.position="absolute",t.style.top=`${Q0}px`,t.style.left=`${J0}px`,t.style.zIndex=tT.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${Zo}px`,this._div.style.height=`${Zo}px`,this._div.style.position="absolute",this._div.style.top=`${q0}px`,this._div.style.left=`${Z0}px`,this._div.style.zIndex=yf.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),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=!1;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:{...vf.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,!1)),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=!1,Oo(this._children,r,1))}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,c=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*c}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*c}px`,o.style.height=`${n.height*a.d*l}px`}else{this._capHitArea(n);let a=this._renderer.resolution,c=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*c}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*c}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
7
7
  color: transparent;
8
8
  pointer-events: none;
9
9
  padding: 0;
@@ -16,9 +16,9 @@ Deprecated since v${i}`),console.warn(r))),md[t]=!0}var md,W,gd,dt=p(()=>{"use s
16
16
  -webkit-user-select: none;
17
17
  -moz-user-select: none;
18
18
  -ms-user-select: none;
19
- `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${Zo}px`,e.style.height=`${Zo}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=yf.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=!0,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 ze(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!==K0||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(t){t?this._activate():this._deactivate()}};Ec.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"accessibility"};Ec.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};Tf=Ec});var wf,Pf=p(()=>{"use strict";wf={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var Af=p(()=>{w();de();Sf();Pf();k.add(Tf);k.mixin(at,wf)});var $i,Ef=p(()=>{w();$i=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}};$i.extension=x.Application});var Ve,Qo=p(()=>{"use strict";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 Nr,Cf=p(()=>{"use strict";Nr=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,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(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var Mf,Yt,Yi=p(()=>{Qo();Cf();Mf=class Jt{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Nr(null,null,1/0),this.deltaMS=1/Jt.targetFPMS,this.elapsedMS=1/Jt.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 Nr(t,e,r))}addOnce(t,e,r=Ve.NORMAL){return this._addListener(new Nr(t,e,r,!0))}_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=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Jt.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,Jt.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(!Jt._shared){let t=Jt._shared=new Jt;t.autoStart=!0,t._protected=!0}return Jt._shared}static get system(){if(!Jt._system){let t=Jt._system=new Jt;t.autoStart=!0,t._protected=!0}return Jt._system}};Mf.targetFPMS=.06;Yt=Mf});var ji,Bf=p(()=>{w();Qo();Yi();ji=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ve.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Yt.shared:new Yt,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};ji.extension=x.Application});var Cc=p(()=>{w();Ef();Bf();k.add($i);k.add(ji)});var Mc,_e,Bc=p(()=>{Qo();Yi();Mc=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(Yt.system.add(this._tickerUpdate,this,Ve.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Yt.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},_e=new Mc});var Ie,Jo=p(()=>{ie();Ko();Ie=class extends ze{constructor(){super(...arguments),this.client=new K,this.movement=new K,this.offset=new K,this.global=new K,this.screen=new K}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,c,l,h,u,d,f,m,_){throw new Error("Method not implemented.")}}});var Ot,Rc=p(()=>{Jo();Ot=class extends Ie{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var ye,Gc=p(()=>{Jo();ye=class extends Ie{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};ye.DOM_DELTA_PIXEL=0;ye.DOM_DELTA_LINE=1;ye.DOM_DELTA_PAGE=2});var eT,rT,Ki,tn,Rf=p(()=>{kt();ie();it();Bc();Jo();Rc();Gc();eT=2048,rT=new K,Ki=new K,tn=class{constructor(t){this.dispatch=new nt,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else F(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){_e.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,rT.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<eT&&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=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(_e.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children;for(let u=h.length-1;u>=0;u--){let d=h[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,r,s,o,n||o(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let c=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:c&&!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")&&(_e.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children,l=r;for(let h=c.length-1;h>=0;h--){let u=c[h],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}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,Ki),!t.hitArea.contains(Ki.x,Ki.y)))return!0;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!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,Ki),t.containsPoint(Ki)):!1}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)){F("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)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;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 c=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,c,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(o)){let h=this.createPointerEvent(t,"pointerleave",o);for(h.eventPhase=h.AT_TARGET;h.target&&!e.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),r&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(l)}if(o!==e.target){let c=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,c);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let h=o?.parent;for(;h&&h!==this.rootTarget.parent&&h!==e.target;)h=h.parent;if(!h||h===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(l)}let n=[],a=this.enableGlobalMoveEvents??!0;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)){F("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)){F("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)){F("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 c=r.button===2;this.notifyTarget(r,c?"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 c=s.clicksByButton[t.button];if(c.target===a.target&&e-c.timeStamp<200?++c.clickCount:c.clickCount=1,c.target=a.target,c.timeStamp=e,a.detail=c.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)){F("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 ye)){F("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(ye);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Ot);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ot&&e instanceof Ot&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Ie&&e instanceof Ie&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,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,!0),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,!0),r[s].fn.call(r[s].context,t)}}});var iT,sT,Ic,en,Fc=p(()=>{w();Rf();Bc();Rc();Gc();iT=1,sT={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ic=class kc{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new tn(null),_e.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Ot(null),this._rootWheelEvent=new ye(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...kc.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,kc._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=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),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,_e.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,_e.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;_e.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,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;_e.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,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,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=!0,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=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=iT),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,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=sT[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}};Ic.extension={name:"events",type:[x.WebGLSystem,x.CanvasSystem,x.WebGPUSystem],priority:-1};Ic.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};en=Ic});var Gf,kf=p(()=>{Fc();Ko();Gf={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??en.defaultEventMode},set eventMode(i){this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,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===!0:!1,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,c=this;s&&s.addEventListener("abort",()=>{c.off(i,a,n)}),o?c.once(i,a,n):c.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 ze))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}}});var If=p(()=>{w();de();Fc();kf();k.add(en);k.mixin(at,Gf)});var qi,Ff=p(()=>{w();qi=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,c=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${c}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-c}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};qi.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"dom"}});var Xe,rn=p(()=>{Xt();de();Xe=class extends at{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new rt(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,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=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,c=a.length;for(let l=0;l<c;l++)a[l].collectRenderables(t,e,r)}}});var Uf=p(()=>{w();Ff();k.add(qi)});var wt,Fe=p(()=>{"use strict";wt=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(wt||{})});var Df,Of=p(()=>{"use strict";Df={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")}});var Lf,O,ct=p(()=>{Of();Lf=Df,O={get(){return Lf},set(i){Lf=i}}});function fe(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Zi(i){return i.split("?")[0].split("#")[0]}function oT(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nT(i,t,e){return i.replace(new RegExp(oT(t),"g"),e)}function aT(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 c=e.lastIndexOf("/");if(c!==e.length-1){c===-1?(e="",r=0):(e=e.slice(0,c),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}}t&&(e.length>0?e+="/..":e="..",r=2)}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 vt,_r=p(()=>{ct();vt={toPosix(i){return nT(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){fe(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(fe(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=Zi(this.toPosix(t??O.get().getBaseUrl())),s=Zi(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?vt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(fe(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=aT(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return fe(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(fe(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(fe(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,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=!1;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){fe(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){fe(i),t&&fe(t),i=Zi(this.toPosix(i));let e=0,r=-1,s=!0,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 c=i.charCodeAt(o);if(c===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(c===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=!1,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){fe(i),i=Zi(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,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=!1,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){fe(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Zi(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,o="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,c=-1,l=!0,h=i.length-1,u=0;for(;h>=s;--h){if(e=i.charCodeAt(h),e===47){if(!l){a=h+1;break}continue}c===-1&&(l=!1,c=h+1),e===46?n===-1?n=h:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||c===-1||u===0||u===1&&n===c-1&&n===a+1?c!==-1&&(a===0&&r?t.base=t.name=i.slice(1,c):t.base=t.name=i.slice(a,c)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,c)):(t.name=i.slice(a,n),t.base=i.slice(a,c)),t.ext=i.slice(n,c)),t.dir=this.dirname(i),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Lt,Qi=p(()=>{"use strict";Lt=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function Nf(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?Nf(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function Hf(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)}),Nf(i,s,0,e,r)}else r.push(i);return r}var Wf=p(()=>{"use strict"});var yr,sn=p(()=>{"use strict";yr=i=>!Array.isArray(i)});function cT(i){return i.split(".").pop().split("?").shift().split("#").shift()}var te,Hr=p(()=>{it();_r();Qi();Wf();sn();te=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 Lt(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&F("[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,c;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),c=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(t,h));r.push(...l),c=[...a,...l]}this.add({...o,alias:c,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)&&F(`[Resolver] already has key: ${o} overwriting`)},Lt(e).forEach(o=>{let{src:n}=o,{data:a,format:c,loadParser:l}=o,h=Lt(n).map(f=>typeof f=="string"?Hf(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let d=[];h.forEach(f=>{f.forEach(m=>{let _={};if(typeof m!="object"){_.src=m;for(let g=0;g<this._parsers.length;g++){let b=this._parsers[g];if(b.test(m)){_=b.parse(m);break}}}else a=m.data??a,c=m.format??c,l=m.loadParser??l,_={..._,...m};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this._buildResolvedAsset(_,{aliases:u,data:a,format:c,loadParser:l}),d.push(_)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=yr(t);t=Lt(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let c in n){let l=n[c];a[this._extractAssetIdFromBundle(s,c)]=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=yr(t);t=Lt(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(c=>{let l=o.filter(h=>h[a]?h[a]===c:!1);l.length&&(o=l)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=vt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??cT(t.src),t}};te.RETINA_PREFIX=/@([0-9\.]+)x/});var Ji,Uc=p(()=>{"use strict";Ji=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var zf,Dc,Vf=p(()=>{bt();et();zf=class ts{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof C?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=ts.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=ts.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,c=null,l=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,h=new V(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new V(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 V(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!==!1&&o.spriteSourceSize&&(c=new V(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 C({source:this.textureSource,frame:a,orig:h,trim:c,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*ts.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*ts.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){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=[]}};zf.BATCH_SIZE=1e3;Dc=zf});function Xf(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s]}),!e){let s=vt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Xf([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var lT,$f,Yf=p(()=>{Fe();Hr();Uc();w();et();_r();Vf();lT=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];$f={extension:x.Asset,cache:{test:i=>i instanceof Dc,getCacheableAssets:(i,t)=>Xf(i,t,!1)},resolver:{extension:{type:x.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&lT.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(te.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:x.LoadParser,priority:wt.Normal,name:"spritesheetLoader"},async testParse(i,t){return vt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=vt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof C)a=r;else{let h=Ji(n+(s??i.meta.image),t.src);a=(await e.load([{src:h,data:o}]))[h]}let c=new Dc(a.source,i);await c.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let h=[];for(let d of l){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=Ji(f,t.src),h.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(h);c.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[c].concat(c.linkedSheets.filter(f=>f!==d))})}return c},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var on=p(()=>{w();Yf();k.add($f)});function nn(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 Oc=p(()=>{"use strict"});var Nt,an=p(()=>{Do();et();Oc();dt();rn();Nt=class i extends Xe{constructor(t=C.EMPTY){t instanceof C&&(t={texture:t});let{texture:e=C.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Bt({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof C?new i(t):new i(C.from(t,e))}set texture(t){t||(t=C.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 nn(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return D("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=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function cn(i,t,e){let r=hT;i.measurable=!0,kr(i,e,r),t.addBoundsMask(r),i.measurable=!1}var hT,Lc=p(()=>{Xt();Hi();hT=new rt});function ln(i,t,e){let r=Qt.get();i.measurable=!0;let s=_t.get().identity(),o=jf(i,e,s);Fr(i,r,o),i.measurable=!1,t.addBoundsMask(r),_t.return(s),Qt.return(r)}function jf(i,t,e){return i?(i!==t&&(jf(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(F("Mask bounds, renderable is not inside the root container"),e)}var Nc=p(()=>{Vo();ur();it()});var es,Kf=p(()=>{w();an();Lc();Nc();es=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Nt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||cn(this.mask,t,e)}addLocalBounds(t,e){ln(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Nt}};es.extension=x.MaskEffect});var rs,qf=p(()=>{w();rs=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"}};rs.extension=x.MaskEffect});var is,Zf=p(()=>{w();de();Lc();Nc();is=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){cn(this.mask,t,e)}addLocalBounds(t,e){ln(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof at}};is.extension=x.MaskEffect});var It,Wr=p(()=>{ct();w();$t();It=class extends tt{constructor(t){t.resource||(t.resource=O.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"))}};It.extension=x.TextureSource});var jt,zr=p(()=>{ct();w();it();$t();jt=class extends tt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=O.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,F("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};jt.extension=x.TextureSource});async function hn(){return Hc??(Hc=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,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,!1),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"})()),Hc}var Hc,Wc=p(()=>{"use strict"});var un,Vr,zc=p(()=>{w();Yi();Wc();$t();un=class Qf extends tt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Qf.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Yt.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=!0),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,!0)),this.alphaMode=await hn(),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,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Yt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Yt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Yt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};un.extension=x.TextureSource;un.defaultOptions={...tt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};un.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Vr=un});var Vc,J,$e=p(()=>{it();Qi();Vc=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||F(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Lt(t),s;for(let c=0;c<this.parsers.length;c++){let l=this.parsers[c];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(c=>{o.set(c,e)});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(c=>{this._cacheMap.set(c,a)}),n.forEach(c=>{let l=s?s[c]:e;this._cache.has(c)&&this._cache.get(c)!==l&&F("[Cache] already has key:",c),this._cache.set(c,o.get(c))})}remove(t){if(!this._cacheMap.has(t)){F(`[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}},J=new Vc});function Jf(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Xc.length;s++){let o=Xc[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function tp(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&J.has(r))return J.get(r);let o=new C({source:Jf(s)});return o.on("destroy",()=>{J.has(r)&&J.remove(r)}),t||J.set(r,o),o}function ep(i,t=!1){return typeof i=="string"?J.get(i):i instanceof tt?new C({source:i}):tp(i,t)}var Xc,$c=p(()=>{$e();w();$t();et();Xc=[];k.handleByList(x.TextureSource,Xc);C.from=ep;tt.from=Jf});var dn=p(()=>{w();Kf();qf();Zf();_c();Wr();zr();zc();$c();k.add(es,rs,is,Vr,jt,It,gr)});var Pt,Ye=p(()=>{"use strict";Pt=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;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=!1;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=!0)}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=!0,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function pn(){return(!fn||fn?.isContextLost())&&(fn=O.get().createCanvas().getContext("webgl",{})),fn}var fn,Yc=p(()=>{ct()});function dT(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
19
+ `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${Zo}px`,e.style.height=`${Zo}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=yf.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=!0,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 ze(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!==K0||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(t){t?this._activate():this._deactivate()}};Ec.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"accessibility"};Ec.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};Tf=Ec});var wf,Pf=p(()=>{"use strict";wf={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var Af=p(()=>{P();de();Sf();Pf();I.add(Tf);I.mixin(at,wf)});var $i,Ef=p(()=>{P();$i=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}};$i.extension=x.Application});var Ve,Qo=p(()=>{"use strict";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 Hr,Cf=p(()=>{"use strict";Hr=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,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(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var Mf,Yt,Yi=p(()=>{Qo();Cf();Mf=class Jt{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Hr(null,null,1/0),this.deltaMS=1/Jt.targetFPMS,this.elapsedMS=1/Jt.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 Hr(t,e,r))}addOnce(t,e,r=Ve.NORMAL){return this._addListener(new Hr(t,e,r,!0))}_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=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Jt.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,Jt.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(!Jt._shared){let t=Jt._shared=new Jt;t.autoStart=!0,t._protected=!0}return Jt._shared}static get system(){if(!Jt._system){let t=Jt._system=new Jt;t.autoStart=!0,t._protected=!0}return Jt._system}};Mf.targetFPMS=.06;Yt=Mf});var ji,Bf=p(()=>{P();Qo();Yi();ji=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ve.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Yt.shared:new Yt,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};ji.extension=x.Application});var Cc=p(()=>{P();Ef();Bf();I.add($i);I.add(ji)});var Mc,_e,Bc=p(()=>{Qo();Yi();Mc=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(Yt.system.add(this._tickerUpdate,this,Ve.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Yt.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},_e=new Mc});var Ie,Jo=p(()=>{ie();Ko();Ie=class extends ze{constructor(){super(...arguments),this.client=new K,this.movement=new K,this.offset=new K,this.global=new K,this.screen=new K}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,c,l,h,u,f,d,m,g){throw new Error("Method not implemented.")}}});var Ot,Rc=p(()=>{Jo();Ot=class extends Ie{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var ye,Gc=p(()=>{Jo();ye=class extends Ie{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};ye.DOM_DELTA_PIXEL=0;ye.DOM_DELTA_LINE=1;ye.DOM_DELTA_PAGE=2});var eT,rT,Ki,tn,Rf=p(()=>{kt();ie();st();Bc();Jo();Rc();Gc();eT=2048,rT=new K,Ki=new K,tn=class{constructor(t){this.dispatch=new nt,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else F(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){_e.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,rT.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<eT&&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=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(_e.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children;for(let u=h.length-1;u>=0;u--){let f=h[u],d=this.hitTestMoveRecursive(f,this._isInteractive(e)?e:f.eventMode,r,s,o,n||o(t,r));if(d){if(d.length>0&&!d[d.length-1].parent)continue;let m=t.isInteractive();(d.length>0||m)&&(m&&this._allInteractiveElements.push(t),d.push(t)),this._hitElements.length===0&&(this._hitElements=d),a=!0}}}let c=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:c&&!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")&&(_e.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children,l=r;for(let h=c.length-1;h>=0;h--){let u=c[h],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,Ki),!t.hitArea.contains(Ki.x,Ki.y)))return!0;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!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,Ki),t.containsPoint(Ki)):!1}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)){F("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)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;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 c=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,c,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(o)){let h=this.createPointerEvent(t,"pointerleave",o);for(h.eventPhase=h.AT_TARGET;h.target&&!e.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),r&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(l)}if(o!==e.target){let c=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,c);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let h=o?.parent;for(;h&&h!==this.rootTarget.parent&&h!==e.target;)h=h.parent;if(!h||h===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??!0;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)){F("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)){F("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)){F("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 c=r.button===2;this.notifyTarget(r,c?"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 c=s.clicksByButton[t.button];if(c.target===a.target&&e-c.timeStamp<200?++c.clickCount:c.clickCount=1,c.target=a.target,c.timeStamp=e,a.detail=c.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)){F("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 ye)){F("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(ye);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Ot);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ot&&e instanceof Ot&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Ie&&e instanceof Ie&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,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,!0),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,!0),r[s].fn.call(r[s].context,t)}}});var iT,sT,Ic,en,Fc=p(()=>{P();Rf();Bc();Rc();Gc();iT=1,sT={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ic=class kc{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new tn(null),_e.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Ot(null),this._rootWheelEvent=new ye(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...kc.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,kc._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=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),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,_e.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,_e.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;_e.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,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;_e.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,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,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=!0,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=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=iT),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,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=sT[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}};Ic.extension={name:"events",type:[x.WebGLSystem,x.CanvasSystem,x.WebGPUSystem],priority:-1};Ic.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};en=Ic});var Gf,kf=p(()=>{Fc();Ko();Gf={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??en.defaultEventMode},set eventMode(i){this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,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===!0:!1,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,c=this;s&&s.addEventListener("abort",()=>{c.off(i,a,n)}),o?c.once(i,a,n):c.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 ze))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}}});var If=p(()=>{P();de();Fc();kf();I.add(en);I.mixin(at,Gf)});var qi,Ff=p(()=>{P();qi=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,c=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${c}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-c}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};qi.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"dom"}});var Xe,rn=p(()=>{Xt();de();Xe=class extends at{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new it(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,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=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,c=a.length;for(let l=0;l<c;l++)a[l].collectRenderables(t,e,r)}}});var Uf=p(()=>{P();Ff();I.add(qi)});var wt,Fe=p(()=>{"use strict";wt=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(wt||{})});var Df,Of=p(()=>{"use strict";Df={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")}});var Lf,L,ct=p(()=>{Of();Lf=Df,L={get(){return Lf},set(i){Lf=i}}});function fe(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Zi(i){return i.split("?")[0].split("#")[0]}function oT(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nT(i,t,e){return i.replace(new RegExp(oT(t),"g"),e)}function aT(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 c=e.lastIndexOf("/");if(c!==e.length-1){c===-1?(e="",r=0):(e=e.slice(0,c),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}}t&&(e.length>0?e+="/..":e="..",r=2)}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 vt,yr=p(()=>{ct();vt={toPosix(i){return nT(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){fe(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(fe(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=Zi(this.toPosix(t??L.get().getBaseUrl())),s=Zi(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?vt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(fe(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=aT(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return fe(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(fe(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(fe(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,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=!1;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){fe(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){fe(i),t&&fe(t),i=Zi(this.toPosix(i));let e=0,r=-1,s=!0,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 c=i.charCodeAt(o);if(c===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(c===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=!1,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){fe(i),i=Zi(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,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=!1,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){fe(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Zi(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,o="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,c=-1,l=!0,h=i.length-1,u=0;for(;h>=s;--h){if(e=i.charCodeAt(h),e===47){if(!l){a=h+1;break}continue}c===-1&&(l=!1,c=h+1),e===46?n===-1?n=h:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||c===-1||u===0||u===1&&n===c-1&&n===a+1?c!==-1&&(a===0&&r?t.base=t.name=i.slice(1,c):t.base=t.name=i.slice(a,c)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,c)):(t.name=i.slice(a,n),t.base=i.slice(a,c)),t.ext=i.slice(n,c)),t.dir=this.dirname(i),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Lt,Qi=p(()=>{"use strict";Lt=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function Nf(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?Nf(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function Hf(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)}),Nf(i,s,0,e,r)}else r.push(i);return r}var Wf=p(()=>{"use strict"});var br,sn=p(()=>{"use strict";br=i=>!Array.isArray(i)});function cT(i){return i.split(".").pop().split("?").shift().split("#").shift()}var te,Wr=p(()=>{st();yr();Qi();Wf();sn();te=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 Lt(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&F("[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,c;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),c=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(t,h));r.push(...l),c=[...a,...l]}this.add({...o,alias:c,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)&&F(`[Resolver] already has key: ${o} overwriting`)},Lt(e).forEach(o=>{let{src:n}=o,{data:a,format:c,loadParser:l}=o,h=Lt(n).map(d=>typeof d=="string"?Hf(d):Array.isArray(d)?d:[d]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let f=[];h.forEach(d=>{d.forEach(m=>{let g={};if(typeof m!="object"){g.src=m;for(let _=0;_<this._parsers.length;_++){let b=this._parsers[_];if(b.test(m)){g=b.parse(m);break}}}else a=m.data??a,c=m.format??c,l=m.loadParser??l,g={...g,...m};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this._buildResolvedAsset(g,{aliases:u,data:a,format:c,loadParser:l}),f.push(g)})}),u.forEach(d=>{this._assetMap[d]=f})})}resolveBundle(t){let e=br(t);t=Lt(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let c in n){let l=n[c];a[this._extractAssetIdFromBundle(s,c)]=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=br(t);t=Lt(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(c=>{let l=o.filter(h=>h[a]?h[a]===c:!1);l.length&&(o=l)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=vt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??cT(t.src),t}};te.RETINA_PREFIX=/@([0-9\.]+)x/});var Ji,Uc=p(()=>{"use strict";Ji=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var zf,Dc,Vf=p(()=>{bt();rt();zf=class ts{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof E?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=ts.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=ts.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,c=null,l=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,h=new V(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new V(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 V(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!==!1&&o.spriteSourceSize&&(c=new V(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 E({source:this.textureSource,frame:a,orig:h,trim:c,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*ts.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*ts.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){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=[]}};zf.BATCH_SIZE=1e3;Dc=zf});function Xf(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s]}),!e){let s=vt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Xf([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var lT,$f,Yf=p(()=>{Fe();Wr();Uc();P();rt();yr();Vf();lT=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];$f={extension:x.Asset,cache:{test:i=>i instanceof Dc,getCacheableAssets:(i,t)=>Xf(i,t,!1)},resolver:{extension:{type:x.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&lT.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(te.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:x.LoadParser,priority:wt.Normal,name:"spritesheetLoader"},async testParse(i,t){return vt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=vt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof E)a=r;else{let h=Ji(n+(s??i.meta.image),t.src);a=(await e.load([{src:h,data:o}]))[h]}let c=new Dc(a.source,i);await c.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let h=[];for(let f of l){if(typeof f!="string")continue;let d=n+f;t.data?.ignoreMultiPack||(d=Ji(d,t.src),h.push(e.load({src:d,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(h);c.linkedSheets=u,u.forEach(f=>{f.linkedSheets=[c].concat(c.linkedSheets.filter(d=>d!==f))})}return c},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var on=p(()=>{P();Yf();I.add($f)});function nn(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 Oc=p(()=>{"use strict"});var Nt,an=p(()=>{Do();rt();Oc();dt();rn();Nt=class i extends Xe{constructor(t=E.EMPTY){t instanceof E&&(t={texture:t});let{texture:e=E.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Bt({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof E?new i(t):new i(E.from(t,e))}set texture(t){t||(t=E.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 nn(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return O("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=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function cn(i,t,e){let r=hT;i.measurable=!0,Ir(i,e,r),t.addBoundsMask(r),i.measurable=!1}var hT,Lc=p(()=>{Xt();Hi();hT=new it});function ln(i,t,e){let r=Qt.get();i.measurable=!0;let s=_t.get().identity(),o=jf(i,e,s);Ur(i,r,o),i.measurable=!1,t.addBoundsMask(r),_t.return(s),Qt.return(r)}function jf(i,t,e){return i?(i!==t&&(jf(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(F("Mask bounds, renderable is not inside the root container"),e)}var Nc=p(()=>{Vo();dr();st()});var es,Kf=p(()=>{P();an();Lc();Nc();es=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Nt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||cn(this.mask,t,e)}addLocalBounds(t,e){ln(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Nt}};es.extension=x.MaskEffect});var rs,qf=p(()=>{P();rs=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"}};rs.extension=x.MaskEffect});var is,Zf=p(()=>{P();de();Lc();Nc();is=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){cn(this.mask,t,e)}addLocalBounds(t,e){ln(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof at}};is.extension=x.MaskEffect});var It,zr=p(()=>{ct();P();$t();It=class extends et{constructor(t){t.resource||(t.resource=L.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"))}};It.extension=x.TextureSource});var jt,Vr=p(()=>{ct();P();st();$t();jt=class extends et{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=L.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,F("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};jt.extension=x.TextureSource});async function hn(){return Hc??(Hc=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,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,!1),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"})()),Hc}var Hc,Wc=p(()=>{"use strict"});var un,Xr,zc=p(()=>{P();Yi();Wc();$t();un=class Qf extends et{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Qf.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Yt.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=!0),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,!0)),this.alphaMode=await hn(),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,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Yt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Yt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Yt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};un.extension=x.TextureSource;un.defaultOptions={...et.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};un.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Xr=un});var Vc,tt,$e=p(()=>{st();Qi();Vc=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||F(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Lt(t),s;for(let c=0;c<this.parsers.length;c++){let l=this.parsers[c];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(c=>{o.set(c,e)});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(c=>{this._cacheMap.set(c,a)}),n.forEach(c=>{let l=s?s[c]:e;this._cache.has(c)&&this._cache.get(c)!==l&&F("[Cache] already has key:",c),this._cache.set(c,o.get(c))})}remove(t){if(!this._cacheMap.has(t)){F(`[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}},tt=new Vc});function Jf(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Xc.length;s++){let o=Xc[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function tp(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&tt.has(r))return tt.get(r);let o=new E({source:Jf(s)});return o.on("destroy",()=>{tt.has(r)&&tt.remove(r)}),t||tt.set(r,o),o}function ep(i,t=!1){return typeof i=="string"?tt.get(i):i instanceof et?new E({source:i}):tp(i,t)}var Xc,$c=p(()=>{$e();P();$t();rt();Xc=[];I.handleByList(x.TextureSource,Xc);E.from=ep;et.from=Jf});var dn=p(()=>{P();Kf();qf();Zf();_c();zr();Vr();zc();$c();I.add(es,rs,is,Xr,jt,It,xr)});var Pt,Ye=p(()=>{"use strict";Pt=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;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=!1;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=!0)}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=!0,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function pn(){return(!fn||fn?.isContextLost())&&(fn=L.get().createCanvas().getContext("webgl",{})),fn}var fn,Yc=p(()=>{ct()});function dT(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
20
20
  else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function rp(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=uT.replace(/%forloop%/gi,dT(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 uT,ip=p(()=>{"use strict";uT=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
- `)});function se(){if(Xr)return Xr;let i=pn();return Xr=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),Xr=rp(Xr,i),i.getExtension("WEBGL_lose_context")?.loseContext(),Xr}var Xr,br=p(()=>{Yc();ip();Xr=null});function $r(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return sp[e]||fT(i,t,e)}function fT(i,t,e){let r={},s=0;jc||(jc=se());for(let n=0;n<jc;n++){let a=n<t?i[n]:C.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new Pt(r);return sp[e]=o,o}var sp,jc,mn=p(()=>{Ye();et();br();sp={};jc=0});var be,Kc=p(()=>{"use strict";be=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 ss(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 qc=p(()=>{"use strict"});var op,lt,vr=p(()=>{"use strict";op={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},lt=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",i[i.NONE=5]="NONE",i))(lt||{})});function Ue(i,t){return t.alphaMode==="no-premultiply-alpha"&&op[i]||i}var os=p(()=>{vr()});var gn,np=p(()=>{"use strict";gn=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 ap(){return Qc>0?lp[--Qc]:new Zc}function cp(i){lp[Qc++]=i}var Zc,lp,Qc,ns,hp,up,dp=p(()=>{Rt();Kc();qc();os();br();np();Zc=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new gn,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},lp=[],Qc=0;ns=0,hp=class xn{constructor(t={}){this.uid=j("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],xn.defaultOptions.maxTextures=xn.defaultOptions.maxTextures??se(),t={...xn.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new be(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++)cp(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}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?!1:(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;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=ap(),s=r.textures;s.clear();let o=e[this.elementStart],n=Ue(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 c=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,h=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",m=this.maxTextures;for(let _=this.elementStart;_<this.elementSize;++_){let g=e[_];e[_]=null;let y=g.texture._source,v=Ue(g.blendMode,y),T=n!==v||a!==g.topology;if(y._batchTick===ns&&!T){g._textureId=y._textureBindLocation,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,c,l,g._attributeStart,g._textureId),this.packQuadIndex(h,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,c,l,g._attributeStart,g._textureId),this.packIndex(g,h,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=r;continue}y._batchTick=ns,(s.count>=m||T)&&(this._finishBatch(r,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=v,a=g.topology,r=ap(),s=r.textures,s.clear(),++ns),g._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,g._batch=r,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,c,l,g._attributeStart,g._textureId),this.packQuadIndex(h,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,c,l,g._attributeStart,g._textureId),this.packIndex(g,h,g._indexStart,g._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,d,u-d,s,n,a,t,f),d=u,++ns),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,r,s,o,n,a,c){t.gpuBindGroup=null,t.bindGroup=null,t.action=c,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++ns,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 be(e);ss(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 ss(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,c=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-c}destroy(){for(let t=0;t<this.batches.length;t++)cp(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}};hp.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};up=hp});var Y,De=p(()=>{"use strict";Y=(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))(Y||{})});var mt,je=p(()=>{kt();Rt();De();mt=class extends nt{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=j("buffer"),this._resourceType="buffer",this._resourceId=j("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,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??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&Y.STATIC)}set static(t){t?this.descriptor.usage|=Y.STATIC:this.descriptor.usage&=~Y.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=j("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function Jc(i,t){if(!(i instanceof mt)){let e=t?Y.INDEX:Y.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=Y.INDEX|Y.COPY_DST):(i=new Float32Array(i),e=Y.VERTEX|Y.COPY_DST)),i=new mt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var fp=p(()=>{je();De()});function pp(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,c=-1/0,l=s.BYTES_PER_ELEMENT,h=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let d=h;d<s.length;d+=u){let f=s[d],m=s[d+1];f>a&&(a=f),m>c&&(c=m),f<o&&(o=f),m<n&&(n=m)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=c,e}var mp=p(()=>{"use strict"});function pT(i){return(i instanceof mt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Jc(i.buffer,!1),i}var oe,Yr=p(()=>{kt();Xt();Rt();je();fp();mp();oe=class extends nt{constructor(t={}){super(),this.uid=j("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new rt,this._boundsDirty=!0;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=!0,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=pT(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=Jc(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,pp(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){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 mT,gT,_n,gp=p(()=>{je();De();Yr();mT=new Float32Array(1),gT=new Uint32Array(1),_n=class extends oe{constructor(){let e=new mt({data:mT,label:"attribute-batch-buffer",usage:Y.VERTEX|Y.COPY_DST,shrinkToFit:!1}),r=new mt({data:gT,label:"index-batch-buffer",usage:Y.INDEX|Y.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r})}}});function Oe(i,t){let e=xp[i];return e===void 0&&(tl[t]===void 0&&(tl[t]=1),xp[i]=e=tl[t]++),e}var tl,xp,as=p(()=>{"use strict";tl=Object.create(null),xp=Object.create(null)});function _p(){if(!yn){yn="mediump";let i=pn();i&&i.getShaderPrecisionFormat&&(yn=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return yn}var yn,yp=p(()=>{Yc()});function bp(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
21
+ `)});function se(){if($r)return $r;let i=pn();return $r=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),$r=rp($r,i),i.getExtension("WEBGL_lose_context")?.loseContext(),$r}var $r,vr=p(()=>{Yc();ip();$r=null});function Yr(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return sp[e]||fT(i,t,e)}function fT(i,t,e){let r={},s=0;jc||(jc=se());for(let n=0;n<jc;n++){let a=n<t?i[n]:E.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new Pt(r);return sp[e]=o,o}var sp,jc,mn=p(()=>{Ye();rt();vr();sp={};jc=0});var be,Kc=p(()=>{"use strict";be=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 ss(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 qc=p(()=>{"use strict"});var op,lt,Tr=p(()=>{"use strict";op={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},lt=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",i[i.NONE=5]="NONE",i))(lt||{})});function Ue(i,t){return t.alphaMode==="no-premultiply-alpha"&&op[i]||i}var os=p(()=>{Tr()});var gn,np=p(()=>{"use strict";gn=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 ap(){return Qc>0?lp[--Qc]:new Zc}function cp(i){lp[Qc++]=i}var Zc,lp,Qc,ns,hp,up,dp=p(()=>{Rt();Kc();qc();os();vr();np();Zc=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new gn,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},lp=[],Qc=0;ns=0,hp=class xn{constructor(t={}){this.uid=Y("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],xn.defaultOptions.maxTextures=xn.defaultOptions.maxTextures??se(),t={...xn.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new be(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++)cp(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}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?!1:(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;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=ap(),s=r.textures;s.clear();let o=e[this.elementStart],n=Ue(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 c=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,h=this.indexBuffer,u=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",m=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){let _=e[g];e[g]=null;let y=_.texture._source,v=Ue(_.blendMode,y),T=n!==v||a!==_.topology;if(y._batchTick===ns&&!T){_._textureId=y._textureBindLocation,u+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,c,l,_._attributeStart,_._textureId),this.packQuadIndex(h,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,c,l,_._attributeStart,_._textureId),this.packIndex(_,h,_._indexStart,_._attributeStart/this.vertexSize)),_._batch=r;continue}y._batchTick=ns,(s.count>=m||T)&&(this._finishBatch(r,f,u-f,s,n,a,t,d),d="renderBatch",f=u,n=v,a=_.topology,r=ap(),s=r.textures,s.clear(),++ns),_._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,_._batch=r,u+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,c,l,_._attributeStart,_._textureId),this.packQuadIndex(h,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,c,l,_._attributeStart,_._textureId),this.packIndex(_,h,_._indexStart,_._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,f,u-f,s,n,a,t,d),f=u,++ns),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=u}_finishBatch(t,e,r,s,o,n,a,c){t.gpuBindGroup=null,t.bindGroup=null,t.action=c,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++ns,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 be(e);ss(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 ss(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,c=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-c}destroy(){for(let t=0;t<this.batches.length;t++)cp(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}};hp.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};up=hp});var $,De=p(()=>{"use strict";$=(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))($||{})});var mt,je=p(()=>{kt();Rt();De();mt=class extends nt{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=Y("buffer"),this._resourceType="buffer",this._resourceId=Y("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,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??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&$.STATIC)}set static(t){t?this.descriptor.usage|=$.STATIC:this.descriptor.usage&=~$.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=Y("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function Jc(i,t){if(!(i instanceof mt)){let e=t?$.INDEX:$.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=$.INDEX|$.COPY_DST):(i=new Float32Array(i),e=$.VERTEX|$.COPY_DST)),i=new mt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var fp=p(()=>{je();De()});function pp(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,c=-1/0,l=s.BYTES_PER_ELEMENT,h=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let f=h;f<s.length;f+=u){let d=s[f],m=s[f+1];d>a&&(a=d),m>c&&(c=m),d<o&&(o=d),m<n&&(n=m)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=c,e}var mp=p(()=>{"use strict"});function pT(i){return(i instanceof mt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Jc(i.buffer,!1),i}var oe,jr=p(()=>{kt();Xt();Rt();je();fp();mp();oe=class extends nt{constructor(t={}){super(),this.uid=Y("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new it,this._boundsDirty=!0;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=!0,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=pT(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=Jc(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,pp(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){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 mT,gT,_n,gp=p(()=>{je();De();jr();mT=new Float32Array(1),gT=new Uint32Array(1),_n=class extends oe{constructor(){let e=new mt({data:mT,label:"attribute-batch-buffer",usage:$.VERTEX|$.COPY_DST,shrinkToFit:!1}),r=new mt({data:gT,label:"index-batch-buffer",usage:$.INDEX|$.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r})}}});function Oe(i,t){let e=xp[i];return e===void 0&&(tl[t]===void 0&&(tl[t]=1),xp[i]=e=tl[t]++),e}var tl,xp,as=p(()=>{"use strict";tl=Object.create(null),xp=Object.create(null)});function _p(){if(!yn){yn="mediump";let i=pn();i&&i.getShaderPrecisionFormat&&(yn=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return yn}var yn,yp=p(()=>{Yc()});function bp(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
22
22
 
23
23
  #ifdef GL_ES // This checks if it is WebGL1
24
24
  #define in varying
@@ -36,7 +36,7 @@ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function rp(i,t){if(i===0)th
36
36
  `}var vp=p(()=>{"use strict"});function Tp(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
37
  ${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var Sp=p(()=>{"use strict"});function wp(i,t){return t?`#version 300 es
38
38
  ${i}`:i}var Pp=p(()=>{"use strict"});function Ap(i,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?xT:_T;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 xT,_T,Ep=p(()=>{"use strict";xT={},_T={}});function Cp(i,t){return t?i.replace("#version 300 es",""):i}var Mp=p(()=>{"use strict"});var el,rl,Bp,ne,Tr=p(()=>{as();yp();vp();Sp();Pp();Ep();Mp();el={stripVersion:Cp,ensurePrecision:Tp,addProgramDefines:bp,setProgramName:Ap,insertVersion:wp},rl=Object.create(null),Bp=class il{constructor(t){t={...il.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:_p()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(el).forEach(n=>{let a=r[n];s=el[n](s,a,!0),o=el[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Oe(`${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 rl[e]||(rl[e]=new il(t)),rl[e]}};Bp.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};ne=Bp});function Kt(i){return Rp[i]??Rp.float32}var Rp,Sr=p(()=>{"use strict";Rp={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function Gp({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 c=yT[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:c,stride:Kt(c).stride,offset:0,instance:!1,start:0}}}}return e}var yT,kp=p(()=>{Sr();yT={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 bn(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,c=/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 h=i.match(n)?.map(u=>{let d=u.match(c)[1],f=u.match(a).reduce((m,_)=>{let[g,b]=_.split(":");return m[g.trim()]=b.trim(),m},{});return f?{name:d,members:f}:null}).filter(({name:u})=>l.some(d=>d.type===u))??[];return{groups:l,structs:h}}var Ip=p(()=>{"use strict"});var jr,Fp=p(()=>{"use strict";jr=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(jr||{})});function Up({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:jr.VERTEX|jr.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:jr.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:jr.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var Dp=p(()=>{Fp()});function Op({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 Lp=p(()=>{"use strict"});function Np(i,t){let e=new Set,r=new Set,s=[...i.structs,...t.structs].filter(n=>e.has(n.name)?!1:(e.add(n.name),!0)),o=[...i.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:s,groups:o}}var Hp=p(()=>{"use strict"});var sl,ae,Kr=p(()=>{as();kp();Ip();Dp();Lp();Hp();sl=Object.create(null),ae=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=bn(e.source);this.structsAndGroups=a}else{let a=bn(r.source),c=bn(e.source);this.structsAndGroups=Np(a,c)}this.layout=s??Op(this.structsAndGroups),this.gpuLayout=o??Up(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=Oe(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Gp(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 sl[e]||(sl[e]=new i(t)),sl[e]}}});function ol(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 F(`${r} placement hook does not exist in shader`)}}var Wp=p(()=>{it()});function nl(i){let t={};return(i.match(bT)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[]}),t}var bT,zp=p(()=>{"use strict";bT=/\{\{(.*?)\}\}/g});function Vp(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function al(i,t,e=!1){let r=[];Vp(t,r),i.forEach(a=>{a.header&&Vp(a.header,r)});let s=r;e&&s.sort();let o=s.map((a,c)=>` @location(${c}) ${a},`).join(`
39
+ ${i}`}var xT,_T,Ep=p(()=>{"use strict";xT={},_T={}});function Cp(i,t){return t?i.replace("#version 300 es",""):i}var Mp=p(()=>{"use strict"});var el,rl,Bp,ne,Sr=p(()=>{as();yp();vp();Sp();Pp();Ep();Mp();el={stripVersion:Cp,ensurePrecision:Tp,addProgramDefines:bp,setProgramName:Ap,insertVersion:wp},rl=Object.create(null),Bp=class il{constructor(t){t={...il.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:_p()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(el).forEach(n=>{let a=r[n];s=el[n](s,a,!0),o=el[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Oe(`${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 rl[e]||(rl[e]=new il(t)),rl[e]}};Bp.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};ne=Bp});function Kt(i){return Rp[i]??Rp.float32}var Rp,wr=p(()=>{"use strict";Rp={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function Gp({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 c=yT[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:c,stride:Kt(c).stride,offset:0,instance:!1,start:0}}}}return e}var yT,kp=p(()=>{wr();yT={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 bn(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,c=/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 h=i.match(n)?.map(u=>{let f=u.match(c)[1],d=u.match(a).reduce((m,g)=>{let[_,b]=g.split(":");return m[_.trim()]=b.trim(),m},{});return d?{name:f,members:d}:null}).filter(({name:u})=>l.some(f=>f.type===u))??[];return{groups:l,structs:h}}var Ip=p(()=>{"use strict"});var Kr,Fp=p(()=>{"use strict";Kr=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(Kr||{})});function Up({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:!1}})}return t}var Dp=p(()=>{Fp()});function Op({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 Lp=p(()=>{"use strict"});function Np(i,t){let e=new Set,r=new Set,s=[...i.structs,...t.structs].filter(n=>e.has(n.name)?!1:(e.add(n.name),!0)),o=[...i.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:s,groups:o}}var Hp=p(()=>{"use strict"});var sl,ae,qr=p(()=>{as();kp();Ip();Dp();Lp();Hp();sl=Object.create(null),ae=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=bn(e.source);this.structsAndGroups=a}else{let a=bn(r.source),c=bn(e.source);this.structsAndGroups=Np(a,c)}this.layout=s??Op(this.structsAndGroups),this.gpuLayout=o??Up(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=Oe(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Gp(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 sl[e]||(sl[e]=new i(t)),sl[e]}}});function ol(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 F(`${r} placement hook does not exist in shader`)}}var Wp=p(()=>{st()});function nl(i){let t={};return(i.match(bT)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[]}),t}var bT,zp=p(()=>{"use strict";bT=/\{\{(.*?)\}\}/g});function Vp(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function al(i,t,e=!1){let r=[];Vp(t,r),i.forEach(a=>{a.header&&Vp(a.header,r)});let s=r;e&&s.sort();let o=s.map((a,c)=>` @location(${c}) ${a},`).join(`
40
40
  `),n=t.replace(/@in\s+[^;]+;\s*/g,"");return n=n.replace("{{in}}",`
41
41
  ${o}
42
42
  `),n}var Xp=p(()=>{"use strict"});function $p(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function vT(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function TT(i){let t=/@.*?\s+/g;return i.replace(t,"")}function Yp(i,t){let e=[];$p(t,e),i.forEach(c=>{c.header&&$p(c.header,e)});let r=0,s=e.sort().map(c=>c.indexOf("builtin")>-1?c:`@location(${r++}) ${c}`).join(`,
@@ -191,17 +191,17 @@ ${s.join(`
191
191
  uniform mat3 uWorldTransformMatrix;
192
192
  uniform vec4 uWorldColorAlpha;
193
193
  uniform vec2 uResolution;
194
- `}}});function ve({bits:i,name:t}){let e=qp({template:{fragment:rm,vertex:em},bits:[nm,...i]});return ae.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Te({bits:i,name:t}){return new ne({name:t,...Zp({template:{vertex:im,fragment:sm},bits:[am,...i]})})}var qe=p(()=>{Tr();Kr();tm();om();cm()});var qr,Zr,cs=p(()=>{"use strict";qr={name:"color-bit",vertex:{header:`
194
+ `}}});function ve({bits:i,name:t}){let e=qp({template:{fragment:rm,vertex:em},bits:[nm,...i]});return ae.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Te({bits:i,name:t}){return new ne({name:t,...Zp({template:{vertex:im,fragment:sm},bits:[am,...i]})})}var qe=p(()=>{Sr();qr();tm();om();cm()});var Zr,Qr,cs=p(()=>{"use strict";Zr={name:"color-bit",vertex:{header:`
195
195
  @in aColor: vec4<f32>;
196
196
  `,main:`
197
197
  vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
198
- `}},Zr={name:"color-bit",vertex:{header:`
198
+ `}},Qr={name:"color-bit",vertex:{header:`
199
199
  in vec4 aColor;
200
200
  `,main:`
201
201
  vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
202
202
  `}}});function PT(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
203
  `)}function AT(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 Qr(i){return hl[i]||(hl[i]={name:"texture-batch-bit",vertex:{header:`
204
+ `)}function Jr(i){return hl[i]||(hl[i]={name:"texture-batch-bit",vertex:{header:`
205
205
  @in aTextureIdAndRound: vec2<u32>;
206
206
  @out @interpolate(flat) vTextureId : u32;
207
207
  `,main:`
@@ -221,7 +221,7 @@ ${s.join(`
221
221
 
222
222
  ${AT(i)}
223
223
  `}}),hl[i]}function ET(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 Jr(i){return ul[i]||(ul[i]={name:"texture-batch-bit",vertex:{header:`
224
+ `)}function ti(i){return ul[i]||(ul[i]={name:"texture-batch-bit",vertex:{header:`
225
225
  in vec2 aTextureIdAndRound;
226
226
  out float vTextureId;
227
227
 
@@ -250,7 +250,7 @@ ${s.join(`
250
250
  {
251
251
  return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
252
252
  }
253
- `}}});var dl,lm,hm=p(()=>{"use strict";dl=["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>"],lm=dl.reduce((i,t)=>(i[t]=!0,i),{})});function um(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 dm=p(()=>{"use strict"});var fm,st,Ht=p(()=>{Rt();as();hm();dm();fm=class pm{constructor(t,e){this._touched=0,this.uid=j("uniform"),this._resourceType="uniformGroup",this._resourceId=j("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...pm.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,!lm[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${dl.join(", ")}`);o.value??(o.value=um(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Oe(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};fm.defaultOptions={ubo:!1,isStatic:!1};st=fm});function ti(i){let t=mm[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=mm[i]=new st({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var mm,vn=p(()=>{Ht();mm={}});var yt,Pe=p(()=>{"use strict";yt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(yt||{})});var gt,pe=p(()=>{kt();Rt();Tr();Ye();Kr();Pe();Ht();gt=class i extends nt{constructor(t){super(),this.uid=j("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=yt.WEBGPU),r&&(n|=yt.WEBGL)),this.compatibleRenderers=n;let c={};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 h in a[l]){let u=a[l][h];c[u]={group:l,binding:h,name:u}}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,c[h.name]=h})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,c[u.name]=u});let l=0;for(let h in o)c[h]||(s[99]||(s[99]=new Pt,this._ownedBindGroups.push(s[99])),c[h]={group:99,binding:l,name:h},a[99]=a[99]||{},a[99][l]=h,l++);for(let h in o){let u=h,d=o[h];!d.source&&!d._resourceType&&(d=new st(d));let f=c[u];f&&(s[f.group]||(s[f.group]=new Pt,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,c)}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 Pt,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=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(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=ae.from(e)),r&&(n=ne.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var Tn,gm=p(()=>{qe();cs();ls();Ze();vn();pe();Tn=class extends gt{constructor(t){let e=Te({name:"batch",bits:[Zr,Jr(t),we]}),r=ve({name:"batch",bits:[qr,Qr(t),Se]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:ti(t)}})}}});var xm,_m,hs,fl=p(()=>{w();dp();gp();gm();xm=null,_m=class ym extends up{constructor(){super(...arguments),this.geometry=new _n,this.shader=xm||(xm=new Tn(this.maxTextures)),this.name=ym.extension.name,this.vertexSize=6}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,c=a.a,l=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,{positions:m,uvs:_}=t,g=t.color,b=t.attributeOffset,y=b+t.attributeSize;for(let v=b;v<y;v++){let T=v*2,R=m[T],S=m[T+1];e[s++]=c*R+h*S+d,e[s++]=u*S+l*R+f,e[s++]=_[T],e[s++]=_[T+1],r[s++]=g,r[s++]=n}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,c=a.a,l=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,m=t.bounds,_=m.maxX,g=m.minX,b=m.maxY,y=m.minY,v=n.uvs,T=t.color,R=o<<16|t.roundPixels&65535;e[s+0]=c*g+h*y+d,e[s+1]=u*y+l*g+f,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=T,r[s+5]=R,e[s+6]=c*_+h*y+d,e[s+7]=u*y+l*_+f,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=T,r[s+11]=R,e[s+12]=c*_+h*b+d,e[s+13]=u*b+l*_+f,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=T,r[s+17]=R,e[s+18]=c*g+h*b+d,e[s+19]=u*b+l*g+f,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=T,r[s+23]=R}};_m.extension={type:[x.Batcher],name:"default"};hs=_m});function bm(i,t,e,r,s,o,n,a=null){let c=0;e*=t,s*=o;let l=a.a,h=a.b,u=a.c,d=a.d,f=a.tx,m=a.ty;for(;c<n;){let _=i[e],g=i[e+1];r[s]=l*_+u*g+f,r[s+1]=h*_+d*g+m,s+=o,e+=t,c++}}function vm(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var Tm=p(()=>{"use strict"});function pl(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,c=t.d,l=t.tx,h=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let d=0;d<s;d++){let f=i[u],m=i[u+1];i[u]=o*f+a*m+l,i[u+1]=n*f+c*m+h,u+=r}}var Sm=p(()=>{"use strict"});var CT,wr,ml=p(()=>{Z();cc();CT=new G,wr=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?zo(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||CT}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=!0,this.renderable=null,this.topology="triangle-list"}}});var ei,wm,Pm,Am=p(()=>{w();ei={extension:{type:x.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let T=i;e=T.x,r=T.y,n=a=T.radius,s=o=0}else if(i.type==="ellipse"){let T=i;e=T.x,r=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=i,R=T.width/2,S=T.height/2;e=T.x+R,r=T.y+S,n=a=Math.max(0,Math.min(T.radius,Math.min(R,S))),s=R-n,o=S-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let c=Math.ceil(2.3*Math.sqrt(n+a)),l=c*8+(s?4:0)+(o?4:0);if(l===0)return t;if(c===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let h=0,u=c*4+(s?2:0)+2,d=u,f=l,m=s+n,_=o,g=e+m,b=e-m,y=r+_;if(t[h++]=g,t[h++]=y,t[--u]=y,t[--u]=b,o){let T=r-_;t[d++]=b,t[d++]=T,t[--f]=T,t[--f]=g}for(let T=1;T<c;T++){let R=Math.PI/2*(T/c),S=s+Math.cos(R)*n,P=o+Math.sin(R)*a,A=e+S,M=e-S,E=r+P,B=r-P;t[h++]=A,t[h++]=E,t[--u]=E,t[--u]=M,t[d++]=M,t[d++]=B,t[--f]=B,t[--f]=A}m=s,_=o+a,g=e+m,b=e-m,y=r+_;let v=r-_;return t[h++]=g,t[h++]=y,t[--f]=v,t[--f]=g,s&&(t[h++]=b,t[h++]=y,t[--f]=v,t[--f]=b),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let h=0;h<i.length;h+=2)n+=i[h],a+=i[h+1];n/=i.length/2,a/=i.length/2;let c=r;t[c*e]=n,t[c*e+1]=a;let l=c++;for(let h=0;h<i.length;h+=2)t[c*e]=i[h],t[c*e+1]=i[h+1],h>0&&(s[o++]=c,s[o++]=l,s[o++]=c-1),c++;s[o++]=l+1,s[o++]=l,s[o++]=c-1}},wm={...ei,extension:{...ei.extension,name:"ellipse"}},Pm={...ei,extension:{...ei.extension,name:"roundedRectangle"}}});function Em(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 Cm=p(()=>{"use strict"});function Mm(i,t,e,r,s,o,n,a){let c=i-e*s,l=t-r*s,h=i+e*o,u=t+r*o,d,f;n?(d=r,f=-e):(d=-r,f=e);let m=c+d,_=l+f,g=h+d,b=u+f;return a.push(m,_),a.push(g,b),2}function Pr(i,t,e,r,s,o,n,a){let c=e-i,l=r-t,h=Math.atan2(c,l),u=Math.atan2(s-i,o-t);a&&h<u?h+=Math.PI*2:!a&&h>u&&(u+=Math.PI*2);let d=h,f=u-h,m=Math.abs(f),_=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(_)/Math.PI>>0)+1,b=f/g;if(d+=b,a){n.push(i,t),n.push(e,r);for(let y=1,v=d;y<g;y++,v+=b)n.push(i,t),n.push(i+Math.sin(v)*_,t+Math.cos(v)*_);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let y=1,v=d;y<g;y++,v+=b)n.push(i+Math.sin(v)*_,t+Math.cos(v)*_),n.push(i,t);n.push(s,o),n.push(i,t)}return g*2}function Bm(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,c=a.alignment;if(t.alignment!==.5){let q=Em(i);e&&(q*=-1),c=(c-.5)*q+.5}let l=new K(i[0],i[1]),h=new K(i[i.length-2],i[i.length-1]),u=r,d=Math.abs(l.x-h.x)<n&&Math.abs(l.y-h.y)<n;if(u){i=i.slice(),d&&(i.pop(),i.pop(),h.set(i[i.length-2],i[i.length-1]));let q=(l.x+h.x)*.5,Ft=(h.y+l.y)*.5;i.unshift(q,Ft),i.push(q,Ft)}let f=s,m=i.length/2,_=i.length,g=f.length/2,b=a.width/2,y=b*b,v=a.miterLimit*a.miterLimit,T=i[0],R=i[1],S=i[2],P=i[3],A=0,M=0,E=-(R-P),B=T-S,I=0,H=0,$=Math.sqrt(E*E+B*B);E/=$,B/=$,E*=b,B*=b;let ot=c,N=(1-ot)*2,U=ot*2;u||(a.cap==="round"?_+=Pr(T-E*(N-U)*.5,R-B*(N-U)*.5,T-E*N,R-B*N,T+E*U,R+B*U,f,!0)+2:a.cap==="square"&&(_+=Mm(T,R,E,B,N,U,!0,f))),f.push(T-E*N,R-B*N),f.push(T+E*U,R+B*U);for(let q=1;q<m-1;++q){T=i[(q-1)*2],R=i[(q-1)*2+1],S=i[q*2],P=i[q*2+1],A=i[(q+1)*2],M=i[(q+1)*2+1],E=-(R-P),B=T-S,$=Math.sqrt(E*E+B*B),E/=$,B/=$,E*=b,B*=b,I=-(P-M),H=S-A,$=Math.sqrt(I*I+H*H),I/=$,H/=$,I*=b,H*=b;let Ft=S-T,he=R-P,or=S-A,Fi=M-P,Wu=Ft*or+he*Fi,Ro=he*or-Fi*Ft,Ui=Ro<0;if(Math.abs(Ro)<.001*Math.abs(Wu)){f.push(S-E*N,P-B*N),f.push(S+E*U,P+B*U),Wu>=0&&(a.join==="round"?_+=Pr(S,P,S-E*N,P-B*N,S-I*N,P-H*N,f,!1)+4:_+=2,f.push(S-I*U,P-H*U),f.push(S+I*N,P+H*N));continue}let zu=(-E+T)*(-B+P)-(-E+S)*(-B+R),Vu=(-I+A)*(-H+P)-(-I+S)*(-H+M),Go=(Ft*Vu-or*zu)/Ro,ko=(Fi*zu-he*Vu)/Ro,Xa=(Go-S)*(Go-S)+(ko-P)*(ko-P),nr=S+(Go-S)*N,ar=P+(ko-P)*N,cr=S-(Go-S)*U,lr=P-(ko-P)*U,T0=Math.min(Ft*Ft+he*he,or*or+Fi*Fi),Xu=Ui?N:U,S0=T0+Xu*Xu*y;Xa<=S0?a.join==="bevel"||Xa/y>v?(Ui?(f.push(nr,ar),f.push(S+E*U,P+B*U),f.push(nr,ar),f.push(S+I*U,P+H*U)):(f.push(S-E*N,P-B*N),f.push(cr,lr),f.push(S-I*N,P-H*N),f.push(cr,lr)),_+=2):a.join==="round"?Ui?(f.push(nr,ar),f.push(S+E*U,P+B*U),_+=Pr(S,P,S+E*U,P+B*U,S+I*U,P+H*U,f,!0)+4,f.push(nr,ar),f.push(S+I*U,P+H*U)):(f.push(S-E*N,P-B*N),f.push(cr,lr),_+=Pr(S,P,S-E*N,P-B*N,S-I*N,P-H*N,f,!1)+4,f.push(S-I*N,P-H*N),f.push(cr,lr)):(f.push(nr,ar),f.push(cr,lr)):(f.push(S-E*N,P-B*N),f.push(S+E*U,P+B*U),a.join==="round"?Ui?_+=Pr(S,P,S+E*U,P+B*U,S+I*U,P+H*U,f,!0)+2:_+=Pr(S,P,S-E*N,P-B*N,S-I*N,P-H*N,f,!1)+2:a.join==="miter"&&Xa/y<=v&&(Ui?(f.push(cr,lr),f.push(cr,lr)):(f.push(nr,ar),f.push(nr,ar)),_+=2),f.push(S-I*N,P-H*N),f.push(S+I*U,P+H*U),_+=2)}T=i[(m-2)*2],R=i[(m-2)*2+1],S=i[(m-1)*2],P=i[(m-1)*2+1],E=-(R-P),B=T-S,$=Math.sqrt(E*E+B*B),E/=$,B/=$,E*=b,B*=b,f.push(S-E*N,P-B*N),f.push(S+E*U,P+B*U),u||(a.cap==="round"?_+=Pr(S-E*(N-U)*.5,P-B*(N-U)*.5,S-E*N,P-B*N,S+E*U,P+B*U,f,!1)+2:a.cap==="square"&&(_+=Mm(S,P,E,B,N,U,!1,f)));let ee=1e-4*1e-4;for(let q=g;q<_+g-2;++q)T=f[q*2],R=f[q*2+1],S=f[(q+1)*2],P=f[(q+1)*2+1],A=f[(q+2)*2],M=f[(q+2)*2+1],!(Math.abs(T*(P-M)+S*(M-R)+A*(R-P))<ee)&&o.push(q,q+1,q+2)}var Rm=p(()=>{ie();Cm()});function Gm(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],c=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-c)<s,h=e,u=i.length/2,d=h.length/2;for(let f=0;f<u;f++)h.push(i[f*2]),h.push(i[f*2+1]);for(let f=0;f<u-1;f++)r.push(d+f,d+f+1);l&&r.push(d+u-1,d)}var km=p(()=>{});var bl=Ya((n2,yl)=>{"use strict";yl.exports=Pn;yl.exports.default=Pn;function Pn(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Fm(i,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,c,l,h,u,d,f;if(r&&(o=FT(i,t,o,e)),i.length>80*e){a=l=i[0],c=h=i[1];for(var m=e;m<s;m+=e)u=i[m],d=i[m+1],u<a&&(a=u),d<c&&(c=d),u>l&&(l=u),d>h&&(h=d);f=Math.max(l-a,h-c),f=f!==0?32767/f:0}return us(o,n,e,a,c,f,0),n}function Fm(i,t,e,r,s){var o,n;if(s===_l(i,t,e,r)>0)for(o=t;o<e;o+=r)n=Im(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=Im(o,i[o],i[o+1],n);return n&&An(n,n.next)&&(fs(n),n=n.next),n}function Ar(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(An(e,e.next)||pt(e.prev,e,e.next)===0)){if(fs(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function us(i,t,e,r,s,o,n){if(i){!n&&o&&NT(i,r,s,o);for(var a=i,c,l;i.prev!==i.next;){if(c=i.prev,l=i.next,o?GT(i,r,s,o):RT(i)){t.push(c.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),fs(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=kT(Ar(i),t,e),us(i,t,e,r,s,o,2)):n===2&&IT(i,t,e,r,s,o):us(Ar(i),t,e,r,s,o,1);break}}}}function RT(i){var t=i.prev,e=i,r=i.next;if(pt(t,e,r)>=0)return!1;for(var s=t.x,o=e.x,n=r.x,a=t.y,c=e.y,l=r.y,h=s<o?s<n?s:n:o<n?o:n,u=a<c?a<l?a:l:c<l?c:l,d=s>o?s>n?s:n:o>n?o:n,f=a>c?a>l?a:l:c>l?c:l,m=r.next;m!==t;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=f&&ri(s,a,o,c,n,l,m.x,m.y)&&pt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function GT(i,t,e,r){var s=i.prev,o=i,n=i.next;if(pt(s,o,n)>=0)return!1;for(var a=s.x,c=o.x,l=n.x,h=s.y,u=o.y,d=n.y,f=a<c?a<l?a:l:c<l?c:l,m=h<u?h<d?h:d:u<d?u:d,_=a>c?a>l?a:l:c>l?c:l,g=h>u?h>d?h:d:u>d?u:d,b=gl(f,m,t,e,r),y=gl(_,g,t,e,r),v=i.prevZ,T=i.nextZ;v&&v.z>=b&&T&&T.z<=y;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==s&&v!==n&&ri(a,h,c,u,l,d,v.x,v.y)&&pt(v.prev,v,v.next)>=0||(v=v.prevZ,T.x>=f&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==n&&ri(a,h,c,u,l,d,T.x,T.y)&&pt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;v&&v.z>=b;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==s&&v!==n&&ri(a,h,c,u,l,d,v.x,v.y)&&pt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;T&&T.z<=y;){if(T.x>=f&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==n&&ri(a,h,c,u,l,d,T.x,T.y)&&pt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function kT(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!An(s,o)&&Um(s,r,r.next,o)&&ds(s,o)&&ds(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),fs(r),fs(r.next),r=i=o),r=r.next}while(r!==i);return Ar(r)}function IT(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&zT(n,a)){var c=Dm(n,a);n=Ar(n,n.next),c=Ar(c,c.next),us(n,t,e,r,s,o,0),us(c,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function FT(i,t,e,r){var s=[],o,n,a,c,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,c=o<n-1?t[o+1]*r:i.length,l=Fm(i,a,c,r,!1),l===l.next&&(l.steiner=!0),s.push(WT(l));for(s.sort(UT),o=0;o<s.length;o++)e=DT(s[o],e);return e}function UT(i,t){return i.x-t.x}function DT(i,t){var e=OT(i,t);if(!e)return t;var r=Dm(e,i);return Ar(r,r.next),Ar(e,e.next)}function OT(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next}while(e!==t);if(!n)return null;var c=n,l=n.x,h=n.y,u=1/0,d;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&ri(s<h?r:o,s,l,h,s<h?o:r,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(r-e.x),ds(e,i)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&LT(n,e)))&&(n=e,u=d)),e=e.next;while(e!==c);return n}function LT(i,t){return pt(i.prev,i,t.prev)<0&&pt(t.next,i,i.next)<0}function NT(i,t,e,r){var s=i;do s.z===0&&(s.z=gl(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,HT(s)}function HT(i){var t,e,r,s,o,n,a,c,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(c=l;a>0||c>0&&r;)a!==0&&(c===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,c--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r}o.nextZ=null,l*=2}while(n>1);return i}function gl(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 WT(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function ri(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 zT(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!VT(i,t)&&(ds(i,t)&&ds(t,i)&&XT(i,t)&&(pt(i.prev,i,t.prev)||pt(i,t.prev,t))||An(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 An(i,t){return i.x===t.x&&i.y===t.y}function Um(i,t,e,r){var s=wn(pt(i,t,e)),o=wn(pt(i,t,r)),n=wn(pt(e,r,i)),a=wn(pt(e,r,t));return!!(s!==o&&n!==a||s===0&&Sn(i,e,t)||o===0&&Sn(i,r,t)||n===0&&Sn(e,i,r)||a===0&&Sn(e,t,r))}function Sn(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 wn(i){return i>0?1:i<0?-1:0}function VT(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Um(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function ds(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 XT(i,t){var e=i,r=!1,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 Dm(i,t){var e=new xl(i.i,i.x,i.y),r=new xl(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 Im(i,t,e,r){var s=new xl(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 fs(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 xl(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Pn.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(_l(i,0,o,e));if(s)for(var a=0,c=t.length;a<c;a++){var l=t[a]*e,h=a<c-1?t[a+1]*e:i.length;n-=Math.abs(_l(i,l,h,e))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*e,f=r[a+1]*e,m=r[a+2]*e;u+=Math.abs((i[d]-i[m])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[m+1]-i[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function _l(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Pn.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r))}return e}});function En(i,t,e,r,s,o,n){let a=(0,Om.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let c=s*r;for(let l=0;l<i.length;l+=2)e[c]=i[l],e[c+1]=i[l+1],c+=r}var Om,vl=p(()=>{Om=Io(bl(),1)});var $T,Lm,Nm=p(()=>{w();vl();$T=[],Lm={extension:{type:x.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){En(i,$T,t,e,r,s,o)}}});var Hm,Wm=p(()=>{w();Hm={extension:{type:x.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var zm,Vm=p(()=>{w();zm={extension:{type:x.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function $m(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function Ym(i,t){let e=O.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function YT(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(D("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]??qt.defaultLinearOptions.textureSize}),t}var Xm,Sl,qt,ii=p(()=>{Mt();ct();Z();zr();et();Rt();dt();pc();Xm=[{offset:0,color:"white"},{offset:1,color:"black"}],Sl=class Tl{constructor(...t){this.uid=j("fillGradient"),this.type="linear",this.colorStops=[];let e=YT(t);e={...e.type==="radial"?Tl.defaultRadialOptions:Tl.defaultLinearOptions,...Xo(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:X.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=t;t=r,r=g,o*=-1}if(n<0){let g=e;e=s,s=g,n*=-1}}let c=this.colorStops.length?this.colorStops:Xm,l=this._textureSize,{canvas:h,context:u}=Ym(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);$m(d,c),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new C({source:new jt({resource:h,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),_=new G;_.scale(f/l,1),_.rotate(m),_.translate(t,e),this.textureSpace==="local"&&_.scale(l,l),this.transform=_}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:Xm,e=this._textureSize,{canvas:r,context:s}=Ym(e,e),{x:o,y:n}=this.center,{x:a,y:c}=this.outerCenter,l=this.innerRadius,h=this.outerRadius,u=a-h,d=c-h,f=e/(h*2),m=(o-u)*f,_=(n-d)*f,g=s.createRadialGradient(m,_,l*f,(a-u)*f,(c-d)*f,h*f);$m(g,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=g,s.translate(m,_),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-_),s.fillRect(0,0,e,e),this.texture=new C({source:new jt({resource:r,addressMode:this._wrapMode})});let b=new G;b.scale(1/f,1/f),b.translate(u,d),this.textureSpace==="local"&&b.scale(e,e),this.transform=b}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Sl.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Sl.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};qt=Sl});function jm(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(KT);t.width&&n.pad(t.width);let{x:a,y:c}=n,l=1/n.width,h=1/n.height,u=-a*l,d=-c*h,f=s.a,m=s.b,_=s.c,g=s.d;s.a*=l,s.b*=l,s.c*=h,s.d*=h,s.tx=u*f+d*_+s.tx,s.ty=u*m+d*g+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof qt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(jT.copyFrom(r).invert()),s}var jT,KT,Km=p(()=>{Z();bt();ii();jT=new G,KT=new V});function Zm(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")QT(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,c=o.data.style,l=o.data.hole;n&&l&&qm(l.shapePath,c,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),qm(a,c,n,r,e)}}}function QT(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,c=[],l=Cn.rectangle,h=qT,u=i.image;h.x=i.dx,h.y=i.dy,h.width=i.dw,h.height=i.dh;let d=i.transform;l.build(h,c),d&&pl(c,d),l.triangulate(c,r,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let m=z.get(wr);m.indexOffset=n,m.indexSize=o.length-n,m.attributeOffset=a,m.attributeSize=r.length/2-a,m.baseColor=i.style,m.alpha=i.alpha,m.texture=u,m.geometryData=e,t.push(m)}function qm(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:c,transform:l,holes:h})=>{let u=a.length,d=o.length/2,f=[],m=Cn[c.type],_="triangle-list";if(m.build(c,f),l&&pl(f,l),e){let v=c.closePath??!0,T=t;T.pixelLine?(Gm(f,v,o,a),_="line-list"):Bm(f,T,!1,v,o,a)}else if(h){let v=[],T=f.slice();JT(h).forEach(S=>{v.push(T.length/2),T.push(...S)}),En(T,v,o,2,d,a,u)}else m.triangulate(f,o,2,d,a,u);let g=n.length/2,b=t.texture;if(b!==C.WHITE){let v=jm(ZT,t,c,l);bm(o,2,d,n,g,2,o.length/2-d,v)}else vm(n,g,2,o.length/2-d);let y=z.get(wr);y.indexOffset=u,y.indexSize=a.length-u,y.attributeOffset=d,y.attributeSize=o.length/2-d,y.baseColor=t.color,y.alpha=t.alpha,y.texture=b,y.geometryData=s,y.topology=_,r.push(y)})}function JT(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];Cn[r.type].build(r,s),t.push(s)}return t}var Cn,qT,ZT,Qm=p(()=>{w();Z();bt();Tm();Sm();et();Dt();ml();Am();Rm();km();Nm();Wm();Vm();Km();vl();Cn={};k.handleByMap(x.ShapeBuilder,Cn);k.add(Hm,Lm,zm,ei,wm,Pm);qT=new V,ZT=new G});var wl,Pl,El,si,Mn=p(()=>{w();mn();fl();dc();dt();Dt();Qm();wl=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Pl=class{constructor(){this.batcher=new hs,this.instructions=new Ur}init(){this.instructions.reset()}get geometry(){return D(gd,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},El=class Al{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Al.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Al.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),Zm(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=!1:r==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=z.get(Pl),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let h=0;h<r.length;h++)r[h].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let h=0;h<r.length;h++){let u=r[h];a.add(u)}a.finish(e.instructions);let c=a.geometry;c.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),c.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let l=a.batches;for(let h=0;h<l.length;h++){let u=l[h];u.bindGroup=$r(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new wl;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]&&(z.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{z.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};El.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"graphicsContext"};El.defaultOptions={bezierSmoothness:.5};si=El});var tS,Cl,Ml,Bl,Rl,Gl,kl,Il,xt,me=p(()=>{"use strict";tS={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},Cl=0,Ml=1,Bl=2,Rl=3,Gl=4,kl=5,Il=class Jm{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Cl)}set blend(t){!!(this.data&1<<Cl)!==t&&(this.data^=1<<Cl)}get offsets(){return!!(this.data&1<<Ml)}set offsets(t){!!(this.data&1<<Ml)!==t&&(this.data^=1<<Ml)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Bl)}set culling(t){!!(this.data&1<<Bl)!==t&&(this.data^=1<<Bl)}get depthTest(){return!!(this.data&1<<Rl)}set depthTest(t){!!(this.data&1<<Rl)!==t&&(this.data^=1<<Rl)}get depthMask(){return!!(this.data&1<<kl)}set depthMask(t){!!(this.data&1<<kl)!==t&&(this.data^=1<<kl)}get clockwiseFrontFace(){return!!(this.data&1<<Gl)}set clockwiseFrontFace(t){!!(this.data&1<<Gl)!==t&&(this.data^=1<<Gl)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=tS[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 Jm;return t.depthTest=!1,t.blend=!0,t}};Il.default2d=Il.for2d();xt=Il});function Ae(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 oi=p(()=>{"use strict"});var ps,tg=p(()=>{w();me();Dt();oi();ml();ps=class{constructor(t,e){this.state=xt.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Ae(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=z.get(wr);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{z.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};ps.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"graphics"}});var Fl=p(()=>{w();Mn();tg();k.add(ps);k.add(si)});var Qe,Bn=p(()=>{"use strict";Qe=class{constructor(){this.batcherName="default",this.packAsQuad=!1,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 ms,eg=p(()=>{w();Z();Ye();Ht();os();Dt();oi();Bn();ms=class{constructor(t,e){this.localUniforms=new st({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Pt({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return!0;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,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(z.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Ue(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Ae(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=z.get(Qe);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&z.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};ms.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"mesh"}});var Ul=p(()=>{w();eg();k.add(ms)});var Rn,rg=p(()=>{"use strict";Rn=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 Dl(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 ig=p(()=>{"use strict"});function og(i){return{dynamicUpdate:sg(i,!0),staticUpdate:sg(i,!1)}}function sg(i,t){let e=[];e.push(`
253
+ `}}});var dl,lm,hm=p(()=>{"use strict";dl=["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>"],lm=dl.reduce((i,t)=>(i[t]=!0,i),{})});function um(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 dm=p(()=>{"use strict"});var fm,ot,Ht=p(()=>{Rt();as();hm();dm();fm=class pm{constructor(t,e){this._touched=0,this.uid=Y("uniform"),this._resourceType="uniformGroup",this._resourceId=Y("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...pm.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,!lm[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${dl.join(", ")}`);o.value??(o.value=um(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Oe(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};fm.defaultOptions={ubo:!1,isStatic:!1};ot=fm});function ei(i){let t=mm[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=mm[i]=new ot({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var mm,vn=p(()=>{Ht();mm={}});var yt,Pe=p(()=>{"use strict";yt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(yt||{})});var gt,pe=p(()=>{kt();Rt();Sr();Ye();qr();Pe();Ht();gt=class i extends nt{constructor(t){super(),this.uid=Y("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=yt.WEBGPU),r&&(n|=yt.WEBGL)),this.compatibleRenderers=n;let c={};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 h in a[l]){let u=a[l][h];c[u]={group:l,binding:h,name:u}}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,c[h.name]=h})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,c[u.name]=u});let l=0;for(let h in o)c[h]||(s[99]||(s[99]=new Pt,this._ownedBindGroups.push(s[99])),c[h]={group:99,binding:l,name:h},a[99]=a[99]||{},a[99][l]=h,l++);for(let h in o){let u=h,f=o[h];!f.source&&!f._resourceType&&(f=new ot(f));let d=c[u];d&&(s[d.group]||(s[d.group]=new Pt,this._ownedBindGroups.push(s[d.group])),s[d.group].setResource(f,d.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,c)}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 Pt,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=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(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=ae.from(e)),r&&(n=ne.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var Tn,gm=p(()=>{qe();cs();ls();Ze();vn();pe();Tn=class extends gt{constructor(t){let e=Te({name:"batch",bits:[Qr,ti(t),we]}),r=ve({name:"batch",bits:[Zr,Jr(t),Se]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:ei(t)}})}}});var xm,_m,hs,fl=p(()=>{P();dp();gp();gm();xm=null,_m=class ym extends up{constructor(){super(...arguments),this.geometry=new _n,this.shader=xm||(xm=new Tn(this.maxTextures)),this.name=ym.extension.name,this.vertexSize=6}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,c=a.a,l=a.b,h=a.c,u=a.d,f=a.tx,d=a.ty,{positions:m,uvs:g}=t,_=t.color,b=t.attributeOffset,y=b+t.attributeSize;for(let v=b;v<y;v++){let T=v*2,C=m[T],S=m[T+1];e[s++]=c*C+h*S+f,e[s++]=u*S+l*C+d,e[s++]=g[T],e[s++]=g[T+1],r[s++]=_,r[s++]=n}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,c=a.a,l=a.b,h=a.c,u=a.d,f=a.tx,d=a.ty,m=t.bounds,g=m.maxX,_=m.minX,b=m.maxY,y=m.minY,v=n.uvs,T=t.color,C=o<<16|t.roundPixels&65535;e[s+0]=c*_+h*y+f,e[s+1]=u*y+l*_+d,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=T,r[s+5]=C,e[s+6]=c*g+h*y+f,e[s+7]=u*y+l*g+d,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=T,r[s+11]=C,e[s+12]=c*g+h*b+f,e[s+13]=u*b+l*g+d,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=T,r[s+17]=C,e[s+18]=c*_+h*b+f,e[s+19]=u*b+l*_+d,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=T,r[s+23]=C}};_m.extension={type:[x.Batcher],name:"default"};hs=_m});function bm(i,t,e,r,s,o,n,a=null){let c=0;e*=t,s*=o;let l=a.a,h=a.b,u=a.c,f=a.d,d=a.tx,m=a.ty;for(;c<n;){let g=i[e],_=i[e+1];r[s]=l*g+u*_+d,r[s+1]=h*g+f*_+m,s+=o,e+=t,c++}}function vm(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var Tm=p(()=>{"use strict"});function pl(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,c=t.d,l=t.tx,h=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let f=0;f<s;f++){let d=i[u],m=i[u+1];i[u]=o*d+a*m+l,i[u+1]=n*d+c*m+h,u+=r}}var Sm=p(()=>{"use strict"});var CT,Pr,ml=p(()=>{Q();cc();CT=new G,Pr=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?zo(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||CT}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=!0,this.renderable=null,this.topology="triangle-list"}}});var ri,wm,Pm,Am=p(()=>{P();ri={extension:{type:x.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let T=i;e=T.x,r=T.y,n=a=T.radius,s=o=0}else if(i.type==="ellipse"){let T=i;e=T.x,r=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=i,C=T.width/2,S=T.height/2;e=T.x+C,r=T.y+S,n=a=Math.max(0,Math.min(T.radius,Math.min(C,S))),s=C-n,o=S-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let c=Math.ceil(2.3*Math.sqrt(n+a)),l=c*8+(s?4:0)+(o?4:0);if(l===0)return t;if(c===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let h=0,u=c*4+(s?2:0)+2,f=u,d=l,m=s+n,g=o,_=e+m,b=e-m,y=r+g;if(t[h++]=_,t[h++]=y,t[--u]=y,t[--u]=b,o){let T=r-g;t[f++]=b,t[f++]=T,t[--d]=T,t[--d]=_}for(let T=1;T<c;T++){let C=Math.PI/2*(T/c),S=s+Math.cos(C)*n,A=o+Math.sin(C)*a,M=e+S,R=e-S,w=r+A,B=r-A;t[h++]=M,t[h++]=w,t[--u]=w,t[--u]=R,t[f++]=R,t[f++]=B,t[--d]=B,t[--d]=M}m=s,g=o+a,_=e+m,b=e-m,y=r+g;let v=r-g;return t[h++]=_,t[h++]=y,t[--d]=v,t[--d]=_,s&&(t[h++]=b,t[h++]=y,t[--d]=v,t[--d]=b),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let h=0;h<i.length;h+=2)n+=i[h],a+=i[h+1];n/=i.length/2,a/=i.length/2;let c=r;t[c*e]=n,t[c*e+1]=a;let l=c++;for(let h=0;h<i.length;h+=2)t[c*e]=i[h],t[c*e+1]=i[h+1],h>0&&(s[o++]=c,s[o++]=l,s[o++]=c-1),c++;s[o++]=l+1,s[o++]=l,s[o++]=c-1}},wm={...ri,extension:{...ri.extension,name:"ellipse"}},Pm={...ri,extension:{...ri.extension,name:"roundedRectangle"}}});function Em(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 Cm=p(()=>{"use strict"});function Mm(i,t,e,r,s,o,n,a){let c=i-e*s,l=t-r*s,h=i+e*o,u=t+r*o,f,d;n?(f=r,d=-e):(f=-r,d=e);let m=c+f,g=l+d,_=h+f,b=u+d;return a.push(m,g),a.push(_,b),2}function Ar(i,t,e,r,s,o,n,a){let c=e-i,l=r-t,h=Math.atan2(c,l),u=Math.atan2(s-i,o-t);a&&h<u?h+=Math.PI*2:!a&&h>u&&(u+=Math.PI*2);let f=h,d=u-h,m=Math.abs(d),g=Math.sqrt(c*c+l*l),_=(15*m*Math.sqrt(g)/Math.PI>>0)+1,b=d/_;if(f+=b,a){n.push(i,t),n.push(e,r);for(let y=1,v=f;y<_;y++,v+=b)n.push(i,t),n.push(i+Math.sin(v)*g,t+Math.cos(v)*g);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let y=1,v=f;y<_;y++,v+=b)n.push(i+Math.sin(v)*g,t+Math.cos(v)*g),n.push(i,t);n.push(s,o),n.push(i,t)}return _*2}function Bm(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,c=a.alignment;if(t.alignment!==.5){let Z=Em(i);e&&(Z*=-1),c=(c-.5)*Z+.5}let l=new K(i[0],i[1]),h=new K(i[i.length-2],i[i.length-1]),u=r,f=Math.abs(l.x-h.x)<n&&Math.abs(l.y-h.y)<n;if(u){i=i.slice(),f&&(i.pop(),i.pop(),h.set(i[i.length-2],i[i.length-1]));let Z=(l.x+h.x)*.5,Ft=(h.y+l.y)*.5;i.unshift(Z,Ft),i.push(Z,Ft)}let d=s,m=i.length/2,g=i.length,_=d.length/2,b=a.width/2,y=b*b,v=a.miterLimit*a.miterLimit,T=i[0],C=i[1],S=i[2],A=i[3],M=0,R=0,w=-(C-A),B=T-S,k=0,N=0,j=Math.sqrt(w*w+B*B);w/=j,B/=j,w*=b,B*=b;let q=c,D=(1-q)*2,U=q*2;u||(a.cap==="round"?g+=Ar(T-w*(D-U)*.5,C-B*(D-U)*.5,T-w*D,C-B*D,T+w*U,C+B*U,d,!0)+2:a.cap==="square"&&(g+=Mm(T,C,w,B,D,U,!0,d))),d.push(T-w*D,C-B*D),d.push(T+w*U,C+B*U);for(let Z=1;Z<m-1;++Z){T=i[(Z-1)*2],C=i[(Z-1)*2+1],S=i[Z*2],A=i[Z*2+1],M=i[(Z+1)*2],R=i[(Z+1)*2+1],w=-(C-A),B=T-S,j=Math.sqrt(w*w+B*B),w/=j,B/=j,w*=b,B*=b,k=-(A-R),N=S-M,j=Math.sqrt(k*k+N*N),k/=j,N/=j,k*=b,N*=b;let Ft=S-T,he=C-A,or=S-M,nr=R-A,Wu=Ft*or+he*nr,Ro=he*or-nr*Ft,Ui=Ro<0;if(Math.abs(Ro)<.001*Math.abs(Wu)){d.push(S-w*D,A-B*D),d.push(S+w*U,A+B*U),Wu>=0&&(a.join==="round"?g+=Ar(S,A,S-w*D,A-B*D,S-k*D,A-N*D,d,!1)+4:g+=2,d.push(S-k*U,A-N*U),d.push(S+k*D,A+N*D));continue}let zu=(-w+T)*(-B+A)-(-w+S)*(-B+C),Vu=(-k+M)*(-N+A)-(-k+S)*(-N+R),Go=(Ft*Vu-or*zu)/Ro,ko=(nr*zu-he*Vu)/Ro,Xa=(Go-S)*(Go-S)+(ko-A)*(ko-A),ar=S+(Go-S)*D,cr=A+(ko-A)*D,lr=S-(Go-S)*U,hr=A-(ko-A)*U,T0=Math.min(Ft*Ft+he*he,or*or+nr*nr),Xu=Ui?D:U,S0=T0+Xu*Xu*y;Xa<=S0?a.join==="bevel"||Xa/y>v?(Ui?(d.push(ar,cr),d.push(S+w*U,A+B*U),d.push(ar,cr),d.push(S+k*U,A+N*U)):(d.push(S-w*D,A-B*D),d.push(lr,hr),d.push(S-k*D,A-N*D),d.push(lr,hr)),g+=2):a.join==="round"?Ui?(d.push(ar,cr),d.push(S+w*U,A+B*U),g+=Ar(S,A,S+w*U,A+B*U,S+k*U,A+N*U,d,!0)+4,d.push(ar,cr),d.push(S+k*U,A+N*U)):(d.push(S-w*D,A-B*D),d.push(lr,hr),g+=Ar(S,A,S-w*D,A-B*D,S-k*D,A-N*D,d,!1)+4,d.push(S-k*D,A-N*D),d.push(lr,hr)):(d.push(ar,cr),d.push(lr,hr)):(d.push(S-w*D,A-B*D),d.push(S+w*U,A+B*U),a.join==="round"?Ui?g+=Ar(S,A,S+w*U,A+B*U,S+k*U,A+N*U,d,!0)+2:g+=Ar(S,A,S-w*D,A-B*D,S-k*D,A-N*D,d,!1)+2:a.join==="miter"&&Xa/y<=v&&(Ui?(d.push(lr,hr),d.push(lr,hr)):(d.push(ar,cr),d.push(ar,cr)),g+=2),d.push(S-k*D,A-N*D),d.push(S+k*U,A+N*U),g+=2)}T=i[(m-2)*2],C=i[(m-2)*2+1],S=i[(m-1)*2],A=i[(m-1)*2+1],w=-(C-A),B=T-S,j=Math.sqrt(w*w+B*B),w/=j,B/=j,w*=b,B*=b,d.push(S-w*D,A-B*D),d.push(S+w*U,A+B*U),u||(a.cap==="round"?g+=Ar(S-w*(D-U)*.5,A-B*(D-U)*.5,S-w*D,A-B*D,S+w*U,A+B*U,d,!1)+2:a.cap==="square"&&(g+=Mm(S,A,w,B,D,U,!1,d)));let ee=1e-4*1e-4;for(let Z=_;Z<g+_-2;++Z)T=d[Z*2],C=d[Z*2+1],S=d[(Z+1)*2],A=d[(Z+1)*2+1],M=d[(Z+2)*2],R=d[(Z+2)*2+1],!(Math.abs(T*(A-R)+S*(R-C)+M*(C-A))<ee)&&o.push(Z,Z+1,Z+2)}var Rm=p(()=>{ie();Cm()});function Gm(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],c=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-c)<s,h=e,u=i.length/2,f=h.length/2;for(let d=0;d<u;d++)h.push(i[d*2]),h.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 km=p(()=>{});var bl=Ya((n2,yl)=>{"use strict";yl.exports=Pn;yl.exports.default=Pn;function Pn(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Fm(i,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,c,l,h,u,f,d;if(r&&(o=FT(i,t,o,e)),i.length>80*e){a=l=i[0],c=h=i[1];for(var m=e;m<s;m+=e)u=i[m],f=i[m+1],u<a&&(a=u),f<c&&(c=f),u>l&&(l=u),f>h&&(h=f);d=Math.max(l-a,h-c),d=d!==0?32767/d:0}return us(o,n,e,a,c,d,0),n}function Fm(i,t,e,r,s){var o,n;if(s===_l(i,t,e,r)>0)for(o=t;o<e;o+=r)n=Im(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=Im(o,i[o],i[o+1],n);return n&&An(n,n.next)&&(fs(n),n=n.next),n}function Er(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(An(e,e.next)||pt(e.prev,e,e.next)===0)){if(fs(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function us(i,t,e,r,s,o,n){if(i){!n&&o&&NT(i,r,s,o);for(var a=i,c,l;i.prev!==i.next;){if(c=i.prev,l=i.next,o?GT(i,r,s,o):RT(i)){t.push(c.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),fs(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=kT(Er(i),t,e),us(i,t,e,r,s,o,2)):n===2&&IT(i,t,e,r,s,o):us(Er(i),t,e,r,s,o,1);break}}}}function RT(i){var t=i.prev,e=i,r=i.next;if(pt(t,e,r)>=0)return!1;for(var s=t.x,o=e.x,n=r.x,a=t.y,c=e.y,l=r.y,h=s<o?s<n?s:n:o<n?o:n,u=a<c?a<l?a:l:c<l?c:l,f=s>o?s>n?s:n:o>n?o:n,d=a>c?a>l?a:l:c>l?c:l,m=r.next;m!==t;){if(m.x>=h&&m.x<=f&&m.y>=u&&m.y<=d&&ii(s,a,o,c,n,l,m.x,m.y)&&pt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function GT(i,t,e,r){var s=i.prev,o=i,n=i.next;if(pt(s,o,n)>=0)return!1;for(var a=s.x,c=o.x,l=n.x,h=s.y,u=o.y,f=n.y,d=a<c?a<l?a:l:c<l?c:l,m=h<u?h<f?h:f:u<f?u:f,g=a>c?a>l?a:l:c>l?c:l,_=h>u?h>f?h:f:u>f?u:f,b=gl(d,m,t,e,r),y=gl(g,_,t,e,r),v=i.prevZ,T=i.nextZ;v&&v.z>=b&&T&&T.z<=y;){if(v.x>=d&&v.x<=g&&v.y>=m&&v.y<=_&&v!==s&&v!==n&&ii(a,h,c,u,l,f,v.x,v.y)&&pt(v.prev,v,v.next)>=0||(v=v.prevZ,T.x>=d&&T.x<=g&&T.y>=m&&T.y<=_&&T!==s&&T!==n&&ii(a,h,c,u,l,f,T.x,T.y)&&pt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;v&&v.z>=b;){if(v.x>=d&&v.x<=g&&v.y>=m&&v.y<=_&&v!==s&&v!==n&&ii(a,h,c,u,l,f,v.x,v.y)&&pt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;T&&T.z<=y;){if(T.x>=d&&T.x<=g&&T.y>=m&&T.y<=_&&T!==s&&T!==n&&ii(a,h,c,u,l,f,T.x,T.y)&&pt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function kT(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!An(s,o)&&Um(s,r,r.next,o)&&ds(s,o)&&ds(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),fs(r),fs(r.next),r=i=o),r=r.next}while(r!==i);return Er(r)}function IT(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&zT(n,a)){var c=Dm(n,a);n=Er(n,n.next),c=Er(c,c.next),us(n,t,e,r,s,o,0),us(c,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function FT(i,t,e,r){var s=[],o,n,a,c,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,c=o<n-1?t[o+1]*r:i.length,l=Fm(i,a,c,r,!1),l===l.next&&(l.steiner=!0),s.push(WT(l));for(s.sort(UT),o=0;o<s.length;o++)e=DT(s[o],e);return e}function UT(i,t){return i.x-t.x}function DT(i,t){var e=OT(i,t);if(!e)return t;var r=Dm(e,i);return Er(r,r.next),Er(e,e.next)}function OT(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next}while(e!==t);if(!n)return null;var c=n,l=n.x,h=n.y,u=1/0,f;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&ii(s<h?r:o,s,l,h,s<h?o:r,s,e.x,e.y)&&(f=Math.abs(s-e.y)/(r-e.x),ds(e,i)&&(f<u||f===u&&(e.x>n.x||e.x===n.x&&LT(n,e)))&&(n=e,u=f)),e=e.next;while(e!==c);return n}function LT(i,t){return pt(i.prev,i,t.prev)<0&&pt(t.next,i,i.next)<0}function NT(i,t,e,r){var s=i;do s.z===0&&(s.z=gl(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,HT(s)}function HT(i){var t,e,r,s,o,n,a,c,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(c=l;a>0||c>0&&r;)a!==0&&(c===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,c--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r}o.nextZ=null,l*=2}while(n>1);return i}function gl(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 WT(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function ii(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 zT(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!VT(i,t)&&(ds(i,t)&&ds(t,i)&&XT(i,t)&&(pt(i.prev,i,t.prev)||pt(i,t.prev,t))||An(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 An(i,t){return i.x===t.x&&i.y===t.y}function Um(i,t,e,r){var s=wn(pt(i,t,e)),o=wn(pt(i,t,r)),n=wn(pt(e,r,i)),a=wn(pt(e,r,t));return!!(s!==o&&n!==a||s===0&&Sn(i,e,t)||o===0&&Sn(i,r,t)||n===0&&Sn(e,i,r)||a===0&&Sn(e,t,r))}function Sn(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 wn(i){return i>0?1:i<0?-1:0}function VT(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Um(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function ds(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 XT(i,t){var e=i,r=!1,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 Dm(i,t){var e=new xl(i.i,i.x,i.y),r=new xl(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 Im(i,t,e,r){var s=new xl(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 fs(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 xl(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Pn.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(_l(i,0,o,e));if(s)for(var a=0,c=t.length;a<c;a++){var l=t[a]*e,h=a<c-1?t[a+1]*e:i.length;n-=Math.abs(_l(i,l,h,e))}var u=0;for(a=0;a<r.length;a+=3){var f=r[a]*e,d=r[a+1]*e,m=r[a+2]*e;u+=Math.abs((i[f]-i[m])*(i[d+1]-i[f+1])-(i[f]-i[d])*(i[m+1]-i[f+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function _l(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Pn.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r))}return e}});function En(i,t,e,r,s,o,n){let a=(0,Om.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let c=s*r;for(let l=0;l<i.length;l+=2)e[c]=i[l],e[c+1]=i[l+1],c+=r}var Om,vl=p(()=>{Om=Io(bl(),1)});var $T,Lm,Nm=p(()=>{P();vl();$T=[],Lm={extension:{type:x.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){En(i,$T,t,e,r,s,o)}}});var Hm,Wm=p(()=>{P();Hm={extension:{type:x.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var zm,Vm=p(()=>{P();zm={extension:{type:x.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function $m(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function Ym(i,t){let e=L.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function YT(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(O("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]??qt.defaultLinearOptions.textureSize}),t}var Xm,Sl,qt,si=p(()=>{Mt();ct();Q();Vr();rt();Rt();dt();pc();Xm=[{offset:0,color:"white"},{offset:1,color:"black"}],Sl=class Tl{constructor(...t){this.uid=Y("fillGradient"),this.type="linear",this.colorStops=[];let e=YT(t);e={...e.type==="radial"?Tl.defaultRadialOptions:Tl.defaultLinearOptions,...Xo(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:X.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 _=t;t=r,r=_,o*=-1}if(n<0){let _=e;e=s,s=_,n*=-1}}let c=this.colorStops.length?this.colorStops:Xm,l=this._textureSize,{canvas:h,context:u}=Ym(l,1),f=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);$m(f,c),u.fillStyle=f,u.fillRect(0,0,l,1),this.texture=new E({source:new jt({resource:h,addressMode:this._wrapMode})});let d=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),g=new G;g.scale(d/l,1),g.rotate(m),g.translate(t,e),this.textureSpace==="local"&&g.scale(l,l),this.transform=g}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:Xm,e=this._textureSize,{canvas:r,context:s}=Ym(e,e),{x:o,y:n}=this.center,{x:a,y:c}=this.outerCenter,l=this.innerRadius,h=this.outerRadius,u=a-h,f=c-h,d=e/(h*2),m=(o-u)*d,g=(n-f)*d,_=s.createRadialGradient(m,g,l*d,(a-u)*d,(c-f)*d,h*d);$m(_,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=_,s.translate(m,g),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-g),s.fillRect(0,0,e,e),this.texture=new E({source:new jt({resource:r,addressMode:this._wrapMode})});let b=new G;b.scale(1/d,1/d),b.translate(u,f),this.textureSpace==="local"&&b.scale(e,e),this.transform=b}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Sl.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Sl.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};qt=Sl});function jm(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(KT);t.width&&n.pad(t.width);let{x:a,y:c}=n,l=1/n.width,h=1/n.height,u=-a*l,f=-c*h,d=s.a,m=s.b,g=s.c,_=s.d;s.a*=l,s.b*=l,s.c*=h,s.d*=h,s.tx=u*d+f*g+s.tx,s.ty=u*m+f*_+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 qt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(jT.copyFrom(r).invert()),s}var jT,KT,Km=p(()=>{Q();bt();si();jT=new G,KT=new V});function Zm(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")QT(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,c=o.data.style,l=o.data.hole;n&&l&&qm(l.shapePath,c,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),qm(a,c,n,r,e)}}}function QT(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,c=[],l=Cn.rectangle,h=qT,u=i.image;h.x=i.dx,h.y=i.dy,h.width=i.dw,h.height=i.dh;let f=i.transform;l.build(h,c),f&&pl(c,f),l.triangulate(c,r,2,a,o,n);let d=u.uvs;s.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);let m=z.get(Pr);m.indexOffset=n,m.indexSize=o.length-n,m.attributeOffset=a,m.attributeSize=r.length/2-a,m.baseColor=i.style,m.alpha=i.alpha,m.texture=u,m.geometryData=e,t.push(m)}function qm(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:c,transform:l,holes:h})=>{let u=a.length,f=o.length/2,d=[],m=Cn[c.type],g="triangle-list";if(m.build(c,d),l&&pl(d,l),e){let v=c.closePath??!0,T=t;T.pixelLine?(Gm(d,v,o,a),g="line-list"):Bm(d,T,!1,v,o,a)}else if(h){let v=[],T=d.slice();JT(h).forEach(S=>{v.push(T.length/2),T.push(...S)}),En(T,v,o,2,f,a,u)}else m.triangulate(d,o,2,f,a,u);let _=n.length/2,b=t.texture;if(b!==E.WHITE){let v=jm(ZT,t,c,l);bm(o,2,f,n,_,2,o.length/2-f,v)}else vm(n,_,2,o.length/2-f);let y=z.get(Pr);y.indexOffset=u,y.indexSize=a.length-u,y.attributeOffset=f,y.attributeSize=o.length/2-f,y.baseColor=t.color,y.alpha=t.alpha,y.texture=b,y.geometryData=s,y.topology=g,r.push(y)})}function JT(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];Cn[r.type].build(r,s),t.push(s)}return t}var Cn,qT,ZT,Qm=p(()=>{P();Q();bt();Tm();Sm();rt();Dt();ml();Am();Rm();km();Nm();Wm();Vm();Km();vl();Cn={};I.handleByMap(x.ShapeBuilder,Cn);I.add(Hm,Lm,zm,ri,wm,Pm);qT=new V,ZT=new G});var wl,Pl,El,oi,Mn=p(()=>{P();mn();fl();dc();dt();Dt();Qm();wl=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Pl=class{constructor(){this.batcher=new hs,this.instructions=new Dr}init(){this.instructions.reset()}get geometry(){return O(gd,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},El=class Al{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Al.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Al.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),Zm(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=!1:r==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=z.get(Pl),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let h=0;h<r.length;h++)r[h].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let h=0;h<r.length;h++){let u=r[h];a.add(u)}a.finish(e.instructions);let c=a.geometry;c.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),c.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let l=a.batches;for(let h=0;h<l.length;h++){let u=l[h];u.bindGroup=Yr(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new wl;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]&&(z.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{z.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};El.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"graphicsContext"};El.defaultOptions={bezierSmoothness:.5};oi=El});var tS,Cl,Ml,Bl,Rl,Gl,kl,Il,xt,me=p(()=>{"use strict";tS={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},Cl=0,Ml=1,Bl=2,Rl=3,Gl=4,kl=5,Il=class Jm{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Cl)}set blend(t){!!(this.data&1<<Cl)!==t&&(this.data^=1<<Cl)}get offsets(){return!!(this.data&1<<Ml)}set offsets(t){!!(this.data&1<<Ml)!==t&&(this.data^=1<<Ml)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Bl)}set culling(t){!!(this.data&1<<Bl)!==t&&(this.data^=1<<Bl)}get depthTest(){return!!(this.data&1<<Rl)}set depthTest(t){!!(this.data&1<<Rl)!==t&&(this.data^=1<<Rl)}get depthMask(){return!!(this.data&1<<kl)}set depthMask(t){!!(this.data&1<<kl)!==t&&(this.data^=1<<kl)}get clockwiseFrontFace(){return!!(this.data&1<<Gl)}set clockwiseFrontFace(t){!!(this.data&1<<Gl)!==t&&(this.data^=1<<Gl)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=tS[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 Jm;return t.depthTest=!1,t.blend=!0,t}};Il.default2d=Il.for2d();xt=Il});function Ae(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 ni=p(()=>{"use strict"});var ps,tg=p(()=>{P();me();Dt();ni();ml();ps=class{constructor(t,e){this.state=xt.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Ae(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=z.get(Pr);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{z.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};ps.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"graphics"}});var Fl=p(()=>{P();Mn();tg();I.add(ps);I.add(oi)});var Qe,Bn=p(()=>{"use strict";Qe=class{constructor(){this.batcherName="default",this.packAsQuad=!1,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 ms,eg=p(()=>{P();Q();Ye();Ht();os();Dt();ni();Bn();ms=class{constructor(t,e){this.localUniforms=new ot({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Pt({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return!0;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,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(z.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Ue(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Ae(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=z.get(Qe);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&z.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};ms.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"mesh"}});var Ul=p(()=>{P();eg();I.add(ms)});var Rn,rg=p(()=>{"use strict";Rn=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 Dl(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 ig=p(()=>{"use strict"});function og(i){return{dynamicUpdate:sg(i,!0),staticUpdate:sg(i,!1)}}function sg(i,t){let e=[];e.push(`
254
254
 
255
255
  var index = 0;
256
256
 
@@ -264,7 +264,7 @@ ${s.join(`
264
264
  `),e.unshift(`
265
265
  var stride = ${r};
266
266
  `);let s=e.join(`
267
- `);return new Function("ps","f32v","u32v",s)}var ng=p(()=>{Sr()});function eS(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 Gn,ag=p(()=>{je();De();Yr();Sr();Kc();ig();ng();Gn=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let h in r){let u=r[h],d=Kt(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new be(e*4*s),this.dynamicAttributeBuffer=new be(e*4*o),this.indexBuffer=Dl(e);let n=new oe,a=0,c=0;this._staticBuffer=new mt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:Y.VERTEX|Y.COPY_DST}),this._dynamicBuffer=new mt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:Y.VERTEX|Y.COPY_DST});for(let h in r){let u=r[h],d=Kt(u.format);u.dynamic?(n.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=d.size):(n.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:c*4,format:u.format}),c+=d.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=eS(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return og(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new be(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new be(this._size*this._dynamicStride*4*4),this.indexBuffer=Dl(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var cg,lg=p(()=>{cg=`varying vec2 vUV;
267
+ `);return new Function("ps","f32v","u32v",s)}var ng=p(()=>{wr()});function eS(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 Gn,ag=p(()=>{je();De();jr();wr();Kc();ig();ng();Gn=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let h in r){let u=r[h],f=Kt(u.format);u.dynamic?o+=f.stride:s+=f.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new be(e*4*s),this.dynamicAttributeBuffer=new be(e*4*o),this.indexBuffer=Dl(e);let n=new oe,a=0,c=0;this._staticBuffer=new mt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:$.VERTEX|$.COPY_DST}),this._dynamicBuffer=new mt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:$.VERTEX|$.COPY_DST});for(let h in r){let u=r[h],f=Kt(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:c*4,format:u.format}),c+=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=eS(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return og(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new be(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new be(this._size*this._dynamicStride*4*4),this.indexBuffer=Dl(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var cg,lg=p(()=>{cg=`varying vec2 vUV;
268
268
  varying vec4 vColor;
269
269
 
270
270
  uniform sampler2D uTexture;
@@ -364,8 +364,8 @@ fn mainFragment(
364
364
  var sample = textureSample(uTexture, uSampler, uv) * color;
365
365
 
366
366
  return sample;
367
- }`});var kn,fg=p(()=>{Mt();Z();Tr();Kr();pe();et();mc();lg();ug();dg();kn=class extends gt{constructor(){let t=ne.from({vertex:hg,fragment:cg}),e=ae.from({fragment:{source:Ol,entryPoint:"mainFragment"},vertex:{source:Ol,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:C.WHITE.source,uSampler:new $o({}),uniforms:{uTranslationMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new X(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var ni,Ll=p(()=>{Z();Ht();os();me();oi();ag();fg();ni=class{constructor(t,e){this.state=xt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new st({uTranslationMatrix:{value:new G,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 kn,this.state=xt.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new Gn({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=Ue(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,Ae(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var gs,pg=p(()=>{w();rg();Ll();gs=class extends ni{constructor(t){super(t,new Rn)}};gs.extension={type:[x.WebGLPipes],name:"particle"}});var In,mg=p(()=>{"use strict";In=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),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 xs,gg=p(()=>{w();mg();Ll();xs=class extends ni{constructor(t){super(t,new In)}};xs.extension={type:[x.WebGPUPipes],name:"particle"}});var Nl=p(()=>{w();pg();gg();k.add(gs);k.add(xs)});var Ee,_s=p(()=>{"use strict";Ee=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}});function ys(i,t){let{texture:e,bounds:r}=i;nn(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var Hl=p(()=>{Oc()});var bs,xg=p(()=>{w();Dt();_s();Hl();bs=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),z.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,ys(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:z.get(Ee)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};bs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"text"}});var Wl,Zt,ai=p(()=>{ct();zi();Wl=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=O.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.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},Zt=new Wl});function _g(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return!1;return!0}function yg(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!1;return!0}function bg(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,c=0,l=e-1,h=r-1;for(;c<r&&_g(n,e,c);)++c;if(c===r)return V.EMPTY;for(;_g(n,e,h);)--h;for(;yg(n,e,a,c,h);)++a;for(;yg(n,e,l,c,h);)--l;return++l,++h,new V(a/t,c/t,(l-a)/t,(h-c)/t)}var vg=p(()=>{bt()});var Tg,Le,Fn=p(()=>{Z();Rt();Tg={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"}},Le=class{constructor(t,e){this.uid=j("fillPattern"),this.transform=new G,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Tg[e].addressModeU,t.source.style.addressModeV=Tg[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var wg=Ya((Bk,Sg)=>{Sg.exports=iS;var zl={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},rS=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function iS(i){var t=[];return i.replace(rS,function(e,r,s){var o=r.toLowerCase();for(s=oS(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==zl[o])return s.unshift(r),t.push(s);if(s.length<zl[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,zl[o])))}}),t}var sS=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function oS(i){var t=i.match(sS);return t?t.map(Number):[]}});function Ag(i,t){let e=(0,Pg.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let c=e[a],l=c[0],h=c;switch(l){case"M":o=h[1],n=h[2],t.moveTo(o,n);break;case"m":o+=h[1],n+=h[2],t.moveTo(o,n);break;case"H":o=h[1],t.lineTo(o,n);break;case"h":o+=h[1],t.lineTo(o,n);break;case"V":n=h[1],t.lineTo(o,n);break;case"v":n+=h[1],t.lineTo(o,n);break;case"L":o=h[1],n=h[2],t.lineTo(o,n);break;case"l":o+=h[1],n+=h[2],t.lineTo(o,n);break;case"C":o=h[5],n=h[6],t.bezierCurveTo(h[1],h[2],h[3],h[4],o,n);break;case"c":t.bezierCurveTo(o+h[1],n+h[2],o+h[3],n+h[4],o+h[5],n+h[6]),o+=h[5],n+=h[6];break;case"S":o=h[3],n=h[4],t.bezierCurveToShort(h[1],h[2],o,n);break;case"s":t.bezierCurveToShort(o+h[1],n+h[2],o+h[3],n+h[4]),o+=h[3],n+=h[4];break;case"Q":o=h[3],n=h[4],t.quadraticCurveTo(h[1],h[2],o,n);break;case"q":t.quadraticCurveTo(o+h[1],n+h[2],o+h[3],n+h[4]),o+=h[3],n+=h[4];break;case"T":o=h[1],n=h[2],t.quadraticCurveToShort(o,n);break;case"t":o+=h[1],n+=h[2],t.quadraticCurveToShort(o,n);break;case"A":o=h[6],n=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],o,n);break;case"a":o+=h[6],n+=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[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:F(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var Pg,Eg=p(()=>{Pg=Io(wg(),1);it()});var Un,Cg=p(()=>{bt();Un=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!1;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!1;let o=this.x-t,n=this.y-e,a=this.radius,c=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+c&&l>a-(r-c)}getBounds(t){return t||(t=new V),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 Dn,Mg=p(()=>{bt();Dn=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!1;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!1;let a=r*(1-s),c=r-a,l=o-c,h=n-c,u=o+a,d=n+a,f=t-this.x,m=e-this.y,_=f*f/(l*l)+m*m/(h*h),g=f*f/(u*u)+m*m/(d*d);return _>1&&g<=1}getBounds(t){return t||(t=new V),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 Bg(i,t,e,r,s,o){let n=i-e,a=t-r,c=s-e,l=o-r,h=n*c+a*l,u=c*c+l*l,d=-1;u!==0&&(d=h/u);let f,m;d<0?(f=e,m=r):d>1?(f=s,m=o):(f=e+d*c,m=r+d*l);let _=i-f,g=t-m;return _*_+g*g}var Rg=p(()=>{"use strict"});var nS,aS,ci,Gg=p(()=>{Rg();bt();ci=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=!0}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],c=e[(s+3)%r];t+=(a-o)*(c+n)}return t<0}containsPolygon(t){let e=this.getBounds(nS),r=t.getBounds(aS);if(!e.containsRect(r))return!1;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!1}return!0}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],c=this.points[o*2+1],l=this.points[n*2],h=this.points[n*2+1];c>e!=h>e&&t<(l-a)*((e-c)/(h-c))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:c}=this,l=c.length-(this.closePath?0:2);for(let h=0;h<l;h+=2){let u=c[h],d=c[h+1],f=c[(h+2)%c.length],m=c[(h+3)%c.length],_=Bg(t,e,u,d,f,m),g=Math.sign((f-u)*(e-d)-(m-d)*(t-u));if(_<=(g<0?a:n))return!0}return!1}getBounds(t){t||(t=new V);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,c=e.length;a<c;a+=2){let l=e[a],h=e[a+1];r=l<r?l:r,s=l>s?l:s,o=h<o?h:o,n=h>n?h:n}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var On,Ln,kg=p(()=>{bt();On=(i,t,e,r,s,o,n)=>{let a=i-e,c=t-r,l=Math.sqrt(a*a+c*c);return l>=s-o&&l<=s+n},Ln=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 V),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!1;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!0;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!0}return!1}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:c,radius:l}=this,h=r*(1-s),u=r-h,d=o+l,f=n+l,m=a-l*2,_=c-l*2,g=o+a,b=n+c;return(t>=o-h&&t<=o+u||t>=g-u&&t<=g+h)&&e>=f&&e<=f+_||(e>=n-h&&e<=n+u||e>=b-u&&e<=b+h)&&t>=d&&t<=d+m?!0:t<d&&e<f&&On(t,e,d,f,l,u,h)||t>g-l&&e<f&&On(t,e,g-l,f,l,u,h)||t>g-l&&e>b-l&&On(t,e,g-l,b-l,l,u,h)||t<d&&e>b-l&&On(t,e,d,b-l,l,u,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Hn(i,t,e,r,s,o,n,a,c,l){let u=Math.min(.99,Math.max(0,l??si.defaultOptions.bezierSmoothness)),d=(lS-u)/1;return d*=d,hS(t,e,r,s,o,n,a,c,i,d),i}function hS(i,t,e,r,s,o,n,a,c,l){Xl(i,t,e,r,s,o,n,a,c,l,0),c.push(n,a)}function Xl(i,t,e,r,s,o,n,a,c,l,h){if(h>cS)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,m=(e+s)/2,_=(r+o)/2,g=(s+n)/2,b=(o+a)/2,y=(d+m)/2,v=(f+_)/2,T=(m+g)/2,R=(_+b)/2,S=(y+T)/2,P=(v+R)/2;if(h>0){let A=n-i,M=a-t,E=Math.abs((e-n)*M-(r-a)*A),B=Math.abs((s-n)*M-(o-a)*A),I,H;if(E>Nn&&B>Nn){if((E+B)*(E+B)<=l*(A*A+M*M)){if(li<Vl){c.push(S,P);return}let $=Math.atan2(o-r,s-e);if(I=Math.abs($-Math.atan2(r-t,e-i)),H=Math.abs(Math.atan2(a-o,n-s)-$),I>=u&&(I=2*u-I),H>=u&&(H=2*u-H),I+H<li){c.push(S,P);return}if(Er!==0){if(I>Er){c.push(e,r);return}if(H>Er){c.push(s,o);return}}}}else if(E>Nn){if(E*E<=l*(A*A+M*M)){if(li<Vl){c.push(S,P);return}if(I=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),I>=u&&(I=2*u-I),I<li){c.push(e,r),c.push(s,o);return}if(Er!==0&&I>Er){c.push(e,r);return}}}else if(B>Nn){if(B*B<=l*(A*A+M*M)){if(li<Vl){c.push(S,P);return}if(I=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),I>=u&&(I=2*u-I),I<li){c.push(e,r),c.push(s,o);return}if(Er!==0&&I>Er){c.push(s,o);return}}}else if(A=S-(i+n)/2,M=P-(t+a)/2,A*A+M*M<=l){c.push(S,P);return}}Xl(i,t,d,f,y,v,S,P,c,l,h+1),Xl(S,P,T,R,g,b,n,a,c,l,h+1)}var cS,Nn,lS,Vl,li,Er,$l=p(()=>{Mn();cS=8,Nn=11920929e-14,lS=1,Vl=.01,li=0,Er=0});function Fg(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??si.defaultOptions.bezierSmoothness)),h=(fS-l)/1;return h*=h,mS(t,e,r,s,o,n,i,h),i}function mS(i,t,e,r,s,o,n,a){Yl(n,i,t,e,r,s,o,a,0),n.push(s,o)}function Yl(i,t,e,r,s,o,n,a,c){if(c>uS)return;let l=Math.PI,h=(t+r)/2,u=(e+s)/2,d=(r+o)/2,f=(s+n)/2,m=(h+d)/2,_=(u+f)/2,g=o-t,b=n-e,y=Math.abs((r-o)*b-(s-n)*g);if(y>dS){if(y*y<=a*(g*g+b*b)){if(Ig<pS){i.push(m,_);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<Ig){i.push(m,_);return}}}else if(g=m-(t+o)/2,b=_-(e+n)/2,g*g+b*b<=a){i.push(m,_);return}Yl(i,t,e,h,u,m,_,a,c+1),Yl(i,m,_,d,f,o,n,a,c+1)}var uS,dS,fS,pS,Ig,Ug=p(()=>{Mn();uS=8,dS=11920929e-14,fS=1,pS=.01,Ig=0});function Wn(i,t,e,r,s,o,n,a){let c=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(c=2*Math.PI-c),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(c/Math.PI)))),a=Math.max(a,3);let l=c/a,h=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(h),f=Math.sin(h),m=t+d*r,_=e+f*r;i.push(m,_),h+=l}}var jl=p(()=>{"use strict"});function Dg(i,t,e,r,s,o){let n=i[i.length-2],c=i[i.length-1]-e,l=n-t,h=s-e,u=r-t,d=Math.abs(c*u-l*h);if(d<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let f=c*c+l*l,m=h*h+u*u,_=c*h+l*u,g=o*Math.sqrt(f)/d,b=o*Math.sqrt(m)/d,y=g*_/f,v=b*_/m,T=g*u+b*l,R=g*h+b*c,S=l*(b+y),P=c*(b+y),A=u*(g+v),M=h*(g+v),E=Math.atan2(P-R,S-T),B=Math.atan2(M-R,A-T);Wn(i,T+t,R+e,o,E,B,l*h>u*c)}var Og=p(()=>{jl()});function gS(i,t){let e=t===-1.5707963267948966?-.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 Ng(i,t,e,r,s,o,n,a=0,c=0,l=0){if(o===0||n===0)return;let h=Math.sin(a*vs/360),u=Math.cos(a*vs/360),d=u*(t-r)/2+h*(e-s)/2,f=-h*(t-r)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let m=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);m>1&&(o*=Math.sqrt(m),n*=Math.sqrt(m)),xS(t,e,r,s,o,n,c,l,h,u,d,f,Kl);let{ang1:_,ang2:g}=Kl,{centerX:b,centerY:y}=Kl,v=Math.abs(g)/(vs/4);Math.abs(1-v)<1e-7&&(v=1);let T=Math.max(Math.ceil(v),1);g/=T;let R=i[i.length-2],S=i[i.length-1],P={x:0,y:0};for(let A=0;A<T;A++){let M=gS(_,g),{x:E,y:B}=ql(M[0],o,n,u,h,b,y,P),{x:I,y:H}=ql(M[1],o,n,u,h,b,y,P),{x:$,y:ot}=ql(M[2],o,n,u,h,b,y,P);Hn(i,R,S,E,B,I,H,$,ot),R=$,S=ot,_+=g}}var vs,Kl,ql,Lg,xS,Hg=p(()=>{$l();vs=Math.PI*2,Kl={centerX:0,centerY:0,ang1:0,ang2:0},ql=({x:i,y:t},e,r,s,o,n,a,c)=>{i*=e,t*=r;let l=s*i-o*t,h=o*i+s*t;return c.x=l+n,c.y=h+a,c};Lg=(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)},xS=(i,t,e,r,s,o,n,a,c,l,h,u,d)=>{let f=Math.pow(s,2),m=Math.pow(o,2),_=Math.pow(h,2),g=Math.pow(u,2),b=f*m-f*g-m*_;b<0&&(b=0),b/=f*g+m*_,b=Math.sqrt(b)*(n===a?-1:1);let y=b*s/o*u,v=b*-o/s*h,T=l*y-c*v+(i+e)/2,R=c*y+l*v+(t+r)/2,S=(h-y)/s,P=(u-v)/o,A=(-h-y)/s,M=(-u-v)/o,E=Lg(1,0,S,P),B=Lg(S,P,A,M);a===0&&B>0&&(B-=vs),a===1&&B<0&&(B+=vs),d.centerX=T,d.centerY=R,d.ang1=E,d.ang2=B}});function Wg(i,t,e){let r=(n,a)=>{let c=a.x-n.x,l=a.y-n.y,h=Math.sqrt(c*c+l*l),u=c/h,d=l/h;return{len:h,nx:u,ny:d}},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],c=a.radius??e;if(c<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],h=r(a,o),u=r(a,l);if(h.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(h.nx*u.ny-h.ny*u.nx),f=1,m=!1;h.nx*u.nx-h.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,m=!0):d>0&&(f=-1,m=!0);let _=d/2,g,b=Math.abs(Math.cos(_)*c/Math.sin(_));b>Math.min(h.len/2,u.len/2)?(b=Math.min(h.len/2,u.len/2),g=Math.abs(b*Math.sin(_)/Math.cos(_))):g=c;let y=a.x+u.nx*b+-u.ny*g*f,v=a.y+u.ny*b+u.nx*g*f,T=Math.atan2(h.ny,h.nx)+Math.PI/2*f,R=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&i.moveTo(y+Math.cos(T)*g,v+Math.sin(T)*g),i.arc(y,v,g,T,R,m),o=a}}function zg(i,t,e,r){let s=(a,c)=>Math.sqrt((a.x-c.x)**2+(a.y-c.y)**2),o=(a,c,l)=>({x:a.x+(c.x-a.x)*l,y:a.y+(c.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let c=t[(a+1)%n],l=c.radius??e;if(l<=0){a===0?i.moveTo(c.x,c.y):i.lineTo(c.x,c.y);continue}let h=t[a],u=t[(a+2)%n],d=s(h,c),f;if(d<1e-4)f=c;else{let g=Math.min(d/2,l);f=o(c,h,g/d)}let m=s(u,c),_;if(m<1e-4)_=c;else{let g=Math.min(m/2,l);_=o(c,u,g/m)}a===0?i.moveTo(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(c.x,c.y,_.x,_.y,r)}}var Vg=p(()=>{"use strict"});var _S,zn,Xg=p(()=>{Cg();Mg();Gg();bt();kg();Xt();$l();Ug();jl();Og();Hg();Vg();_S=new V,zn=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new rt,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(!1);let a=this._currentPoly.points;return Wn(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Dg(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let c=this._currentPoly.points;return Ng(c,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 c=this._currentPoly;return Hn(this._currentPoly.points,c.lastX,c.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return Fg(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),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 c=a.shape,l=o?.shape;l&&l.containsPolygon(c)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,o){return this.drawShape(new V(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new Un(t,e,r),s),this}poly(t,e,r){let s=new ci(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,c=Math.PI*2/s,l=[];for(let h=0;h<s;h++){let u=a-h*c;l.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(l,!0,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 c=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,c);let l=-1*Math.PI/2+n,h=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*h+l,m=t+r*Math.cos(f),_=e+r*Math.sin(f),g=f+Math.PI+u,b=f-Math.PI-u,y=m+o*Math.cos(g),v=_+o*Math.sin(g),T=m+o*Math.cos(b),R=_+o*Math.sin(b);d===0?this.moveTo(y,v):this.lineTo(y,v),this.quadraticCurveTo(m,_,T,R,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?zg(this,t,e,s):Wg(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)),c=t+r,l=e+s,h=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+h,e+h,t+u,e,u).lineTo(c-u,e).arcTo(c-h,e+h,c,e+u,u).lineTo(c,l-u).arcTo(c-h,l-h,t+r-u,l,u).lineTo(t+u,l).arcTo(t+h,l-h,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),c=t+r,l=e+s,h=[t+a,e,c-a,e,c,e+a,c,l-a,c-a,l,t+a,l,t,l-a,t,e+a];for(let u=h.length-1;u>=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,n)}ellipse(t,e,r,s,o){return this.drawShape(new Dn(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new Ln(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 ci,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new ci,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(_S);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function Ts(i,t){return i?i.prepend(t):t.clone()}var Je,Zl=p(()=>{ie();Rt();it();Eg();Xg();Je=class i{constructor(t,e=!1){this.instructions=[],this.uid=j("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Ag(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new zn(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(K.shared),c=0,l=0;if(!n||n.action!=="bezierCurveTo")c=a.x,l=a.y;else{c=n.data[2],l=n.data[3];let h=a.x,u=a.y;c=h+(h-c),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[c,l,t,e,r,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(K.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 c=o.x,l=o.y;n=c+(c-n),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=!0,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,r,s,o,n,a){o||(o=s/2);let c=-1*Math.PI/2+n,l=r*2,h=Math.PI*2/l,u=[];for(let d=0;d<l;d++){let f=d%2?o:s,m=d*h+c;u.push(t+f*Math.cos(m),e+f*Math.sin(m))}return this.poly(u,!0,a),this}clone(t=!1){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=!0,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,c=0,l=0,h=0,u=0,d=0,f=0,m=0,_=0;for(let g=0;g<this.instructions.length;g++){let b=this.instructions[g],y=b.data;switch(b.action){case"moveTo":case"lineTo":c=y[0],l=y[1],y[0]=e*c+s*l+n,y[1]=r*c+o*l+a;break;case"bezierCurveTo":h=y[0],u=y[1],d=y[2],f=y[3],c=y[4],l=y[5],y[0]=e*h+s*u+n,y[1]=r*h+o*u+a,y[2]=e*d+s*f+n,y[3]=r*d+o*f+a,y[4]=e*c+s*l+n,y[5]=r*c+o*l+a;break;case"quadraticCurveTo":h=y[0],u=y[1],c=y[2],l=y[3],y[0]=e*h+s*u+n,y[1]=r*h+o*u+a,y[2]=e*c+s*l+n,y[3]=r*c+o*l+a;break;case"arcToSvg":c=y[5],l=y[6],m=y[0],_=y[1],y[0]=e*m+s*_,y[1]=r*m+o*_,y[5]=e*c+s*l+n,y[6]=r*c+o*l+a;break;case"circle":y[4]=Ts(y[3],t);break;case"rect":y[4]=Ts(y[4],t);break;case"ellipse":y[8]=Ts(y[8],t);break;case"roundRect":y[5]=Ts(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=Ts(y[2],t);break;default:F("unknown transform action",b.action);break}}return this._dirty=!0,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 ut(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var Ql=p(()=>{"use strict"});function $g(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]=yS(n);break;case"radialgradient":t.defs[n.id]=bS(n);break;default:break}}}}function yS(i){let t=ut(i,"x1",0),e=ut(i,"y1",0),r=ut(i,"x2",1),s=ut(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new qt(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let c=i.children[a],l=ut(c,"offset",0),h=X.shared.setValue(c.getAttribute("stop-color")).toNumber();n.addColorStop(l,h)}return n}function bS(i){return F("[SVG Parser] Radial gradients are not yet supported"),new qt(0,0,1,0)}var Yg=p(()=>{Mt();it();ii();Ql()});function Jl(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var jg=p(()=>{"use strict"});function th(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Kg){let a=i.getAttribute(n);a&&qg(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let c=n[a].trim(),[l,h]=c.split(":");Kg[l]&&qg(t,o,l,h.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function qg(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Jl(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=X.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){let s=Jl(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=X.shared.setValue(r).toNumber();t.useFill=!0}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 Kg,Zg=p(()=>{Mt();jg();Kg={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 Qg(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 Je};$g(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=th(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&Jg(a,e,s,o)}return t}function Jg(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=th(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 c,l,h,u,d,f,m,_,g,b,y,v,T,R,S,P,A;switch(i.nodeName.toLowerCase()){case"path":R=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&F("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new Je(R,!0),t.context.path(S),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"circle":m=ut(i,"cx",0),_=ut(i,"cy",0),g=ut(i,"r",0),t.context.ellipse(m,_,g,g),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":c=ut(i,"x",0),l=ut(i,"y",0),P=ut(i,"width",0),A=ut(i,"height",0),b=ut(i,"rx",0),y=ut(i,"ry",0),b||y?t.context.roundRect(c,l,P,A,b||y):t.context.rect(c,l,P,A),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":m=ut(i,"cx",0),_=ut(i,"cy",0),b=ut(i,"rx",0),y=ut(i,"ry",0),t.context.beginPath(),t.context.ellipse(m,_,b,y),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":h=ut(i,"x1",0),u=ut(i,"y1",0),d=ut(i,"x2",0),f=ut(i,"y2",0),t.context.beginPath(),t.context.moveTo(h,u),t.context.lineTo(d,f),r&&t.context.stroke(r);break;case"polygon":T=i.getAttribute("points"),v=T.match(/\d+/g).map(M=>parseInt(M,10)),t.context.poly(v,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":T=i.getAttribute("points"),v=T.match(/\d+/g).map(M=>parseInt(M,10)),t.context.poly(v,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{F(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let M=0;M<s.length;M++)Jg(s[M],t,e,r)}var tx=p(()=>{it();Zl();Yg();Ql();Zg()});function vS(i){return X.isColorLike(i)}function ex(i){return i instanceof Le}function rx(i){return i instanceof qt}function TS(i){return i instanceof C}function SS(i,t,e){let r=X.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=C.WHITE,{...e,...i}}function wS(i,t,e){return i.texture=t,{...e,...i}}function ix(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function sx(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 PS(i,t){let e={...t,...i},r=X.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Ne(i,t){if(i==null)return null;let e={},r=i;return vS(i)?SS(e,i,t):TS(i)?wS(e,i,t):ex(i)?ix(e,i,t):rx(i)?sx(e,i,t):r.fill&&ex(r.fill)?ix(r,r.fill,t):r.fill&&rx(r.fill)?sx(r,r.fill,t):PS(r,t)}function hi(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...c}=t,l=Ne(i,c);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var eh=p(()=>{Mt();et();ii();Fn()});var AS,ox,rh,Wt,Vn=p(()=>{kt();Mt();Z();ie();et();Rt();dt();Xt();Zl();tx();eh();AS=new K,ox=new G,rh=class Ce extends nt{constructor(){super(...arguments),this.uid=j("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Je,this._transform=new G,this._fillStyle={...Ce.defaultFillStyle},this._strokeStyle={...Ce.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new rt,this._boundsDirty=!0}clone(){let t=new Ce;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=Ne(t,Ce.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=hi(t,Ce.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Ne(t,Ce.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Ne(t,Ce.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?X.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Je,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"&&(D(W,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Ne(t,Ce.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(K.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,Ce.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 c=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,c.a*n+c.c*a+c.tx,c.b*n+c.d*a+c.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let c=this._transform;return this._activePath.bezierCurveTo(c.a*t+c.c*e+c.tx,c.b*t+c.d*e+c.ty,c.a*r+c.c*s+c.tx,c.b*r+c.d*s+c.ty,c.a*o+c.c*n+c.tx,c.b*o+c.d*n+c.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++,Qg(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 G?(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 G?(this._transform.append(t),this):(ox.set(t,e,r,s,o,n),this._transform.append(ox),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=!0,this._boundsDirty=!0)}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),c=o.path.bounds;t.addFrame(c.minX-a,c.minY-a,c.maxX+a,c.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,r=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let c=n.style,l=a.shapePath.shapePrimitives;for(let h=0;h<l.length;h++){let u=l[h].shape;if(!c||!u)continue;let d=l[h].transform,f=d?d.applyInverse(t,AS):t;if(o.action==="fill")r=u.contains(f.x,f.y);else{let _=c;r=u.strokeContains(f.x,f.y,_.width,_.alignment)}let m=n.hole;if(m){let _=m.shapePath?.shapePrimitives;if(_)for(let g=0;g<_.length;g++)_[g].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};rh.defaultFillStyle={color:16777215,alpha:1,texture:C.WHITE,matrix:null,fill:null,textureSpace:"local"};rh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:C.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Wt=rh});function Xn(i){let t=[],e=0;for(let r=0;r<nx.length;r++){let s=`_${nx[r]}`;t[e++]=i[s]}return e=ax(i._fill,t,e),e=ES(i._stroke,t,e),e=CS(i.dropShadow,t,e),t.join("-")}function ax(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function ES(i,t,e){return i&&(e=ax(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 CS(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=X.shared.setValue(i.color).toNumber()),e}var nx,ih=p(()=>{Mt();nx=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function MS(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Tt.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){D(W,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(X.isColorLike(e))r.color=e;else if(e instanceof qt||e instanceof Le)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)){D(W,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=Tt.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new qt({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>X.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o)}),i.fill={fill:r}}}var sh,Tt,Cr=p(()=>{kt();Mt();dt();ii();Fn();Vn();eh();ih();sh=class ui extends nt{constructor(t={}){super(),MS(t);let e={...ui.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({...ui.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...ui.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Wt.defaultFillStyle,...t},()=>{this._fill=Ne({...this._originalFill},Wt.defaultFillStyle)})),this._fill=Ne(t===0?"black":t,Wt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Wt.defaultStrokeStyle,...t},()=>{this._stroke=hi({...this._originalStroke},Wt.defaultStrokeStyle)})),this._stroke=hi(t,Wt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Xn(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=ui.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new ui({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let 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(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(X.isColorLike(t)||t instanceof qt||t instanceof Le)}};sh.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};sh.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};Tt=sh});function $n(i,t,e,r){let s=BS;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=ft.getOptimalTexture(s.width,s.height,r,!1);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 BS,oh=p(()=>{We();Xt();BS=new rt});function Mr(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)&&!RS.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var RS,Yn=p(()=>{"use strict";RS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var nh,ge,At,Ss=p(()=>{ct();Yn();nh={willReadFrequently:!0},ge=class L{static get experimentalLetterSpacingSupported(){let t=L._experimentalLetterSpacingSupported;if(t!==void 0){let e=O.get().getCanvasRenderingContext2D().prototype;t=L._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,o,n,a,c,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=c,this.fontProperties=l}static measureText(t=" ",e,r=L._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(L._measurementCache[o])return L._measurementCache[o];let n=Mr(e),a=L.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let c=L.__context;c.font=n;let h=(s?L._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let y=0;y<h.length;y++){let v=L._measureText(h[y],e.letterSpacing,c);u[y]=v,d=Math.max(d,v)}let f=e._stroke?.width||0,m=d+f;e.dropShadow&&(m+=e.dropShadow.distance);let _=e.lineHeight||a.fontSize,g=Math.max(_,a.fontSize+f)+(h.length-1)*(_+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new L(t,e,m,g,h,u,_+e.leading,d,a)}static _measureText(t,e,r){let s=!1;L.experimentalLetterSpacingSupported&&(L.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(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 h=(L.graphemeSegmenter(t).length-1)*e;n+=h,l+=h}return Math.max(n,l)}static _wordWrap(t,e,r=L._canvas){let s=r.getContext("2d",nh),o=0,n="",a="",c=Object.create(null),{letterSpacing:l,whiteSpace:h}=e,u=L._collapseSpaces(h),d=L._collapseNewlines(h),f=!u,m=e.wordWrapWidth+l,_=L._tokenize(t);for(let g=0;g<_.length;g++){let b=_[g];if(L._isNewline(b)){if(!d){a+=L._addLine(n),f=!u,n="",o=0;continue}b=" "}if(u){let v=L.isBreakingSpace(b),T=L.isBreakingSpace(n[n.length-1]);if(v&&T)continue}let y=L._getFromCache(b,l,c,s);if(y>m)if(n!==""&&(a+=L._addLine(n),n="",o=0),L.canBreakWords(b,e.breakWords)){let v=L.wordWrapSplit(b);for(let T=0;T<v.length;T++){let R=v[T],S=R,P=1;for(;v[T+P];){let M=v[T+P];if(!L.canBreakChars(S,M,b,T,e.breakWords))R+=M;else break;S=M,P++}T+=P-1;let A=L._getFromCache(R,l,c,s);A+o>m&&(a+=L._addLine(n),f=!1,n="",o=0),n+=R,o+=A}}else{n.length>0&&(a+=L._addLine(n),n="",o=0);let v=g===_.length-1;a+=L._addLine(b,!v),f=!1,n="",o=0}else y+o>m&&(f=!1,a+=L._addLine(n),n="",o=0),(n.length>0||!L.isBreakingSpace(b)||f)&&(n+=b,o+=y)}return a+=L._addLine(n,!1),a}static _addLine(t,e=!0){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"?!1:L._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1: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=""),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!0}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",nh)?.measureText)return L.__canvas=e,e;t=O.get().createCanvas()}catch{t=O.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",nh)),L.__context}};ge.METRICS_STRING="|\xC9q\xC5";ge.BASELINE_SYMBOL="M";ge.BASELINE_MULTIPLIER=1.4;ge.HEIGHT_MULTIPLIER=2;ge.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();ge.experimentalLetterSpacing=!1;ge._fonts={};ge._newlines=[10,13];ge._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];ge._measurementCache={};At=ge});function di(i,t,e,r=0){if(i.texture===C.WHITE&&!i.fill)return X.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof Le){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(G.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof qt){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,c=1;n&&e&&(a=e.width+r,c=e.height+r);let l,h=!1;if(o){let{start:u,end:d}=s;l=t.createLinearGradient(u.x*a,u.y*c,d.x*a,d.y*c),h=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:m}=s;l=t.createRadialGradient(u.x*a,u.y*c,d*a,f.x*a,f.y*c,m*a)}if(h&&n&&e){let u=e.lineHeight/c;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+r/2)/c;s.colorStops.forEach(m=>{let _=f+m.offset*u;l.addColorStop(Math.floor(_*cx)/cx,X.shared.setValue(m.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,X.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(G.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return F("FillStyle not recognised",i),"red"}var cx,ah=p(()=>{Mt();Z();et();it();ii();Fn();cx=1e5});var ws,lx=p(()=>{Mt();w();zi();ai();We();vg();dt();Cr();oh();Ss();Yn();ah();ws=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){let s=At.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=Ge(o),n=Ge(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(D("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof Tt||(t.style=new Tt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Zt.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=At.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),c=Zt.getOptimalCanvasAndContext(n,a),{canvas:l}=c;this.renderTextToCanvas(e,r,s,c);let h=$n(l,n,a,s);if(r.trim){let u=bg(l,s);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:c}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",ft.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(Zt.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=Mr(e),c=At.measureText(t||" ",e),l=c.lines,h=c.lineHeight,u=c.lineWidths,d=c.maxLineWidth,f=c.fontProperties,m=o.height;if(n.resetTransform(),n.scale(r,r),n.textBaseline=e.textBaseline,e._stroke?.width){let y=e._stroke;n.lineWidth=y.width,n.miterLimit=y.miterLimit,n.lineJoin=y.join,n.lineCap=y.cap}n.font=a;let _,g,b=e.dropShadow?2:1;for(let y=0;y<b;++y){let v=e.dropShadow&&y===0,T=v?Math.ceil(Math.max(1,m)+e.padding*2):0,R=T*r;if(v){n.fillStyle="black",n.strokeStyle="black";let A=e.dropShadow,M=A.color,E=A.alpha;n.shadowColor=X.shared.setValue(M).setAlpha(E).toRgbaString();let B=A.blur*r,I=A.distance*r;n.shadowBlur=B,n.shadowOffsetX=Math.cos(A.angle)*I,n.shadowOffsetY=Math.sin(A.angle)*I+R}else{if(n.fillStyle=e._fill?di(e._fill,n,c):null,e._stroke?.width){let A=e._stroke.width*e._stroke.alignment;n.strokeStyle=di(e._stroke,n,c,A)}n.shadowColor="black"}let S=(h-f.fontSize)/2;h-f.fontSize<0&&(S=0);let P=e._stroke?.width??0;for(let A=0;A<l.length;A++)_=P/2,g=P/2+A*h+f.ascent+S,e.align==="right"?_+=d-u[A]:e.align==="center"&&(_+=(d-u[A])/2),e._stroke?.width&&this._drawLetterSpacing(l[A],e,s,_+e.padding,g+e.padding-T,!0),e._fill!==void 0&&this._drawLetterSpacing(l[A],e,s,_+e.padding,g+e.padding-T)}}_drawLetterSpacing(t,e,r,s,o,n=!1){let{context:a}=r,c=e.letterSpacing,l=!1;if(At.experimentalLetterSpacingSupported&&(At.experimentalLetterSpacing?(a.letterSpacing=`${c}px`,a.textLetterSpacing=`${c}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),c===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let h=s,u=At.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let m=0;m<u.length;++m){let _=u[m];n?a.strokeText(_,h,o):a.fillText(_,h,o);let g="";for(let b=m+1;b<u.length;++b)g+=u[b];f=a.measureText(g).width,h+=d-f+c,d=f}}destroy(){this._activeTextures=null}};ws.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"canvasText"}});var ch=p(()=>{w();xg();lx();k.add(ws);k.add(bs)});var zt,lh=p(()=>{dt();rn();Vn();zt=class i extends Xe{constructor(t){t instanceof Wt&&(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 Wt,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,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=!1){return t?new i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){D(W,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){D(W,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){D(W,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Wt.defaultStrokeStyle.width||t.color!==Wt.defaultStrokeStyle.color||t.alpha!==Wt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return D(W,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return D(W,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return D(W,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return D(W,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return D(W,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return D(W,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var hx,ux,dx=p(()=>{"use strict";hx={name:"local-uniform-msdf-bit",vertex:{header:`
367
+ }`});var kn,fg=p(()=>{Mt();Q();Sr();qr();pe();rt();mc();lg();ug();dg();kn=class extends gt{constructor(){let t=ne.from({vertex:hg,fragment:cg}),e=ae.from({fragment:{source:Ol,entryPoint:"mainFragment"},vertex:{source:Ol,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:E.WHITE.source,uSampler:new $o({}),uniforms:{uTranslationMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new X(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var ai,Ll=p(()=>{Q();Ht();os();me();ni();ag();fg();ai=class{constructor(t,e){this.state=xt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new ot({uTranslationMatrix:{value:new G,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 kn,this.state=xt.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new Gn({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=Ue(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,Ae(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var gs,pg=p(()=>{P();rg();Ll();gs=class extends ai{constructor(t){super(t,new Rn)}};gs.extension={type:[x.WebGLPipes],name:"particle"}});var In,mg=p(()=>{"use strict";In=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),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 xs,gg=p(()=>{P();mg();Ll();xs=class extends ai{constructor(t){super(t,new In)}};xs.extension={type:[x.WebGPUPipes],name:"particle"}});var Nl=p(()=>{P();pg();gg();I.add(gs);I.add(xs)});var Ee,_s=p(()=>{"use strict";Ee=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}});function ys(i,t){let{texture:e,bounds:r}=i;nn(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var Hl=p(()=>{Oc()});var bs,xg=p(()=>{P();Dt();_s();Hl();bs=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),z.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,ys(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:z.get(Ee)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};bs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"text"}});var Wl,Zt,ci=p(()=>{ct();zi();Wl=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=L.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.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},Zt=new Wl});function _g(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return!1;return!0}function yg(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!1;return!0}function bg(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,c=0,l=e-1,h=r-1;for(;c<r&&_g(n,e,c);)++c;if(c===r)return V.EMPTY;for(;_g(n,e,h);)--h;for(;yg(n,e,a,c,h);)++a;for(;yg(n,e,l,c,h);)--l;return++l,++h,new V(a/t,c/t,(l-a)/t,(h-c)/t)}var vg=p(()=>{bt()});var Tg,Le,Fn=p(()=>{Q();Rt();Tg={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"}},Le=class{constructor(t,e){this.uid=Y("fillPattern"),this.transform=new G,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Tg[e].addressModeU,t.source.style.addressModeV=Tg[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var wg=Ya((Bk,Sg)=>{Sg.exports=iS;var zl={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},rS=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function iS(i){var t=[];return i.replace(rS,function(e,r,s){var o=r.toLowerCase();for(s=oS(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==zl[o])return s.unshift(r),t.push(s);if(s.length<zl[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,zl[o])))}}),t}var sS=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function oS(i){var t=i.match(sS);return t?t.map(Number):[]}});function Ag(i,t){let e=(0,Pg.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let c=e[a],l=c[0],h=c;switch(l){case"M":o=h[1],n=h[2],t.moveTo(o,n);break;case"m":o+=h[1],n+=h[2],t.moveTo(o,n);break;case"H":o=h[1],t.lineTo(o,n);break;case"h":o+=h[1],t.lineTo(o,n);break;case"V":n=h[1],t.lineTo(o,n);break;case"v":n+=h[1],t.lineTo(o,n);break;case"L":o=h[1],n=h[2],t.lineTo(o,n);break;case"l":o+=h[1],n+=h[2],t.lineTo(o,n);break;case"C":o=h[5],n=h[6],t.bezierCurveTo(h[1],h[2],h[3],h[4],o,n);break;case"c":t.bezierCurveTo(o+h[1],n+h[2],o+h[3],n+h[4],o+h[5],n+h[6]),o+=h[5],n+=h[6];break;case"S":o=h[3],n=h[4],t.bezierCurveToShort(h[1],h[2],o,n);break;case"s":t.bezierCurveToShort(o+h[1],n+h[2],o+h[3],n+h[4]),o+=h[3],n+=h[4];break;case"Q":o=h[3],n=h[4],t.quadraticCurveTo(h[1],h[2],o,n);break;case"q":t.quadraticCurveTo(o+h[1],n+h[2],o+h[3],n+h[4]),o+=h[3],n+=h[4];break;case"T":o=h[1],n=h[2],t.quadraticCurveToShort(o,n);break;case"t":o+=h[1],n+=h[2],t.quadraticCurveToShort(o,n);break;case"A":o=h[6],n=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],o,n);break;case"a":o+=h[6],n+=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[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:F(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var Pg,Eg=p(()=>{Pg=Io(wg(),1);st()});var Un,Cg=p(()=>{bt();Un=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!1;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!1;let o=this.x-t,n=this.y-e,a=this.radius,c=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+c&&l>a-(r-c)}getBounds(t){return t||(t=new V),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 Dn,Mg=p(()=>{bt();Dn=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!1;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!1;let a=r*(1-s),c=r-a,l=o-c,h=n-c,u=o+a,f=n+a,d=t-this.x,m=e-this.y,g=d*d/(l*l)+m*m/(h*h),_=d*d/(u*u)+m*m/(f*f);return g>1&&_<=1}getBounds(t){return t||(t=new V),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 Bg(i,t,e,r,s,o){let n=i-e,a=t-r,c=s-e,l=o-r,h=n*c+a*l,u=c*c+l*l,f=-1;u!==0&&(f=h/u);let d,m;f<0?(d=e,m=r):f>1?(d=s,m=o):(d=e+f*c,m=r+f*l);let g=i-d,_=t-m;return g*g+_*_}var Rg=p(()=>{"use strict"});var nS,aS,li,Gg=p(()=>{Rg();bt();li=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=!0}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],c=e[(s+3)%r];t+=(a-o)*(c+n)}return t<0}containsPolygon(t){let e=this.getBounds(nS),r=t.getBounds(aS);if(!e.containsRect(r))return!1;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!1}return!0}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],c=this.points[o*2+1],l=this.points[n*2],h=this.points[n*2+1];c>e!=h>e&&t<(l-a)*((e-c)/(h-c))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:c}=this,l=c.length-(this.closePath?0:2);for(let h=0;h<l;h+=2){let u=c[h],f=c[h+1],d=c[(h+2)%c.length],m=c[(h+3)%c.length],g=Bg(t,e,u,f,d,m),_=Math.sign((d-u)*(e-f)-(m-f)*(t-u));if(g<=(_<0?a:n))return!0}return!1}getBounds(t){t||(t=new V);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,c=e.length;a<c;a+=2){let l=e[a],h=e[a+1];r=l<r?l:r,s=l>s?l:s,o=h<o?h:o,n=h>n?h:n}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var On,Ln,kg=p(()=>{bt();On=(i,t,e,r,s,o,n)=>{let a=i-e,c=t-r,l=Math.sqrt(a*a+c*c);return l>=s-o&&l<=s+n},Ln=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 V),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!1;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!0;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!0}return!1}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:c,radius:l}=this,h=r*(1-s),u=r-h,f=o+l,d=n+l,m=a-l*2,g=c-l*2,_=o+a,b=n+c;return(t>=o-h&&t<=o+u||t>=_-u&&t<=_+h)&&e>=d&&e<=d+g||(e>=n-h&&e<=n+u||e>=b-u&&e<=b+h)&&t>=f&&t<=f+m?!0:t<f&&e<d&&On(t,e,f,d,l,u,h)||t>_-l&&e<d&&On(t,e,_-l,d,l,u,h)||t>_-l&&e>b-l&&On(t,e,_-l,b-l,l,u,h)||t<f&&e>b-l&&On(t,e,f,b-l,l,u,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Hn(i,t,e,r,s,o,n,a,c,l){let u=Math.min(.99,Math.max(0,l??oi.defaultOptions.bezierSmoothness)),f=(lS-u)/1;return f*=f,hS(t,e,r,s,o,n,a,c,i,f),i}function hS(i,t,e,r,s,o,n,a,c,l){Xl(i,t,e,r,s,o,n,a,c,l,0),c.push(n,a)}function Xl(i,t,e,r,s,o,n,a,c,l,h){if(h>cS)return;let u=Math.PI,f=(i+e)/2,d=(t+r)/2,m=(e+s)/2,g=(r+o)/2,_=(s+n)/2,b=(o+a)/2,y=(f+m)/2,v=(d+g)/2,T=(m+_)/2,C=(g+b)/2,S=(y+T)/2,A=(v+C)/2;if(h>0){let M=n-i,R=a-t,w=Math.abs((e-n)*R-(r-a)*M),B=Math.abs((s-n)*R-(o-a)*M),k,N;if(w>Nn&&B>Nn){if((w+B)*(w+B)<=l*(M*M+R*R)){if(hi<Vl){c.push(S,A);return}let j=Math.atan2(o-r,s-e);if(k=Math.abs(j-Math.atan2(r-t,e-i)),N=Math.abs(Math.atan2(a-o,n-s)-j),k>=u&&(k=2*u-k),N>=u&&(N=2*u-N),k+N<hi){c.push(S,A);return}if(Cr!==0){if(k>Cr){c.push(e,r);return}if(N>Cr){c.push(s,o);return}}}}else if(w>Nn){if(w*w<=l*(M*M+R*R)){if(hi<Vl){c.push(S,A);return}if(k=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),k>=u&&(k=2*u-k),k<hi){c.push(e,r),c.push(s,o);return}if(Cr!==0&&k>Cr){c.push(e,r);return}}}else if(B>Nn){if(B*B<=l*(M*M+R*R)){if(hi<Vl){c.push(S,A);return}if(k=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),k>=u&&(k=2*u-k),k<hi){c.push(e,r),c.push(s,o);return}if(Cr!==0&&k>Cr){c.push(s,o);return}}}else if(M=S-(i+n)/2,R=A-(t+a)/2,M*M+R*R<=l){c.push(S,A);return}}Xl(i,t,f,d,y,v,S,A,c,l,h+1),Xl(S,A,T,C,_,b,n,a,c,l,h+1)}var cS,Nn,lS,Vl,hi,Cr,$l=p(()=>{Mn();cS=8,Nn=11920929e-14,lS=1,Vl=.01,hi=0,Cr=0});function Fg(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??oi.defaultOptions.bezierSmoothness)),h=(fS-l)/1;return h*=h,mS(t,e,r,s,o,n,i,h),i}function mS(i,t,e,r,s,o,n,a){Yl(n,i,t,e,r,s,o,a,0),n.push(s,o)}function Yl(i,t,e,r,s,o,n,a,c){if(c>uS)return;let l=Math.PI,h=(t+r)/2,u=(e+s)/2,f=(r+o)/2,d=(s+n)/2,m=(h+f)/2,g=(u+d)/2,_=o-t,b=n-e,y=Math.abs((r-o)*b-(s-n)*_);if(y>dS){if(y*y<=a*(_*_+b*b)){if(Ig<pS){i.push(m,g);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<Ig){i.push(m,g);return}}}else if(_=m-(t+o)/2,b=g-(e+n)/2,_*_+b*b<=a){i.push(m,g);return}Yl(i,t,e,h,u,m,g,a,c+1),Yl(i,m,g,f,d,o,n,a,c+1)}var uS,dS,fS,pS,Ig,Ug=p(()=>{Mn();uS=8,dS=11920929e-14,fS=1,pS=.01,Ig=0});function Wn(i,t,e,r,s,o,n,a){let c=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(c=2*Math.PI-c),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(c/Math.PI)))),a=Math.max(a,3);let l=c/a,h=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let f=Math.cos(h),d=Math.sin(h),m=t+f*r,g=e+d*r;i.push(m,g),h+=l}}var jl=p(()=>{"use strict"});function Dg(i,t,e,r,s,o){let n=i[i.length-2],c=i[i.length-1]-e,l=n-t,h=s-e,u=r-t,f=Math.abs(c*u-l*h);if(f<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let d=c*c+l*l,m=h*h+u*u,g=c*h+l*u,_=o*Math.sqrt(d)/f,b=o*Math.sqrt(m)/f,y=_*g/d,v=b*g/m,T=_*u+b*l,C=_*h+b*c,S=l*(b+y),A=c*(b+y),M=u*(_+v),R=h*(_+v),w=Math.atan2(A-C,S-T),B=Math.atan2(R-C,M-T);Wn(i,T+t,C+e,o,w,B,l*h>u*c)}var Og=p(()=>{jl()});function gS(i,t){let e=t===-1.5707963267948966?-.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 Ng(i,t,e,r,s,o,n,a=0,c=0,l=0){if(o===0||n===0)return;let h=Math.sin(a*vs/360),u=Math.cos(a*vs/360),f=u*(t-r)/2+h*(e-s)/2,d=-h*(t-r)/2+u*(e-s)/2;if(f===0&&d===0)return;o=Math.abs(o),n=Math.abs(n);let m=Math.pow(f,2)/Math.pow(o,2)+Math.pow(d,2)/Math.pow(n,2);m>1&&(o*=Math.sqrt(m),n*=Math.sqrt(m)),xS(t,e,r,s,o,n,c,l,h,u,f,d,Kl);let{ang1:g,ang2:_}=Kl,{centerX:b,centerY:y}=Kl,v=Math.abs(_)/(vs/4);Math.abs(1-v)<1e-7&&(v=1);let T=Math.max(Math.ceil(v),1);_/=T;let C=i[i.length-2],S=i[i.length-1],A={x:0,y:0};for(let M=0;M<T;M++){let R=gS(g,_),{x:w,y:B}=ql(R[0],o,n,u,h,b,y,A),{x:k,y:N}=ql(R[1],o,n,u,h,b,y,A),{x:j,y:q}=ql(R[2],o,n,u,h,b,y,A);Hn(i,C,S,w,B,k,N,j,q),C=j,S=q,g+=_}}var vs,Kl,ql,Lg,xS,Hg=p(()=>{$l();vs=Math.PI*2,Kl={centerX:0,centerY:0,ang1:0,ang2:0},ql=({x:i,y:t},e,r,s,o,n,a,c)=>{i*=e,t*=r;let l=s*i-o*t,h=o*i+s*t;return c.x=l+n,c.y=h+a,c};Lg=(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)},xS=(i,t,e,r,s,o,n,a,c,l,h,u,f)=>{let d=Math.pow(s,2),m=Math.pow(o,2),g=Math.pow(h,2),_=Math.pow(u,2),b=d*m-d*_-m*g;b<0&&(b=0),b/=d*_+m*g,b=Math.sqrt(b)*(n===a?-1:1);let y=b*s/o*u,v=b*-o/s*h,T=l*y-c*v+(i+e)/2,C=c*y+l*v+(t+r)/2,S=(h-y)/s,A=(u-v)/o,M=(-h-y)/s,R=(-u-v)/o,w=Lg(1,0,S,A),B=Lg(S,A,M,R);a===0&&B>0&&(B-=vs),a===1&&B<0&&(B+=vs),f.centerX=T,f.centerY=C,f.ang1=w,f.ang2=B}});function Wg(i,t,e){let r=(n,a)=>{let c=a.x-n.x,l=a.y-n.y,h=Math.sqrt(c*c+l*l),u=c/h,f=l/h;return{len:h,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],c=a.radius??e;if(c<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],h=r(a,o),u=r(a,l);if(h.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let f=Math.asin(h.nx*u.ny-h.ny*u.nx),d=1,m=!1;h.nx*u.nx-h.ny*-u.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,m=!0):f>0&&(d=-1,m=!0);let g=f/2,_,b=Math.abs(Math.cos(g)*c/Math.sin(g));b>Math.min(h.len/2,u.len/2)?(b=Math.min(h.len/2,u.len/2),_=Math.abs(b*Math.sin(g)/Math.cos(g))):_=c;let y=a.x+u.nx*b+-u.ny*_*d,v=a.y+u.ny*b+u.nx*_*d,T=Math.atan2(h.ny,h.nx)+Math.PI/2*d,C=Math.atan2(u.ny,u.nx)-Math.PI/2*d;n===0&&i.moveTo(y+Math.cos(T)*_,v+Math.sin(T)*_),i.arc(y,v,_,T,C,m),o=a}}function zg(i,t,e,r){let s=(a,c)=>Math.sqrt((a.x-c.x)**2+(a.y-c.y)**2),o=(a,c,l)=>({x:a.x+(c.x-a.x)*l,y:a.y+(c.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let c=t[(a+1)%n],l=c.radius??e;if(l<=0){a===0?i.moveTo(c.x,c.y):i.lineTo(c.x,c.y);continue}let h=t[a],u=t[(a+2)%n],f=s(h,c),d;if(f<1e-4)d=c;else{let _=Math.min(f/2,l);d=o(c,h,_/f)}let m=s(u,c),g;if(m<1e-4)g=c;else{let _=Math.min(m/2,l);g=o(c,u,_/m)}a===0?i.moveTo(d.x,d.y):i.lineTo(d.x,d.y),i.quadraticCurveTo(c.x,c.y,g.x,g.y,r)}}var Vg=p(()=>{"use strict"});var _S,zn,Xg=p(()=>{Cg();Mg();Gg();bt();kg();Xt();$l();Ug();jl();Og();Hg();Vg();_S=new V,zn=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new it,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return(s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Wn(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Dg(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let c=this._currentPoly.points;return Ng(c,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 c=this._currentPoly;return Hn(this._currentPoly.points,c.lastX,c.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return Fg(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),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 c=a.shape,l=o?.shape;l&&l.containsPolygon(c)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,o){return this.drawShape(new V(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new Un(t,e,r),s),this}poly(t,e,r){let s=new li(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,c=Math.PI*2/s,l=[];for(let h=0;h<s;h++){let u=a-h*c;l.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(l,!0,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 c=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,c);let l=-1*Math.PI/2+n,h=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){let d=f*h+l,m=t+r*Math.cos(d),g=e+r*Math.sin(d),_=d+Math.PI+u,b=d-Math.PI-u,y=m+o*Math.cos(_),v=g+o*Math.sin(_),T=m+o*Math.cos(b),C=g+o*Math.sin(b);f===0?this.moveTo(y,v):this.lineTo(y,v),this.quadraticCurveTo(m,g,T,C,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?zg(this,t,e,s):Wg(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)),c=t+r,l=e+s,h=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+h,e+h,t+u,e,u).lineTo(c-u,e).arcTo(c-h,e+h,c,e+u,u).lineTo(c,l-u).arcTo(c-h,l-h,t+r-u,l,u).lineTo(t+u,l).arcTo(t+h,l-h,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),c=t+r,l=e+s,h=[t+a,e,c-a,e,c,e+a,c,l-a,c-a,l,t+a,l,t,l-a,t,e+a];for(let u=h.length-1;u>=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,n)}ellipse(t,e,r,s,o){return this.drawShape(new Dn(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new Ln(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 li,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new li,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(_S);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function Ts(i,t){return i?i.prepend(t):t.clone()}var Je,Zl=p(()=>{ie();Rt();st();Eg();Xg();Je=class i{constructor(t,e=!1){this.instructions=[],this.uid=Y("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Ag(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new zn(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(K.shared),c=0,l=0;if(!n||n.action!=="bezierCurveTo")c=a.x,l=a.y;else{c=n.data[2],l=n.data[3];let h=a.x,u=a.y;c=h+(h-c),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[c,l,t,e,r,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(K.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 c=o.x,l=o.y;n=c+(c-n),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=!0,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,r,s,o,n,a){o||(o=s/2);let c=-1*Math.PI/2+n,l=r*2,h=Math.PI*2/l,u=[];for(let f=0;f<l;f++){let d=f%2?o:s,m=f*h+c;u.push(t+d*Math.cos(m),e+d*Math.sin(m))}return this.poly(u,!0,a),this}clone(t=!1){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=!0,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,c=0,l=0,h=0,u=0,f=0,d=0,m=0,g=0;for(let _=0;_<this.instructions.length;_++){let b=this.instructions[_],y=b.data;switch(b.action){case"moveTo":case"lineTo":c=y[0],l=y[1],y[0]=e*c+s*l+n,y[1]=r*c+o*l+a;break;case"bezierCurveTo":h=y[0],u=y[1],f=y[2],d=y[3],c=y[4],l=y[5],y[0]=e*h+s*u+n,y[1]=r*h+o*u+a,y[2]=e*f+s*d+n,y[3]=r*f+o*d+a,y[4]=e*c+s*l+n,y[5]=r*c+o*l+a;break;case"quadraticCurveTo":h=y[0],u=y[1],c=y[2],l=y[3],y[0]=e*h+s*u+n,y[1]=r*h+o*u+a,y[2]=e*c+s*l+n,y[3]=r*c+o*l+a;break;case"arcToSvg":c=y[5],l=y[6],m=y[0],g=y[1],y[0]=e*m+s*g,y[1]=r*m+o*g,y[5]=e*c+s*l+n,y[6]=r*c+o*l+a;break;case"circle":y[4]=Ts(y[3],t);break;case"rect":y[4]=Ts(y[4],t);break;case"ellipse":y[8]=Ts(y[8],t);break;case"roundRect":y[5]=Ts(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=Ts(y[2],t);break;default:F("unknown transform action",b.action);break}}return this._dirty=!0,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 ut(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var Ql=p(()=>{"use strict"});function $g(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]=yS(n);break;case"radialgradient":t.defs[n.id]=bS(n);break;default:break}}}}function yS(i){let t=ut(i,"x1",0),e=ut(i,"y1",0),r=ut(i,"x2",1),s=ut(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new qt(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let c=i.children[a],l=ut(c,"offset",0),h=X.shared.setValue(c.getAttribute("stop-color")).toNumber();n.addColorStop(l,h)}return n}function bS(i){return F("[SVG Parser] Radial gradients are not yet supported"),new qt(0,0,1,0)}var Yg=p(()=>{Mt();st();si();Ql()});function Jl(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var jg=p(()=>{"use strict"});function th(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Kg){let a=i.getAttribute(n);a&&qg(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let c=n[a].trim(),[l,h]=c.split(":");Kg[l]&&qg(t,o,l,h.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function qg(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Jl(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=X.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){let s=Jl(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=X.shared.setValue(r).toNumber();t.useFill=!0}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 Kg,Zg=p(()=>{Mt();jg();Kg={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 Qg(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 Je};$g(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=th(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&Jg(a,e,s,o)}return t}function Jg(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=th(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 c,l,h,u,f,d,m,g,_,b,y,v,T,C,S,A,M;switch(i.nodeName.toLowerCase()){case"path":C=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&F("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new Je(C,!0),t.context.path(S),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"circle":m=ut(i,"cx",0),g=ut(i,"cy",0),_=ut(i,"r",0),t.context.ellipse(m,g,_,_),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":c=ut(i,"x",0),l=ut(i,"y",0),A=ut(i,"width",0),M=ut(i,"height",0),b=ut(i,"rx",0),y=ut(i,"ry",0),b||y?t.context.roundRect(c,l,A,M,b||y):t.context.rect(c,l,A,M),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":m=ut(i,"cx",0),g=ut(i,"cy",0),b=ut(i,"rx",0),y=ut(i,"ry",0),t.context.beginPath(),t.context.ellipse(m,g,b,y),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":h=ut(i,"x1",0),u=ut(i,"y1",0),f=ut(i,"x2",0),d=ut(i,"y2",0),t.context.beginPath(),t.context.moveTo(h,u),t.context.lineTo(f,d),r&&t.context.stroke(r);break;case"polygon":T=i.getAttribute("points"),v=T.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(v,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":T=i.getAttribute("points"),v=T.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(v,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{F(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let R=0;R<s.length;R++)Jg(s[R],t,e,r)}var tx=p(()=>{st();Zl();Yg();Ql();Zg()});function vS(i){return X.isColorLike(i)}function ex(i){return i instanceof Le}function rx(i){return i instanceof qt}function TS(i){return i instanceof E}function SS(i,t,e){let r=X.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=E.WHITE,{...e,...i}}function wS(i,t,e){return i.texture=t,{...e,...i}}function ix(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function sx(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 PS(i,t){let e={...t,...i},r=X.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Ne(i,t){if(i==null)return null;let e={},r=i;return vS(i)?SS(e,i,t):TS(i)?wS(e,i,t):ex(i)?ix(e,i,t):rx(i)?sx(e,i,t):r.fill&&ex(r.fill)?ix(r,r.fill,t):r.fill&&rx(r.fill)?sx(r,r.fill,t):PS(r,t)}function ui(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...c}=t,l=Ne(i,c);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var eh=p(()=>{Mt();rt();si();Fn()});var AS,ox,rh,Wt,Vn=p(()=>{kt();Mt();Q();ie();rt();Rt();dt();Xt();Zl();tx();eh();AS=new K,ox=new G,rh=class Ce extends nt{constructor(){super(...arguments),this.uid=Y("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Je,this._transform=new G,this._fillStyle={...Ce.defaultFillStyle},this._strokeStyle={...Ce.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new it,this._boundsDirty=!0}clone(){let t=new Ce;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=Ne(t,Ce.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ui(t,Ce.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Ne(t,Ce.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Ne(t,Ce.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?X.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Je,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"&&(O(W,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Ne(t,Ce.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(K.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=ui(t,Ce.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 c=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,c.a*n+c.c*a+c.tx,c.b*n+c.d*a+c.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let c=this._transform;return this._activePath.bezierCurveTo(c.a*t+c.c*e+c.tx,c.b*t+c.d*e+c.ty,c.a*r+c.c*s+c.tx,c.b*r+c.d*s+c.ty,c.a*o+c.c*n+c.tx,c.b*o+c.d*n+c.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++,Qg(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 G?(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 G?(this._transform.append(t),this):(ox.set(t,e,r,s,o,n),this._transform.append(ox),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=!0,this._boundsDirty=!0)}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),c=o.path.bounds;t.addFrame(c.minX-a,c.minY-a,c.maxX+a,c.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,r=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let c=n.style,l=a.shapePath.shapePrimitives;for(let h=0;h<l.length;h++){let u=l[h].shape;if(!c||!u)continue;let f=l[h].transform,d=f?f.applyInverse(t,AS):t;if(o.action==="fill")r=u.contains(d.x,d.y);else{let g=c;r=u.strokeContains(d.x,d.y,g.width,g.alignment)}let m=n.hole;if(m){let g=m.shapePath?.shapePrimitives;if(g)for(let _=0;_<g.length;_++)g[_].shape.contains(d.x,d.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};rh.defaultFillStyle={color:16777215,alpha:1,texture:E.WHITE,matrix:null,fill:null,textureSpace:"local"};rh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:E.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Wt=rh});function Xn(i){let t=[],e=0;for(let r=0;r<nx.length;r++){let s=`_${nx[r]}`;t[e++]=i[s]}return e=ax(i._fill,t,e),e=ES(i._stroke,t,e),e=CS(i.dropShadow,t,e),t.join("-")}function ax(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function ES(i,t,e){return i&&(e=ax(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 CS(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=X.shared.setValue(i.color).toNumber()),e}var nx,ih=p(()=>{Mt();nx=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function MS(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Tt.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){O(W,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(X.isColorLike(e))r.color=e;else if(e instanceof qt||e instanceof Le)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)){O(W,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=Tt.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new qt({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>X.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o)}),i.fill={fill:r}}}var sh,Tt,Mr=p(()=>{kt();Mt();dt();si();Fn();Vn();eh();ih();sh=class di extends nt{constructor(t={}){super(),MS(t);let e={...di.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({...di.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...di.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Wt.defaultFillStyle,...t},()=>{this._fill=Ne({...this._originalFill},Wt.defaultFillStyle)})),this._fill=Ne(t===0?"black":t,Wt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Wt.defaultStrokeStyle,...t},()=>{this._stroke=ui({...this._originalStroke},Wt.defaultStrokeStyle)})),this._stroke=ui(t,Wt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Xn(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=di.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new di({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let 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(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(X.isColorLike(t)||t instanceof qt||t instanceof Le)}};sh.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};sh.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};Tt=sh});function $n(i,t,e,r){let s=BS;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=ft.getOptimalTexture(s.width,s.height,r,!1);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 BS,oh=p(()=>{We();Xt();BS=new it});function Br(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)&&!RS.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var RS,Yn=p(()=>{"use strict";RS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var nh,ge,At,Ss=p(()=>{ct();Yn();nh={willReadFrequently:!0},ge=class H{static get experimentalLetterSpacingSupported(){let t=H._experimentalLetterSpacingSupported;if(t!==void 0){let e=L.get().getCanvasRenderingContext2D().prototype;t=H._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,o,n,a,c,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=c,this.fontProperties=l}static measureText(t=" ",e,r=H._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(H._measurementCache[o])return H._measurementCache[o];let n=Br(e),a=H.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let c=H.__context;c.font=n;let h=(s?H._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),f=0;for(let y=0;y<h.length;y++){let v=H._measureText(h[y],e.letterSpacing,c);u[y]=v,f=Math.max(f,v)}let d=e._stroke?.width||0,m=f+d;e.dropShadow&&(m+=e.dropShadow.distance);let g=e.lineHeight||a.fontSize,_=Math.max(g,a.fontSize+d)+(h.length-1)*(g+e.leading);return e.dropShadow&&(_+=e.dropShadow.distance),new H(t,e,m,_,h,u,g+e.leading,f,a)}static _measureText(t,e,r){let s=!1;H.experimentalLetterSpacingSupported&&(H.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(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 h=(H.graphemeSegmenter(t).length-1)*e;n+=h,l+=h}return Math.max(n,l)}static _wordWrap(t,e,r=H._canvas){let s=r.getContext("2d",nh),o=0,n="",a="",c=Object.create(null),{letterSpacing:l,whiteSpace:h}=e,u=H._collapseSpaces(h),f=H._collapseNewlines(h),d=!u,m=e.wordWrapWidth+l,g=H._tokenize(t);for(let _=0;_<g.length;_++){let b=g[_];if(H._isNewline(b)){if(!f){a+=H._addLine(n),d=!u,n="",o=0;continue}b=" "}if(u){let v=H.isBreakingSpace(b),T=H.isBreakingSpace(n[n.length-1]);if(v&&T)continue}let y=H._getFromCache(b,l,c,s);if(y>m)if(n!==""&&(a+=H._addLine(n),n="",o=0),H.canBreakWords(b,e.breakWords)){let v=H.wordWrapSplit(b);for(let T=0;T<v.length;T++){let C=v[T],S=C,A=1;for(;v[T+A];){let R=v[T+A];if(!H.canBreakChars(S,R,b,T,e.breakWords))C+=R;else break;S=R,A++}T+=A-1;let M=H._getFromCache(C,l,c,s);M+o>m&&(a+=H._addLine(n),d=!1,n="",o=0),n+=C,o+=M}}else{n.length>0&&(a+=H._addLine(n),n="",o=0);let v=_===g.length-1;a+=H._addLine(b,!v),d=!1,n="",o=0}else y+o>m&&(d=!1,a+=H._addLine(n),n="",o=0),(n.length>0||!H.isBreakingSpace(b)||d)&&(n+=b,o+=y)}return a+=H._addLine(n,!1),a}static _addLine(t,e=!0){return t=H._trimRight(t),t=e?`${t}
368
+ `:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=H._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(!H.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:H._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:H._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(H.isBreakingSpace(o,n)||H._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return!0}static wordWrapSplit(t){return H.graphemeSegmenter(t)}static measureFont(t){if(H._fonts[t])return H._fonts[t];let e=H._context;e.font=t;let r=e.measureText(H.METRICS_STRING+H.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return H._fonts[t]=s,s}static clearMetrics(t=""){t?delete H._fonts[t]:H._fonts={}}static get _canvas(){if(!H.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",nh)?.measureText)return H.__canvas=e,e;t=L.get().createCanvas()}catch{t=L.get().createCanvas()}t.width=t.height=10,H.__canvas=t}return H.__canvas}static get _context(){return H.__context||(H.__context=H._canvas.getContext("2d",nh)),H.__context}};ge.METRICS_STRING="|\xC9q\xC5";ge.BASELINE_SYMBOL="M";ge.BASELINE_MULTIPLIER=1.4;ge.HEIGHT_MULTIPLIER=2;ge.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();ge.experimentalLetterSpacing=!1;ge._fonts={};ge._newlines=[10,13];ge._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];ge._measurementCache={};At=ge});function fi(i,t,e,r=0){if(i.texture===E.WHITE&&!i.fill)return X.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof Le){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(G.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof qt){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,c=1;n&&e&&(a=e.width+r,c=e.height+r);let l,h=!1;if(o){let{start:u,end:f}=s;l=t.createLinearGradient(u.x*a,u.y*c,f.x*a,f.y*c),h=Math.abs(f.x-u.x)<Math.abs((f.y-u.y)*.1)}else{let{center:u,innerRadius:f,outerCenter:d,outerRadius:m}=s;l=t.createRadialGradient(u.x*a,u.y*c,f*a,d.x*a,d.y*c,m*a)}if(h&&n&&e){let u=e.lineHeight/c;for(let f=0;f<e.lines.length;f++){let d=(f*e.lineHeight+r/2)/c;s.colorStops.forEach(m=>{let g=d+m.offset*u;l.addColorStop(Math.floor(g*cx)/cx,X.shared.setValue(m.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,X.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(G.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return F("FillStyle not recognised",i),"red"}var cx,ah=p(()=>{Mt();Q();rt();st();si();Fn();cx=1e5});var ws,lx=p(()=>{Mt();P();zi();ci();We();vg();dt();Mr();oh();Ss();Yn();ah();ws=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){let s=At.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=Ge(o),n=Ge(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(O("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof Tt||(t.style=new Tt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Zt.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=At.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),c=Zt.getOptimalCanvasAndContext(n,a),{canvas:l}=c;this.renderTextToCanvas(e,r,s,c);let h=$n(l,n,a,s);if(r.trim){let u=bg(l,s);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:c}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",ft.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(Zt.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=Br(e),c=At.measureText(t||" ",e),l=c.lines,h=c.lineHeight,u=c.lineWidths,f=c.maxLineWidth,d=c.fontProperties,m=o.height;if(n.resetTransform(),n.scale(r,r),n.textBaseline=e.textBaseline,e._stroke?.width){let y=e._stroke;n.lineWidth=y.width,n.miterLimit=y.miterLimit,n.lineJoin=y.join,n.lineCap=y.cap}n.font=a;let g,_,b=e.dropShadow?2:1;for(let y=0;y<b;++y){let v=e.dropShadow&&y===0,T=v?Math.ceil(Math.max(1,m)+e.padding*2):0,C=T*r;if(v){n.fillStyle="black",n.strokeStyle="black";let M=e.dropShadow,R=M.color,w=M.alpha;n.shadowColor=X.shared.setValue(R).setAlpha(w).toRgbaString();let B=M.blur*r,k=M.distance*r;n.shadowBlur=B,n.shadowOffsetX=Math.cos(M.angle)*k,n.shadowOffsetY=Math.sin(M.angle)*k+C}else{if(n.fillStyle=e._fill?fi(e._fill,n,c):null,e._stroke?.width){let M=e._stroke.width*e._stroke.alignment;n.strokeStyle=fi(e._stroke,n,c,M)}n.shadowColor="black"}let S=(h-d.fontSize)/2;h-d.fontSize<0&&(S=0);let A=e._stroke?.width??0;for(let M=0;M<l.length;M++)g=A/2,_=A/2+M*h+d.ascent+S,e.align==="right"?g+=f-u[M]:e.align==="center"&&(g+=(f-u[M])/2),e._stroke?.width&&this._drawLetterSpacing(l[M],e,s,g+e.padding,_+e.padding-T,!0),e._fill!==void 0&&this._drawLetterSpacing(l[M],e,s,g+e.padding,_+e.padding-T)}}_drawLetterSpacing(t,e,r,s,o,n=!1){let{context:a}=r,c=e.letterSpacing,l=!1;if(At.experimentalLetterSpacingSupported&&(At.experimentalLetterSpacing?(a.letterSpacing=`${c}px`,a.textLetterSpacing=`${c}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),c===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let h=s,u=At.graphemeSegmenter(t),f=a.measureText(t).width,d=0;for(let m=0;m<u.length;++m){let g=u[m];n?a.strokeText(g,h,o):a.fillText(g,h,o);let _="";for(let b=m+1;b<u.length;++b)_+=u[b];d=a.measureText(_).width,h+=f-d+c,f=d}}destroy(){this._activeTextures=null}};ws.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"canvasText"}});var ch=p(()=>{P();xg();lx();I.add(ws);I.add(bs)});var zt,lh=p(()=>{dt();rn();Vn();zt=class i extends Xe{constructor(t){t instanceof Wt&&(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 Wt,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,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=!1){return t?new i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){O(W,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){O(W,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){O(W,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Wt.defaultStrokeStyle.width||t.color!==Wt.defaultStrokeStyle.color||t.alpha!==Wt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return O(W,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return O(W,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return O(W,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return O(W,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return O(W,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return O(W,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var hx,ux,dx=p(()=>{"use strict";hx={name:"local-uniform-msdf-bit",vertex:{header:`
369
369
  struct LocalUniforms {
370
370
  uColor:vec4<f32>,
371
371
  uTransformMatrix:mat3x3<f32>,
@@ -462,16 +462,16 @@ fn mainFragment(
462
462
 
463
463
  return coverage;
464
464
  }
465
- `}}});var hh,uh,jn,gx=p(()=>{Z();br();qe();cs();ls();Ze();vn();pe();Ht();dx();mx();jn=class extends gt{constructor(){let t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=se();hh??(hh=ve({name:"sdf-shader",bits:[qr,Qr(e),hx,fx,Se]})),uh??(uh=Te({name:"sdf-shader",bits:[Zr,Jr(e),ux,px,we]})),super({glProgram:uh,gpuProgram:hh,resources:{localUniforms:t,batchSamplers:ti(e)}})}}});var fi,dh=p(()=>{kt();dt();fi=class extends nt{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return D(W,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return D(W,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return D(W,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return D(W,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return D(W,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){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(!0)),this.pages=null)}}});function Kn(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,c=n;a<=c;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 fh=p(()=>{"use strict"});var xx,ph,yx=p(()=>{Mt();bt();ai();zr();et();dt();Ss();Yn();ah();Cr();dh();fh();xx=class _x extends fi{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let e={..._x.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=C.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=Mr(r);e.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/s):r.fontSize=this.baseRenderedFontSize=s,this._style=r,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=At.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(t){let e=Kn(t).filter(g=>!this._currentChars.includes(g)).filter((g,b,y)=>y.indexOf(g)===b);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,c=this._currentX,l=this._currentY,h=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*h,d=0,f=!1,m=s.width/this.resolution,_=s.height/this.resolution;for(let g=0;g<e.length;g++){let b=e[g],y=At.measureText(b,a,s,!1);y.lineHeight=y.height;let v=y.width*h,T=Math.ceil((a.fontStyle==="italic"?2:1)*v),R=y.height*h,S=T+u*2,P=R+u*2;if(f=!1,b!==`
466
- `&&b!=="\r"&&b!==" "&&b!==" "&&(f=!0,d=Math.ceil(Math.max(P,d))),c+S>m&&(l+=d,d=P,c=0,l+d>_)){n.update();let M=this._nextPage();s=M.canvasAndContext.canvas,o=M.canvasAndContext.context,n=M.texture.source,l=0}let A=v/h-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[b]={id:b.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:A,kerning:{}},f){this._drawGlyph(o,y,c+u,l+u,h,a);let M=n.width*h,E=n.height*h,B=new V(c/M*n.width,l/E*n.height,S/M*n.width,P/E*n.height);this.chars[b].texture=new C({source:n,frame:B}),c+=Math.ceil(S)}}n.update(),this._currentX=c,this._currentY=l,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return D(W,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],c=r[o];c||(c=r[o]=e.measureText(o).width);let l=r[a];l||(l=r[a]=e.measureText(a).width);let h=e.measureText(o+a).width,u=h-(c+l);u&&(this.chars[o].kerning[a]=u),h=e.measureText(o+a).width,u=h-(c+l),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=Zt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new C({source:new jt({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,r){e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=Mr(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=di(s,t)),e._fill&&(t.fillStyle=di(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=X.shared.setValue(n.color).toArray(),c=n.blur*r,l=n.distance*r;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=c,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,c=e.fontProperties,h=(n._stroke?.width??0)*o,u=r+h/2,d=s-h/2,f=c.descent*o,m=e.lineHeight*o;n.stroke&&h&&t.strokeText(a,u,d+m-f),n._fill&&t.fillText(a,u,d+m-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];Zt.returnCanvasAndContext(e),r.destroy(!0)}this.pages=null}};xx.defaultOptions={textureSize:512,style:new Tt,mipmap:!0};ph=xx});function qn(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=!0,c={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=m=>{let _=o.width;for(let g=0;g<c.index;g++){let b=m.positions[g];o.chars.push(m.chars[g]),o.charPositions.push(b+_)}o.width+=m.width,a=!1,c.width=0,c.index=0,c.chars.length=0},h=()=>{let m=o.chars.length-1;if(r){let _=o.chars[m];for(;_===" ";)o.width-=e.chars[_].xAdvance,_=o.chars[--m]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,f=t.wordWrapWidth*u;for(let m=0;m<i.length+1;m++){let _,g=m===i.length;g||(_=i[m]);let b=e.chars[_]||e.chars[" "];if(/(?:\s)/.test(_)||_==="\r"||_===`
467
- `||g){if(!a&&t.wordWrap&&o.width+c.width-d>f?(h(),l(c),g||o.charPositions.push(0)):(c.start=o.width,l(c),g||o.charPositions.push(0)),_==="\r"||_===`
468
- `)o.width!==0&&h();else if(!g){let R=b.xAdvance+(b.kerning[n]||0)+d;o.width+=R,o.spaceWidth=R,o.spacesIndex.push(o.charPositions.length),o.chars.push(_)}}else{let T=b.kerning[n]||0,R=b.xAdvance+T+d;c.positions[c.index++]=c.width+T,c.chars.push(_),c.width+=R}n=_}return h(),t.align==="center"?GS(s):t.align==="right"?kS(s):t.align==="justify"&&IS(s),s}function GS(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 kS(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 IS(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 h=0;h<r.charPositions.length;h++)h===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[h]+=n}}var mh=p(()=>{"use strict"});var Zn,gh,Ps,xh=p(()=>{$e();dt();it();Cr();yx();mh();fh();Zn=0,gh=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let r=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=!1}if(!J.has(r)){let n=new ph({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});Zn++,Zn>50&&F("BitmapText",`You have dynamically created ${Zn} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Zn--,J.remove(r)}),J.set(r,n)}let o=J.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return qn([...t],e,s,r)}measureText(t,e,r=!0){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},D(W,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Tt?s:new Tt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new ph({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),c=Kn(e.chars);return a.ensureCharacters(c.join("")),J.set(`${r}-bitmap`,a),a.once("destroy",()=>J.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=J.get(e);r&&r.destroy()}},Ps=new gh});function bx(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 As,vx=p(()=>{$e();w();Dt();lh();gx();xh();mh();As=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);bx(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(z.return(e.customShader),e.customShader=null),z.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);bx(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Ps.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=z.get(jn)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,c=qn(o,n,s,!0),l=0,h=n.padding,u=c.scale,d=c.width,f=c.height+c.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),r.translate(-t._anchor._x*d-h,-t._anchor._y*f-h).scale(u,u);let m=s.applyFillAsTint?n._fill.color:16777215;for(let _=0;_<c.lines.length;_++){let g=c.lines[_];for(let b=0;b<g.charPositions.length;b++){let y=o[l++],v=s.chars[y];v?.texture&&r.texture(v.texture,m||"black",Math.round(g.charPositions[b]+v.xOffset),Math.round(a+v.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=z.get(zt);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=J.get(`${r}-bitmap`),{a:o,b:n,c:a,d:c}=t.groupTransform,l=Math.sqrt(o*o+n*n),h=Math.sqrt(a*a+c*c),u=(Math.abs(l)+Math.abs(h))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=u*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};As.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"bitmapText"}});var _h=p(()=>{w();vx();k.add(As)});var Es,Tx=p(()=>{w();et();Dt();_s();Hl();Es=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),z.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,ys(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=r;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),ys(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:C.EMPTY,currentKey:"--",batchableSprite:z.get(Ee),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=C.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};Es.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"htmlText"}});function Sx(){let{userAgent:i}=O.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var wx=p(()=>{ct()});var Px,Ax,pi,yh=p(()=>{"use strict";Px="http://www.w3.org/2000/svg",Ax="http://www.w3.org/1999/xhtml",pi=class{constructor(){this.svgRoot=document.createElementNS(Px,"svg"),this.foreignObject=document.createElementNS(Px,"foreignObject"),this.domElement=document.createElementNS(Ax,"div"),this.styleElement=document.createElementNS(Ax,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s)}}});function Mx(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${X.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[Rx(t)]:[],...i.dropShadow?[Bx(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return FS(i.tagStyles,s),s.join(" ")}function Bx(i){let t=X.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function Rx(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${X.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${X.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function FS(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)Cx[o]?s.push(Cx[o](r[o])):Ex[o]&&s.push(Ex[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var Ex,Cx,Gx=p(()=>{Mt();Ex={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},Cx={fill:i=>`color: ${X.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:Rx,dropShadow:Bx}});var Qn,kx=p(()=>{it();Cr();ih();Gx();Qn=class i extends Tt{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Xn(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=Mx(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function Ix(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(c){s[c]||(r.push(c),s[c]=!0)}if(Array.isArray(e))for(let c=0;c<e.length;c++)a(e[c]);else a(e);n&&n.forEach(c=>{let l=c.split(":")[1].trim();a(l)});for(let c in t.tagStyles){let l=t.tagStyles[c].fontFamily;a(l)}return r}var Fx=p(()=>{"use strict"});async function Ux(i){let e=await(await O.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 Dx=p(()=>{ct()});async function bh(i,t){let e=await Ux(t);return`@font-face {
465
+ `}}});var hh,uh,jn,gx=p(()=>{Q();vr();qe();cs();ls();Ze();vn();pe();Ht();dx();mx();jn=class extends gt{constructor(){let t=new ot({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=se();hh??(hh=ve({name:"sdf-shader",bits:[Zr,Jr(e),hx,fx,Se]})),uh??(uh=Te({name:"sdf-shader",bits:[Qr,ti(e),ux,px,we]})),super({glProgram:uh,gpuProgram:hh,resources:{localUniforms:t,batchSamplers:ei(e)}})}}});var pi,dh=p(()=>{kt();dt();pi=class extends nt{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return O(W,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return O(W,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return O(W,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return O(W,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return O(W,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){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(!0)),this.pages=null)}}});function Kn(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,c=n;a<=c;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 fh=p(()=>{"use strict"});var xx,ph,yx=p(()=>{Mt();bt();ci();Vr();rt();dt();Ss();Yn();ah();Mr();dh();fh();xx=class _x extends pi{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let e={..._x.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=E.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=Br(r);e.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/s):r.fontSize=this.baseRenderedFontSize=s,this._style=r,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=At.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(t){let e=Kn(t).filter(_=>!this._currentChars.includes(_)).filter((_,b,y)=>y.indexOf(_)===b);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,c=this._currentX,l=this._currentY,h=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*h,f=0,d=!1,m=s.width/this.resolution,g=s.height/this.resolution;for(let _=0;_<e.length;_++){let b=e[_],y=At.measureText(b,a,s,!1);y.lineHeight=y.height;let v=y.width*h,T=Math.ceil((a.fontStyle==="italic"?2:1)*v),C=y.height*h,S=T+u*2,A=C+u*2;if(d=!1,b!==`
466
+ `&&b!=="\r"&&b!==" "&&b!==" "&&(d=!0,f=Math.ceil(Math.max(A,f))),c+S>m&&(l+=f,f=A,c=0,l+f>g)){n.update();let R=this._nextPage();s=R.canvasAndContext.canvas,o=R.canvasAndContext.context,n=R.texture.source,l=0}let M=v/h-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[b]={id:b.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:M,kerning:{}},d){this._drawGlyph(o,y,c+u,l+u,h,a);let R=n.width*h,w=n.height*h,B=new V(c/R*n.width,l/w*n.height,S/R*n.width,A/w*n.height);this.chars[b].texture=new E({source:n,frame:B}),c+=Math.ceil(S)}}n.update(),this._currentX=c,this._currentY=l,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return O(W,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],c=r[o];c||(c=r[o]=e.measureText(o).width);let l=r[a];l||(l=r[a]=e.measureText(a).width);let h=e.measureText(o+a).width,u=h-(c+l);u&&(this.chars[o].kerning[a]=u),h=e.measureText(o+a).width,u=h-(c+l),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=Zt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new E({source:new jt({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,r){e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=Br(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=fi(s,t)),e._fill&&(t.fillStyle=fi(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=X.shared.setValue(n.color).toArray(),c=n.blur*r,l=n.distance*r;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=c,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,c=e.fontProperties,h=(n._stroke?.width??0)*o,u=r+h/2,f=s-h/2,d=c.descent*o,m=e.lineHeight*o;n.stroke&&h&&t.strokeText(a,u,f+m-d),n._fill&&t.fillText(a,u,f+m-d)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];Zt.returnCanvasAndContext(e),r.destroy(!0)}this.pages=null}};xx.defaultOptions={textureSize:512,style:new Tt,mipmap:!0};ph=xx});function qn(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=!0,c={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=m=>{let g=o.width;for(let _=0;_<c.index;_++){let b=m.positions[_];o.chars.push(m.chars[_]),o.charPositions.push(b+g)}o.width+=m.width,a=!1,c.width=0,c.index=0,c.chars.length=0},h=()=>{let m=o.chars.length-1;if(r){let g=o.chars[m];for(;g===" ";)o.width-=e.chars[g].xAdvance,g=o.chars[--m]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,f=t.letterSpacing*u,d=t.wordWrapWidth*u;for(let m=0;m<i.length+1;m++){let g,_=m===i.length;_||(g=i[m]);let b=e.chars[g]||e.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
467
+ `||_){if(!a&&t.wordWrap&&o.width+c.width-f>d?(h(),l(c),_||o.charPositions.push(0)):(c.start=o.width,l(c),_||o.charPositions.push(0)),g==="\r"||g===`
468
+ `)o.width!==0&&h();else if(!_){let C=b.xAdvance+(b.kerning[n]||0)+f;o.width+=C,o.spaceWidth=C,o.spacesIndex.push(o.charPositions.length),o.chars.push(g)}}else{let T=b.kerning[n]||0,C=b.xAdvance+T+f;c.positions[c.index++]=c.width+T,c.chars.push(g),c.width+=C}n=g}return h(),t.align==="center"?GS(s):t.align==="right"?kS(s):t.align==="justify"&&IS(s),s}function GS(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 kS(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 IS(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 h=0;h<r.charPositions.length;h++)h===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[h]+=n}}var mh=p(()=>{"use strict"});var Zn,gh,Ps,xh=p(()=>{$e();dt();st();Mr();yx();mh();fh();Zn=0,gh=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let r=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=!1}if(!tt.has(r)){let n=new ph({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});Zn++,Zn>50&&F("BitmapText",`You have dynamically created ${Zn} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Zn--,tt.remove(r)}),tt.set(r,n)}let o=tt.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return qn([...t],e,s,r)}measureText(t,e,r=!0){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},O(W,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Tt?s:new Tt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new ph({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),c=Kn(e.chars);return a.ensureCharacters(c.join("")),tt.set(`${r}-bitmap`,a),a.once("destroy",()=>tt.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=tt.get(e);r&&r.destroy()}},Ps=new gh});function bx(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 As,vx=p(()=>{$e();P();Dt();lh();gx();xh();mh();As=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);bx(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(z.return(e.customShader),e.customShader=null),z.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);bx(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Ps.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=z.get(jn)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,c=qn(o,n,s,!0),l=0,h=n.padding,u=c.scale,f=c.width,d=c.height+c.offsetY;n._stroke&&(f+=n._stroke.width/u,d+=n._stroke.width/u),r.translate(-t._anchor._x*f-h,-t._anchor._y*d-h).scale(u,u);let m=s.applyFillAsTint?n._fill.color:16777215;for(let g=0;g<c.lines.length;g++){let _=c.lines[g];for(let b=0;b<_.charPositions.length;b++){let y=o[l++],v=s.chars[y];v?.texture&&r.texture(v.texture,m||"black",Math.round(_.charPositions[b]+v.xOffset),Math.round(a+v.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=z.get(zt);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=tt.get(`${r}-bitmap`),{a:o,b:n,c:a,d:c}=t.groupTransform,l=Math.sqrt(o*o+n*n),h=Math.sqrt(a*a+c*c),u=(Math.abs(l)+Math.abs(h))/2,f=s.baseRenderedFontSize/t._style.fontSize,d=u*s.distanceField.range*(1/f);e.customShader.resources.localUniforms.uniforms.uDistance=d}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};As.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"bitmapText"}});var _h=p(()=>{P();vx();I.add(As)});var Es,Tx=p(()=>{P();rt();Dt();_s();Hl();Es=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),z.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,ys(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=r;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),ys(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:E.EMPTY,currentKey:"--",batchableSprite:z.get(Ee),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=E.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};Es.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"htmlText"}});function Sx(){let{userAgent:i}=L.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var wx=p(()=>{ct()});var Px,Ax,mi,yh=p(()=>{"use strict";Px="http://www.w3.org/2000/svg",Ax="http://www.w3.org/1999/xhtml",mi=class{constructor(){this.svgRoot=document.createElementNS(Px,"svg"),this.foreignObject=document.createElementNS(Px,"foreignObject"),this.domElement=document.createElementNS(Ax,"div"),this.styleElement=document.createElementNS(Ax,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s)}}});function Mx(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${X.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[Rx(t)]:[],...i.dropShadow?[Bx(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return FS(i.tagStyles,s),s.join(" ")}function Bx(i){let t=X.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function Rx(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${X.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${X.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function FS(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)Cx[o]?s.push(Cx[o](r[o])):Ex[o]&&s.push(Ex[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var Ex,Cx,Gx=p(()=>{Mt();Ex={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},Cx={fill:i=>`color: ${X.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:Rx,dropShadow:Bx}});var Qn,kx=p(()=>{st();Mr();ih();Gx();Qn=class i extends Tt{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Xn(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=Mx(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function Ix(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(c){s[c]||(r.push(c),s[c]=!0)}if(Array.isArray(e))for(let c=0;c<e.length;c++)a(e[c]);else a(e);n&&n.forEach(c=>{let l=c.split(":")[1].trim();a(l)});for(let c in t.tagStyles){let l=t.tagStyles[c].fontFamily;a(l)}return r}var Fx=p(()=>{"use strict"});async function Ux(i){let e=await(await L.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 Dx=p(()=>{ct()});async function bh(i,t){let e=await Ux(t);return`@font-face {
469
469
  font-family: "${i.fontFamily}";
470
470
  src: url('${e}');
471
471
  font-weight: ${i.fontWeight};
472
472
  font-style: ${i.fontStyle};
473
- }`}var Ox=p(()=>{Dx()});async function Lx(i,t,e){let r=i.filter(s=>J.has(`${s}-and-url`)).map((s,o)=>{if(!Jn.has(s)){let{url:n}=J.get(`${s}-and-url`);o===0?Jn.set(s,bh({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):Jn.set(s,bh({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return Jn.get(s)});return(await Promise.all(r)).join(`
474
- `)}var Jn,Nx=p(()=>{$e();Ox();Jn=new Map});function Hx(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:c,height:l}=s.image;return a.setAttribute("width",c.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}var Wx=p(()=>{"use strict"});function zx(i,t){let e=Zt.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 Vx=p(()=>{ai()});function Xx(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 $x=p(()=>{"use strict"});function jx(i,t,e,r){r||(r=Yx||(Yx=new pi));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 c=t.padding*2;return{width:a.width-c,height:a.height-c}}var Yx,Kx=p(()=>{yh()});var mi,qx=p(()=>{w();ai();We();Pe();wx();it();Dt();oh();yh();kx();Fx();Nx();Wx();Vx();$x();Kx();mi=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===yt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,r).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,r){let s=z.get(pi),o=Ix(t,r),n=await Lx(o,r,Qn.defaultTextStyle),a=jx(t,r,n,s),c=Math.ceil(Math.ceil(Math.max(1,a.width)+r.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+r.padding*2)*e),h=s.image,u=2;h.width=(c|0)+u,h.height=(l|0)+u;let d=Hx(t,r,e,n,s);await Xx(h,d,Sx()&&o.length>0);let f=h,m;this._createCanvas&&(m=zx(h,e));let _=$n(m?m.canvas:f,h.width-u,h.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(_.source),Zt.returnCanvasAndContext(m)),z.return(s),_}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(r=>{e.texture=r,this._cleanUp(e)}).catch(()=>{F("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){ft.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};mi.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"htmlText"};mi.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var vh=p(()=>{w();Tx();qx();k.add(mi);k.add(Es)});var Zx,gi,ta=p(()=>{je();De();Yr();dt();Zx=class Qx extends oe{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(D(W,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...Qx.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 mt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:Y.VERTEX|Y.COPY_DST}),c=new mt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:Y.VERTEX|Y.COPY_DST}),l=new mt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:Y.INDEX|Y.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:c,format:"float32x2",stride:2*4,offset:0}},indexBuffer:l,topology:e.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};Zx.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};gi=Zx});var Br,Jx,xi,_i=p(()=>{"use strict";Br={name:"local-uniform-bit",vertex:{header:`
473
+ }`}var Ox=p(()=>{Dx()});async function Lx(i,t,e){let r=i.filter(s=>tt.has(`${s}-and-url`)).map((s,o)=>{if(!Jn.has(s)){let{url:n}=tt.get(`${s}-and-url`);o===0?Jn.set(s,bh({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):Jn.set(s,bh({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return Jn.get(s)});return(await Promise.all(r)).join(`
474
+ `)}var Jn,Nx=p(()=>{$e();Ox();Jn=new Map});function Hx(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:c,height:l}=s.image;return a.setAttribute("width",c.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}var Wx=p(()=>{"use strict"});function zx(i,t){let e=Zt.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 Vx=p(()=>{ci()});function Xx(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 $x=p(()=>{"use strict"});function jx(i,t,e,r){r||(r=Yx||(Yx=new mi));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 c=t.padding*2;return{width:a.width-c,height:a.height-c}}var Yx,Kx=p(()=>{yh()});var gi,qx=p(()=>{P();ci();We();Pe();wx();st();Dt();oh();yh();kx();Fx();Nx();Wx();Vx();$x();Kx();gi=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===yt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,r).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,r){let s=z.get(mi),o=Ix(t,r),n=await Lx(o,r,Qn.defaultTextStyle),a=jx(t,r,n,s),c=Math.ceil(Math.ceil(Math.max(1,a.width)+r.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+r.padding*2)*e),h=s.image,u=2;h.width=(c|0)+u,h.height=(l|0)+u;let f=Hx(t,r,e,n,s);await Xx(h,f,Sx()&&o.length>0);let d=h,m;this._createCanvas&&(m=zx(h,e));let g=$n(m?m.canvas:d,h.width-u,h.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(g.source),Zt.returnCanvasAndContext(m)),z.return(s),g}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(r=>{e.texture=r,this._cleanUp(e)}).catch(()=>{F("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){ft.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};gi.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"htmlText"};gi.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var vh=p(()=>{P();Tx();qx();I.add(gi);I.add(Es)});var Zx,xi,ta=p(()=>{je();De();jr();dt();Zx=class Qx extends oe{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(O(W,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...Qx.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 mt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:$.VERTEX|$.COPY_DST}),c=new mt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:$.VERTEX|$.COPY_DST}),l=new mt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:$.INDEX|$.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:c,format:"float32x2",stride:2*4,offset:0}},indexBuffer:l,topology:e.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};Zx.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};xi=Zx});var Rr,Jx,_i,yi=p(()=>{"use strict";Rr={name:"local-uniform-bit",vertex:{header:`
475
475
 
476
476
  struct LocalUniforms {
477
477
  uTransformMatrix:mat3x3<f32>,
@@ -488,7 +488,7 @@ fn mainFragment(
488
488
  {
489
489
  vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
490
490
  }
491
- `}},Jx={...Br,vertex:{...Br.vertex,header:Br.vertex.header.replace("group(1)","group(2)")}},xi={name:"local-uniform-bit",vertex:{header:`
491
+ `}},Jx={...Rr,vertex:{...Rr.vertex,header:Rr.vertex.header.replace("group(1)","group(2)")}},_i={name:"local-uniform-bit",vertex:{header:`
492
492
 
493
493
  uniform mat3 uTransformMatrix;
494
494
  uniform vec4 uColor;
@@ -566,7 +566,7 @@ fn mainFragment(
566
566
 
567
567
  outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
568
568
 
569
- `}}});var Th,Sh,ea,i_=p(()=>{Z();qe();_i();Ze();pe();Ht();et();r_();ea=class extends gt{constructor(){Th??(Th=ve({name:"tiling-sprite-shader",bits:[Br,t_,Se]})),Sh??(Sh=Te({name:"tiling-sprite-shader",bits:[xi,e_,we]}));let t=new st({uMapCoord:{value:new G,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 G,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Sh,gpuProgram:Th,resources:{localUniforms:new st({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:C.EMPTY.source,uSampler:C.EMPTY.source.style}})}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,c=n.width,l=n.height,h=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*c/t,r.b*c/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=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 ra,s_=p(()=>{ta();ra=class extends gi{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 o_(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 n_=p(()=>{"use strict"});function a_(i,t,e,r){let s=0,o=i.length/(t||2),n=r.a,a=r.b,c=r.c,l=r.d,h=r.tx,u=r.ty;for(e*=t;s<o;){let d=i[e],f=i[e+1];i[e]=n*d+c*f+h,i[e+1]=a*d+l*f+u,e+=t,s++}}var c_=p(()=>{"use strict"});function l_(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=G.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),a_(t,2,0,a)}var h_=p(()=>{Z();c_()});var ia,Cs,u_=p(()=>{w();os();me();Pe();oi();Bn();ta();i_();s_();n_();h_();ia=new ra,Cs=class{constructor(t){this._state=xt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new 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 ea),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Ae(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Ue(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:ia,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new gi({indices:ia.indices,positions:ia.positions.slice(),uvs:ia.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),l_(t,r.uvs),o_(t,r.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=!0;return this._renderer.type===yt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Cs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"tilingSprite"}});var wh=p(()=>{w();u_();k.add(Cs)});var d_,p_,m_=p(()=>{dt();ta();d_=class f_ extends gi{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(D(W,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...f_.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,c=this.width/n,l=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;r.push(d*c,f*l),s.push(d/n,f/a)}let h=n*a;for(let u=0;u<h;u++){let d=u%n,f=u/n|0,m=f*this.verticesX+d,_=f*this.verticesX+d+1,g=(f+1)*this.verticesX+d,b=(f+1)*this.verticesX+d+1;o.push(m,_,g,_,b,g)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};d_.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};p_=d_});var g_,__,y_=p(()=>{m_();g_=class x_ extends p_{constructor(t={}){t={...x_.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:c,_anchorY:l}=this,h=s+o,u=e>h?1:e/h,d=n+a,f=r>d?1:r/d,m=Math.min(u,f),_=c*e,g=l*r;t[0]=t[8]=t[16]=t[24]=-_,t[2]=t[10]=t[18]=t[26]=s*m-_,t[4]=t[12]=t[20]=t[28]=e-o*m-_,t[6]=t[14]=t[22]=t[30]=e-_,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*m-g,t[17]=t[19]=t[21]=t[23]=r-a*m-g,t[25]=t[27]=t[29]=t[31]=r-g,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};g_.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};__=g_});var Ms,b_=p(()=>{w();Dt();Bn();y_();Ms=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];z.return(e.geometry),z.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=z.get(Qe);return e.geometry=z.get(__),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};Ms.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"nineSliceSprite"}});var Ph=p(()=>{w();b_();k.add(Ms)});var Bs,v_=p(()=>{w();Bs=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};Bs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"filter"}});function T_(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 S_=p(()=>{"use strict"});var US,Rs,w_=p(()=>{w();Z();ie();Ye();Yr();Ht();et();We();Pe();Xt();S_();it();US=new oe({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Rs=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new st({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 Pt({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?T_(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,c=0,l=!0,h=!1,u=!1,d=!0;for(let f=0;f<r.length;f++){let m=r[f];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),c+=m.padding,m.antialias==="off"?l=!1:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(d=!1),!!!(m.compatibleRenderers&e.type)){u=!1;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){F("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=m.enabled||u,h||(h=m.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/m,0,f.height/m)}if(o.scale(a).ceil().scale(1/a).pad(c|0),!o.isPositive){s.skip=!0;return}s.skip=!1,s.bounds=o,s.blendRequired=h,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=ft.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=C.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,c=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(c,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,!1),ft.returnTexture(r);else{let a=e.inputTexture,c=ft.getOptimalTexture(s.width,s.height,a.source._resolution,!1),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,c,!0);let u=a;a=c,c=u}n[l].apply(this,a,e.previousRenderSurface,!1),ft.returnTexture(a),ft.returnTexture(c)}e.blendRequired&&ft.returnTexture(o)}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=ft.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let c=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:c,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,c=K.shared,h=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,m=f.uniforms,_=m.uOutputFrame,g=m.uInputSize,b=m.uInputPixel,y=m.uInputClamp,v=m.uGlobalFrame,T=m.uOutputTexture;if(h){let P=this._filterStackIndex;for(;P>0;){P--;let A=this._filterStack[this._filterStackIndex-1];if(!A.skip){c.x=A.bounds.minX,c.y=A.bounds.minY;break}}_[0]=a.minX-c.x,_[1]=a.minY-c.y}else _[0]=0,_[1]=0;_[2]=e.frame.width,_[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[1],b[0]=e.source.pixelWidth,b[1]=e.source.pixelHeight,b[2]=1/b[0],b[3]=1/b[1],y[0]=.5*b[2],y[1]=.5*b[3],y[2]=e.frame.width*g[2]-.5*b[2],y[3]=e.frame.height*g[3]-.5*b[3];let R=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=c.x*u,v[1]=c.y*u,v[2]=R.source.width*u,v[3]=R.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof C?(T[0]=r.frame.width,T[1]=r.frame.height):(T[0]=S.width,T[1]=S.height),T[2]=S.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let P=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(P,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:US,shader:t,state:t._state,topology:"triangle-list"}),o.type===yt.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new rt,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(G.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Rs.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"filter"}});var Ah=p(()=>{w();v_();w_();k.add(Rs);k.add(Bs)});var DS={};var P_=p(()=>{Af();Cc();If();Uf();on();dn();Fl();Ul();Nl();ch();_h();vh();wh();Ph();Ah()});var OS={};var E_=p(()=>{Cc();on();dn();Fl();Ul();Nl();ch();_h();vh();wh();Ph();Ah()});var M_,B_,R_=p(()=>{Tr();Kr();pe();me();M_=class Eh extends gt{constructor(t){t={...Eh.defaultOptions,...t},super(t),this.enabled=!0,this._state=xt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,r,s){t.applyFilter(this,e,r,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=ae.from(e)),r&&(n=ne.from(r)),new Eh({gpuProgram:o,glProgram:n,...s})}};M_.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};B_=M_});async function G_(i){if(!i)for(let t=0;t<Ch.length;t++){let e=Ch[t];if(e.value.test()){await e.value.load();return}}}var Ch,k_=p(()=>{w();Ch=[];k.handleByNamedList(x.Environment,Ch)});function sa(){if(typeof Gs=="boolean")return Gs;try{Gs=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Gs=!1}return Gs}var Gs,Mh=p(()=>{"use strict"});var Et,yi=p(()=>{"use strict";Et=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(Et||{})});var bi,Bh=p(()=>{"use strict";bi=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,o,n,a,c){let{name:l,items:h}=this;for(let u=0,d=h.length;u<d;u++)h[u][l](t,e,r,s,o,n,a,c);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var LS,I_,tr,ks=p(()=>{Mt();k_();de();Mh();dt();yi();Bh();kt();LS=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],I_=class F_ extends nt{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let e=[...LS,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await G_(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...F_.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,e){let r=t;if(r instanceof at&&(r={container:r},e&&(D(W,"passing a second argument is deprecated, please use render options instead"),r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){let s=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=s?r.clearColor:X.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,e,r){let s=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==s&&this.runners.resolutionChange.emit(r)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=Et.ALL);let{clear:r,clearColor:s,target:o}=t;X.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,X.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new bi(e)})}_addSystems(t){let e;for(e in t){let r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}_addPipes(t,e){let r=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=r[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!sa())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};I_.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};tr=I_});var Is,O_=p(()=>{w();Z();br();mn();qe();cs();ls();_i();Ze();pe();Ht();Is=class{init(){let t=new st({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=ve({name:"graphics",bits:[qr,Qr(se()),Jx,Se]});this.shader=new gt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:c}=n.getContextRenderData(r),l=o.encoder;l.setGeometry(a.geometry,s.gpuProgram);let h=o.globalUniforms.bindGroup;l.setBindGroup(0,h,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);l.setBindGroup(2,u,s.gpuProgram);let d=c.instructions,f=null;for(let m=0;m<c.instructionSize;m++){let _=d[m];if(_.topology!==f&&(f=_.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,_.topology)),s.groups[1]=_.bindGroup,!_.gpuBindGroup){let g=_.textures;_.bindGroup=$r(g.textures,g.count),_.gpuBindGroup=o.bindGroup.getBindGroup(_.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,_.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(_.size,1,_.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};Is.extension={type:[x.WebGPUPipesAdaptor],name:"graphics"}});var L_,N_,Rh=p(()=>{"use strict";L_={name:"texture-bit",vertex:{header:`
569
+ `}}});var Th,Sh,ea,i_=p(()=>{Q();qe();yi();Ze();pe();Ht();rt();r_();ea=class extends gt{constructor(){Th??(Th=ve({name:"tiling-sprite-shader",bits:[Rr,t_,Se]})),Sh??(Sh=Te({name:"tiling-sprite-shader",bits:[_i,e_,we]}));let t=new ot({uMapCoord:{value:new G,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 G,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Sh,gpuProgram:Th,resources:{localUniforms:new ot({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:E.EMPTY.source,uSampler:E.EMPTY.source.style}})}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,c=n.width,l=n.height,h=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*c/t,r.b*c/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=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 ra,s_=p(()=>{ta();ra=class extends xi{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 o_(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 n_=p(()=>{"use strict"});function a_(i,t,e,r){let s=0,o=i.length/(t||2),n=r.a,a=r.b,c=r.c,l=r.d,h=r.tx,u=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+c*d+h,i[e+1]=a*f+l*d+u,e+=t,s++}}var c_=p(()=>{"use strict"});function l_(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=G.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),a_(t,2,0,a)}var h_=p(()=>{Q();c_()});var ia,Cs,u_=p(()=>{P();os();me();Pe();ni();Bn();ta();i_();s_();n_();h_();ia=new ra,Cs=class{constructor(t){this._state=xt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new 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 ea),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Ae(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Ue(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:ia,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new xi({indices:ia.indices,positions:ia.positions.slice(),uvs:ia.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),l_(t,r.uvs),o_(t,r.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=!0;return this._renderer.type===yt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Cs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"tilingSprite"}});var wh=p(()=>{P();u_();I.add(Cs)});var d_,p_,m_=p(()=>{dt();ta();d_=class f_ extends xi{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(O(W,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...f_.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,c=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*c,d*l),s.push(f/n,d/a)}let h=n*a;for(let u=0;u<h;u++){let f=u%n,d=u/n|0,m=d*this.verticesX+f,g=d*this.verticesX+f+1,_=(d+1)*this.verticesX+f,b=(d+1)*this.verticesX+f+1;o.push(m,g,_,g,b,_)}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()}};d_.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};p_=d_});var g_,__,y_=p(()=>{m_();g_=class x_ extends p_{constructor(t={}){t={...x_.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:c,_anchorY:l}=this,h=s+o,u=e>h?1:e/h,f=n+a,d=r>f?1:r/f,m=Math.min(u,d),g=c*e,_=l*r;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*m-g,t[4]=t[12]=t[20]=t[28]=e-o*m-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-_,t[9]=t[11]=t[13]=t[15]=n*m-_,t[17]=t[19]=t[21]=t[23]=r-a*m-_,t[25]=t[27]=t[29]=t[31]=r-_,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()}};g_.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};__=g_});var Ms,b_=p(()=>{P();Dt();Bn();y_();Ms=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];z.return(e.geometry),z.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=z.get(Qe);return e.geometry=z.get(__),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};Ms.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"nineSliceSprite"}});var Ph=p(()=>{P();b_();I.add(Ms)});var Bs,v_=p(()=>{P();Bs=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};Bs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"filter"}});function T_(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 S_=p(()=>{"use strict"});var US,Rs,w_=p(()=>{P();Q();ie();Ye();jr();Ht();rt();We();Pe();Xt();S_();st();US=new oe({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Rs=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new ot({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 Pt({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?T_(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,c=0,l=!0,h=!1,u=!1,f=!0;for(let d=0;d<r.length;d++){let m=r[d];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),c+=m.padding,m.antialias==="off"?l=!1:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(f=!1),!!!(m.compatibleRenderers&e.type)){u=!1;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){F("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=m.enabled||u,h||(h=m.blendRequired)}if(!u){s.skip=!0;return}if(f){let d=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/m,0,d.height/m)}if(o.scale(a).ceil().scale(1/a).pad(c|0),!o.isPositive){s.skip=!0;return}s.skip=!1,s.bounds=o,s.blendRequired=h,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=ft.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=E.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,c=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(c,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,!1),ft.returnTexture(r);else{let a=e.inputTexture,c=ft.getOptimalTexture(s.width,s.height,a.source._resolution,!1),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,c,!0);let u=a;a=c,c=u}n[l].apply(this,a,e.previousRenderSurface,!1),ft.returnTexture(a),ft.returnTexture(c)}e.blendRequired&&ft.returnTexture(o)}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=ft.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let c=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:c,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,c=K.shared,h=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(u=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,g=m.uOutputFrame,_=m.uInputSize,b=m.uInputPixel,y=m.uInputClamp,v=m.uGlobalFrame,T=m.uOutputTexture;if(h){let A=this._filterStackIndex;for(;A>0;){A--;let M=this._filterStack[this._filterStackIndex-1];if(!M.skip){c.x=M.bounds.minX,c.y=M.bounds.minY;break}}g[0]=a.minX-c.x,g[1]=a.minY-c.y}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,_[0]=e.source.width,_[1]=e.source.height,_[2]=1/_[0],_[3]=1/_[1],b[0]=e.source.pixelWidth,b[1]=e.source.pixelHeight,b[2]=1/b[0],b[3]=1/b[1],y[0]=.5*b[2],y[1]=.5*b[3],y[2]=e.frame.width*_[2]-.5*b[2],y[3]=e.frame.height*_[3]-.5*b[3];let C=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=c.x*u,v[1]=c.y*u,v[2]=C.source.width*u,v[3]=C.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof E?(T[0]=r.frame.width,T[1]=r.frame.height):(T[0]=S.width,T[1]=S.height),T[2]=S.isRoot?-1:1,d.update(),o.renderPipes.uniformBatch){let A=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(A,0)}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:US,shader:t,state:t._state,topology:"triangle-list"}),o.type===yt.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new it,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(G.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Rs.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"filter"}});var Ah=p(()=>{P();v_();w_();I.add(Rs);I.add(Bs)});var DS={};var P_=p(()=>{Af();Cc();If();Uf();on();dn();Fl();Ul();Nl();ch();_h();vh();wh();Ph();Ah()});var OS={};var E_=p(()=>{Cc();on();dn();Fl();Ul();Nl();ch();_h();vh();wh();Ph();Ah()});var M_,B_,R_=p(()=>{Sr();qr();pe();me();M_=class Eh extends gt{constructor(t){t={...Eh.defaultOptions,...t},super(t),this.enabled=!0,this._state=xt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,r,s){t.applyFilter(this,e,r,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=ae.from(e)),r&&(n=ne.from(r)),new Eh({gpuProgram:o,glProgram:n,...s})}};M_.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};B_=M_});async function G_(i){if(!i)for(let t=0;t<Ch.length;t++){let e=Ch[t];if(e.value.test()){await e.value.load();return}}}var Ch,k_=p(()=>{P();Ch=[];I.handleByNamedList(x.Environment,Ch)});function sa(){if(typeof Gs=="boolean")return Gs;try{Gs=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Gs=!1}return Gs}var Gs,Mh=p(()=>{"use strict"});var Et,bi=p(()=>{"use strict";Et=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(Et||{})});var vi,Bh=p(()=>{"use strict";vi=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,o,n,a,c){let{name:l,items:h}=this;for(let u=0,f=h.length;u<f;u++)h[u][l](t,e,r,s,o,n,a,c);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var LS,I_,tr,ks=p(()=>{Mt();k_();de();Mh();dt();bi();Bh();kt();LS=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],I_=class F_ extends nt{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let e=[...LS,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await G_(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...F_.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,e){let r=t;if(r instanceof at&&(r={container:r},e&&(O(W,"passing a second argument is deprecated, please use render options instead"),r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){let s=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=s?r.clearColor:X.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,e,r){let s=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==s&&this.runners.resolutionChange.emit(r)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=Et.ALL);let{clear:r,clearColor:s,target:o}=t;X.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,X.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new vi(e)})}_addSystems(t){let e;for(e in t){let r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}_addPipes(t,e){let r=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=r[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!sa())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};I_.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};tr=I_});var Is,O_=p(()=>{P();Q();vr();mn();qe();cs();ls();yi();Ze();pe();Ht();Is=class{init(){let t=new ot({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=ve({name:"graphics",bits:[Zr,Jr(se()),Jx,Se]});this.shader=new gt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:c}=n.getContextRenderData(r),l=o.encoder;l.setGeometry(a.geometry,s.gpuProgram);let h=o.globalUniforms.bindGroup;l.setBindGroup(0,h,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);l.setBindGroup(2,u,s.gpuProgram);let f=c.instructions,d=null;for(let m=0;m<c.instructionSize;m++){let g=f[m];if(g.topology!==d&&(d=g.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,g.topology)),s.groups[1]=g.bindGroup,!g.gpuBindGroup){let _=g.textures;g.bindGroup=Yr(_.textures,_.count),g.gpuBindGroup=o.bindGroup.getBindGroup(g.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,g.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};Is.extension={type:[x.WebGPUPipesAdaptor],name:"graphics"}});var L_,N_,Rh=p(()=>{"use strict";L_={name:"texture-bit",vertex:{header:`
570
570
 
571
571
  struct TextureUniforms {
572
572
  uTextureMatrix:mat3x3<f32>,
@@ -592,7 +592,7 @@ fn mainFragment(
592
592
 
593
593
  `,main:`
594
594
  outColor = texture(uTexture, vUV);
595
- `}}});var Fs,H_=p(()=>{w();Z();qe();_i();Ze();Rh();pe();et();it();Fs=class{init(){let t=ve({name:"mesh",bits:[Br,L_,Se]});this._shader=new gt({gpuProgram:t,resources:{uTexture:C.EMPTY._source,uSampler:C.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){F("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Fs.extension={type:[x.WebGPUPipesAdaptor],name:"mesh"}});var aa,Us,W_=p(()=>{w();me();mn();aa=xt.for2d(),Us=class{start(t,e,r){let s=t.renderer,o=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=e,o.setGeometry(e,n),aa.blendMode="normal",s.pipeline.getPipeline(e,n,aa);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let c=e.textures;e.bindGroup=$r(c.textures,c.count)}aa.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,aa,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Us.extension={type:[x.WebGPUPipesAdaptor],name:"batch"}});var Ds,z_=p(()=>{w();Ds=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}};Ds.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"customRender"}});function Os(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=r[s];t[o.renderPipeId].execute(o)}}var Gh=p(()=>{"use strict"});var NS,Ls,V_=p(()=>{w();Z();Dt();_s();Gh();NS=new G,Ls=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(z.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=z.get(Ee));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=NS.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),Os(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),Os(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};Ls.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"renderGroup"}});function Ns(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var kh=p(()=>{"use strict"});function Ih(i,t=!1){WS(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,c=n.index;for(let l=0;l<c;l++){let h=a[l];h.parentRenderGroup===i&&h.relativeRenderGroupDepth===o&&Y_(h,r,0)}Ns(a,c),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)Ih(i.renderGroupChildren[s],t)}function WS(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=Ir(t.groupColor,r.worldColor),e=t.groupAlpha*r.worldAlpha}else i.worldTransform.copyFrom(t.localTransform),i.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,i.worldAlpha=e,i.worldColorAlpha=i.worldColor+((e*255|0)<<24)}function Y_(i,t,e){if(t===i.updateTick)return;i.updateTick=t,i.didChange=!1;let r=i.localTransform;i.updateLocalTransform();let s=i.parent;if(s&&!s.renderGroup?(e|=i._updateFlags,i.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),e&X_&&$_(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&X_&&$_(i,HS,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)Y_(o[l],t,e);let a=i.parentRenderGroup,c=i;c.renderPipeId&&!a.structureDidChange&&a.updateRenderable(c)}}function $_(i,t,e){if(e&Or){i.groupColor=Ir(i.localColor,t.groupColor);let r=i.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,i.groupAlpha=r,i.groupColorAlpha=i.groupColor+((r*255|0)<<24)}e&Vi&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&xr&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var HS,X_,j_=p(()=>{de();kh();lc();HS=new at,X_=xr|Or|Vi});function K_(i,t){let{list:e,index:r}=i.childrenRenderablesToUpdate,s=!1;for(let o=0;o<r;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return i.structureDidChange=s,s}var q_=p(()=>{"use strict"});var zS,Hs,Z_=p(()=>{w();Z();We();Xt();kh();Gh();j_();q_();zS=new G,Hs=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=zS;e&&(n=n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Os(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=r,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let s=t.texture;t.texture&&ft.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=ft.getOptimalTexture(r.width,r.height,n,a),t._textureBounds||(t._textureBounds=new rt),t._textureBounds.copyFrom(r),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(ft.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?Ns(t.childrenRenderablesToUpdate.list,0):K_(t,r),Ih(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let s=0;s<r;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}Ns(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};Hs.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"renderGroup"}});var Ws,Q_=p(()=>{w();Dt();_s();Ws=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];z.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=z.get(Ee);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)z.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};Ws.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"sprite"}});var vi,Fh=p(()=>{kt();vi="8.9.2"});var zs,Vs,Uh=p(()=>{w();Fh();zs=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,vi)}static destroy(){}};zs.extension=x.Application;Vs=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,vi)}destroy(){this._renderer=null}};Vs.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"initHook",priority:-10}});var Dh,Oh,ty=p(()=>{w();me();fl();Dh=class J_{constructor(t,e){this.state=xt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new hs)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let r=this._activeBatches[t.batcherName];r||(r=this._activeBatches[t.batcherName]=J_.getBatcher(t.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let r in e){let s=e[r],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let r in e){let s=e[r],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,r=e.geometry,s=e.shader;this._adaptor.start(this,r,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};Dh.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"batch"};Dh._availableBatchers=Object.create(null);Oh=Dh;k.handleByMap(x.Batcher,Oh._availableBatchers);k.add(hs)});var ey,ry=p(()=>{ey=`in vec2 vMaskCoord;
595
+ `}}});var Fs,H_=p(()=>{P();Q();qe();yi();Ze();Rh();pe();rt();st();Fs=class{init(){let t=ve({name:"mesh",bits:[Rr,L_,Se]});this._shader=new gt({gpuProgram:t,resources:{uTexture:E.EMPTY._source,uSampler:E.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){F("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Fs.extension={type:[x.WebGPUPipesAdaptor],name:"mesh"}});var aa,Us,W_=p(()=>{P();me();mn();aa=xt.for2d(),Us=class{start(t,e,r){let s=t.renderer,o=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=e,o.setGeometry(e,n),aa.blendMode="normal",s.pipeline.getPipeline(e,n,aa);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let c=e.textures;e.bindGroup=Yr(c.textures,c.count)}aa.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,aa,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Us.extension={type:[x.WebGPUPipesAdaptor],name:"batch"}});var Ds,z_=p(()=>{P();Ds=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}};Ds.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"customRender"}});function Os(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=r[s];t[o.renderPipeId].execute(o)}}var Gh=p(()=>{"use strict"});var NS,Ls,V_=p(()=>{P();Q();Dt();_s();Gh();NS=new G,Ls=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(z.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=z.get(Ee));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=NS.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),Os(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),Os(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};Ls.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"renderGroup"}});function Ns(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var kh=p(()=>{"use strict"});function Ih(i,t=!1){WS(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,c=n.index;for(let l=0;l<c;l++){let h=a[l];h.parentRenderGroup===i&&h.relativeRenderGroupDepth===o&&Y_(h,r,0)}Ns(a,c),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)Ih(i.renderGroupChildren[s],t)}function WS(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=Fr(t.groupColor,r.worldColor),e=t.groupAlpha*r.worldAlpha}else i.worldTransform.copyFrom(t.localTransform),i.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,i.worldAlpha=e,i.worldColorAlpha=i.worldColor+((e*255|0)<<24)}function Y_(i,t,e){if(t===i.updateTick)return;i.updateTick=t,i.didChange=!1;let r=i.localTransform;i.updateLocalTransform();let s=i.parent;if(s&&!s.renderGroup?(e|=i._updateFlags,i.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),e&X_&&$_(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&X_&&$_(i,HS,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)Y_(o[l],t,e);let a=i.parentRenderGroup,c=i;c.renderPipeId&&!a.structureDidChange&&a.updateRenderable(c)}}function $_(i,t,e){if(e&Lr){i.groupColor=Fr(i.localColor,t.groupColor);let r=i.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,i.groupAlpha=r,i.groupColorAlpha=i.groupColor+((r*255|0)<<24)}e&Vi&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&_r&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var HS,X_,j_=p(()=>{de();kh();lc();HS=new at,X_=_r|Lr|Vi});function K_(i,t){let{list:e,index:r}=i.childrenRenderablesToUpdate,s=!1;for(let o=0;o<r;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return i.structureDidChange=s,s}var q_=p(()=>{"use strict"});var zS,Hs,Z_=p(()=>{P();Q();We();Xt();kh();Gh();j_();q_();zS=new G,Hs=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=zS;e&&(n=n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Os(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=r,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let s=t.texture;t.texture&&ft.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=ft.getOptimalTexture(r.width,r.height,n,a),t._textureBounds||(t._textureBounds=new it),t._textureBounds.copyFrom(r),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(ft.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?Ns(t.childrenRenderablesToUpdate.list,0):K_(t,r),Ih(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let s=0;s<r;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}Ns(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};Hs.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"renderGroup"}});var Ws,Q_=p(()=>{P();Dt();_s();Ws=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];z.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=z.get(Ee);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)z.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};Ws.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"sprite"}});var Ti,Fh=p(()=>{kt();Ti="8.9.2"});var zs,Vs,Uh=p(()=>{P();Fh();zs=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Ti)}static destroy(){}};zs.extension=x.Application;Vs=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Ti)}destroy(){this._renderer=null}};Vs.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"initHook",priority:-10}});var Dh,Oh,ty=p(()=>{P();me();fl();Dh=class J_{constructor(t,e){this.state=xt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new hs)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let r=this._activeBatches[t.batcherName];r||(r=this._activeBatches[t.batcherName]=J_.getBatcher(t.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let r in e){let s=e[r],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let r in e){let s=e[r],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,r=e.geometry,s=e.shader;this._adaptor.start(this,r,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};Dh.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"batch"};Dh._availableBatchers=Object.create(null);Oh=Dh;I.handleByMap(x.Batcher,Oh._availableBatchers);I.add(hs)});var ey,ry=p(()=>{ey=`in vec2 vMaskCoord;
596
596
  in vec2 vTextureCoord;
597
597
 
598
598
  uniform sampler2D uTexture;
@@ -761,9 +761,9 @@ fn mainFragment(
761
761
 
762
762
  return source * a;
763
763
  }
764
- `});var ca,ny=p(()=>{Z();Tr();Kr();Ht();yc();R_();ry();sy();oy();ca=class extends B_{constructor(t){let{sprite:e,...r}=t,s=new Dr(e.texture),o=new st({uFilterMatrix:{value:new G,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=ae.from({vertex:{source:Lh,entryPoint:"mainVertex"},fragment:{source:Lh,entryPoint:"mainFragment"}}),a=ne.from({vertex:iy,fragment:ey,name:"mask-filter"});super({...r,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,r,s)}}});var VS,Nh,Xs,ay=p(()=>{w();Lo();ny();Xt();Hi();an();Dt();et();We();Pe();VS=new rt,Nh=class extends Re{constructor(){super(),this.filters=[new ca({sprite:new Nt(C.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},Xs=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let s=this._renderer;if(s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(r,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=z.get(Nh);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=kr(t.mask.mask,!0,VS);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=ft.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let c=s.sprite;c.texture=a,c.worldTransform.tx=o.minX,c.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===yt.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();r&&ft.returnTexture(s.filterTexture),z.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};Xs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"alphaMask"}});var $s,cy=p(()=>{w();$s=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};$s.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"colorMask"}});var Ys,ly=p(()=>{w();yi();vr();Ys=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(o.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let c=this._maskHash.get(o);c.instructionsStart=r.instructionSize,a.collectRenderables(r,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-c.instructionsStart-1;c.instructionsLength=l;let h=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[h]??(s[h]=0)}pop(t,e,r){let s=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[n.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(lt.RENDERING_MASK_ADD,o),o++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode(lt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(lt.MASK_ACTIVE,o),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),o!==0?r.stencil.setStencilMode(lt.RENDERING_MASK_REMOVE,o):(r.renderTarget.clear(null,Et.STENCIL),r.stencil.setStencilMode(lt.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode(lt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(lt.MASK_ACTIVE,o),r.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};Ys.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"stencilMask"}});var Hh,uy,dy=p(()=>{Mt();w();Hh=class hy{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new X(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...hy.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Hh.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"background",priority:0};Hh.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};uy=Hh});var js,Ks,fy=p(()=>{w();Lo();it();js={};k.handle(x.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");js[i.name]=i.ref},i=>{delete js[i.name]});Ks=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!js[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!js[e]){F(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new Re,r.filters=[new js[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};Ks.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"blendMode"}});var Wh,zh,my,gy=p(()=>{w();de();et();Wh={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},zh=class py{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof at||t instanceof C?{target:t,...e}:{...e,...t}}async image(t){let e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,py.defaultImageOptions);let{format:e,quality:r}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let c=new FileReader;c.onload=()=>o(c.result),c.onerror=n,c.readAsDataURL(a)},Wh[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(Wh[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Wh[e],quality:r});return new Promise((n,a)=>{let c=new FileReader;c.onload=()=>n(c.result),c.onerror=a,c.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer;if(e instanceof C)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),o=r.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof C?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof at&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof C?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=e.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};zh.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"extract"};zh.defaultImageOptions={format:"png",quality:1};my=zh});var la,xy=p(()=>{$t();et();la=class i extends C{static create(t){return new i({source:new tt(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var XS,$S,YS,qs,_y=p(()=>{Mt();w();Z();bt();Xt();Vo();de();xy();XS=new V,$S=new rt,YS=[0,0,0,0],qs=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof at&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,r=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:X.shared.setValue(o).toArray():o=YS;let n=t.frame?.copyTo(XS)||Fr(s,$S).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=la.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),c=G.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:c,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};qs.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGenerator"}});var Zs,yy=p(()=>{w();Z();ie();oi();Ye();Pe();Ht();Zs=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new G,worldColor:4294967295,offset:new K},c={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let h=l.uniforms;h.uProjectionMatrix=c.projectionMatrix,h.uResolution=c.resolution,h.uWorldTransformMatrix.copyFrom(c.worldTransformMatrix),h.uWorldTransformMatrix.tx-=c.offset.x,h.uWorldTransformMatrix.ty-=c.offset.y,Ae(c.worldColor,h.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new Pt,this._activeBindGroups.push(u),u.setResource(l,0)),c.bindGroup=u,this._currentGlobalUniformData=c}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===yt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new st({uProjectionMatrix:{value:new G,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new G,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};Zs.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"globalUniforms"}});var jS,Qs,by=p(()=>{w();Yi();jS=1,Qs=class{constructor(){this._tasks=[],this._offset=0}init(){Yt.system.add(this._update,this)}repeat(t,e,r=!0){let s=jS++,o=0;return r&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let s=t-r.start;r.func(s),r.last=t}}}destroy(){Yt.system.remove(this._update,this),this._tasks.length=0}};Qs.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"scheduler",priority:0}});function Ty(i){if(!vy){if(O.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${vi} (${i}) http://www.pixijs.com/
764
+ `});var ca,ny=p(()=>{Q();Sr();qr();Ht();yc();R_();ry();sy();oy();ca=class extends B_{constructor(t){let{sprite:e,...r}=t,s=new Or(e.texture),o=new ot({uFilterMatrix:{value:new G,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=ae.from({vertex:{source:Lh,entryPoint:"mainVertex"},fragment:{source:Lh,entryPoint:"mainFragment"}}),a=ne.from({vertex:iy,fragment:ey,name:"mask-filter"});super({...r,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,r,s)}}});var VS,Nh,Xs,ay=p(()=>{P();Lo();ny();Xt();Hi();an();Dt();rt();We();Pe();VS=new it,Nh=class extends Re{constructor(){super(),this.filters=[new ca({sprite:new Nt(E.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},Xs=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let s=this._renderer;if(s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(r,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=z.get(Nh);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=Ir(t.mask.mask,!0,VS);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=ft.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let c=s.sprite;c.texture=a,c.worldTransform.tx=o.minX,c.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===yt.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();r&&ft.returnTexture(s.filterTexture),z.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};Xs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"alphaMask"}});var $s,cy=p(()=>{P();$s=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};$s.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"colorMask"}});var Ys,ly=p(()=>{P();bi();Tr();Ys=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(o.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let c=this._maskHash.get(o);c.instructionsStart=r.instructionSize,a.collectRenderables(r,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-c.instructionsStart-1;c.instructionsLength=l;let h=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[h]??(s[h]=0)}pop(t,e,r){let s=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[n.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(lt.RENDERING_MASK_ADD,o),o++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode(lt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(lt.MASK_ACTIVE,o),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),o!==0?r.stencil.setStencilMode(lt.RENDERING_MASK_REMOVE,o):(r.renderTarget.clear(null,Et.STENCIL),r.stencil.setStencilMode(lt.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode(lt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(lt.MASK_ACTIVE,o),r.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};Ys.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"stencilMask"}});var Hh,uy,dy=p(()=>{Mt();P();Hh=class hy{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new X(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...hy.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Hh.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"background",priority:0};Hh.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};uy=Hh});var js,Ks,fy=p(()=>{P();Lo();st();js={};I.handle(x.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");js[i.name]=i.ref},i=>{delete js[i.name]});Ks=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!js[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!js[e]){F(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new Re,r.filters=[new js[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};Ks.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"blendMode"}});var Wh,zh,my,gy=p(()=>{P();de();rt();Wh={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},zh=class py{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof at||t instanceof E?{target:t,...e}:{...e,...t}}async image(t){let e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,py.defaultImageOptions);let{format:e,quality:r}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let c=new FileReader;c.onload=()=>o(c.result),c.onerror=n,c.readAsDataURL(a)},Wh[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(Wh[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Wh[e],quality:r});return new Promise((n,a)=>{let c=new FileReader;c.onload=()=>n(c.result),c.onerror=a,c.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer;if(e instanceof E)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),o=r.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof E?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof at&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof E?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=e.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};zh.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"extract"};zh.defaultImageOptions={format:"png",quality:1};my=zh});var la,xy=p(()=>{$t();rt();la=class i extends E{static create(t){return new i({source:new et(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var XS,$S,YS,qs,_y=p(()=>{Mt();P();Q();bt();Xt();Vo();de();xy();XS=new V,$S=new it,YS=[0,0,0,0],qs=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof at&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,r=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:X.shared.setValue(o).toArray():o=YS;let n=t.frame?.copyTo(XS)||Ur(s,$S).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=la.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),c=G.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:c,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};qs.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGenerator"}});var Zs,yy=p(()=>{P();Q();ie();ni();Ye();Pe();Ht();Zs=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new G,worldColor:4294967295,offset:new K},c={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let h=l.uniforms;h.uProjectionMatrix=c.projectionMatrix,h.uResolution=c.resolution,h.uWorldTransformMatrix.copyFrom(c.worldTransformMatrix),h.uWorldTransformMatrix.tx-=c.offset.x,h.uWorldTransformMatrix.ty-=c.offset.y,Ae(c.worldColor,h.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new Pt,this._activeBindGroups.push(u),u.setResource(l,0)),c.bindGroup=u,this._currentGlobalUniformData=c}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===yt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new ot({uProjectionMatrix:{value:new G,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new G,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};Zs.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"globalUniforms"}});var jS,Qs,by=p(()=>{P();Yi();jS=1,Qs=class{constructor(){this._tasks=[],this._offset=0}init(){Yt.system.add(this._update,this)}repeat(t,e,r=!0){let s=jS++,o=0;return r&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let s=t-r.start;r.func(s),r.last=t}}}destroy(){Yt.system.remove(this._update,this),this._tasks.length=0}};Qs.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"scheduler",priority:0}});function Ty(i){if(!vy){if(L.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Ti} (${i}) http://www.pixijs.com/
765
765
 
766
- `,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${vi} - ${i} - http://www.pixijs.com/`);vy=!0}}var vy,Sy=p(()=>{ct();Fh();vy=!1});var Ti,wy=p(()=>{w();Sy();Pe();Ti=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===yt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),Ty(e)}}};Ti.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"hello",priority:-2};Ti.defaultOptions={hello:!1}});function Py(i){let t=!1;for(let r in i)if(i[r]==null){t=!0;break}if(!t)return i;let e=Object.create(null);for(let r in i){let s=i[r];s&&(e[r]=s)}return e}function Ay(i){let t=0;for(let e=0;e<i.length;e++)i[e]==null?t++:i[e-t]=i[e];return i.length-=t,i}var Ey=p(()=>{"use strict"});var KS,Vh,My,By=p(()=>{w();Ey();KS=0,Vh=class Cy{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...Cy.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedHashes)e.context[e.hash]=Py(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)Ay(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=KS++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,r=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,c=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===c&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let l=r;a&&(a.structureDidChange=!0),l[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}};Vh.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"renderableGC",priority:0};Vh.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};My=Vh});var Xh,Gy,ky=p(()=>{w();Xh=class Ry{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...Ry.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};Xh.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGC"};Xh.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};Gy=Xh});var Iy,Js,$h=p(()=>{Rt();$t();et();Iy=class Fy{constructor(t={}){if(this.uid=j("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...Fy.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new tt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.source)];let e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof C||t.depthStencilTexture instanceof tt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new tt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};Iy.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Js=Iy});function ha(i,t){if(!to.has(i)){let e=new C({source:new It({resource:i,...t})}),r=()=>{to.get(i)===e&&to.delete(i)};e.once("destroy",r),e.source.once("destroy",r),to.set(i,e)}return to.get(i)}var to,Yh=p(()=>{Wr();et();to=new Map});var jh,Dy,Oy=p(()=>{ct();w();bt();dt();$h();Yh();jh=class Uy{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={...Uy.defaultOptions,...t},t.view&&(D(W,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new V(0,0,t.width,t.height),this.canvas=t.canvas||O.get().createCanvas(),this.antialias=!!t.antialias,this.texture=ha(this.canvas,t),this.renderTarget=new Js({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};jh.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"view",priority:0};jh.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};Dy=jh});var ua,da,Kh=p(()=>{z_();V_();Z_();Q_();Uh();ty();ay();cy();ly();dy();fy();gy();_y();yy();by();wy();By();ky();Oy();ua=[uy,Zs,Ti,Dy,Hs,Gy,qs,my,Vs,My,Qs],da=[Ks,Oh,Ws,Ls,Xs,Ys,$s,Ds]});var eo,Ly=p(()=>{w();eo=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let s=this._gpu.device,o=e.layout[r],n=[],a=this._renderer;for(let h in o){let u=t.resources[h]??t.resources[o[h]],d;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let m=f.buffer;d={buffer:a.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;d=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[h],resource:d})}let c=a.shader.getProgramData(e).bindGroups[r],l=s.createBindGroup({layout:c,entries:n});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};eo.extension={type:[x.WebGPUSystem],name:"bindGroup"}});var ro,Ny=p(()=>{w();qc();ro=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(ss(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}};ro.extension={type:[x.WebGPUSystem],name:"buffer"}});var io,Hy=p(()=>{w();io=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}};io.extension={type:[x.WebGPUSystem],name:"colorMask"}});var Si,Wy=p(()=>{ct();w();Si=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await O.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};Si.extension={type:[x.WebGPUSystem],name:"device"};Si.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var so,zy=p(()=>{w();so=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,r,s){let o=this._renderer.pipeline.getPipeline(t,e,r,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(s,t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let s=t.groups[r];e||this._syncBindGroup(s),this.setBindGroup(r,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:o,size:n,start:a,instanceCount:c,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,o),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,c??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),c??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}};so.extension={type:[x.WebGPUSystem],name:"encoder",priority:1}});var oo,Vy=p(()=>{w();vr();oo=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:lt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};oo.extension={type:[x.WebGPUSystem],name:"stencil"}});var wi,qh=p(()=>{Mh();je();De();wi=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!sa())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new mt({data:new Float32Array(e.layout.size/4),usage:Y.UNIFORM|Y.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);r=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new mt({data:new Float32Array(s.layout.size/4),usage:Y.UNIFORM|Y.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),r||(r=0),s.syncFunction(t.uniforms,e,o,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function Xy(i){let t=i.map(r=>({data:r,offset:0,size:0})),e=0;for(let r=0;r<t.length;r++){let s=t[r],o=no[s.data.type].size,n=no[s.data.type].align;if(!no[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var no,Zh=p(()=>{"use strict";no={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}});var He,Qh=p(()=>{"use strict";He=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
766
+ `,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${Ti} - ${i} - http://www.pixijs.com/`);vy=!0}}var vy,Sy=p(()=>{ct();Fh();vy=!1});var Si,wy=p(()=>{P();Sy();Pe();Si=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===yt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),Ty(e)}}};Si.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"hello",priority:-2};Si.defaultOptions={hello:!1}});function Py(i){let t=!1;for(let r in i)if(i[r]==null){t=!0;break}if(!t)return i;let e=Object.create(null);for(let r in i){let s=i[r];s&&(e[r]=s)}return e}function Ay(i){let t=0;for(let e=0;e<i.length;e++)i[e]==null?t++:i[e-t]=i[e];return i.length-=t,i}var Ey=p(()=>{"use strict"});var KS,Vh,My,By=p(()=>{P();Ey();KS=0,Vh=class Cy{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...Cy.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedHashes)e.context[e.hash]=Py(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)Ay(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=KS++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,r=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,c=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===c&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let l=r;a&&(a.structureDidChange=!0),l[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}};Vh.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"renderableGC",priority:0};Vh.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};My=Vh});var Xh,Gy,ky=p(()=>{P();Xh=class Ry{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...Ry.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};Xh.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGC"};Xh.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};Gy=Xh});var Iy,Js,$h=p(()=>{Rt();$t();rt();Iy=class Fy{constructor(t={}){if(this.uid=Y("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...Fy.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new et({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.source)];let e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof E||t.depthStencilTexture instanceof et?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new et({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};Iy.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Js=Iy});function ha(i,t){if(!to.has(i)){let e=new E({source:new It({resource:i,...t})}),r=()=>{to.get(i)===e&&to.delete(i)};e.once("destroy",r),e.source.once("destroy",r),to.set(i,e)}return to.get(i)}var to,Yh=p(()=>{zr();rt();to=new Map});var jh,Dy,Oy=p(()=>{ct();P();bt();dt();$h();Yh();jh=class Uy{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={...Uy.defaultOptions,...t},t.view&&(O(W,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new V(0,0,t.width,t.height),this.canvas=t.canvas||L.get().createCanvas(),this.antialias=!!t.antialias,this.texture=ha(this.canvas,t),this.renderTarget=new Js({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};jh.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"view",priority:0};jh.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};Dy=jh});var ua,da,Kh=p(()=>{z_();V_();Z_();Q_();Uh();ty();ay();cy();ly();dy();fy();gy();_y();yy();by();wy();By();ky();Oy();ua=[uy,Zs,Si,Dy,Hs,Gy,qs,my,Vs,My,Qs],da=[Ks,Oh,Ws,Ls,Xs,Ys,$s,Ds]});var eo,Ly=p(()=>{P();eo=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let s=this._gpu.device,o=e.layout[r],n=[],a=this._renderer;for(let h in o){let u=t.resources[h]??t.resources[o[h]],f;if(u._resourceType==="uniformGroup"){let d=u;a.ubo.updateUniformGroup(d);let m=d.buffer;f={buffer:a.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(u._resourceType==="buffer"){let d=u;f={buffer:a.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(u._resourceType==="bufferResource"){let d=u;f={buffer:a.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(u._resourceType==="textureSampler"){let d=u;f=a.texture.getGpuSampler(d)}else if(u._resourceType==="textureSource"){let d=u;f=a.texture.getGpuSource(d).createView({})}n.push({binding:o[h],resource:f})}let c=a.shader.getProgramData(e).bindGroups[r],l=s.createBindGroup({layout:c,entries:n});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};eo.extension={type:[x.WebGPUSystem],name:"bindGroup"}});var ro,Ny=p(()=>{P();qc();ro=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(ss(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}};ro.extension={type:[x.WebGPUSystem],name:"buffer"}});var io,Hy=p(()=>{P();io=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}};io.extension={type:[x.WebGPUSystem],name:"colorMask"}});var wi,Wy=p(()=>{ct();P();wi=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await L.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};wi.extension={type:[x.WebGPUSystem],name:"device"};wi.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var so,zy=p(()=>{P();so=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,r,s){let o=this._renderer.pipeline.getPipeline(t,e,r,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(s,t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let s=t.groups[r];e||this._syncBindGroup(s),this.setBindGroup(r,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:o,size:n,start:a,instanceCount:c,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,o),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,c??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),c??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}};so.extension={type:[x.WebGPUSystem],name:"encoder",priority:1}});var oo,Vy=p(()=>{P();Tr();oo=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:lt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};oo.extension={type:[x.WebGPUSystem],name:"stencil"}});var Pi,qh=p(()=>{Mh();je();De();Pi=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!sa())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new mt({data:new Float32Array(e.layout.size/4),usage:$.UNIFORM|$.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);r=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new mt({data:new Float32Array(s.layout.size/4),usage:$.UNIFORM|$.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),r||(r=0),s.syncFunction(t.uniforms,e,o,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function Xy(i){let t=i.map(r=>({data:r,offset:0,size:0})),e=0;for(let r=0;r<t.length;r++){let s=t[r],o=no[s.data.type].size,n=no[s.data.type].align;if(!no[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var no,Zh=p(()=>{"use strict";no={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}});var He,Qh=p(()=>{"use strict";He=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
767
767
  var matrix = uv[name].toArray(true);
768
768
  data[offset] = matrix[0];
769
769
  data[offset + 1] = matrix[1];
@@ -841,12 +841,12 @@ fn mainFragment(
841
841
  var index = 0;
842
842
  var name = null;
843
843
  var arrayOffset = null;
844
- `],o=0;for(let a=0;a<i.length;a++){let c=i[a],l=c.data.name,h=!1,u=0;for(let d=0;d<He.length;d++)if(He[d].test(c.data)){u=c.offset/4,s.push(`name = "${l}";`,`offset += ${u-o};`,He[d][t]||He[d].ubo),h=!0;break}if(!h)if(c.data.size>1)u=c.offset/4,s.push(e(c,u-o));else{let d=r[c.data.type];u=c.offset/4,s.push(`
844
+ `],o=0;for(let a=0;a<i.length;a++){let c=i[a],l=c.data.name,h=!1,u=0;for(let f=0;f<He.length;f++)if(He[f].test(c.data)){u=c.offset/4,s.push(`name = "${l}";`,`offset += ${u-o};`,He[f][t]||He[f].ubo),h=!0;break}if(!h)if(c.data.size>1)u=c.offset/4,s.push(e(c,u-o));else{let f=r[c.data.type];u=c.offset/4,s.push(`
845
845
  v = uv.${l};
846
846
  offset += ${u-o};
847
- ${d};
847
+ ${f};
848
848
  `)}o=u}let n=s.join(`
849
- `);return new Function("uv","data","dataInt32","offset",n)}var Jh=p(()=>{Qh()});function Pi(i,t){return`
849
+ `);return new Function("uv","data","dataInt32","offset",n)}var Jh=p(()=>{Qh()});function Ai(i,t){return`
850
850
  for (let i = 0; i < ${i*t}; i++) {
851
851
  data[offset + (((i / ${i})|0) * 4) + (i % ${i})] = v[i];
852
852
  }
@@ -886,7 +886,7 @@ fn mainFragment(
886
886
  data[offset + 10] = v[8];`,"mat4x4<f32>":`
887
887
  for (let i = 0; i < 16; i++) {
888
888
  data[offset + i] = v[i];
889
- }`,"mat3x2<f32>":Pi(3,2),"mat4x2<f32>":Pi(4,2),"mat2x3<f32>":Pi(2,3),"mat4x3<f32>":Pi(4,3),"mat2x4<f32>":Pi(2,4),"mat3x4<f32>":Pi(3,4)},$y={...tu,"mat2x2<f32>":`
889
+ }`,"mat3x2<f32>":Ai(3,2),"mat4x2<f32>":Ai(4,2),"mat2x3<f32>":Ai(2,3),"mat4x3<f32>":Ai(4,3),"mat2x4<f32>":Ai(2,4),"mat3x4<f32>":Ai(3,4)},$y={...tu,"mat2x2<f32>":`
890
890
  data[offset] = v[0];
891
891
  data[offset + 1] = v[1];
892
892
  data[offset + 2] = v[2];
@@ -907,7 +907,7 @@ fn mainFragment(
907
907
  }
908
908
  ${s!==0?`arrayOffset += ${s};`:""}
909
909
  }
910
- `}var jy=p(()=>{Zh()});function Ky(i){return fa(i,"uboWgsl",Yy,$y)}var qy=p(()=>{Jh();eu();jy()});var ao,Zy=p(()=>{w();qh();Zh();qy();ao=class extends wi{constructor(){super({createUboElements:Xy,generateUboSync:Ky})}};ao.extension={type:[x.WebGPUSystem],name:"ubo"}});var er,pa=p(()=>{kt();Rt();er=class extends nt{constructor({buffer:t,offset:e,size:r}){super(),this.uid=j("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=j("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=j("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var ma,Qy=p(()=>{"use strict";ma=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}});var rr,co,Jy=p(()=>{w();je();pa();De();Qy();Ye();rr=128,co=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new ma({minUniformOffsetAlignment:rr});let e=256/rr;for(let r=0;r<e;r++){let s=Y.UNIFORM|Y.COPY_DST;r===0&&(s|=Y.COPY_SRC),this._buffers.push(new mt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let r=t.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/rr),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/rr)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/rr)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/rr;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new er({buffer:e,offset:(t/2|0)*256,size:rr})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new Pt({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),rr,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};co.extension={type:[x.WebGPUPipes],name:"uniformBatch"}});function ga(i,t){for(let e in i.attributes){let r=i.attributes[e],s=t[e];s?(r.format??(r.format=s.format),r.offset??(r.offset=s.offset),r.instance??(r.instance=s.instance)):F(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}qS(i)}function qS(i){let{buffers:t,attributes:e}=i,r={},s={};for(let o in t){let n=t[o];r[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];r[n.buffer.uid]+=Kt(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=r[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=Kt(n.format).stride}}var ru=p(()=>{it();Sr()});var Me,iu=p(()=>{vr();Me=[];Me[lt.NONE]=void 0;Me[lt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Me[lt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Me[lt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Me[lt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Me[lt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function QS(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function JS(i,t,e,r){return e<<6|i<<3|r<<1|t}var ZS,lo,tb=p(()=>{w();it();ru();vr();as();iu();ZS={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};lo=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(lt.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Me[t],this._updatePipeHash())}setPipeline(t,e,r,s){let o=this.getPipeline(t,e,r);s.setPipeline(o)}getPipeline(t,e,r,s){t._layoutKey||(ga(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=QS(t._layoutKey,e._layoutKey,r.data,r._blendModeId,ZS[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,r,s),this._pipeCache[o])}_createPipeline(t,e,r,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===lt.RENDERING_MASK_ADD?0:this._colorMask;let c=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:r.cullMode},layout:c,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),o.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],r=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let o=e.join("|");return t._layoutKey=Oe(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[r++]=a.location}let o=e.join("|");return t._attributeLocationsKey=Oe(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let l=Object.values(s[a].attributes)[0].shaderLocation;for(let h in n)if(n[h].location===l){o[a]=h;break}}return this._bindingNamesCache[r]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let c in e.attributeData){let l=t.attributes[c];(l.divisor??1)!==1&&F(`Attribute ${c} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===o&&(n.arrayStride=l.stride,n.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[c].location,offset:l.offset,format:l.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){let t=JS(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};lo.extension={type:[x.WebGPUSystem],name:"pipeline"}});function eb(i,t,e,r,s,o){let n=o?1:-1;return i.identity(),i.a=1/r*2,i.d=n*(1/s*2),i.tx=-1-t*i.a,i.ty=-n-e*i.d,i}var rb=p(()=>{"use strict"});function ib(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var sb=p(()=>{"use strict"});var Ai,su=p(()=>{Z();bt();yi();rb();Bh();Wr();$t();et();Yh();sb();$h();Ai=class{constructor(t){this.rootViewPort=new V,this.viewport=new V,this.onRenderTargetChange=new bi("onRenderTargetChange"),this.projectionMatrix=new G,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:s}){this._renderTargetStack.length=0,this.push(t,e,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=ib(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let c=o.colorTexture,l=this.viewport,h=c.pixelWidth,u=c.pixelHeight;if(!s&&t instanceof C&&(s=t.frame),s){let d=c._resolution;l.x=s.x*d+.5|0,l.y=s.y*d+.5|0,l.width=s.width*d+.5|0,l.height=s.height*d+.5|0}else l.x=0,l.y=0,l.width=h,l.height=u;return eb(this.projectionMatrix,0,0,l.width/c.resolution,l.height/c.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,r,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=Et.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=Et.ALL,r,s){let o=this.bind(t,e,r,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,s,o){r.x<0&&(s.width+=r.x,o.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,o.y-=r.y,r.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-r.x),s.height=Math.min(s.height,a-r.y),this.adaptor.copyToTexture(t,e,r,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return It.test(t)&&(t=ha(t).source),t instanceof Js?e=t:t instanceof tt&&(e=new Js({colorTextures:[t]}),It.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var xa,ob=p(()=>{"use strict";xa=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var _a,nb=p(()=>{yi();Wr();$t();ob();_a=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),c=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:c,origin:o},s),e}startRenderPass(t,e=!0,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,r);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){typeof e=="boolean"&&(e=e?Et.ALL:Et.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((l,h)=>{let u=o.contexts[h],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),o.msaaTextures[h]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[h]));let m=e&Et.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:r,storeOp:"store",loadOp:m}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let l=e&Et.STENCIL?"clear":"load",h=e&Et.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:h,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,r,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let l=a.createCommandEncoder(),h=this.getDescriptor(t,e,r),u=l.beginRenderPass(h);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=l.finish();a.queue.submit([d])}else this.startRenderPass(t,e,r,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new xa;return t.colorTextures.forEach((r,s)=>{if(It.test(r.resource)){let o=r.resource.getContext("webgpu"),n=r.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=r.source.antialias,r.source.antialias){let o=new tt({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((r,s)=>{e.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}});var ho,ab=p(()=>{w();su();nb();ho=class extends Ai{constructor(t){super(t),this.adaptor=new _a,this.adaptor.init(t,this)}};ho.extension={type:[x.WebGPUSystem],name:"renderTarget"}});var uo,cb=p(()=>{w();uo=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,r=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};uo.extension={type:[x.WebGPUSystem],name:"shader"}});var Vt,lb=p(()=>{"use strict";Vt={};Vt.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Vt.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Vt.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Vt.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Vt.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Vt.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Vt["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Vt["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Vt["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Vt.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Vt.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Vt.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var fo,hb=p(()=>{w();me();lb();fo=class{constructor(){this.defaultState=new xt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Vt[t.blendMode]||Vt.normal}]}destroy(){this.gpu=null}};fo.extension={type:[x.WebGPUSystem],name:"state"}});var ub,db=p(()=>{"use strict";ub={type:"image",upload(i,t,e){let r=i.resource,s=(i.pixelWidth|0)*(i.pixelHeight|0),o=r.byteLength/s;e.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelHeight*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var ou,tw,fb,pb=p(()=>{"use strict";ou={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},tw={blockBytes:4,blockWidth:1,blockHeight:1},fb={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=ou[i.format]||tw;for(let n=0;n<i.resource.length;n++){let a=i.resource[n],c=Math.ceil(r/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:c},{width:Math.ceil(r/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var ya,nu=p(()=>{"use strict";ya={type:"image",upload(i,t,e){let r=i.resource;if(!r)return;let s=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),n=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var mb,gb=p(()=>{nu();mb={type:"video",upload(i,t,e){ya.upload(i,t,e)}}});var ba,xb=p(()=>{"use strict";ba=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
910
+ `}var jy=p(()=>{Zh()});function Ky(i){return fa(i,"uboWgsl",Yy,$y)}var qy=p(()=>{Jh();eu();jy()});var ao,Zy=p(()=>{P();qh();Zh();qy();ao=class extends Pi{constructor(){super({createUboElements:Xy,generateUboSync:Ky})}};ao.extension={type:[x.WebGPUSystem],name:"ubo"}});var er,pa=p(()=>{kt();Rt();er=class extends nt{constructor({buffer:t,offset:e,size:r}){super(),this.uid=Y("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=Y("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=Y("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var ma,Qy=p(()=>{"use strict";ma=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}});var rr,co,Jy=p(()=>{P();je();pa();De();Qy();Ye();rr=128,co=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new ma({minUniformOffsetAlignment:rr});let e=256/rr;for(let r=0;r<e;r++){let s=$.UNIFORM|$.COPY_DST;r===0&&(s|=$.COPY_SRC),this._buffers.push(new mt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let r=t.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/rr),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/rr)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/rr)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/rr;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new er({buffer:e,offset:(t/2|0)*256,size:rr})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new Pt({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),rr,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};co.extension={type:[x.WebGPUPipes],name:"uniformBatch"}});function ga(i,t){for(let e in i.attributes){let r=i.attributes[e],s=t[e];s?(r.format??(r.format=s.format),r.offset??(r.offset=s.offset),r.instance??(r.instance=s.instance)):F(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}qS(i)}function qS(i){let{buffers:t,attributes:e}=i,r={},s={};for(let o in t){let n=t[o];r[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];r[n.buffer.uid]+=Kt(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=r[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=Kt(n.format).stride}}var ru=p(()=>{st();wr()});var Me,iu=p(()=>{Tr();Me=[];Me[lt.NONE]=void 0;Me[lt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Me[lt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Me[lt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Me[lt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Me[lt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function QS(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function JS(i,t,e,r){return e<<6|i<<3|r<<1|t}var ZS,lo,tb=p(()=>{P();st();ru();Tr();as();iu();ZS={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};lo=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(lt.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Me[t],this._updatePipeHash())}setPipeline(t,e,r,s){let o=this.getPipeline(t,e,r);s.setPipeline(o)}getPipeline(t,e,r,s){t._layoutKey||(ga(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=QS(t._layoutKey,e._layoutKey,r.data,r._blendModeId,ZS[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,r,s),this._pipeCache[o])}_createPipeline(t,e,r,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===lt.RENDERING_MASK_ADD?0:this._colorMask;let c=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:r.cullMode},layout:c,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),o.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],r=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let o=e.join("|");return t._layoutKey=Oe(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[r++]=a.location}let o=e.join("|");return t._attributeLocationsKey=Oe(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let l=Object.values(s[a].attributes)[0].shaderLocation;for(let h in n)if(n[h].location===l){o[a]=h;break}}return this._bindingNamesCache[r]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let c in e.attributeData){let l=t.attributes[c];(l.divisor??1)!==1&&F(`Attribute ${c} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===o&&(n.arrayStride=l.stride,n.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[c].location,offset:l.offset,format:l.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){let t=JS(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};lo.extension={type:[x.WebGPUSystem],name:"pipeline"}});function eb(i,t,e,r,s,o){let n=o?1:-1;return i.identity(),i.a=1/r*2,i.d=n*(1/s*2),i.tx=-1-t*i.a,i.ty=-n-e*i.d,i}var rb=p(()=>{"use strict"});function ib(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var sb=p(()=>{"use strict"});var Ei,su=p(()=>{Q();bt();bi();rb();Bh();zr();$t();rt();Yh();sb();$h();Ei=class{constructor(t){this.rootViewPort=new V,this.viewport=new V,this.onRenderTargetChange=new vi("onRenderTargetChange"),this.projectionMatrix=new G,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:s}){this._renderTargetStack.length=0,this.push(t,e,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=ib(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let c=o.colorTexture,l=this.viewport,h=c.pixelWidth,u=c.pixelHeight;if(!s&&t instanceof E&&(s=t.frame),s){let f=c._resolution;l.x=s.x*f+.5|0,l.y=s.y*f+.5|0,l.width=s.width*f+.5|0,l.height=s.height*f+.5|0}else l.x=0,l.y=0,l.width=h,l.height=u;return eb(this.projectionMatrix,0,0,l.width/c.resolution,l.height/c.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,r,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=Et.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=Et.ALL,r,s){let o=this.bind(t,e,r,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,s,o){r.x<0&&(s.width+=r.x,o.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,o.y-=r.y,r.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-r.x),s.height=Math.min(s.height,a-r.y),this.adaptor.copyToTexture(t,e,r,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return It.test(t)&&(t=ha(t).source),t instanceof Js?e=t:t instanceof et&&(e=new Js({colorTextures:[t]}),It.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var xa,ob=p(()=>{"use strict";xa=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var _a,nb=p(()=>{bi();zr();$t();ob();_a=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),c=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:c,origin:o},s),e}startRenderPass(t,e=!0,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,r);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){typeof e=="boolean"&&(e=e?Et.ALL:Et.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((l,h)=>{let u=o.contexts[h],f,d;u?f=u.getCurrentTexture().createView():f=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),o.msaaTextures[h]&&(d=f,f=this._renderer.texture.getTextureView(o.msaaTextures[h]));let m=e&Et.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:f,resolveTarget:d,clearValue:r,storeOp:"store",loadOp:m}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let l=e&Et.STENCIL?"clear":"load",h=e&Et.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:h,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,r,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let l=a.createCommandEncoder(),h=this.getDescriptor(t,e,r),u=l.beginRenderPass(h);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let f=l.finish();a.queue.submit([f])}else this.startRenderPass(t,e,r,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new xa;return t.colorTextures.forEach((r,s)=>{if(It.test(r.resource)){let o=r.resource.getContext("webgpu"),n=r.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=r.source.antialias,r.source.antialias){let o=new et({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((r,s)=>{e.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}});var ho,ab=p(()=>{P();su();nb();ho=class extends Ei{constructor(t){super(t),this.adaptor=new _a,this.adaptor.init(t,this)}};ho.extension={type:[x.WebGPUSystem],name:"renderTarget"}});var uo,cb=p(()=>{P();uo=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,r=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};uo.extension={type:[x.WebGPUSystem],name:"shader"}});var Vt,lb=p(()=>{"use strict";Vt={};Vt.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Vt.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Vt.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Vt.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Vt.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Vt.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Vt["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Vt["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Vt["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Vt.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Vt.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Vt.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var fo,hb=p(()=>{P();me();lb();fo=class{constructor(){this.defaultState=new xt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Vt[t.blendMode]||Vt.normal}]}destroy(){this.gpu=null}};fo.extension={type:[x.WebGPUSystem],name:"state"}});var ub,db=p(()=>{"use strict";ub={type:"image",upload(i,t,e){let r=i.resource,s=(i.pixelWidth|0)*(i.pixelHeight|0),o=r.byteLength/s;e.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelHeight*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var ou,tw,fb,pb=p(()=>{"use strict";ou={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},tw={blockBytes:4,blockWidth:1,blockHeight:1},fb={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=ou[i.format]||tw;for(let n=0;n<i.resource.length;n++){let a=i.resource[n],c=Math.ceil(r/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:c},{width:Math.ceil(r/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var ya,nu=p(()=>{"use strict";ya={type:"image",upload(i,t,e){let r=i.resource;if(!r)return;let s=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),n=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var mb,gb=p(()=>{nu();mb={type:"video",upload(i,t,e){ya.upload(i,t,e)}}});var ba,xb=p(()=>{"use strict";ba=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
911
911
  var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
912
912
  vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
913
913
 
@@ -931,7 +931,7 @@ fn mainFragment(
931
931
  fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
932
932
  return textureSample(img, imgSampler, texCoord);
933
933
  }
934
- `})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let c={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(c)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let c=0;c<s;++c){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:c,arrayLayerCount:1}),h=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=r.createView({baseMipLevel:h++,mipLevelCount:1,dimension:"2d",baseArrayLayer:c,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),m=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});f.setPipeline(e),f.setBindGroup(0,m),f.draw(3,1,0,0),f.end(),l=d}}if(!o){let c={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let l=1;l<t.mipLevelCount;++l)n.copyTextureToTexture({texture:r,mipLevel:l-1},{texture:t,mipLevel:l},c),c.width=Math.ceil(c.width/2),c.height=Math.ceil(c.height/2)}return this.device.queue.submit([n.finish()]),o||r.destroy(),t}}});var po,_b=p(()=>{ct();w();Ht();ai();Ye();db();pb();nu();gb();xb();po=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:ya,buffer:ub,video:mb,compressed:fb},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let c=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(c))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=ou[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,o=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new ba(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new Pt({0:e,1:e.style,2:new st({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),s=O.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:O.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=Zt.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),c=new Uint8ClampedArray(a.data.buffer);return Zt.returnCanvasAndContext(r),{pixels:c,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};po.extension={type:[x.WebGPUSystem],name:"texture"}});var Tb={};$u(Tb,{WebGPURenderer:()=>au});var ew,rw,iw,yb,bb,vb,au,Sb=p(()=>{w();O_();H_();W_();ks();Kh();Pe();Ly();Ny();Hy();Wy();zy();Vy();Zy();Jy();tb();ab();cb();hb();_b();ew=[...ua,ao,so,Si,ro,po,ho,uo,fo,lo,io,oo,eo],rw=[...da,co],iw=[Us,Fs,Is],yb=[],bb=[],vb=[];k.handleByNamedList(x.WebGPUSystem,yb);k.handleByNamedList(x.WebGPUPipes,bb);k.handleByNamedList(x.WebGPUPipesAdaptor,vb);k.add(...ew,...rw,...iw);au=class extends tr{constructor(){let t={name:"webgpu",type:yt.WEBGPU,systems:yb,renderPipes:bb,renderPipeAdaptors:vb};super(t)}}});var mo,wb=p(()=>{w();Z();br();qe();cs();ls();_i();Ze();vn();pe();Ht();mo=class{init(){let t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=se(),r=Te({name:"graphics",bits:[Zr,Jr(e),xi,we]});this.shader=new gt({glProgram:r,resources:{localUniforms:t,batchSamplers:ti(e)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:c}=n.getContextRenderData(r);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let l=c.instructions;for(let h=0;h<c.instructionSize;h++){let u=l[h];if(u.size){for(let d=0;d<u.textures.count;d++)o.texture.bind(u.textures.textures[d],d);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};mo.extension={type:[x.WebGLPipesAdaptor],name:"graphics"}});var go,Pb=p(()=>{w();Z();qe();_i();Ze();Rh();pe();et();it();go=class{init(){let t=Te({name:"mesh",bits:[xi,N_,we]});this._shader=new gt({glProgram:t,resources:{uTexture:C.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){F("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=r.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};go.extension={type:[x.WebGLPipesAdaptor],name:"mesh"}});var xo,Ab=p(()=>{w();me();xo=class{constructor(){this._tempState=xt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,o=this._didUploadHash[r.uid];s.shader.bind(r,o),o||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)r.texture.bind(s[o],o);r.geometry.draw(e.topology,e.size,e.start)}};xo.extension={type:[x.WebGLPipesAdaptor],name:"batch"}});var _o,Eb=p(()=>{"use strict";_o=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(_o||{})});var va,Cb=p(()=>{"use strict";va=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var yo,Mb=p(()=>{w();De();Eb();Cb();yo=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,s){let{_gl:o}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,r*256,s||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let s=t.data,o=t.descriptor.usage&Y.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,o)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,o)),r}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let r=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=_o.ARRAY_BUFFER;t.descriptor.usage&Y.INDEX?r=_o.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&Y.UNIFORM&&(r=_o.UNIFORM_BUFFER);let s=new va(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};yo.extension={type:[x.WebGLSystem],name:"buffer"}});var cu,Rb,Gb=p(()=>{ct();w();it();cu=class Bb{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){t={...Bb.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(F("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=O.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let r=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&F("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof O.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let r,s=this.canvas;if(t===2&&(r=s.getContext("webgl2",e)),!r&&(r=s.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&F("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=this.webGLVersion===2,o=this.extensions;r.uint32Indices=s||!!o.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!o.vertexArrayObject,r.srgbTextures=s||!!o.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||F("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};cu.extension={type:[x.WebGLSystem],name:"context"};cu.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};Rb=cu});var Ta,lu,Q,hu=p(()=>{"use strict";Ta=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Ta||{}),lu=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(lu||{}),Q=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(Q||{})});function Ib(i){return kb[i]??kb.float32}var kb,Fb=p(()=>{hu();kb={uint8x2:Q.UNSIGNED_BYTE,uint8x4:Q.UNSIGNED_BYTE,sint8x2:Q.BYTE,sint8x4:Q.BYTE,unorm8x2:Q.UNSIGNED_BYTE,unorm8x4:Q.UNSIGNED_BYTE,snorm8x2:Q.BYTE,snorm8x4:Q.BYTE,uint16x2:Q.UNSIGNED_SHORT,uint16x4:Q.UNSIGNED_SHORT,sint16x2:Q.SHORT,sint16x4:Q.SHORT,unorm16x2:Q.UNSIGNED_SHORT,unorm16x4:Q.UNSIGNED_SHORT,snorm16x2:Q.SHORT,snorm16x4:Q.SHORT,float16x2:Q.HALF_FLOAT,float16x4:Q.HALF_FLOAT,float32:Q.FLOAT,float32x2:Q.FLOAT,float32x3:Q.FLOAT,float32x4:Q.FLOAT,uint32:Q.UNSIGNED_INT,uint32x2:Q.UNSIGNED_INT,uint32x3:Q.UNSIGNED_INT,uint32x4:Q.UNSIGNED_INT,sint32:Q.INT,sint32x2:Q.INT,sint32x3:Q.INT,sint32x4:Q.INT}});var sw,bo,Ub=p(()=>{w();Sr();ru();Fb();sw={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},bo=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(s,o,n,a)=>{r.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,c)=>{r.drawElementsInstancedANGLE(s,o,n,a,c)},t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.updateBuffer(s)}}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],c=a[n];if(c)return a[e._key]=c,c;ga(t,e._attributeData);let l=t.buffers;c=s.createVertexArray(),s.bindVertexArray(c);for(let h=0;h<l.length;h++){let u=l[h];o.bind(u)}return this.activateVao(t,e),a[e._key]=c,a[n]=c,s.bindVertexArray(null),c}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],s=this.gl;if(r){if(e)for(let o in r)this._activeVao!==r[o]&&this.unbind(),s.deleteVertexArray(r[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[r]){let o=this._geometryVaoHash[r];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let c=o[a],l=c.buffer,h=s.getGlBuffer(l),u=e._attributeData[a];if(u){n!==h&&(s.bind(l),n=h);let d=u.location;r.enableVertexAttribArray(d);let f=Kt(c.format),m=Ib(c.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(d,f.size,m,c.stride,c.offset):r.vertexAttribPointer(d,f.size,m,f.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){let _=c.divisor??1;r.vertexAttribDivisor(d,_)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=sw[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let c=n.indexBuffer.data.BYTES_PER_ELEMENT,l=c===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,l,(r||0)*c,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(r||0)*c)}else s>1?o.drawArraysInstanced(a,r||0,e||n.getSize(),s):o.drawArrays(a,r||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};bo.extension={type:[x.WebGLSystem],name:"geometry"}});var ow,uu,Ob,Lb=p(()=>{w();it();Yr();pe();me();$t();et();Tr();ow=new oe({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),uu=class Db{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...Db.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(F("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=xt.for2d();let s=new ne({vertex:`
934
+ `})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let c={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(c)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let c=0;c<s;++c){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:c,arrayLayerCount:1}),h=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let f=r.createView({baseMipLevel:h++,mipLevelCount:1,dimension:"2d",baseArrayLayer:c,arrayLayerCount:1}),d=n.beginRenderPass({colorAttachments:[{view:f,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),m=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});d.setPipeline(e),d.setBindGroup(0,m),d.draw(3,1,0,0),d.end(),l=f}}if(!o){let c={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let l=1;l<t.mipLevelCount;++l)n.copyTextureToTexture({texture:r,mipLevel:l-1},{texture:t,mipLevel:l},c),c.width=Math.ceil(c.width/2),c.height=Math.ceil(c.height/2)}return this.device.queue.submit([n.finish()]),o||r.destroy(),t}}});var po,_b=p(()=>{ct();P();Ht();ci();Ye();db();pb();nu();gb();xb();po=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:ya,buffer:ub,video:mb,compressed:fb},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let c=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(c))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=ou[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,o=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new ba(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new Pt({0:e,1:e.style,2:new ot({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),s=L.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:L.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=Zt.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),c=new Uint8ClampedArray(a.data.buffer);return Zt.returnCanvasAndContext(r),{pixels:c,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};po.extension={type:[x.WebGPUSystem],name:"texture"}});var Tb={};$u(Tb,{WebGPURenderer:()=>au});var ew,rw,iw,yb,bb,vb,au,Sb=p(()=>{P();O_();H_();W_();ks();Kh();Pe();Ly();Ny();Hy();Wy();zy();Vy();Zy();Jy();tb();ab();cb();hb();_b();ew=[...ua,ao,so,wi,ro,po,ho,uo,fo,lo,io,oo,eo],rw=[...da,co],iw=[Us,Fs,Is],yb=[],bb=[],vb=[];I.handleByNamedList(x.WebGPUSystem,yb);I.handleByNamedList(x.WebGPUPipes,bb);I.handleByNamedList(x.WebGPUPipesAdaptor,vb);I.add(...ew,...rw,...iw);au=class extends tr{constructor(){let t={name:"webgpu",type:yt.WEBGPU,systems:yb,renderPipes:bb,renderPipeAdaptors:vb};super(t)}}});var mo,wb=p(()=>{P();Q();vr();qe();cs();ls();yi();Ze();vn();pe();Ht();mo=class{init(){let t=new ot({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=se(),r=Te({name:"graphics",bits:[Qr,ti(e),_i,we]});this.shader=new gt({glProgram:r,resources:{localUniforms:t,batchSamplers:ei(e)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:c}=n.getContextRenderData(r);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let l=c.instructions;for(let h=0;h<c.instructionSize;h++){let u=l[h];if(u.size){for(let f=0;f<u.textures.count;f++)o.texture.bind(u.textures.textures[f],f);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};mo.extension={type:[x.WebGLPipesAdaptor],name:"graphics"}});var go,Pb=p(()=>{P();Q();qe();yi();Ze();Rh();pe();rt();st();go=class{init(){let t=Te({name:"mesh",bits:[_i,N_,we]});this._shader=new gt({glProgram:t,resources:{uTexture:E.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){F("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=r.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};go.extension={type:[x.WebGLPipesAdaptor],name:"mesh"}});var xo,Ab=p(()=>{P();me();xo=class{constructor(){this._tempState=xt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,o=this._didUploadHash[r.uid];s.shader.bind(r,o),o||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)r.texture.bind(s[o],o);r.geometry.draw(e.topology,e.size,e.start)}};xo.extension={type:[x.WebGLPipesAdaptor],name:"batch"}});var _o,Eb=p(()=>{"use strict";_o=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(_o||{})});var va,Cb=p(()=>{"use strict";va=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var yo,Mb=p(()=>{P();De();Eb();Cb();yo=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,s){let{_gl:o}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,r*256,s||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let s=t.data,o=t.descriptor.usage&$.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,o)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,o)),r}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let r=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=_o.ARRAY_BUFFER;t.descriptor.usage&$.INDEX?r=_o.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&$.UNIFORM&&(r=_o.UNIFORM_BUFFER);let s=new va(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};yo.extension={type:[x.WebGLSystem],name:"buffer"}});var cu,Rb,Gb=p(()=>{ct();P();st();cu=class Bb{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){t={...Bb.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(F("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=L.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let r=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&F("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof L.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let r,s=this.canvas;if(t===2&&(r=s.getContext("webgl2",e)),!r&&(r=s.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&F("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=this.webGLVersion===2,o=this.extensions;r.uint32Indices=s||!!o.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!o.vertexArrayObject,r.srgbTextures=s||!!o.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||F("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};cu.extension={type:[x.WebGLSystem],name:"context"};cu.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};Rb=cu});var Ta,lu,J,hu=p(()=>{"use strict";Ta=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Ta||{}),lu=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(lu||{}),J=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(J||{})});function Ib(i){return kb[i]??kb.float32}var kb,Fb=p(()=>{hu();kb={uint8x2:J.UNSIGNED_BYTE,uint8x4:J.UNSIGNED_BYTE,sint8x2:J.BYTE,sint8x4:J.BYTE,unorm8x2:J.UNSIGNED_BYTE,unorm8x4:J.UNSIGNED_BYTE,snorm8x2:J.BYTE,snorm8x4:J.BYTE,uint16x2:J.UNSIGNED_SHORT,uint16x4:J.UNSIGNED_SHORT,sint16x2:J.SHORT,sint16x4:J.SHORT,unorm16x2:J.UNSIGNED_SHORT,unorm16x4:J.UNSIGNED_SHORT,snorm16x2:J.SHORT,snorm16x4:J.SHORT,float16x2:J.HALF_FLOAT,float16x4:J.HALF_FLOAT,float32:J.FLOAT,float32x2:J.FLOAT,float32x3:J.FLOAT,float32x4:J.FLOAT,uint32:J.UNSIGNED_INT,uint32x2:J.UNSIGNED_INT,uint32x3:J.UNSIGNED_INT,uint32x4:J.UNSIGNED_INT,sint32:J.INT,sint32x2:J.INT,sint32x3:J.INT,sint32x4:J.INT}});var sw,bo,Ub=p(()=>{P();wr();ru();Fb();sw={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},bo=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(s,o,n,a)=>{r.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,c)=>{r.drawElementsInstancedANGLE(s,o,n,a,c)},t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.updateBuffer(s)}}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],c=a[n];if(c)return a[e._key]=c,c;ga(t,e._attributeData);let l=t.buffers;c=s.createVertexArray(),s.bindVertexArray(c);for(let h=0;h<l.length;h++){let u=l[h];o.bind(u)}return this.activateVao(t,e),a[e._key]=c,a[n]=c,s.bindVertexArray(null),c}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],s=this.gl;if(r){if(e)for(let o in r)this._activeVao!==r[o]&&this.unbind(),s.deleteVertexArray(r[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[r]){let o=this._geometryVaoHash[r];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let c=o[a],l=c.buffer,h=s.getGlBuffer(l),u=e._attributeData[a];if(u){n!==h&&(s.bind(l),n=h);let f=u.location;r.enableVertexAttribArray(f);let d=Kt(c.format),m=Ib(c.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(f,d.size,m,c.stride,c.offset):r.vertexAttribPointer(f,d.size,m,d.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){let g=c.divisor??1;r.vertexAttribDivisor(f,g)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=sw[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let c=n.indexBuffer.data.BYTES_PER_ELEMENT,l=c===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,l,(r||0)*c,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(r||0)*c)}else s>1?o.drawArraysInstanced(a,r||0,e||n.getSize(),s):o.drawArrays(a,r||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};bo.extension={type:[x.WebGLSystem],name:"geometry"}});var ow,uu,Ob,Lb=p(()=>{P();st();jr();pe();me();$t();rt();Sr();ow=new oe({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),uu=class Db{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...Db.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(F("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=xt.for2d();let s=new ne({vertex:`
935
935
  attribute vec2 aPosition;
936
936
  out vec2 vUv;
937
937
 
@@ -950,7 +950,7 @@ fn mainFragment(
950
950
 
951
951
  void main() {
952
952
  finalColor = texture(uTexture, vUv);
953
- }`,name:"big-triangle"});this._bigTriangleShader=new gt({glProgram:s,resources:{uTexture:C.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let r=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=r.colorTexture,t.target=this._getBackBufferTexture(r.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:ow,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new C({source:new tt({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};uu.extension={type:[x.WebGLSystem],name:"backBuffer",priority:1};uu.defaultOptions={useBackBuffer:!1};Ob=uu});var vo,Nb=p(()=>{w();vo=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}};vo.extension={type:[x.WebGLSystem],name:"colorMask"}});var To,Hb=p(()=>{w();To=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:r,shader:s,state:o,skipSync:n,topology:a,size:c,start:l,instanceCount:h}=t;e.shader.bind(s,n),e.geometry.bind(r,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,c,l,h??r.instanceCount)}destroy(){this._renderer=null}};To.extension={type:[x.WebGLSystem],name:"encoder"}});var So,Wb=p(()=>{w();iu();vr();So=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:lt.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this.resetState()}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:lt.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=lt.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Me[t],n=this._stencilCache;if(r.stencilMode=t,r.stencilReference=e,t===lt.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(t!==n.stencilMode||n.stencilReference!==e)&&(n.stencilMode=t,n.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[o.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[o.stencilBack.passOp]))}};So.extension={type:[x.WebGLSystem],name:"stencil"}});function zb(i){let t=i.map(o=>({data:o,offset:0,size:0})),e=16,r=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(r=du[n.data.type],!r)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(r=Math.max(r,e)*n.data.size);let a=r===12?16:r;n.size=r;let c=s%e;c>0&&e-c<a?s+=(e-c)%16:s+=(r-c%r)%r,n.offset=s,s+=r}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var du,fu=p(()=>{"use strict";du={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function Vb(i,t){let e=Math.max(du[i.data.type]/16,1),r=i.data.value.length/i.data.size,s=(4-r%4)%4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
953
+ }`,name:"big-triangle"});this._bigTriangleShader=new gt({glProgram:s,resources:{uTexture:E.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let r=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=r.colorTexture,t.target=this._getBackBufferTexture(r.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:ow,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new E({source:new et({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};uu.extension={type:[x.WebGLSystem],name:"backBuffer",priority:1};uu.defaultOptions={useBackBuffer:!1};Ob=uu});var vo,Nb=p(()=>{P();vo=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}};vo.extension={type:[x.WebGLSystem],name:"colorMask"}});var To,Hb=p(()=>{P();To=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:r,shader:s,state:o,skipSync:n,topology:a,size:c,start:l,instanceCount:h}=t;e.shader.bind(s,n),e.geometry.bind(r,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,c,l,h??r.instanceCount)}destroy(){this._renderer=null}};To.extension={type:[x.WebGLSystem],name:"encoder"}});var So,Wb=p(()=>{P();iu();Tr();So=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:lt.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this.resetState()}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:lt.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=lt.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Me[t],n=this._stencilCache;if(r.stencilMode=t,r.stencilReference=e,t===lt.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(t!==n.stencilMode||n.stencilReference!==e)&&(n.stencilMode=t,n.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[o.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[o.stencilBack.passOp]))}};So.extension={type:[x.WebGLSystem],name:"stencil"}});function zb(i){let t=i.map(o=>({data:o,offset:0,size:0})),e=16,r=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(r=du[n.data.type],!r)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(r=Math.max(r,e)*n.data.size);let a=r===12?16:r;n.size=r;let c=s%e;c>0&&e-c<a?s+=(e-c)%16:s+=(r-c%r)%r,n.offset=s,s+=r}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var du,fu=p(()=>{"use strict";du={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function Vb(i,t){let e=Math.max(du[i.data.type]/16,1),r=i.data.value.length/i.data.size,s=(4-r%4)%4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
954
954
  v = uv.${i.data.name};
955
955
  offset += ${t};
956
956
 
@@ -966,7 +966,7 @@ fn mainFragment(
966
966
  }
967
967
  ${s!==0?`arrayOffset += ${s};`:""}
968
968
  }
969
- `}var Xb=p(()=>{fu()});function $b(i){return fa(i,"uboStd40",Vb,tu)}var Yb=p(()=>{Jh();eu();Xb()});var wo,jb=p(()=>{w();qh();fu();Yb();wo=class extends wi{constructor(){super({createUboElements:zb,generateUboSync:$b})}};wo.extension={type:[x.WebGLSystem],name:"ubo"}});var Sa,Kb=p(()=>{"use strict";Sa=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var wa,qb=p(()=>{bt();it();Wr();yi();Kb();wa=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new V}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new V}copyToTexture(t,e,r,s,o){let n=this._renderTargetSystem,a=this._renderer,c=n.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,c.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,o.x,o.y,r.x,r.y,s.width,s.height),e}startRenderPass(t,e=!0,r,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),c=s.y;t.isRoot&&(c=n.pixelHeight-s.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let h=this._viewPortCache;(h.x!==s.x||h.y!==c||h.width!==s.width||h.height!==s.height)&&(h.x=s.x,h.y=c,h.width=s.width,h.height=s.height,l.viewport(s.x,c,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,r)}finishRenderPass(t){let r=this._renderTargetSystem.getGpuRenderTarget(t);if(!r.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,r.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,r.framebuffer),s.blitFramebuffer(0,0,r.width,r.height,0,0,r.width,r.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,r.framebuffer)}initGpuRenderTarget(t){let r=this._renderer.gl,s=new Sa,o=t.colorTexture;return It.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),r.bindFramebuffer(r.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){let e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(r=>{e.deleteRenderbuffer(r)}),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?Et.ALL:Et.NONE);let o=this._renderer.gl;if(e&Et.COLOR){r??(r=s.defaultClearColor);let n=this._clearColorCache,a=r;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let r=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,r),(t.stencil||t.depth)&&this._resizeStencil(r)}_initColor(t,e){let r=this._renderer,s=r.gl,o=s.createFramebuffer();if(e.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((n,a)=>{let c=n.source;c.antialias&&(r.context.supports.msaa?e.msaa=!0:F("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(c,0);let h=r.texture.getGlSource(c).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,h,0)}),e.msaa){let n=s.createFramebuffer();e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorTextures.forEach((a,c)=>{let l=s.createRenderbuffer();e.msaaRenderBuffer[c]=l})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(r.width,r.height,r._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,c)=>{let l=a.source;s.texture.bindSource(l,0);let u=s.texture.getGlSource(l).internalFormat,d=e.msaaRenderBuffer[c];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,u,l.pixelWidth,l.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+c,o.RENDERBUFFER,d)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),this._resizeStencil(t)}_resizeStencil(t){let e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&It.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&It.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}}});var Po,Zb=p(()=>{w();su();qb();Po=class extends Ai{constructor(t){super(t),this.adaptor=new wa,this.adaptor.init(t,this)}};Po.extension={type:[x.WebGLSystem],name:"renderTarget"}});function Qb(i,t){let e=[],r=[`
969
+ `}var Xb=p(()=>{fu()});function $b(i){return fa(i,"uboStd40",Vb,tu)}var Yb=p(()=>{Jh();eu();Xb()});var wo,jb=p(()=>{P();qh();fu();Yb();wo=class extends Pi{constructor(){super({createUboElements:zb,generateUboSync:$b})}};wo.extension={type:[x.WebGLSystem],name:"ubo"}});var Sa,Kb=p(()=>{"use strict";Sa=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var wa,qb=p(()=>{bt();st();zr();bi();Kb();wa=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new V}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new V}copyToTexture(t,e,r,s,o){let n=this._renderTargetSystem,a=this._renderer,c=n.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,c.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,o.x,o.y,r.x,r.y,s.width,s.height),e}startRenderPass(t,e=!0,r,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),c=s.y;t.isRoot&&(c=n.pixelHeight-s.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let h=this._viewPortCache;(h.x!==s.x||h.y!==c||h.width!==s.width||h.height!==s.height)&&(h.x=s.x,h.y=c,h.width=s.width,h.height=s.height,l.viewport(s.x,c,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,r)}finishRenderPass(t){let r=this._renderTargetSystem.getGpuRenderTarget(t);if(!r.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,r.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,r.framebuffer),s.blitFramebuffer(0,0,r.width,r.height,0,0,r.width,r.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,r.framebuffer)}initGpuRenderTarget(t){let r=this._renderer.gl,s=new Sa,o=t.colorTexture;return It.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),r.bindFramebuffer(r.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){let e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(r=>{e.deleteRenderbuffer(r)}),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?Et.ALL:Et.NONE);let o=this._renderer.gl;if(e&Et.COLOR){r??(r=s.defaultClearColor);let n=this._clearColorCache,a=r;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let r=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,r),(t.stencil||t.depth)&&this._resizeStencil(r)}_initColor(t,e){let r=this._renderer,s=r.gl,o=s.createFramebuffer();if(e.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((n,a)=>{let c=n.source;c.antialias&&(r.context.supports.msaa?e.msaa=!0:F("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(c,0);let h=r.texture.getGlSource(c).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,h,0)}),e.msaa){let n=s.createFramebuffer();e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorTextures.forEach((a,c)=>{let l=s.createRenderbuffer();e.msaaRenderBuffer[c]=l})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(r.width,r.height,r._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,c)=>{let l=a.source;s.texture.bindSource(l,0);let u=s.texture.getGlSource(l).internalFormat,f=e.msaaRenderBuffer[c];o.bindRenderbuffer(o.RENDERBUFFER,f),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,u,l.pixelWidth,l.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+c,o.RENDERBUFFER,f)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),this._resizeStencil(t)}_resizeStencil(t){let e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&It.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&It.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}}});var Po,Zb=p(()=>{P();su();qb();Po=class extends Ei{constructor(t){super(t),this.adaptor=new wa,this.adaptor.init(t,this)}};Po.extension={type:[x.WebGLSystem],name:"renderTarget"}});function Qb(i,t){let e=[],r=[`
970
970
  var g = s.groups;
971
971
  var sS = r.shader;
972
972
  var p = s.glProgram;
@@ -974,29 +974,29 @@ fn mainFragment(
974
974
  var resources;
975
975
  `],s=!1,o=0,n=t._getProgramData(i.glProgram);for(let c in i.groups){let l=i.groups[c];e.push(`
976
976
  resources = g[${c}].resources;
977
- `);for(let h in l.resources){let u=l.resources[h];if(u instanceof st)if(u.ubo){let d=i._uniformBindMap[c][Number(h)];e.push(`
977
+ `);for(let h in l.resources){let u=l.resources[h];if(u instanceof ot)if(u.ubo){let f=i._uniformBindMap[c][Number(h)];e.push(`
978
978
  sS.bindUniformBlock(
979
979
  resources[${h}],
980
- '${d}',
981
- ${i.glProgram._uniformBlockData[d].index}
980
+ '${f}',
981
+ ${i.glProgram._uniformBlockData[f].index}
982
982
  );
983
983
  `)}else e.push(`
984
984
  ugS.updateUniformGroup(resources[${h}], p, sD);
985
- `);else if(u instanceof er){let d=i._uniformBindMap[c][Number(h)];e.push(`
985
+ `);else if(u instanceof er){let f=i._uniformBindMap[c][Number(h)];e.push(`
986
986
  sS.bindUniformBlock(
987
987
  resources[${h}],
988
- '${d}',
989
- ${i.glProgram._uniformBlockData[d].index}
988
+ '${f}',
989
+ ${i.glProgram._uniformBlockData[f].index}
990
990
  );
991
- `)}else if(u instanceof tt){let d=i._uniformBindMap[c][h],f=n.uniformData[d];f&&(s||(s=!0,r.push(`
991
+ `)}else if(u instanceof et){let f=i._uniformBindMap[c][h],d=n.uniformData[f];d&&(s||(s=!0,r.push(`
992
992
  var tS = r.texture;
993
- `)),t._gl.uniform1i(f.location,o),e.push(`
993
+ `)),t._gl.uniform1i(d.location,o),e.push(`
994
994
  tS.bind(resources[${h}], ${o});
995
995
  `),o++)}}}let a=[...r,...e].join(`
996
- `);return new Function("r","s","sD",a)}var Jb=p(()=>{pa();Ht();$t()});var Pa,tv=p(()=>{"use strict";Pa=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function pu(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}var ev=p(()=>{"use strict"});function mu(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Aa(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return mu(2*t);case"bvec3":return mu(3*t);case"bvec4":return mu(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var gu=p(()=>{"use strict"});function xu(i,t){if(!Ea){let e=Object.keys(rv);Ea={};for(let r=0;r<e.length;++r){let s=e[r];Ea[i[s]]=rv[s]}}return Ea[t]}function iv(i,t){let e=xu(i,t);return nw[e]||"float32"}var Ea,rv,nw,_u=p(()=>{"use strict";Ea=null,rv={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},nw={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function sv(i,t,e=!1){let r={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){let a=t.getActiveAttrib(i,n);if(a.name.startsWith("gl_"))continue;let c=iv(t,a.type);r[a.name]={location:0,format:c,stride:Kt(c).stride,offset:0,instance:!1,start:0}}let o=Object.keys(r);if(e){o.sort((n,a)=>n>a?1:-1);for(let n=0;n<o.length;n++)r[o[n]].location=n,t.bindAttribLocation(i,n,o[n]);t.linkProgram(i)}else for(let n=0;n<o.length;n++)r[o[n]].location=t.getAttribLocation(i,o[n]);return r}var ov=p(()=>{Sr();_u()});function nv(i,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<r;s++){let o=t.getActiveUniformBlockName(i,s),n=t.getUniformBlockIndex(i,o),a=t.getActiveUniformBlockParameter(i,s,t.UNIFORM_BLOCK_DATA_SIZE);e[o]={name:o,index:n,size:a}}return e}var av=p(()=>{"use strict"});function cv(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),c=xu(t,o.type);e[n]={name:n,index:s,type:c,size:o.size,isArray:a,value:Aa(c,o.size)}}return e}var lv=p(()=>{gu();_u()});function hv(i,t){let e=i.getShaderSource(t).split(`
996
+ `);return new Function("r","s","sD",a)}var Jb=p(()=>{pa();Ht();$t()});var Pa,tv=p(()=>{"use strict";Pa=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function pu(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}var ev=p(()=>{"use strict"});function mu(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Aa(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return mu(2*t);case"bvec3":return mu(3*t);case"bvec4":return mu(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var gu=p(()=>{"use strict"});function xu(i,t){if(!Ea){let e=Object.keys(rv);Ea={};for(let r=0;r<e.length;++r){let s=e[r];Ea[i[s]]=rv[s]}}return Ea[t]}function iv(i,t){let e=xu(i,t);return nw[e]||"float32"}var Ea,rv,nw,_u=p(()=>{"use strict";Ea=null,rv={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},nw={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function sv(i,t,e=!1){let r={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){let a=t.getActiveAttrib(i,n);if(a.name.startsWith("gl_"))continue;let c=iv(t,a.type);r[a.name]={location:0,format:c,stride:Kt(c).stride,offset:0,instance:!1,start:0}}let o=Object.keys(r);if(e){o.sort((n,a)=>n>a?1:-1);for(let n=0;n<o.length;n++)r[o[n]].location=n,t.bindAttribLocation(i,n,o[n]);t.linkProgram(i)}else for(let n=0;n<o.length;n++)r[o[n]].location=t.getAttribLocation(i,o[n]);return r}var ov=p(()=>{wr();_u()});function nv(i,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<r;s++){let o=t.getActiveUniformBlockName(i,s),n=t.getUniformBlockIndex(i,o),a=t.getActiveUniformBlockParameter(i,s,t.UNIFORM_BLOCK_DATA_SIZE);e[o]={name:o,index:n,size:a}}return e}var av=p(()=>{"use strict"});function cv(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),c=xu(t,o.type);e[n]={name:n,index:s,type:c,size:o.size,isArray:a,value:Aa(c,o.size)}}return e}var lv=p(()=>{gu();_u()});function hv(i,t){let e=i.getShaderSource(t).split(`
997
997
  `).map((l,h)=>`${h}: ${l}`),r=i.getShaderInfoLog(t),s=r.split(`
998
998
  `),o={},n=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!o[l]?(o[l]=!0,!0):!1),a=[""];n.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let c=e.join(`
999
- `);a[0]=c,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function uv(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||hv(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||hv(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var dv=p(()=>{"use strict"});function fv(i,t){let e=pu(i,i.VERTEX_SHADER,t.vertex),r=pu(i,i.FRAGMENT_SHADER,t.fragment),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.transformFeedbackVaryings;o&&(typeof i.transformFeedbackVaryings!="function"?F("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||uv(i,s,e,r),t._attributeData=sv(s,i,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=cv(s,i),t._uniformBlockData=nv(s,i),i.deleteShader(e),i.deleteShader(r);let n={};for(let c in t._uniformData){let l=t._uniformData[c];n[c]={location:i.getUniformLocation(s,c),value:Aa(l.type,l.size)}}return new Pa(s,n)}var pv=p(()=>{it();tv();ev();gu();ov();av();lv();dv()});var Ca,Ao,mv=p(()=>{w();br();Jb();pv();Ca={textureCount:0,blockIndex:0},Ao=class{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=se()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Ca.textureCount=0,Ca.blockIndex=0;let r=this._shaderSyncFunctions[t.glProgram._key];r||(r=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),r(this._renderer,t,Ca)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Ca)}bindUniformBlock(t,e,r=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=t._bufferResource;n||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,c=s.updateBuffer(a),l=s.freeLocationForBufferBase(c);if(n){let{offset:u,size:d}=t;u===0&&d===a.data.byteLength?s.bindBufferBase(c,l):s.bindBufferRange(c,l,u)}else s.getLastBindBaseLocation(c)!==l&&s.bindBufferBase(c,l);let h=this._activeProgram._uniformBlockData[e].index;o.uniformBlockBindings[r]!==l&&(o.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(o.program,h,l))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=fv(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return Qb(t,e)}resetState(){this._activeProgram=null}};Ao.extension={type:[x.WebGLSystem],name:"shader"}});var gv,xv,_v=p(()=>{"use strict";gv={f32:`if (cv !== v) {
999
+ `);a[0]=c,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function uv(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||hv(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||hv(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var dv=p(()=>{"use strict"});function fv(i,t){let e=pu(i,i.VERTEX_SHADER,t.vertex),r=pu(i,i.FRAGMENT_SHADER,t.fragment),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.transformFeedbackVaryings;o&&(typeof i.transformFeedbackVaryings!="function"?F("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||uv(i,s,e,r),t._attributeData=sv(s,i,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=cv(s,i),t._uniformBlockData=nv(s,i),i.deleteShader(e),i.deleteShader(r);let n={};for(let c in t._uniformData){let l=t._uniformData[c];n[c]={location:i.getUniformLocation(s,c),value:Aa(l.type,l.size)}}return new Pa(s,n)}var pv=p(()=>{st();tv();ev();gu();ov();av();lv();dv()});var Ca,Ao,mv=p(()=>{P();vr();Jb();pv();Ca={textureCount:0,blockIndex:0},Ao=class{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=se()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Ca.textureCount=0,Ca.blockIndex=0;let r=this._shaderSyncFunctions[t.glProgram._key];r||(r=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),r(this._renderer,t,Ca)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Ca)}bindUniformBlock(t,e,r=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=t._bufferResource;n||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,c=s.updateBuffer(a),l=s.freeLocationForBufferBase(c);if(n){let{offset:u,size:f}=t;u===0&&f===a.data.byteLength?s.bindBufferBase(c,l):s.bindBufferRange(c,l,u)}else s.getLastBindBaseLocation(c)!==l&&s.bindBufferBase(c,l);let h=this._activeProgram._uniformBlockData[e].index;o.uniformBlockBindings[r]!==l&&(o.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(o.program,h,l))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=fv(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return Qb(t,e)}resetState(){this._activeProgram=null}};Ao.extension={type:[x.WebGLSystem],name:"shader"}});var gv,xv,_v=p(()=>{"use strict";gv={f32:`if (cv !== v) {
1000
1000
  cu.value = v;
1001
1001
  gl.uniform1f(location, v);
1002
1002
  }`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
@@ -1075,7 +1075,7 @@ fn mainFragment(
1075
1075
  var t = 0;
1076
1076
  var gl = renderer.gl;
1077
1077
  var name = null;
1078
- `];for(let r in i.uniforms){if(!t[r]){i.uniforms[r]instanceof st?i.uniforms[r].ubo?e.push(`
1078
+ `];for(let r in i.uniforms){if(!t[r]){i.uniforms[r]instanceof ot?i.uniforms[r].ubo?e.push(`
1079
1079
  renderer.shader.bindUniformBlock(uv.${r}, "${r}");
1080
1080
  `):e.push(`
1081
1081
  renderer.shader.updateUniformGroup(uv.${r});
@@ -1086,8 +1086,8 @@ fn mainFragment(
1086
1086
  cv = cu.value;
1087
1087
  v = uv["${r}"];
1088
1088
  ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
1089
- `))}var bv=p(()=>{pa();Ht();Qh();_v()});var Eo,vv=p(()=>{w();bv();Eo=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return yv(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};Eo.extension={type:[x.WebGLSystem],name:"uniformGroup"}});function Tv(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof O.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var Sv=p(()=>{ct()});var aw,cw,lw,hw,uw,dw,wv,Pv,Av=p(()=>{w();me();Sv();aw=0,cw=1,lw=2,hw=3,uw=4,dw=5,wv=class yu{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[aw]=this.setBlend,this.map[cw]=this.setOffset,this.map[lw]=this.setCullFace,this.map[hw]=this.setDepthTest,this.map[uw]=this.setFrontFace,this.map[dw]=this.setDepthMask,this.checks=[],this.defaultState=xt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=Tv(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(yu._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(yu._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};wv.extension={type:[x.WebGLSystem],name:"state"};Pv=wv});var Ma,Ev=p(()=>{hu();Ma=class{constructor(t){this.target=lu.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=Q.UNSIGNED_BYTE,this.internalFormat=Ta.RGBA,this.format=Ta.RGBA,this.samplerType=0}}});var Cv,Mv=p(()=>{"use strict";Cv={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var fw,Bv,Rv=p(()=>{"use strict";fw={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},Bv={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!fw[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Ba,bu=p(()=>{"use strict";Ba={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,c=i.resourceWidth,l=i.resourceHeight;c<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,c,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var Gv,kv=p(()=>{bu();Gv={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Ba.upload(i,t,e,r)}}});var vu,Iv,Ra,Fv,Uv=p(()=>{"use strict";vu={linear:9729,nearest:9728},Iv={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Ra={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Fv={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Tu(i,t,e,r,s,o,n,a){let c=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=Ra[n?"clamp-to-edge":i.addressModeU],h=Ra[n?"clamp-to-edge":i.addressModeV],u=Ra[n?"clamp-to-edge":i.addressModeW];t[s](c,t.TEXTURE_WRAP_S,l),t[s](c,t.TEXTURE_WRAP_T,h),t.TEXTURE_WRAP_R&&t[s](c,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](c,t.TEXTURE_MAG_FILTER,vu[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=Iv[i.minFilter][i.mipmapFilter];t[s](c,t.TEXTURE_MIN_FILTER,l)}}else t[s](c,t.TEXTURE_MIN_FILTER,vu[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](c,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](c,t.TEXTURE_COMPARE_FUNC,Fv[i.compare])}var Dv=p(()=>{Uv()});function Ov(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var Lv=p(()=>{"use strict"});function Nv(i,t){let e={},r=i.RGBA;return i instanceof O.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var Hv=p(()=>{ct()});function Wv(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var zv=p(()=>{"use strict"});var pw,Co,Vv=p(()=>{ct();w();et();Ev();Mv();Rv();bu();kv();Dv();Lv();Hv();zv();pw=4,Co=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Ba,buffer:Cv,video:Gv,compressed:Bv},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Nv(t,this._renderer.context.extensions),this._mapFormatToType=Wv(t),this._mapFormatToFormat=Ov(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(C.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=C.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new Ma(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Tu(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Tu(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:s}=this.getPixels(t),o=O.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(pw*s*o),a=this._renderer,c=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(c),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),h.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,h.RGBA,h.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(C.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Co.extension={type:[x.WebGLSystem],name:"texture"}});var jv={};$u(jv,{WebGLRenderer:()=>Su});var mw,gw,xw,Xv,$v,Yv,Su,Kv=p(()=>{w();wb();Pb();Ab();ks();Kh();Pe();Mb();Gb();Ub();Lb();Nb();Hb();Wb();jb();Zb();mv();vv();Av();Vv();mw=[...ua,wo,Ob,Rb,yo,Co,Po,bo,Eo,Ao,To,Pv,So,vo],gw=[...da],xw=[xo,go,mo],Xv=[],$v=[],Yv=[];k.handleByNamedList(x.WebGLSystem,Xv);k.handleByNamedList(x.WebGLPipes,$v);k.handleByNamedList(x.WebGLPipesAdaptor,Yv);k.add(...mw,...gw,...xw);Su=class extends tr{constructor(){let t={name:"webgl",type:yt.WEBGL,systems:Xv,renderPipes:$v,renderPipeAdaptors:Yv};super(t)}}});w();var A_={extension:{type:x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(P_(),DS))}};w();var C_={extension:{type:x.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(E_(),OS))}};w();w();dn();on();w();ct();ks();var oa;function U_(i){return oa!==void 0||(oa=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??tr.defaultOptions.failIfMajorPerformanceCaveat};try{if(!O.get().getWebGLRenderingContext())return!1;let r=O.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),oa}ct();var na;async function D_(i={}){return na!==void 0||(na=await(async()=>{let t=O.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),na}ks();var qv=["webgl","webgpu","canvas"];async function Zv(i){let t=[];i.preference?(t.push(i.preference),qv.forEach(o=>{o!==i.preference&&t.push(o)})):t=qv.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await D_()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(Sb(),Tb));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&U_(i.failIfMajorPerformanceCaveat??tr.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(Kv(),jv));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}de();Uh();dt();var Qv=class wu{constructor(...t){this.stage=new at,t[0]!==void 0&&D(W,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await Zv(t),wu._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return D(W,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=wu._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Qv._plugins=[];var Ga=Qv;k.handleByList(x.Application,Ga._plugins);k.add(zs);w();Fe();Uc();ct();w();_r();bt();et();dh();xh();var Mo=class extends fi{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:c}=r[n.page],l=new V(n.x+a.x,n.y+a.y,n.width,n.height),h=new C({source:c,frame:l});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:h}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Ps.install(t)}static uninstall(t){Ps.uninstall(t)}};var ka={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),m={};for(let _ in f){let g=f[_].split("="),b=g[0],y=g[1].replace(/"/gm,""),v=parseFloat(y),T=isNaN(v)?y:v;m[b]=T}e[d].push(m)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let c={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),m=d.letter??d.char??String.fromCharCode(f);m==="space"&&(m=" "),c[f]=m,r.chars[m]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let h=e.kerning||[];for(let u=0;u<h.length;u++){let d=parseInt(h[u].first,10),f=parseInt(h[u].second,10),m=parseInt(h[u].amount,10);r.chars[c[f]].kerning[c[d]]=m}return r}};ct();var Pu={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let c={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let h=n[l],u=parseInt(h.getAttribute("id"),10),d=h.getAttribute("letter")??h.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),c[u]=d,t.chars[d]={id:u,page:parseInt(h.getAttribute("page"),10)||0,x:parseInt(h.getAttribute("x"),10),y:parseInt(h.getAttribute("y"),10),width:parseInt(h.getAttribute("width"),10),height:parseInt(h.getAttribute("height"),10),xOffset:parseInt(h.getAttribute("xoffset"),10),yOffset:parseInt(h.getAttribute("yoffset"),10),xAdvance:parseInt(h.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){let h=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[c[u]].kerning[c[h]]=d}return t}};var Au={test(i){return typeof i=="string"&&i.includes("<font>")?Pu.test(O.get().parseXML(i)):!1},parse(i){return Pu.parse(O.get().parseXML(i))}};var _w=[".xml",".fnt"],Jv={extension:{type:x.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof Mo,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},t0={extension:{type:x.LoadParser,priority:wt.Normal},name:"loadBitmapFont",test(i){return _w.includes(vt.extname(i).toLowerCase())},async testParse(i){return ka.test(i)||Au.test(i)},async parse(i,t,e){let r=ka.test(i)?ka.parse(i):Au.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=vt.join(vt.dirname(s),d);f=Ji(f,s),n.push({src:f,data:a})}let c=await e.load(n),l=n.map(u=>c[u.src]);return new Mo({data:r,textures:l},s)},async load(i,t){return await(await O.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};it();var Ia=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};$e();w();et();var e0={extension:{type:x.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof C),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};w();async function Fa(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var r0={extension:{type:x.DetectionParser,priority:1},test:async()=>Fa("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};w();var i0=["png","jpg","jpeg"],s0={extension:{type:x.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...i0],remove:async i=>i.filter(t=>!i0.includes(t))};w();var yw="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Ei(i){return yw?!1:document.createElement("video").canPlayType(i)!==""}var o0={extension:{type:x.DetectionParser,priority:0},test:async()=>Ei("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};w();var n0={extension:{type:x.DetectionParser,priority:0},test:async()=>Ei("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};w();var a0={extension:{type:x.DetectionParser,priority:0},test:async()=>Ei("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};w();var c0={extension:{type:x.DetectionParser,priority:0},test:async()=>Fa("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};it();_r();Qi();sn();var Ua=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||F(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return F(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=yr(t),n=Lt(t,l=>({alias:[l],src:l,data:{}})),a=n.length,c=n.map(async l=>{let h=vt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[h]||(this.promiseCache[h]=this._getLoadPromiseAndParser(h,l)),s[l.src]=await this.promiseCache[h].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[h],delete s[l.src],new Error(`[Loader.load] Failed to load ${h}.
1090
- ${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Lt(t,s=>({alias:[s],src:s})).map(async s=>{let o=vt.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(r)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&F(`[Assets] loadParser name conflict "${e.name}"`):F("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};ct();w();function ce(i,t){if(Array.isArray(t)){for(let e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}_r();function le(i,t){let e=i.split("?")[0],r=vt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}Fe();var bw=".json",vw="application/json",l0={extension:{type:x.LoadParser,priority:wt.Low},name:"loadJson",test(i){return ce(i,vw)||le(i,bw)},async load(i){return await(await O.get().fetch(i)).json()}};ct();w();Fe();var Tw=".txt",Sw="text/plain",h0={name:"loadTxt",extension:{type:x.LoadParser,priority:wt.Low,name:"loadTxt"},test(i){return ce(i,Sw)||le(i,Tw)},async load(i){return await(await O.get().fetch(i)).text()}};ct();w();it();_r();$e();Fe();var ww=["normal","bold","100","200","300","400","500","600","700","800","900"],Pw=[".ttf",".otf",".woff",".woff2"],Aw=["font/ttf","font/otf","font/woff","font/woff2"],Ew=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Cw(i){let t=vt.extname(i),s=vt.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(Ew)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var Mw=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Bw(i){return Mw.test(i)?i:encodeURI(i)}var u0={extension:{type:x.LoadParser,priority:wt.Low},name:"loadWebFont",test(i){return ce(i,Aw)||le(i,Pw)},async load(i,t){let e=O.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??Cw(i),o=t.data?.weights?.filter(a=>ww.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let c=o[a],l=new FontFace(s,`url(${Bw(i)})`,{...n,weight:c});await l.load(),e.add(l),r.push(l)}return J.set(`${s}-and-url`,{url:i,fontFaces:r}),r.length===1?r[0]:r}return F("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>{J.remove(`${t.family}-and-url`),O.get().getFontFaceSet().delete(t)})}};ct();w();zr();Vn();Hr();function Ci(i,t=1){let e=te.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}Fe();et();it();$e();function Mi(i,t,e){i.label=e,i._sourceOrigin=e;let r=new C({source:i,label:e}),s=()=>{delete t.promiseCache[e],J.has(e)&&J.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(F("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),r.once("destroy",()=>{i.destroyed||(F("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var Rw=".svg",Gw="image/svg+xml",d0={extension:{type:x.LoadParser,priority:wt.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return ce(i,Gw)||le(i,Rw)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?Iw(i):kw(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function kw(i,t,e,r){let o=await(await O.get().fetch(i)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=r,await a.decode(),URL.revokeObjectURL(n);let c=document.createElement("canvas"),l=c.getContext("2d"),h=t.data?.resolution||Ci(i),u=t.data?.width??a.width,d=t.data?.height??a.height;c.width=u*h,c.height=d*h,l.drawImage(a,0,0,u*h,d*h);let{parseAsGraphicsContext:f,...m}=t.data??{},_=new jt({resource:c,alphaMode:"premultiply-alpha-on-upload",resolution:h,...m});return Mi(_,e,i)}async function Iw(i){let e=await(await O.get().fetch(i)).text(),r=new Wt;return r.svg(e),r}ct();w();zr();var Fw=`(function () {
1089
+ `))}var bv=p(()=>{pa();Ht();Qh();_v()});var Eo,vv=p(()=>{P();bv();Eo=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return yv(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};Eo.extension={type:[x.WebGLSystem],name:"uniformGroup"}});function Tv(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof L.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var Sv=p(()=>{ct()});var aw,cw,lw,hw,uw,dw,wv,Pv,Av=p(()=>{P();me();Sv();aw=0,cw=1,lw=2,hw=3,uw=4,dw=5,wv=class yu{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[aw]=this.setBlend,this.map[cw]=this.setOffset,this.map[lw]=this.setCullFace,this.map[hw]=this.setDepthTest,this.map[uw]=this.setFrontFace,this.map[dw]=this.setDepthMask,this.checks=[],this.defaultState=xt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=Tv(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(yu._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(yu._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};wv.extension={type:[x.WebGLSystem],name:"state"};Pv=wv});var Ma,Ev=p(()=>{hu();Ma=class{constructor(t){this.target=lu.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=J.UNSIGNED_BYTE,this.internalFormat=Ta.RGBA,this.format=Ta.RGBA,this.samplerType=0}}});var Cv,Mv=p(()=>{"use strict";Cv={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var fw,Bv,Rv=p(()=>{"use strict";fw={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},Bv={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!fw[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Ba,bu=p(()=>{"use strict";Ba={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,c=i.resourceWidth,l=i.resourceHeight;c<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,c,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var Gv,kv=p(()=>{bu();Gv={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Ba.upload(i,t,e,r)}}});var vu,Iv,Ra,Fv,Uv=p(()=>{"use strict";vu={linear:9729,nearest:9728},Iv={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Ra={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Fv={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Tu(i,t,e,r,s,o,n,a){let c=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=Ra[n?"clamp-to-edge":i.addressModeU],h=Ra[n?"clamp-to-edge":i.addressModeV],u=Ra[n?"clamp-to-edge":i.addressModeW];t[s](c,t.TEXTURE_WRAP_S,l),t[s](c,t.TEXTURE_WRAP_T,h),t.TEXTURE_WRAP_R&&t[s](c,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](c,t.TEXTURE_MAG_FILTER,vu[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=Iv[i.minFilter][i.mipmapFilter];t[s](c,t.TEXTURE_MIN_FILTER,l)}}else t[s](c,t.TEXTURE_MIN_FILTER,vu[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](c,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](c,t.TEXTURE_COMPARE_FUNC,Fv[i.compare])}var Dv=p(()=>{Uv()});function Ov(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var Lv=p(()=>{"use strict"});function Nv(i,t){let e={},r=i.RGBA;return i instanceof L.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var Hv=p(()=>{ct()});function Wv(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var zv=p(()=>{"use strict"});var pw,Co,Vv=p(()=>{ct();P();rt();Ev();Mv();Rv();bu();kv();Dv();Lv();Hv();zv();pw=4,Co=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Ba,buffer:Cv,video:Gv,compressed:Bv},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Nv(t,this._renderer.context.extensions),this._mapFormatToType=Wv(t),this._mapFormatToFormat=Ov(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(E.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=E.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new Ma(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Tu(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Tu(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:s}=this.getPixels(t),o=L.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(pw*s*o),a=this._renderer,c=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(c),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),h.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,h.RGBA,h.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(E.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Co.extension={type:[x.WebGLSystem],name:"texture"}});var jv={};$u(jv,{WebGLRenderer:()=>Su});var mw,gw,xw,Xv,$v,Yv,Su,Kv=p(()=>{P();wb();Pb();Ab();ks();Kh();Pe();Mb();Gb();Ub();Lb();Nb();Hb();Wb();jb();Zb();mv();vv();Av();Vv();mw=[...ua,wo,Ob,Rb,yo,Co,Po,bo,Eo,Ao,To,Pv,So,vo],gw=[...da],xw=[xo,go,mo],Xv=[],$v=[],Yv=[];I.handleByNamedList(x.WebGLSystem,Xv);I.handleByNamedList(x.WebGLPipes,$v);I.handleByNamedList(x.WebGLPipesAdaptor,Yv);I.add(...mw,...gw,...xw);Su=class extends tr{constructor(){let t={name:"webgl",type:yt.WEBGL,systems:Xv,renderPipes:$v,renderPipeAdaptors:Yv};super(t)}}});P();var A_={extension:{type:x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(P_(),DS))}};P();var C_={extension:{type:x.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(E_(),OS))}};P();P();dn();on();P();ct();ks();var oa;function U_(i){return oa!==void 0||(oa=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??tr.defaultOptions.failIfMajorPerformanceCaveat};try{if(!L.get().getWebGLRenderingContext())return!1;let r=L.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),oa}ct();var na;async function D_(i={}){return na!==void 0||(na=await(async()=>{let t=L.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),na}ks();var qv=["webgl","webgpu","canvas"];async function Zv(i){let t=[];i.preference?(t.push(i.preference),qv.forEach(o=>{o!==i.preference&&t.push(o)})):t=qv.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await D_()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(Sb(),Tb));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&U_(i.failIfMajorPerformanceCaveat??tr.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(Kv(),jv));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}de();Uh();dt();var Qv=class wu{constructor(...t){this.stage=new at,t[0]!==void 0&&O(W,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await Zv(t),wu._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return O(W,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=wu._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Qv._plugins=[];var Ga=Qv;I.handleByList(x.Application,Ga._plugins);I.add(zs);P();Fe();Uc();ct();P();yr();bt();rt();dh();xh();var Mo=class extends pi{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:c}=r[n.page],l=new V(n.x+a.x,n.y+a.y,n.width,n.height),h=new E({source:c,frame:l});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:h}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Ps.install(t)}static uninstall(t){Ps.uninstall(t)}};var ka={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let f=t[u].match(/^[a-z]+/gm)[0],d=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),m={};for(let g in d){let _=d[g].split("="),b=_[0],y=_[1].replace(/"/gm,""),v=parseFloat(y),T=isNaN(v)?y:v;m[b]=T}e[f].push(m)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let c={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let f=l[u],d=parseInt(f.id,10),m=f.letter??f.char??String.fromCharCode(d);m==="space"&&(m=" "),c[d]=m,r.chars[m]={id:d,page:parseInt(f.page,10)||0,x:parseInt(f.x,10),y:parseInt(f.y,10),width:parseInt(f.width,10),height:parseInt(f.height,10),xOffset:parseInt(f.xoffset,10),yOffset:parseInt(f.yoffset,10),xAdvance:parseInt(f.xadvance,10),kerning:{}}}let h=e.kerning||[];for(let u=0;u<h.length;u++){let f=parseInt(h[u].first,10),d=parseInt(h[u].second,10),m=parseInt(h[u].amount,10);r.chars[c[d]].kerning[c[f]]=m}return r}};ct();var Pu={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let c={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let h=n[l],u=parseInt(h.getAttribute("id"),10),f=h.getAttribute("letter")??h.getAttribute("char")??String.fromCharCode(u);f==="space"&&(f=" "),c[u]=f,t.chars[f]={id:u,page:parseInt(h.getAttribute("page"),10)||0,x:parseInt(h.getAttribute("x"),10),y:parseInt(h.getAttribute("y"),10),width:parseInt(h.getAttribute("width"),10),height:parseInt(h.getAttribute("height"),10),xOffset:parseInt(h.getAttribute("xoffset"),10),yOffset:parseInt(h.getAttribute("yoffset"),10),xAdvance:parseInt(h.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){let h=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),f=parseInt(a[l].getAttribute("amount"),10);t.chars[c[u]].kerning[c[h]]=f}return t}};var Au={test(i){return typeof i=="string"&&i.includes("<font>")?Pu.test(L.get().parseXML(i)):!1},parse(i){return Pu.parse(L.get().parseXML(i))}};var _w=[".xml",".fnt"],Jv={extension:{type:x.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof Mo,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},t0={extension:{type:x.LoadParser,priority:wt.Normal},name:"loadBitmapFont",test(i){return _w.includes(vt.extname(i).toLowerCase())},async testParse(i){return ka.test(i)||Au.test(i)},async parse(i,t,e){let r=ka.test(i)?ka.parse(i):Au.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let f=o[u].file,d=vt.join(vt.dirname(s),f);d=Ji(d,s),n.push({src:d,data:a})}let c=await e.load(n),l=n.map(u=>c[u.src]);return new Mo({data:r,textures:l},s)},async load(i,t){return await(await L.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};st();var Ia=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};$e();P();rt();var e0={extension:{type:x.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof E),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};P();async function Fa(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var r0={extension:{type:x.DetectionParser,priority:1},test:async()=>Fa("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};P();var i0=["png","jpg","jpeg"],s0={extension:{type:x.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...i0],remove:async i=>i.filter(t=>!i0.includes(t))};P();var yw="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Ci(i){return yw?!1:document.createElement("video").canPlayType(i)!==""}var o0={extension:{type:x.DetectionParser,priority:0},test:async()=>Ci("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};P();var n0={extension:{type:x.DetectionParser,priority:0},test:async()=>Ci("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};P();var a0={extension:{type:x.DetectionParser,priority:0},test:async()=>Ci("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};P();var c0={extension:{type:x.DetectionParser,priority:0},test:async()=>Fa("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};st();yr();Qi();sn();var Ua=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||F(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return F(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=br(t),n=Lt(t,l=>({alias:[l],src:l,data:{}})),a=n.length,c=n.map(async l=>{let h=vt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[h]||(this.promiseCache[h]=this._getLoadPromiseAndParser(h,l)),s[l.src]=await this.promiseCache[h].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[h],delete s[l.src],new Error(`[Loader.load] Failed to load ${h}.
1090
+ ${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Lt(t,s=>({alias:[s],src:s})).map(async s=>{let o=vt.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(r)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&F(`[Assets] loadParser name conflict "${e.name}"`):F("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};ct();P();function ce(i,t){if(Array.isArray(t)){for(let e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}yr();function le(i,t){let e=i.split("?")[0],r=vt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}Fe();var bw=".json",vw="application/json",l0={extension:{type:x.LoadParser,priority:wt.Low},name:"loadJson",test(i){return ce(i,vw)||le(i,bw)},async load(i){return await(await L.get().fetch(i)).json()}};ct();P();Fe();var Tw=".txt",Sw="text/plain",h0={name:"loadTxt",extension:{type:x.LoadParser,priority:wt.Low,name:"loadTxt"},test(i){return ce(i,Sw)||le(i,Tw)},async load(i){return await(await L.get().fetch(i)).text()}};ct();P();st();yr();$e();Fe();var ww=["normal","bold","100","200","300","400","500","600","700","800","900"],Pw=[".ttf",".otf",".woff",".woff2"],Aw=["font/ttf","font/otf","font/woff","font/woff2"],Ew=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Cw(i){let t=vt.extname(i),s=vt.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(Ew)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var Mw=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Bw(i){return Mw.test(i)?i:encodeURI(i)}var u0={extension:{type:x.LoadParser,priority:wt.Low},name:"loadWebFont",test(i){return ce(i,Aw)||le(i,Pw)},async load(i,t){let e=L.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??Cw(i),o=t.data?.weights?.filter(a=>ww.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let c=o[a],l=new FontFace(s,`url(${Bw(i)})`,{...n,weight:c});await l.load(),e.add(l),r.push(l)}return tt.set(`${s}-and-url`,{url:i,fontFaces:r}),r.length===1?r[0]:r}return F("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>{tt.remove(`${t.family}-and-url`),L.get().getFontFaceSet().delete(t)})}};ct();P();Vr();Vn();Wr();function Mi(i,t=1){let e=te.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}Fe();rt();st();$e();function Bi(i,t,e){i.label=e,i._sourceOrigin=e;let r=new E({source:i,label:e}),s=()=>{delete t.promiseCache[e],tt.has(e)&&tt.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(F("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),r.once("destroy",()=>{i.destroyed||(F("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var Rw=".svg",Gw="image/svg+xml",d0={extension:{type:x.LoadParser,priority:wt.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return ce(i,Gw)||le(i,Rw)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?Iw(i):kw(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function kw(i,t,e,r){let o=await(await L.get().fetch(i)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=r,await a.decode(),URL.revokeObjectURL(n);let c=document.createElement("canvas"),l=c.getContext("2d"),h=t.data?.resolution||Mi(i),u=t.data?.width??a.width,f=t.data?.height??a.height;c.width=u*h,c.height=f*h,l.drawImage(a,0,0,u*h,f*h);let{parseAsGraphicsContext:d,...m}=t.data??{},g=new jt({resource:c,alphaMode:"premultiply-alpha-on-upload",resolution:h,...m});return Bi(g,e,i)}async function Iw(i){let e=await(await L.get().fetch(i)).text(),r=new Wt;return r.svg(e),r}ct();P();Vr();var Fw=`(function () {
1091
1091
  'use strict';
1092
1092
 
1093
1093
  const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
@@ -1108,7 +1108,7 @@ ${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Lt(t
1108
1108
  });
1109
1109
 
1110
1110
  })();
1111
- `,Bi=null,Ri=class{constructor(){Bi||(Bi=URL.createObjectURL(new Blob([Fw],{type:"application/javascript"}))),this.worker=new Worker(Bi)}};Ri.revokeObjectURL=function(){Bi&&(URL.revokeObjectURL(Bi),Bi=null)};var Uw=`(function () {
1111
+ `,Ri=null,Gi=class{constructor(){Ri||(Ri=URL.createObjectURL(new Blob([Fw],{type:"application/javascript"}))),this.worker=new Worker(Ri)}};Gi.revokeObjectURL=function(){Ri&&(URL.revokeObjectURL(Ri),Ri=null)};var Uw=`(function () {
1112
1112
  'use strict';
1113
1113
 
1114
1114
  async function loadImageBitmap(url, alphaMode) {
@@ -1137,4 +1137,4 @@ ${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Lt(t
1137
1137
  };
1138
1138
 
1139
1139
  })();
1140
- `,Gi=null,Bo=class{constructor(){Gi||(Gi=URL.createObjectURL(new Blob([Uw],{type:"application/javascript"}))),this.worker=new Worker(Gi)}};Bo.revokeObjectURL=function(){Gi&&(URL.revokeObjectURL(Gi),Gi=null)};var f0=0,Eu,Cu=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Ri;e.addEventListener("message",r=>{e.terminate(),Ri.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Eu===void 0&&(Eu=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Eu&&(this._createdWorkers++,t=new Bo().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[f0]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:f0++,id:r})}},Mu=new Cu;Fe();var Dw=[".jpeg",".jpg",".png",".webp",".avif"],Ow=["image/jpeg","image/png","image/webp","image/avif"];async function Lw(i,t){let e=await O.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var Da={name:"loadTextures",extension:{type:x.LoadParser,priority:wt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ce(i,Ow)||le(i,Dw)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Mu.isImageBitmapSupported()?r=await Mu.loadImageBitmap(i,t):r=await Lw(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new jt({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Ci(i),...t.data});return Mi(s,e,i)},unload(i){i.destroy(!0)}};w();zc();Wc();var p0=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Nw=p0.map(i=>`video/${i.substring(1)}`);function Hw(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=zw(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function Ww(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function zw(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var m0={name:"loadVideo",extension:{type:x.LoadParser,name:"loadVideo"},test(i){let t=ce(i,Nw),e=le(i,p0);return t||e},async load(i,t,e){let r={...Vr.defaultOptions,resolution:t.data?.resolution||Ci(i),alphaMode:t.data?.alphaMode||await hn(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(c=>{let l=o[c];l!==void 0&&s.setAttribute(c,l)}),r.muted===!0&&(s.muted=!0),Hw(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let c=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=Vr.MIME_TYPES[c]||`video/${c}`}return n.src=i,a&&(n.type=a),new Promise(c=>{let l=async()=>{let h=new Vr({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await Ww(s),c(Mi(h,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};w();Hr();w();Hr();var Oa={extension:{type:x.ResolveParser,name:"resolveTexture"},test:Da.test,parse:i=>({resolution:parseFloat(te.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var g0={extension:{type:x.ResolveParser,priority:-2,name:"resolveJson"},test:i=>te.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Oa.parse};Hr();Qi();sn();var La=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new te,this.loader=new Ua,this.cache=J,this._backgroundLoader=new Ia(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){F("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=yr(t),s=Lt(t).map(a=>{if(typeof a!="string"){let c=this.resolver.getAlias(a);return c.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(c)?c[0]:c}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,c=0,l=()=>{e?.(++a/c)},h=n.map(u=>{let d=s[u];return c+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(h),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return J.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=J.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],c=[n.src];n.alias&&c.push(...n.alias),c.forEach(l=>{o[l]=a}),J.set(c,a)}),o}async unload(t){this._initialized||await this.init();let e=Lt(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Lt(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{J.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},xe=new La;k.handleByList(x.LoadParser,xe.loader.parsers).handleByList(x.ResolveParser,xe.resolver.parsers).handleByList(x.CacheParser,xe.cache.parsers).handleByList(x.DetectionParser,xe.detections);k.add(e0,s0,r0,c0,o0,n0,a0,l0,h0,u0,d0,Da,m0,t0,Jv,Oa,g0);var x0={loader:x.LoadParser,resolver:x.ResolveParser,cache:x.CacheParser,detection:x.DetectionParser};k.handle(x.Asset,i=>{let t=i.ref;Object.entries(x0).filter(([e])=>!!t[e]).forEach(([e,r])=>k.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(x0).filter(e=>!!t[e]).forEach(e=>k.remove(t[e]))});Do();dt();rn();var Na=class extends Xe{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:c,roundPixels:l,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Bt({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),c!==void 0&&(this.height=c)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.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.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function _0(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(D(W,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Ss();Cr();var ir=class extends Na{constructor(...t){let e=_0(t,"Text");super(e,Tt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=At.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};Fe();bt();et();$c();de();lh();an();Ss();Cr();kt();var Vw=Io(bl(),1);k.add(A_,C_);var Ct={Add:"add",Remove:"remove",Update:"update"},Ha=class{init(t){throw new Error("Method not implemented.")}render(t){throw new Error("Method not implemented.")}},sr=class{rendererName;rendererType;add=async(t,e,r)=>{throw new Error("Method not implemented.")};remove=async(t,e,r)=>{throw new Error("Method not implemented.")};update=async(t,e,r)=>{throw new Error("Method not implemented.")}};var Wa=(i=[],t=[])=>{let e=[],r=[],s=[],o=i.filter(a=>!a.hidden),n=t.filter(a=>!a.hidden);for(let a of o){let c=n.find(l=>l.id===a.id&&l.type===a.type);c?r.push({prev:a,next:c}):e.push(a)}for(let a of n)o.find(l=>l.id===a.id&&l.type===a.type)||s.push(a);for(let a of i){let c=t.find(l=>l.id===a.id&&l.type===a.type);c&&c.hidden&&!a.hidden&&e.push(a)}return{toDeleteElements:e,toUpdateElements:r,toAddElements:s}};var Rr=new(window.AudioContext||window.webkitAudioContext),ki=class i{static loadedAssets={};static load=async(t,e)=>{if(!i.loadedAssets[t]&&e.byteLength!==0)try{let r=await Rr.decodeAudioData(e);i.loadedAssets[t]=r}catch(r){console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}};static getAsset=t=>i.loadedAssets[t]},Bu=class{_audioSource;_gainNode;volume=1;id;url;loop=!1;constructor(t,e){this.id=t,this.url=e.url,this.loop=e.loop||!1,this.volume=e.volume??1,this._gainNode=Rr.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Rr.destination)}play=()=>{let t=ki.getAsset(this.url);if(!t){console.warn("AudioPlayer.play: Asset not found",this.url);return}this._audioSource=Rr.createBufferSource(),this._audioSource.buffer=t,this._audioSource.loop=this.loop,this._gainNode.gain.setValueAtTime(this.volume,Rr.currentTime),this._audioSource.connect(this._gainNode),this._audioSource.start(0)};stop=()=>{this._audioSource&&(this._audioSource.stop(),this._audioSource.disconnect(),this._gainNode.disconnect(),this._gainNode=Rr.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Rr.destination))}},za=class{audioPlayers=[];stageAudios=[];add=t=>{this.stageAudios.push(t)};remove=t=>{this.stageAudios=this.stageAudios.filter(e=>e.id!==t)};getById=t=>this.stageAudios.find(e=>e.id===t);tick=()=>{for(let e of this.stageAudios){let r=this.audioPlayers.find(s=>s.id===e.id);if(!r){let s=new Bu(e.id,{url:e.url,loop:e.loop,volume:e.volume??1});this.audioPlayers.push(s),s.play();return}(r.url!==e.url||r.loop!==e.loop)&&(r.stop(),r.url=e.url,r.loop=e.loop??!1,r.play()),r.volume!==(e.volume??1)&&(r.volume=e.volume??1,r._gainNode.gain.value=r.volume)}let t=[];for(let e of this.audioPlayers)this.stageAudios.find(r=>r.id===e.id)||(e.stop(),t.push(e.id));this.audioPlayers=this.audioPlayers.filter(e=>!t.includes(e.id))};destroy=()=>{for(let t of this.audioPlayers)t.stop();this.audioPlayers=[],this.stageAudios=[]}};var Xw=i=>i.split("/").pop(),Ru=class{name="advancedBufferLoader";priority=2;constructor(t){this.bufferMap=t}test(t){return!0}async load(t){let e=t.startsWith("file:")?t:Xw(t),r=this.bufferMap[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}}async testParse(t){return!0}async parse(t){if(t instanceof C)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new C.from(r)}async unload(t){t.destroy(!0)}},Gu=class i extends Ha{static rendererName="pixi";_app;_audioStage=new za;_state={elements:[]};_eventHandler;_plugins;_currentAbortController;_advancedLoader;get canvas(){return this._app.canvas}init=async t=>{let{eventHandler:e,plugins:r,width:s,height:o,backgroundColor:n}=t;for(let c of r)if(c.rendererName!==i.rendererName)throw new Error("Plugin does not match renderer name");this._plugins=r,this._eventHandler=e,this._app=new Ga,this._app.audioStage=this._audioStage,await this._app.init({width:s,height:o,backgroundColor:n});let a=new zt;return a.rect(0,0,s,o),a.fill(n||0),this._app.stage.addChild(a),this._app.stage.width=s,this._app.stage.height=o,this._app.ticker.add(this._app.audioStage.tick),this};destroy=()=>{this._app.audioStage.destroy(),this._app.destroy()};_classifyAsset=t=>t?t.startsWith("audio/")?"audio":t.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(t)?"font":"texture":"texture";loadAssets=async t=>{if(!t)throw new Error("assetBufferMap is required");let e={audio:{},font:{},texture:{}};for(let[s,o]of Object.entries(t)){let n=this._classifyAsset(o.type);e[n][s]=o}await Promise.all(Object.entries(e.audio).map(([s,o])=>ki.load(s,o.buffer))),await Promise.all(Object.entries(e.font).map(async([s,o])=>{let n=new Blob([o.buffer],{type:o.type}),a=URL.createObjectURL(n),c=new FontFace(s,`url(${a})`);try{await c.load(),document.fonts.add(c),console.log(`Font loaded successfully: ${s}`)}catch(l){console.error(`Failed to load font ${s}:`,l)}finally{URL.revokeObjectURL(a)}})),this._advancedLoader?Object.assign(this._advancedLoader.bufferMap,e.texture):(this._advancedLoader=new Ru(e.texture),xe.loader.parsers.length=0,xe.reset(),k.add({name:"advanced-buffer-loader",extension:x.Asset,priority:wt.High,loader:this._advancedLoader}),typeof xe.registerPlugin=="function"&&xe.registerPlugin(this._advancedLoader));let r=Object.keys(e.texture);return Promise.all(r.map(s=>xe.load(s)))};loadAudioAssets=async t=>Promise.all(t.map(async e=>{let s=await(await fetch(e)).arrayBuffer();return ki.load(e,s)}));updatedBackgroundColor=t=>{this._app.renderer.background.color=t};render=t=>{this._render(this._app,this._app.stage,this._state,t,this._eventHandler),this._state=t};_getRendererByElement=t=>{for(let e of this._plugins)if(e.rendererType===t.type)return e;throw new Error(`No renderer found for element type: ${t.type}`)};_getTransitionByType=t=>{for(let e of this._plugins)if(e.transitionType===t)return e;throw new Error(`No transition found for transition type: ${t}`)};_render=async(t,e,r,s,o)=>{let n=Date.now(),{toAddElements:a,toUpdateElements:c,toDeleteElements:l}=Wa(r.elements,s.elements);this._currentAbortController&&this._currentAbortController.abort(),this._currentAbortController=new AbortController;let h=this._currentAbortController.signal,u=[];for(let d of l){let f=this._getRendererByElement(d);u.push(()=>f.remove(t,{parent:e,element:d,transitions:s.transitions,getRendererByElement:this._getRendererByElement,getTransitionByType:this._getTransitionByType,eventHandler:o},h))}for(let d of a){let f=this._getRendererByElement(d);u.push(()=>f.add(t,{parent:e,element:d,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o},h))}for(let d of c){let f=this._getRendererByElement(d.next);u.push(()=>f.update(t,{parent:e,prevElement:d.prev,nextElement:d.next,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o},h))}try{await Promise.all(u.map(d=>d())),t.stage.children.sort((d,f)=>{let m=s.elements.find(g=>g.id===d.label),_=s.elements.find(g=>g.id===f.label);if(m&&_){let g=m.zIndex??0,b=_.zIndex??0;if(g!==b)return g-b;let y=s.elements.findIndex(T=>T.id===d.label),v=s.elements.findIndex(T=>T.id===f.label);return y-v}if(!m&&!_)return 0;if(!m)return-1;if(!_)return 1}),o&&o("completed",{id:s.id,diffTime:Date.now()-n})}catch(d){if(d.name==="AbortError")return;throw console.error("Error:",d),d}finally{this._currentAbortController=void 0}}},y0=Gu;var ku=class extends sr{static rendererName="pixi";rendererName="pixi";rendererType="sprite";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=o.url?C.from(o.url):C.EMPTY,h,u,d=o.scaleX??1,f=o.scaleY??1;o.hoverUrl&&(h=C.from(o.hoverUrl)),o.clickUrl&&(u=C.from(o.clickUrl));let m=new Nt(l);m.label=o.id,(o.eventName||o.hoverUrl||o.clickUrl)&&(m.cursor="pointer",m.eventMode="static"),o.width!==void 0?m.width=o.width*d:m.width*=d,o.height!==void 0?m.height=o.height*f:m.height*=f,o.anchorX!==void 0&&(m.pivot.x=m.width*o.anchorX),o.anchorY!==void 0&&(m.pivot.y=m.height*o.anchorY),o.rotation!==void 0&&(m.rotation=o.rotation*Math.PI/180),o.x!==void 0&&(m.x=o.x),o.y!==void 0&&(m.y=o.y),o.zIndex!==void 0&&(m.zIndex=o.zIndex),o.alpha!==void 0&&(m.alpha=o.alpha),(h||u)&&m.on("pointerup",()=>{m.texture=l}).on("pointerupoutside",()=>{m.texture=l}).on("pointerleave",()=>{m.texture=l}),u&&m.on("pointerdown",()=>{m.texture=u}),h&&m.on("pointerenter",()=>{m.texture=h}),m.on("pointerup",g=>{g.stopPropagation();let b=g.button;b===0?c&&c(o.eventName,o.eventPayload):b===2&&(o.rightClickEventName&&c?c(o.rightClickEventName):t.stage.emit("rightclick",event))});let _=[];for(let g of n)if(g.elementId===o.id&&g.event===Ct.Add){let b=a(g.type);if(!b)throw new Error(`Transition class not found for type ${g.type}`);_.push(b.add(t,m,g,r))}s.addChild(m),await Promise.all(_)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c)throw new Error(`Sprite with id ${o.id} not found`);let l=[];for(let h of n)if(h.elementId===o.id&&h.event===Ct.Remove){let u=a(h.type);if(!u)throw new Error(`Transition class not found for type ${h.type}`);l.push(u.remove(t,c,h,r))}await Promise.all(l),c&&c.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a},c)=>{if(c?.aborted)throw new DOMException("Operation aborted","AbortError");let l=e.getChildByName(r.id);if(!l)throw new Error(`Sprite with id ${r.id} not found`);let h=[];for(let f of o)if(f.elementId===r.id&&f.event===Ct.Update){let m=n(f.type);if(!m)throw new Error(`Transition class not found for type ${f.type}`);h.push(m.add(t,l,f,c))}h.length>0?(await Promise.all(h),u()):d();function u(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let g=C.from(s.url);if(l.texture=g,!r.url&&s.url)if(g.baseTexture.valid){let b=s.scaleX??1,y=s.scaleY??1;l.width=(s.width??g.width)*b,l.height=(s.height??g.height)*y}else g.baseTexture.once("loaded",()=>{let b=s.scaleX??1,y=s.scaleY??1;l.width=(s.width??g.width)*b,l.height=(s.height??g.height)*y})}let m=r.hoverUrl||r.clickUrl,_=s.hoverUrl||s.clickUrl;if(!m&&_){let g=l.texture;l.on("pointerup",()=>{l.texture=g}).on("pointerupoutside",()=>{l.texture=g}).on("pointerleave",()=>{l.texture=g})}if(s.hoverUrl){let g=C.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=g})}if(s.clickUrl){let g=C.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=g})}}(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="pointer",l.eventMode="static")}function d(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let y=C.from(s.url);if(l.texture=y,!r.url&&s.url)if(y.baseTexture.valid){let v=s.scaleX??1,T=s.scaleY??1;l.width=(s.width??y.width)*v,l.height=(s.height??y.height)*T}else y.baseTexture.once("loaded",()=>{let v=s.scaleX??1,T=s.scaleY??1;l.width=(s.width??y.width)*v,l.height=(s.height??y.height)*T})}let g=r.hoverUrl||r.clickUrl,b=s.hoverUrl||s.clickUrl;if(!g&&b){let y=l.texture;l.on("pointerup",()=>{l.texture=y}).on("pointerupoutside",()=>{l.texture=y}).on("pointerleave",()=>{l.texture=y})}if(s.hoverUrl){let y=C.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=y})}if(s.clickUrl){let y=C.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=y})}}s.x!==void 0&&s.x!==r.x&&(l.x=s.x),s.y!==void 0&&s.y!==r.y&&(l.y=s.y),s.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180);let m=s.scaleX??1,_=s.scaleY??1;s.width!==void 0&&(s.width!==r.width||m!==(r.scaleX??1))&&(l.width=s.width*m),s.height!==void 0&&(s.height!==r.height||_!==(r.scaleY??1))&&(l.height=s.height*_),s.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=l.width*s.anchorX/m),s.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=l.height*s.anchorY/_),s.zIndex!==void 0&&s.zIndex!==r.zIndex&&(l.zIndex=s.zIndex),s.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="pointer",l.eventMode="static")}}};var Va=i=>new Tt({wordWrap:i.wordWrap||!0,breakWords:i.breakWords||!1,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Iu=class{static rendererName="pixi";rendererName="pixi";rendererType="text";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=Va(o.style),h=new ir({text:o.text,style:l}),u;o.hoverStyle&&(u=Va(o.hoverStyle));let d;if(o.clickedStyle&&(d=Va(o.clickedStyle)),(o.eventName||o.clickedStyle||o.hoverStyle)&&(h.cursor="pointer",h.eventMode="static"),h.label=o.id,o.x!==void 0&&(h.x=o.x),o.y!==void 0&&(h.y=o.y),o.anchorX!==void 0&&(h.anchor.x=o.anchorX),o.anchorY!==void 0&&(h.anchor.y=o.anchorY),o.anchorX!==void 0||o.anchorY!==void 0){let m=h.getLocalBounds();h.hitArea=new V(-m.width*h.anchor.x,-m.height*h.anchor.y,m.width,m.height)}h.on("pointerupoutside",()=>{h.style=l}).on("pointerup",()=>{h.style=l}).on("pointerleave",()=>{h.style=l}),h.on("pointerup",m=>{o.clickSoundUrl&&t.soundStage&&t.soundStage.add({id:`${o.id}-click-${Math.random()}`,url:o.clickSoundUrl,loop:!1,volume:o.clickSoundVolume??50/100}),m.stopPropagation(),c&&c(o.eventName,o.eventPayload)}),d&&h.on("pointerdown",()=>{h.style=d}),u&&h.on("pointerenter",()=>{h.style=u,o.hoverSoundUrl&&t.soundStage&&o.hoverSoundVolume!==void 0&&t.soundStage.add({id:`${o.id}-hover-${Math.random()}`,url:o.hoverSoundUrl,loop:!1,volume:o.hoverSoundVolume/100})});let f=[];for(let m of n)if(m.elementId===o.id&&m.event===Ct.Add){let _=a(m.type);if(!_)throw new Error(`Transition class not found for type ${m.type}`);f.push(_.add(t,h,m,r))}s.addChild(h),await Promise.all(f)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c){console.warn(`Text with id ${o.id} not found`);return}let l=[];for(let h of n)if(h.elementId===o.id&&h.event===Ct.Remove){let u=a(h.type);if(!u)throw new Error(`Transition class not found for type ${h.type}`);l.push(u.remove(t,c,h,r))}await Promise.all(l),c&&c.destroy()};update=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,prevElement:o,nextElement:n,transitions:a,getTransitionByType:c,eventHandler:l}=e,h=s.getChildByName(o.id);if(!h){console.warn(`Text with id ${o.id} not found`);return}if(JSON.stringify(o)!==JSON.stringify(n)){let u=[this.add(t,{parent:s,element:n,transitions:a,getTransitionByType:c,eventHandler:l},r),this.remove(t,{parent:s,element:o,transitions:a,getTransitionByType:c},r)];await Promise.all(u)}else o.text!==n.text&&(h.text=n.text),JSON.stringify(o.style)!==JSON.stringify(n.style)&&(h.style=Va(n?.style)),n.x!==void 0&&(h.x=n.x),n.y!==void 0&&(h.y=n.y)}};var Ii=(i,t=!1)=>new Tt({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Fu=class{static rendererName="pixi";rendererName="pixi";rendererType="text-revealing";add=async(t,{parent:e,element:r})=>{let s=Ii(r.style,r.text),o=new ir({text:"",style:s});o.label=r.id,o.text_id=r.text;let n=new at;r.x!==void 0&&(n.x=r.x),r.y!==void 0&&(n.y=r.y),n.addChild(o),n.label=r.id,e.addChild(n);let a=r.style.wordWrapWidth||500,c=r.text?[{text:r.text,style:r.style}]:r.segments,l=[],h=[],u=0,d=0,f=0;for(;;){let S=c[0];if(!S){h.length>0&&l.push({lineParts:h,y:d});break}if(d>1e4)break;let P={...S.style,wordWrapWidth:a-u},A=At.measureText(S.text,Ii(P));A.lineHeight>f&&(f=A.lineHeight);let M=At.measureText("a",Ii(P)),B=At.measureText("a a",Ii(P)).width-M.width*2;if(A.lineWidths[0]+u>a){u=0,l.push({lineParts:h,y:d}),d+=f,f=0,h=[];continue}let I=A.lines[0],H=A.lines.slice(1).join(" "),$={text:I,style:P,x:u,y:0};if(h.push($),H&&H.length>0?S.text=H:c.shift(),!(!I||I.length===0)){if(S.furigana){let ot=At.measureText(S.furigana.text,Ii(S.furigana.style)),N={text:S.furigana.text,style:S.furigana.style,x:u+(A.width-ot.width)/2,y:-10};h.push(N)}u+=A.lineWidths[0]+B}}l.forEach(S=>{let P=new at;P.y=S.y,P.alpha=0,S.lineParts.forEach(A=>{let M=new ir({text:A.text,style:Ii(A.style),x:A.x,y:A.y});P.addChild(M)}),n.addChild(P)});let m=new zt,_=1e3,g=a/2,b=a/2;m.fill({color:16777215,alpha:1}),m.rect(0,0,g,_);for(let S=0;S<b;S++)m.fill({color:16777215,alpha:1-S/b}),m.rect(g+S,0,g+1,_);let y=t.renderer.generateTexture(m),v=new Nt(y);v.x=-1.35*g-b,t.stage.addChild(v);let T=0,R=1;if(l.length!==0){if(r.displaySpeed===100||r.hasEnded){n.children.forEach(S=>{t.stage.removeChild(v),S.mask=null,S.alpha=1});return}await new Promise(S=>{let P=A=>{if(R>n.children.length){S();return}n.getChildAt(R).mask||(n.getChildAt(R).mask=v,n.getChildAt(R).alpha=1),T+=A.deltaMS;let E=(r.displaySpeed||50)/1e3;v.x+=E*T,v.x>=0&&(n.getChildAt(R).mask=null,v.x=-1.35*g-b,R=R+1,T=0,R>=n.children.length&&(n.getChildAt(R-1).mask=null,t.ticker.remove(P),S()))};t.ticker.add(P)})}};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Text with id ${s.id} not found`,{parent:r});return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Ct.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o}=e;if(!r.getChildByName(s.id)){console.warn(`Text with id ${s.id} not found`,{parent:r});return}await this.remove(t,{parent:r,element:s}),await this.add(t,{parent:r,element:o})}};var Uu=class{static rendererName="pixi";rendererName="pixi";rendererType="container";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,getRendererByElement:c,eventHandler:l}=e,h=structuredClone(o),u=new at;u.label=h.id;let d={};h.x!==void 0&&(typeof h.x=="string"&&h.x.endsWith("%")?u.x=Number(h.x.replace("%",""))*t.screen.width/100:u.x=h.x),h.y!==void 0&&(typeof h.y=="string"&&h.y.endsWith("%")?u.y=Number(h.y.replace("%",""))*t.screen.height/100:u.y=h.y),h.scaleX!==void 0&&(u.scale.x=h.scaleX),h.scaleY!==void 0&&(u.scale.y=h.scaleY),h.zIndex!==void 0&&(u.zIndex=h.zIndex),h.rotation!==void 0&&(u.rotation=h.rotation*Math.PI/180),h.propagateEvents&&(u.eventMode="static",["pointerup","pointerupoutside","pointerleave","pointerdown","pointerenter"].forEach(A=>{u.on(A,M=>{M.stopPropagation();for(let E of u.children)E.emit(A)})}));let f=h.gap||0,m=new zt().roundRect(0,0,h.width||0,h.height||0,1).fill(h.fill?h.fill.color:"transparent"),_=[0,.5,1],g=h.anchorX??0,b=h.anchorY??0;if(!_.includes(g))throw new Error(`Invalid anchorX value: ${g}. Must be 0, 0.5, or 1`);if(!_.includes(b))throw new Error(`Invalid anchorY value: ${b}. Must be 0, 0.5, or 1`);if(h.direction){let A,M;h.direction==="horizontal"?(A=h.children.reduce((B,I)=>B+I.width+f,0),M=h.children.reduce((B,I)=>Math.max(B,I.height||0),0)):h.direction==="vertical"&&(A=h.children.reduce((B,I)=>Math.max(B,I.width||0),0),M=h.children.reduce((B,I)=>B+I.height+f,0));let E={x:g,y:b};h.direction==="horizontal"?this.layoutChildren({element:h,anchor:E,totalWidth:A,totalHeight:M,gap:f,direction:"horizontal",scroll:h.scroll}):h.direction==="vertical"&&this.layoutChildren({element:h,anchor:E,totalWidth:A,totalHeight:M,gap:f,direction:"vertical",scroll:h.scroll}),this.setupScrolling({container:u,element:h,totalHeight:M,totalWidth:A,eventHandler:l,sliderRef:d}),m=this.createContainerGraphic(h,A,M,E)}m.label=`${h.id}-container-background`,u.addChild(m);let y=[];(h.children||[]).forEach(A=>{let M=c(A),E=h.width||0,B=h.height||0,I=g*E,H=b*B,$={zIndex:h.zIndex,...A,x:(A.x||0)+I,y:(A.y||0)+H};y.push(M.add(t,{parent:u,element:$,transitions:n,getTransitionByType:a,getRendererByElement:c,eventHandler:l},r))});let v=[];for(let A of n)if(A.elementId===h.id&&A.event===Ct.Add){let M=a(A.type);if(!M)throw new Error(`Transition class not found for type ${A.type}`);v.push(M.add(t,u,A,r))}s.addChild(u),await Promise.all([...y,...v]);let{width:T,height:R}=this.getContainerDimensions(h,u),S=g*T,P=b*R;u.pivot.x=S,u.pivot.y=P};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");console.log("remove container 11111111111");let{parent:s,element:o}=e,n=s.getChildByName(o.id);if(!n){console.warn(`Container with id ${o.id} not found`);return}n.destroy()};update=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,prevElement:o,nextElement:n,getRendererByElement:a,transitions:c=[],getTransitionByType:l,eventHandler:h}=e,u=structuredClone(o),d=structuredClone(n),f=s.getChildByName(u.id);if(!f){console.warn(`Container with id ${u.id} not found`);return}d.x!==void 0&&d.x!==u.x&&(f.x=d.x),d.y!==void 0&&d.y!==u.y&&(f.y=d.y),d.rotation!==void 0&&d.rotation!==u.rotation&&(f.rotation=d.rotation*Math.PI/180);let m=[0,.5,1],_=d.anchorX??0,g=d.anchorY??0;if(!m.includes(_))throw new Error(`Invalid anchorX value: ${_}. Must be 0, 0.5, or 1`);if(!m.includes(g))throw new Error(`Invalid anchorY value: ${g}. Must be 0, 0.5, or 1`);if(d.direction){let M=d.gap||0,E,B;d.direction==="horizontal"?(E=d.children.reduce(($,ot)=>$+ot.width+M,0),B=d.children.reduce(($,ot)=>Math.max($,ot.height||0),0)):d.direction==="vertical"&&(E=d.children.reduce(($,ot)=>Math.max($,ot.width||0),0),B=d.children.reduce(($,ot)=>$+ot.height+M,0));let I={x:_,y:g};d.direction==="horizontal"?this.layoutChildren({element:d,anchor:I,totalWidth:E,totalHeight:B,gap:M,direction:"horizontal",scroll:d.scroll}):d.direction==="vertical"&&this.layoutChildren({element:d,anchor:I,totalWidth:E,totalHeight:B,gap:M,direction:"vertical",scroll:d.scroll});let H=f.children.find($=>$.label===`${d.id}-container-background`);if(H){H.destroy();let $=this.createContainerGraphic(d,E,B,I);$.label=`${d.id}-container-background`,f.addChildAt($,0)}u.scroll!==d.scroll&&this.setupScrolling({container:f,element:d,totalHeight:B,totalWidth:E,eventHandler:h,sliderRef:{}})}let b=[],{toAddElements:y,toUpdateElements:v,toDeleteElements:T}=Wa(u.children,d.children);for(let M of T){let E=a(M);b.push(E.remove(t,{parent:f,element:M,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h},r))}for(let M of y){let E=a(M),B=d.width||0,I=d.height||0,H=_*B,$=g*I,ot={...M,x:(M.x||0)+H,y:(M.y||0)+$};b.push(E.add(t,{parent:f,element:ot,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h},r))}for(let M of v){let E=a(M.next),B=d.width||0,I=d.height||0,H=_*B,$=g*I,ot=u.anchorX??0,N=u.anchorY??0,U=u.width||0,ee=u.height||0,q=ot*U,Ft=N*ee,he={...M.prev,x:(M.prev.x||0)+q,y:(M.prev.y||0)+Ft},or={...M.next,x:(M.next.x||0)+H,y:(M.next.y||0)+$};b.push(E.update(t,{parent:f,prevElement:he,nextElement:or,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h},r))}d.children&&d.children.length>0&&f.children.sort((M,E)=>{let B=d.children.find(H=>H.id===M.label),I=d.children.find(H=>H.id===E.label);if(B&&I){let H=B.zIndex??0,$=I.zIndex??0;if(H!==$)return H-$;let ot=d.children.indexOf(B),N=d.children.indexOf(I);return ot-N}if(!B&&!I)return 0;if(!B)return-1;if(!I)return 1}),await Promise.all(b);let{width:R,height:S}=this.getContainerDimensions(d,f),P=_*R,A=g*S;f.pivot.x=P,f.pivot.y=A};layoutChildren({element:t,anchor:e,totalWidth:r,totalHeight:s,gap:o,direction:n,scroll:a}){let c=n==="horizontal",l=c?"x":"y",h=c?"y":"x",u=c?"width":"height",d=c?"height":"width",f=c?r:s,m=c?s:r,_=c?e.x:e.y,g=c?e.y:e.x;if(!a&&t[u]!==void 0&&t[u]<f){let y=0,v=0,T=0,R=0;(t.children||[]).forEach((S,P)=>{y>0&&y+S[u]>t[u]&&(this.alignRowElements(t.children.slice(R,P),l,_,t[u]),y=0,v+=T+o,T=0,R=P),S[l]=y,S[h]=v,y+=S[u]+o,T=Math.max(T,S[d]||0)}),R<t.children.length&&this.alignRowElements(t.children.slice(R),l,_,t[u])}else{if(_===0){let y=0;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}else if(_===1){let y=-f;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}else if(_===.5){let y=-f/2;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}g===0?(t.children||[]).forEach(y=>{y[h]=0}):g===.5?(t.children||[]).forEach(y=>{y[h]=-m/2}):g===1&&(t.children||[]).forEach(y=>{y[h]=-m})}}alignRowElements(t,e,r,s){if(!t.length)return;let o=t.reduce((n,a,c)=>n+a[e==="x"?"width":"height"]+(c>0,0),0);if(r===.5){let a=(s-o)/2;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}else if(r===1){let a=s-o;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}}createContainerGraphic(t,e,r,s){let o=new zt().roundRect(0,0,e,r,1).fill(t.fill?t.fill.color:"transparent");return s.x===1&&(o.x-=t.width),s.x===.5&&(o.x-=t.width/2),s.y===1&&(o.y-=t.height),s.y===.5&&(o.y-=t.height/2),o}getContainerDimensions(t,e){let r=t.width||0,s=t.height||0;if(!t.direction&&(!t.width||!t.height)&&e.children&&e.children.length>0){let o=1/0,n=-1/0,a=1/0,c=-1/0;e.children.forEach(l=>{let h=l.x||0,u=l.y||0,d=l.width||0,f=l.height||0;o=Math.min(o,h),n=Math.max(n,h+d),a=Math.min(a,u),c=Math.max(c,u+f)}),t.width||(r=n-o,(isNaN(r)||!isFinite(r))&&(r=0)),t.height||(s=c-a,(isNaN(s)||!isFinite(s))&&(s=0))}return{width:r,height:s}}setupScrolling({container:t,element:e,totalHeight:r,totalWidth:s,eventHandler:o,sliderRef:n}){let a=e.scroll&&e.height&&r>e.height,c=e.scroll&&e.width&&s>e.width;if(a||c){let l=0,h=0,u=-r+e.height,d=-s+e.width,f=new zt().rect(0,0,e.width||s,e.height||r).fill("red");t.mask=f,t.eventMode="static",t.addChild(f),t.on("wheel",m=>{if(a&&m.deltaY!==0&&(l-m.deltaY>0||l-m.deltaY<u||(l-=m.deltaY,t.y-=m.deltaY,f.y+=m.deltaY)),c&&(m.deltaX!==0||m.shiftKey&&m.deltaY!==0)){let _=m.deltaX!==0?m.deltaX:m.deltaY;if(h-_>0||h-_<d)return;h-=_,t.x-=_,f.x+=_}})}}};var $w={linear:i=>i},Yw=(i,t,e,r)=>i+(t-i)*$w[r](e);function b0(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r}function v0(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i}var jw=(i,t)=>{let e=[],r=0,s;i.forEach(({value:n,duration:a,easing:c,relative:l},h)=>{h===0?(s=n,e.push({time:r,value:n,easing:"linear"})):a!==void 0&&c!==void 0&&(r+=a,l?s=s+n:s=n,e.push({time:r,value:s,easing:c}))});let o=0;for(let n=0;n<e.length-1;n++){let{time:a,value:c,easing:l}=e[n],{time:h,value:u}=e[n+1];if(t>=a&&t<=h){let d=(t-a)/(h-a);o=Yw(c,u,d,l);break}else t>h&&(o=u)}return o};function Kw(i){return Math.max.apply(null,i)}var Du=class{static rendererName="pixi";rendererName="pixi";transitionType="keyframes";_transition=async(t,e,r,s)=>new Promise((o,n)=>{if(s?.aborted){n(new DOMException("Operation aborted","AbortError"));return}let{properties:a}=r,c=Array.isArray(a)?a:Object.entries(a).map(([g,b])=>({...b,property:g})),l=c.map(g=>g.keyframes.reduce((b,y)=>b+y.duration||0,0)),h=Kw(l),u=0,d={};c.forEach(g=>{d[g.property]=b0(e,g.property)});let f=g=>{let b={};c.forEach(y=>{let v=[];y.initialValue!==void 0?v=[{value:y.initialValue,duration:0}]:v=[{value:d[y.property],duration:0}],v=v.concat(y.keyframes),v0(b,y.property,jw(v,g))}),c.forEach(y=>{let{property:v}=y;e&&!e.destroyed&&v0(e,v,b0(b,v))})},m=()=>{t.ticker.remove(_),f(h)};s&&s.addEventListener("abort",()=>{m(),n(new DOMException("Operation aborted","AbortError"))});let _=g=>{if(u+=g.deltaMS,u>=h){t.ticker.remove(_),o();return}f(u)};if(s?.aborted){m(),n(new DOMException("Operation aborted","AbortError"));return}t.ticker.add(_)});add=async(t,e,r,s)=>this._transition(t,e,r,s);remove=async(t,e,r,s)=>this._transition(t,e,r,s)};var Ou=class{static rendererName="pixi";rendererName="pixi";rendererType="rect";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=new zt;l.label=o.id,o.x!==void 0&&(l.x=o.x),o.y!==void 0&&(l.y=o.y),o.alpha!==void 0&&(l.alpha=o.alpha),o.scaleX!==void 0&&(l.scale.x=o.scaleX),o.scaleY!==void 0&&(l.scale.y=o.scaleY),o.rotation!==void 0&&(l.rotation=o.rotation*Math.PI/180);let h=o.width,u=o.height;l.rect(0,0,h,u),l.fill(o.fill),o.anchorX!==void 0&&(l.pivot.x=h*o.anchorX),o.anchorY!==void 0&&(l.pivot.y=u*o.anchorY),(o.clickEventName||o.rightClickEventName)&&c&&(l.eventMode="static",l.on("pointerup",f=>{f.button===0?c(o.clickEventName):f.button===2&&c(o.rightClickEventName)})),o.wheelEventName&&c&&(l.eventMode="static",l.on("wheel",f=>{c(o.wheelEventName,{deltaY:f.deltaY})}));let d=[];for(let f of n)if(f.elementId===o.id&&f.event===Ct.Add){let m=a(f.type);if(!m)throw new Error(`Transition class not found for type ${f.type}`);d.push(m.add(t,l,f,r))}s.addChild(l),await Promise.all(d)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c)throw new Error(`Rect with id ${o.id} not found`);let l=[];for(let h of n)if(h.elementId===o.id&&h.event===Ct.Remove){let u=a(h.type);if(!u)throw new Error(`Transition class not found for type ${h.type}`);l.push(u.remove(t,c,h,r))}await Promise.all(l),c&&c.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a},c)=>{if(c?.aborted)throw new DOMException("Operation aborted","AbortError");let l=e.getChildByName(r.id);if(!l)throw new Error(`Rect with id ${r.id} not found`);let h=[];for(let u of o)if(u.elementId===r.id&&u.event===Ct.Update){let d=n(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);h.push(d.add(t,l,u,c))}h.length>0?(await Promise.all(h),(r.width!==s.width||r.height!==s.height||r.fill!==s.fill)&&(l.clear(),l.rect(0,0,s.width,s.height),l.fill(s.fill)),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY)):(r.x!==void 0&&s.x!==r.x&&(l.x=s.x),r.y!==void 0&&s.y!==r.y&&(l.y=s.y),r.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),r.scaleX!==void 0&&s.scaleX!==r.scaleX&&(l.scale.x=s.scaleX),r.scaleY!==void 0&&s.scaleY!==r.scaleY&&(l.scale.y=s.scaleY),r.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180),(r.width!==s.width||r.height!==s.height||r.fill!==s.fill)&&(l.clear(),l.rect(0,0,s.width,s.height),l.fill(s.fill)),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY))}};var Lu=class extends sr{static rendererName="pixi";rendererName="pixi";rendererType="slider";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o,eventHandler:n,ref:a})=>{let{direction:c,idleThumb:l,hoverThumb:h,idleBar:u,hoverBar:d,dragEndEventName:f,dragEventName:m,dragEventPayload:_,initialValue:g}=r,b={horizontal:{axis:"x",size:"width"},vertical:{axis:"y",size:"height"}},y=b[c].axis,v=b[c].size,T=C.from(l),R=C.from(h),S=C.from(u),P=C.from(d),A=new Nt({texture:S,anchor:{x:0,y:0}});A.label=r.id;let M=A[v];A.x=r.x||0,A.y=r.y||0;let E=new Nt({texture:T,anchor:{x:.5,y:.5}});if(E.y=A.height/2,E.x=A.width/2,E.eventMode="static",E.cursor="pointer",A.eventMode="static",A.cursor="pointer",E.on("pointerdown",H).on("pointerup",$).on("pointerupoutside",$),A.on("pointerdown",B).on("pointerup",I).on("pointerupoutside",I),A.addChild(E),g!==void 0){let U=E[v]/2;E[y]=g/100*(M-E[v])+U}function B(U){E.texture=R,A.texture=P,ot(U),t.stage.eventMode="static",t.stage.addEventListener("pointermove",ot)}function I(U){E.texture=T,A.texture=S,ot(U),t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",ot)}function H(U){U.stopPropagation(),E.texture=R,A.texture=P,t.stage.eventMode="static",t.stage.addEventListener("pointermove",ot)}function $(U){if(E.texture=T,A.texture=S,t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",ot),f){let ee=A.toLocal(U.global)[y],q=E[v]/2;E[y]=Math.max(0+q,Math.min(ee,M-q));let Ft=Math.floor((E[y]-q)/(M-E[v])*100),he=JSON.stringify(_);n&&n(f,JSON.parse(he.replace('"{{ value }}"',String(Ft))))}}function ot(U){let ee=A.toLocal(U.global)[y],q=E[v]/2;E[y]=Math.max(0+q,Math.min(ee,M-q));let Ft=Math.floor((E[y]-q)/(M-E[v])*100);if(m){let he=JSON.stringify(_);n&&n(m,JSON.parse(he.replace('"{{ value }}"',String(Ft))))}return Ft}a&&(a.current={updateValue:U=>{let ee=E[v]/2;E[y]=U/100*(M-E[v])+ee}});let N=[];for(let U of s)if(U.elementId===r.id&&U.event===Ct.Add){let ee=o(U.type);if(!ee)throw new Error(`Transition class not found for type ${U.type}`);N.push(ee.add(t,A,U))}e.addChild(A),await Promise.all(N)};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Sprite with id ${s.id} not found`);return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Ct.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>{if(!e.getChildByName(r.id)){console.warn(`Slider with id ${r.id} not found`,{parent:e});return}JSON.stringify(r)!==JSON.stringify(s)&&await Promise.all([this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n,eventHandler:a}),this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a})])}};var Nu=class extends sr{static rendererName="pixi";rendererName="pixi";rendererType="audio";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o})=>{r.delay?setTimeout(()=>{t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})},r.delay):t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})};remove=async(t,e)=>{let{element:r}=e;t.audioStage.remove(r.id)};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n})=>{if(r.url!==s.url||r.volume!==s.volume){let a=t.audioStage.getById(r.id);a&&(a.url=s.url,a.volume=s.volume??1)}}};var Hu=class{constructor(){this.cache=new Map}async load(t){let e=[];for(let[r,s]of Object.entries(t))this.cache.has(r)||e.push([r,s]);e.length>0&&await Promise.all(e.map(async([r,s])=>{let a={buffer:await(await fetch(s.url)).arrayBuffer(),type:s.type};this.cache.set(r,a)}))}getBufferMap(){let t={};for(let[e,r]of this.cache.entries())t[e]=r;return t}clear(){this.cache.clear()}size(){return this.cache.size}has(t){return this.cache.has(t)}},qw=()=>new Hu;var tj=y0;export{Nu as AudioPlugin,Uu as ContainerRendererPlugin,Du as KeyframeTransitionPlugin,Ou as RectRendererPlugin,Lu as SliderRendererPlugin,ku as SpriteRendererPlugin,Iu as TextRendererPlugin,Fu as TextRevealingRendererPlugin,qw as createAssetBufferManager,tj as default};
1140
+ `,ki=null,Bo=class{constructor(){ki||(ki=URL.createObjectURL(new Blob([Uw],{type:"application/javascript"}))),this.worker=new Worker(ki)}};Bo.revokeObjectURL=function(){ki&&(URL.revokeObjectURL(ki),ki=null)};var f0=0,Eu,Cu=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Gi;e.addEventListener("message",r=>{e.terminate(),Gi.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Eu===void 0&&(Eu=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Eu&&(this._createdWorkers++,t=new Bo().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[f0]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:f0++,id:r})}},Mu=new Cu;Fe();var Dw=[".jpeg",".jpg",".png",".webp",".avif"],Ow=["image/jpeg","image/png","image/webp","image/avif"];async function Lw(i,t){let e=await L.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var Da={name:"loadTextures",extension:{type:x.LoadParser,priority:wt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ce(i,Ow)||le(i,Dw)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Mu.isImageBitmapSupported()?r=await Mu.loadImageBitmap(i,t):r=await Lw(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new jt({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Mi(i),...t.data});return Bi(s,e,i)},unload(i){i.destroy(!0)}};P();zc();Wc();var p0=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Nw=p0.map(i=>`video/${i.substring(1)}`);function Hw(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=zw(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function Ww(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function zw(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var m0={name:"loadVideo",extension:{type:x.LoadParser,name:"loadVideo"},test(i){let t=ce(i,Nw),e=le(i,p0);return t||e},async load(i,t,e){let r={...Xr.defaultOptions,resolution:t.data?.resolution||Mi(i),alphaMode:t.data?.alphaMode||await hn(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(c=>{let l=o[c];l!==void 0&&s.setAttribute(c,l)}),r.muted===!0&&(s.muted=!0),Hw(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let c=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=Xr.MIME_TYPES[c]||`video/${c}`}return n.src=i,a&&(n.type=a),new Promise(c=>{let l=async()=>{let h=new Xr({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await Ww(s),c(Bi(h,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};P();Wr();P();Wr();var Oa={extension:{type:x.ResolveParser,name:"resolveTexture"},test:Da.test,parse:i=>({resolution:parseFloat(te.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var g0={extension:{type:x.ResolveParser,priority:-2,name:"resolveJson"},test:i=>te.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Oa.parse};Wr();Qi();sn();var La=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new te,this.loader=new Ua,this.cache=tt,this._backgroundLoader=new Ia(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){F("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=br(t),s=Lt(t).map(a=>{if(typeof a!="string"){let c=this.resolver.getAlias(a);return c.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(c)?c[0]:c}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,c=0,l=()=>{e?.(++a/c)},h=n.map(u=>{let f=s[u];return c+=Object.keys(f).length,this._mapLoadToResolve(f,l).then(d=>{o[u]=d})});return await Promise.all(h),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return tt.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=tt.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],c=[n.src];n.alias&&c.push(...n.alias),c.forEach(l=>{o[l]=a}),tt.set(c,a)}),o}async unload(t){this._initialized||await this.init();let e=Lt(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Lt(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{tt.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},xe=new La;I.handleByList(x.LoadParser,xe.loader.parsers).handleByList(x.ResolveParser,xe.resolver.parsers).handleByList(x.CacheParser,xe.cache.parsers).handleByList(x.DetectionParser,xe.detections);I.add(e0,s0,r0,c0,o0,n0,a0,l0,h0,u0,d0,Da,m0,t0,Jv,Oa,g0);var x0={loader:x.LoadParser,resolver:x.ResolveParser,cache:x.CacheParser,detection:x.DetectionParser};I.handle(x.Asset,i=>{let t=i.ref;Object.entries(x0).filter(([e])=>!!t[e]).forEach(([e,r])=>I.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(x0).filter(e=>!!t[e]).forEach(e=>I.remove(t[e]))});Do();dt();rn();var Na=class extends Xe{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:c,roundPixels:l,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Bt({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),c!==void 0&&(this.height=c)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.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.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function _0(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(O(W,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Ss();Mr();var ir=class extends Na{constructor(...t){let e=_0(t,"Text");super(e,Tt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=At.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};Fe();bt();rt();$c();de();lh();an();Ss();Mr();kt();var Vw=Io(bl(),1);I.add(A_,C_);var Ct={Add:"add",Remove:"remove",Update:"update"},Ha=class{init(t){throw new Error("Method not implemented.")}render(t){throw new Error("Method not implemented.")}},sr=class{rendererName;rendererType;add=async(t,e,r)=>{throw new Error("Method not implemented.")};remove=async(t,e,r)=>{throw new Error("Method not implemented.")};update=async(t,e,r)=>{throw new Error("Method not implemented.")}};var Wa=(i=[],t=[])=>{let e=[],r=[],s=[],o=i.filter(a=>!a.hidden),n=t.filter(a=>!a.hidden);for(let a of o){let c=n.find(l=>l.id===a.id&&l.type===a.type);c?r.push({prev:a,next:c}):e.push(a)}for(let a of n)o.find(l=>l.id===a.id&&l.type===a.type)||s.push(a);for(let a of i){let c=t.find(l=>l.id===a.id&&l.type===a.type);c&&c.hidden&&!a.hidden&&e.push(a)}return{toDeleteElements:e,toUpdateElements:r,toAddElements:s}};var Gr=new(window.AudioContext||window.webkitAudioContext),Ii=class i{static loadedAssets={};static load=async(t,e)=>{if(!i.loadedAssets[t]&&e.byteLength!==0)try{let r=await Gr.decodeAudioData(e);i.loadedAssets[t]=r}catch(r){console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}};static getAsset=t=>i.loadedAssets[t]},Bu=class{_audioSource;_gainNode;volume=1;id;url;loop=!1;constructor(t,e){this.id=t,this.url=e.url,this.loop=e.loop||!1,this.volume=e.volume??1,this._gainNode=Gr.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Gr.destination)}play=()=>{let t=Ii.getAsset(this.url);if(!t){console.warn("AudioPlayer.play: Asset not found",this.url);return}this._audioSource=Gr.createBufferSource(),this._audioSource.buffer=t,this._audioSource.loop=this.loop,this._gainNode.gain.setValueAtTime(this.volume,Gr.currentTime),this._audioSource.connect(this._gainNode),this._audioSource.start(0)};stop=()=>{this._audioSource&&(this._audioSource.stop(),this._audioSource.disconnect(),this._gainNode.disconnect(),this._gainNode=Gr.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Gr.destination))}},za=class{audioPlayers=[];stageAudios=[];add=t=>{this.stageAudios.push(t)};remove=t=>{this.stageAudios=this.stageAudios.filter(e=>e.id!==t)};getById=t=>this.stageAudios.find(e=>e.id===t);tick=()=>{for(let e of this.stageAudios){let r=this.audioPlayers.find(s=>s.id===e.id);if(!r){let s=new Bu(e.id,{url:e.url,loop:e.loop,volume:e.volume??1});this.audioPlayers.push(s),s.play();return}(r.url!==e.url||r.loop!==e.loop)&&(r.stop(),r.url=e.url,r.loop=e.loop??!1,r.play()),r.volume!==(e.volume??1)&&(r.volume=e.volume??1,r._gainNode.gain.value=r.volume)}let t=[];for(let e of this.audioPlayers)this.stageAudios.find(r=>r.id===e.id)||(e.stop(),t.push(e.id));this.audioPlayers=this.audioPlayers.filter(e=>!t.includes(e.id))};destroy=()=>{for(let t of this.audioPlayers)t.stop();this.audioPlayers=[],this.stageAudios=[]}};var Xw=i=>i.split("/").pop(),Ru=class{name="advancedBufferLoader";priority=2;constructor(t){this.bufferMap=t}test(t){return!0}async load(t){let e=t.startsWith("file:")?t:Xw(t),r=this.bufferMap[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}}async testParse(t){return!0}async parse(t){if(t instanceof E)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new E.from(r)}async unload(t){t.destroy(!0)}},Gu=class i extends Ha{static rendererName="pixi";_app;_audioStage=new za;_state={elements:[]};_eventHandler;_plugins;_currentAbortController;_advancedLoader;get canvas(){return this._app.canvas}init=async t=>{let{eventHandler:e,plugins:r,width:s,height:o,backgroundColor:n}=t;for(let c of r)if(c.rendererName!==i.rendererName)throw new Error("Plugin does not match renderer name");this._plugins=r,this._eventHandler=e,this._app=new Ga,this._app.audioStage=this._audioStage,await this._app.init({width:s,height:o,backgroundColor:n});let a=new zt;return a.rect(0,0,s,o),a.fill(n||0),this._app.stage.addChild(a),this._app.stage.width=s,this._app.stage.height=o,this._app.ticker.add(this._app.audioStage.tick),this};destroy=()=>{this._app.audioStage.destroy(),this._app.destroy()};_classifyAsset=t=>t?t.startsWith("audio/")?"audio":t.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(t)?"font":"texture":"texture";loadAssets=async t=>{if(!t)throw new Error("assetBufferMap is required");let e={audio:{},font:{},texture:{}};for(let[s,o]of Object.entries(t)){let n=this._classifyAsset(o.type);e[n][s]=o}await Promise.all(Object.entries(e.audio).map(([s,o])=>Ii.load(s,o.buffer))),await Promise.all(Object.entries(e.font).map(async([s,o])=>{let n=new Blob([o.buffer],{type:o.type}),a=URL.createObjectURL(n),c=new FontFace(s,`url(${a})`);try{await c.load(),document.fonts.add(c),console.log(`Font loaded successfully: ${s}`)}catch(l){console.error(`Failed to load font ${s}:`,l)}finally{URL.revokeObjectURL(a)}})),this._advancedLoader?Object.assign(this._advancedLoader.bufferMap,e.texture):(this._advancedLoader=new Ru(e.texture),xe.loader.parsers.length=0,xe.reset(),I.add({name:"advanced-buffer-loader",extension:x.Asset,priority:wt.High,loader:this._advancedLoader}),typeof xe.registerPlugin=="function"&&xe.registerPlugin(this._advancedLoader));let r=Object.keys(e.texture);return Promise.all(r.map(s=>xe.load(s)))};loadAudioAssets=async t=>Promise.all(t.map(async e=>{let s=await(await fetch(e)).arrayBuffer();return Ii.load(e,s)}));updatedBackgroundColor=t=>{this._app.renderer.background.color=t};render=t=>{this._render(this._app,this._app.stage,this._state,t,this._eventHandler),this._state=t};_getRendererByElement=t=>{for(let e of this._plugins)if(e.rendererType===t.type)return e;throw new Error(`No renderer found for element type: ${t.type}`)};_getTransitionByType=t=>{for(let e of this._plugins)if(e.transitionType===t)return e;throw new Error(`No transition found for transition type: ${t}`)};_render=async(t,e,r,s,o)=>{let n=Date.now(),{toAddElements:a,toUpdateElements:c,toDeleteElements:l}=Wa(r.elements,s.elements);this._currentAbortController&&this._currentAbortController.abort(),this._currentAbortController=new AbortController;let h=this._currentAbortController.signal,u=[];for(let f of l){let d=this._getRendererByElement(f);u.push(()=>d.remove(t,{parent:e,element:f,elements:s.elements,transitions:s.transitions,getRendererByElement:this._getRendererByElement,getTransitionByType:this._getTransitionByType,eventHandler:o},h))}for(let f of a){let d=this._getRendererByElement(f);u.push(()=>d.add(t,{parent:e,element:f,elements:s.elements,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o},h))}for(let f of c){let d=this._getRendererByElement(f.next);u.push(()=>d.update(t,{parent:e,prevElement:f.prev,nextElement:f.next,elements:s.elements,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o},h))}try{await Promise.all(u.map(f=>f())),t.stage.children.sort((f,d)=>{let m=s.elements.find(_=>_.id===f.label),g=s.elements.find(_=>_.id===d.label);if(m&&g){let _=m.zIndex??0,b=g.zIndex??0;if(_!==b)return _-b;let y=s.elements.findIndex(T=>T.id===f.label),v=s.elements.findIndex(T=>T.id===d.label);return y-v}if(!m&&!g)return 0;if(!m)return-1;if(!g)return 1}),o&&o("completed",{id:s.id,diffTime:Date.now()-n})}catch(f){if(f.name==="AbortError")return;throw console.error("Error:",f),f}finally{this._currentAbortController=void 0}}},y0=Gu;var ku=class extends sr{static rendererName="pixi";rendererName="pixi";rendererType="sprite";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c,elements:l=[]}=e,h=o.url?E.from(o.url):E.EMPTY,u,f,d=o.scaleX??1,m=o.scaleY??1;o.hoverUrl&&(u=E.from(o.hoverUrl)),o.clickUrl&&(f=E.from(o.clickUrl));let g=new Nt(h);g.label=o.id,(o.eventName||o.hoverUrl||o.clickUrl)&&(g.cursor="pointer",g.eventMode="static"),o.width!==void 0?g.width=o.width*d:g.width*=d,o.height!==void 0?g.height=o.height*m:g.height*=m,o.anchorX!==void 0&&(g.pivot.x=g.width*o.anchorX),o.anchorY!==void 0&&(g.pivot.y=g.height*o.anchorY),o.rotation!==void 0&&(g.rotation=o.rotation*Math.PI/180),o.x!==void 0&&(g.x=o.x),o.y!==void 0&&(g.y=o.y),o.zIndex!==void 0&&(g.zIndex=o.zIndex),o.alpha!==void 0&&(g.alpha=o.alpha),(u||f)&&g.on("pointerup",()=>{g.texture=h}).on("pointerupoutside",()=>{g.texture=h}).on("pointerleave",()=>{g.texture=h}),f&&g.on("pointerdown",()=>{g.texture=f}),u&&g.on("pointerenter",()=>{g.texture=u}),g.on("pointerup",b=>{b.stopPropagation();let y=b.button;y===0?c&&c(o.eventName,o.eventPayload):y===2&&(o.rightClickEventName&&c?c(o.rightClickEventName):t.stage.emit("rightclick",event))});let _=[];for(let b of n)if(b.elementId===o.id&&b.event===Ct.Add){let y=a(b.type);if(!y)throw new Error(`Transition class not found for type ${b.type}`);_.push(y.add(t,g,b,r))}s.addChild(g),Array.isArray(l)&&l.length>0&&s.children.sort((b,y)=>{let v=l.find(C=>C.id===b.label),T=l.find(C=>C.id===y.label);if(v&&T){let C=v.zIndex??0,S=T.zIndex??0;if(C!==S)return C-S;let A=l.findIndex(R=>R.id===b.label),M=l.findIndex(R=>R.id===y.label);return A-M}if(!v&&!T)return 0;if(!v)return-1;if(!T)return 1}),await Promise.all(_)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c)throw new Error(`Sprite with id ${o.id} not found`);let l=[];for(let h of n)if(h.elementId===o.id&&h.event===Ct.Remove){let u=a(h.type);if(!u)throw new Error(`Transition class not found for type ${h.type}`);l.push(u.remove(t,c,h,r))}await Promise.all(l),c&&c.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a},c)=>{if(c?.aborted)throw new DOMException("Operation aborted","AbortError");let l=e.getChildByName(r.id);if(!l)throw new Error(`Sprite with id ${r.id} not found`);let h=[];for(let d of o)if(d.elementId===r.id&&d.event===Ct.Update){let m=n(d.type);if(!m)throw new Error(`Transition class not found for type ${d.type}`);h.push(m.add(t,l,d,c))}h.length>0?(await Promise.all(h),u()):f();function u(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let _=E.from(s.url);if(l.texture=_,!r.url&&s.url)if(_.baseTexture.valid){let b=s.scaleX??1,y=s.scaleY??1;l.width=(s.width??_.width)*b,l.height=(s.height??_.height)*y}else _.baseTexture.once("loaded",()=>{let b=s.scaleX??1,y=s.scaleY??1;l.width=(s.width??_.width)*b,l.height=(s.height??_.height)*y})}let m=r.hoverUrl||r.clickUrl,g=s.hoverUrl||s.clickUrl;if(!m&&g){let _=l.texture;l.on("pointerup",()=>{l.texture=_}).on("pointerupoutside",()=>{l.texture=_}).on("pointerleave",()=>{l.texture=_})}if(s.hoverUrl){let _=E.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=_})}if(s.clickUrl){let _=E.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=_})}}(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="pointer",l.eventMode="static")}function f(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let y=E.from(s.url);if(l.texture=y,!r.url&&s.url)if(y.baseTexture.valid){let v=s.scaleX??1,T=s.scaleY??1;l.width=(s.width??y.width)*v,l.height=(s.height??y.height)*T}else y.baseTexture.once("loaded",()=>{let v=s.scaleX??1,T=s.scaleY??1;l.width=(s.width??y.width)*v,l.height=(s.height??y.height)*T})}let _=r.hoverUrl||r.clickUrl,b=s.hoverUrl||s.clickUrl;if(!_&&b){let y=l.texture;l.on("pointerup",()=>{l.texture=y}).on("pointerupoutside",()=>{l.texture=y}).on("pointerleave",()=>{l.texture=y})}if(s.hoverUrl){let y=E.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=y})}if(s.clickUrl){let y=E.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=y})}}s.x!==void 0&&s.x!==r.x&&(l.x=s.x),s.y!==void 0&&s.y!==r.y&&(l.y=s.y),s.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180);let m=s.scaleX??1,g=s.scaleY??1;s.width!==void 0&&(s.width!==r.width||m!==(r.scaleX??1))&&(l.width=s.width*m),s.height!==void 0&&(s.height!==r.height||g!==(r.scaleY??1))&&(l.height=s.height*g),s.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=l.width*s.anchorX/m),s.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=l.height*s.anchorY/g),s.zIndex!==void 0&&s.zIndex!==r.zIndex&&(l.zIndex=s.zIndex),s.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="pointer",l.eventMode="static")}}};var Va=i=>new Tt({wordWrap:i.wordWrap||!0,breakWords:i.breakWords||!1,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Iu=class{static rendererName="pixi";rendererName="pixi";rendererType="text";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=Va(o.style),h=new ir({text:o.text,style:l}),u;o.hoverStyle&&(u=Va(o.hoverStyle));let f;if(o.clickedStyle&&(f=Va(o.clickedStyle)),(o.eventName||o.clickedStyle||o.hoverStyle)&&(h.cursor="pointer",h.eventMode="static"),h.label=o.id,o.x!==void 0&&(h.x=o.x),o.y!==void 0&&(h.y=o.y),o.anchorX!==void 0&&(h.anchor.x=o.anchorX),o.anchorY!==void 0&&(h.anchor.y=o.anchorY),o.anchorX!==void 0||o.anchorY!==void 0){let m=h.getLocalBounds();h.hitArea=new V(-m.width*h.anchor.x,-m.height*h.anchor.y,m.width,m.height)}h.on("pointerupoutside",()=>{h.style=l}).on("pointerup",()=>{h.style=l}).on("pointerleave",()=>{h.style=l}),h.on("pointerup",m=>{o.clickSoundUrl&&t.soundStage&&t.soundStage.add({id:`${o.id}-click-${Math.random()}`,url:o.clickSoundUrl,loop:!1,volume:o.clickSoundVolume??50/100}),m.stopPropagation(),c&&c(o.eventName,o.eventPayload)}),f&&h.on("pointerdown",()=>{h.style=f}),u&&h.on("pointerenter",()=>{h.style=u,o.hoverSoundUrl&&t.soundStage&&o.hoverSoundVolume!==void 0&&t.soundStage.add({id:`${o.id}-hover-${Math.random()}`,url:o.hoverSoundUrl,loop:!1,volume:o.hoverSoundVolume/100})});let d=[];for(let m of n)if(m.elementId===o.id&&m.event===Ct.Add){let g=a(m.type);if(!g)throw new Error(`Transition class not found for type ${m.type}`);d.push(g.add(t,h,m,r))}s.addChild(h),await Promise.all(d)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c){console.warn(`Text with id ${o.id} not found`);return}let l=[];for(let h of n)if(h.elementId===o.id&&h.event===Ct.Remove){let u=a(h.type);if(!u)throw new Error(`Transition class not found for type ${h.type}`);l.push(u.remove(t,c,h,r))}await Promise.all(l),c&&c.destroy()};update=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,prevElement:o,nextElement:n,transitions:a,getTransitionByType:c,eventHandler:l}=e,h=s.getChildByName(o.id);if(!h){console.warn(`Text with id ${o.id} not found`);return}if(JSON.stringify(o)!==JSON.stringify(n)){let u=[this.add(t,{parent:s,element:n,transitions:a,getTransitionByType:c,eventHandler:l},r),this.remove(t,{parent:s,element:o,transitions:a,getTransitionByType:c},r)];await Promise.all(u)}else o.text!==n.text&&(h.text=n.text),JSON.stringify(o.style)!==JSON.stringify(n.style)&&(h.style=Va(n?.style)),n.x!==void 0&&(h.x=n.x),n.y!==void 0&&(h.y=n.y)}};var Fi=(i,t=!1)=>new Tt({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Fu=class{static rendererName="pixi";rendererName="pixi";rendererType="text-revealing";add=async(t,{parent:e,element:r})=>{let s=Fi(r.style,r.text),o=new ir({text:"",style:s});o.label=r.id,o.text_id=r.text;let n=new at;r.x!==void 0&&(n.x=r.x),r.y!==void 0&&(n.y=r.y),n.addChild(o),n.label=r.id,e.addChild(n);let a=r.style.wordWrapWidth||500,c=r.text?[{text:r.text,style:r.style}]:r.segments,l=[],h=[],u=0,f=0,d=0;for(;;){let S=c[0];if(!S){h.length>0&&l.push({lineParts:h,y:f});break}if(f>1e4)break;let A={...S.style,wordWrapWidth:a-u},M=At.measureText(S.text,Fi(A));M.lineHeight>d&&(d=M.lineHeight);let R=At.measureText("a",Fi(A)),B=At.measureText("a a",Fi(A)).width-R.width*2;if(M.lineWidths[0]+u>a){u=0,l.push({lineParts:h,y:f}),f+=d,d=0,h=[];continue}let k=M.lines[0],N=M.lines.slice(1).join(" "),j={text:k,style:A,x:u,y:0};if(h.push(j),N&&N.length>0?S.text=N:c.shift(),!(!k||k.length===0)){if(S.furigana){let q=At.measureText(S.furigana.text,Fi(S.furigana.style)),D={text:S.furigana.text,style:S.furigana.style,x:u+(M.width-q.width)/2,y:-10};h.push(D)}u+=M.lineWidths[0]+B}}l.forEach(S=>{let A=new at;A.y=S.y,A.alpha=0,S.lineParts.forEach(M=>{let R=new ir({text:M.text,style:Fi(M.style),x:M.x,y:M.y});A.addChild(R)}),n.addChild(A)});let m=new zt,g=1e3,_=a/2,b=a/2;m.fill({color:16777215,alpha:1}),m.rect(0,0,_,g);for(let S=0;S<b;S++)m.fill({color:16777215,alpha:1-S/b}),m.rect(_+S,0,_+1,g);let y=t.renderer.generateTexture(m),v=new Nt(y);v.x=-1.35*_-b,t.stage.addChild(v);let T=0,C=1;if(l.length!==0){if(r.displaySpeed===100||r.hasEnded){n.children.forEach(S=>{t.stage.removeChild(v),S.mask=null,S.alpha=1});return}await new Promise(S=>{let A=M=>{if(C>n.children.length){S();return}n.getChildAt(C).mask||(n.getChildAt(C).mask=v,n.getChildAt(C).alpha=1),T+=M.deltaMS;let w=(r.displaySpeed||50)/1e3;v.x+=w*T,v.x>=0&&(n.getChildAt(C).mask=null,v.x=-1.35*_-b,C=C+1,T=0,C>=n.children.length&&(n.getChildAt(C-1).mask=null,t.ticker.remove(A),S()))};t.ticker.add(A)})}};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Text with id ${s.id} not found`,{parent:r});return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Ct.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o}=e;if(!r.getChildByName(s.id)){console.warn(`Text with id ${s.id} not found`,{parent:r});return}await this.remove(t,{parent:r,element:s}),await this.add(t,{parent:r,element:o})}};var Uu=class{static rendererName="pixi";rendererName="pixi";rendererType="container";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,elements:n=[],transitions:a=[],getTransitionByType:c,getRendererByElement:l,eventHandler:h}=e,u=structuredClone(o),f=new at;f.label=u.id;let d={};u.x!==void 0&&(typeof u.x=="string"&&u.x.endsWith("%")?f.x=Number(u.x.replace("%",""))*t.screen.width/100:f.x=u.x),u.y!==void 0&&(typeof u.y=="string"&&u.y.endsWith("%")?f.y=Number(u.y.replace("%",""))*t.screen.height/100:f.y=u.y),u.scaleX!==void 0&&(f.scale.x=u.scaleX),u.scaleY!==void 0&&(f.scale.y=u.scaleY),u.zIndex!==void 0&&(f.zIndex=u.zIndex),u.rotation!==void 0&&(f.rotation=u.rotation*Math.PI/180),u.propagateEvents&&(f.eventMode="static",["pointerup","pointerupoutside","pointerleave","pointerdown","pointerenter"].forEach(R=>{f.on(R,w=>{w.stopPropagation();for(let B of f.children)B.emit(R)})}));let m=u.gap||0,g=new zt().roundRect(0,0,u.width||0,u.height||0,1).fill(u.fill?u.fill.color:"transparent"),_=[0,.5,1],b=u.anchorX??0,y=u.anchorY??0;if(!_.includes(b))throw new Error(`Invalid anchorX value: ${b}. Must be 0, 0.5, or 1`);if(!_.includes(y))throw new Error(`Invalid anchorY value: ${y}. Must be 0, 0.5, or 1`);if(u.direction){let R,w;u.direction==="horizontal"?(R=u.children.reduce((k,N)=>k+N.width+m,0),w=u.children.reduce((k,N)=>Math.max(k,N.height||0),0)):u.direction==="vertical"&&(R=u.children.reduce((k,N)=>Math.max(k,N.width||0),0),w=u.children.reduce((k,N)=>k+N.height+m,0));let B={x:b,y};u.direction==="horizontal"?this.layoutChildren({element:u,anchor:B,totalWidth:R,totalHeight:w,gap:m,direction:"horizontal",scroll:u.scroll}):u.direction==="vertical"&&this.layoutChildren({element:u,anchor:B,totalWidth:R,totalHeight:w,gap:m,direction:"vertical",scroll:u.scroll}),this.setupScrolling({container:f,element:u,totalHeight:w,totalWidth:R,eventHandler:h,sliderRef:d}),g=this.createContainerGraphic(u,R,w,B)}g.label=`${u.id}-container-background`,f.addChild(g);let v=[];(u.children||[]).forEach(R=>{let w=l(R),B=u.width||0,k=u.height||0,N=b*B,j=y*k,q={zIndex:u.zIndex,...R,x:(R.x||0)+N,y:(R.y||0)+j};v.push(w.add(t,{parent:f,element:q,elements:u.children||[],transitions:a,getTransitionByType:c,getRendererByElement:l,eventHandler:h},r))});let T=[];for(let R of a)if(R.elementId===u.id&&R.event===Ct.Add){let w=c(R.type);if(!w)throw new Error(`Transition class not found for type ${R.type}`);T.push(w.add(t,f,R,r))}s.addChild(f),await Promise.all([...v,...T]);let{width:C,height:S}=this.getContainerDimensions(u,f),A=b*C,M=y*S;f.pivot.x=A,f.pivot.y=M};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");console.log("remove container 11111111111");let{parent:s,element:o}=e,n=s.getChildByName(o.id);if(!n){console.warn(`Container with id ${o.id} not found`);return}n.destroy()};update=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,prevElement:o,nextElement:n,elements:a=[],getRendererByElement:c,transitions:l=[],getTransitionByType:h,eventHandler:u}=e,f=structuredClone(o),d=structuredClone(n),m=s.getChildByName(f.id);if(!m){console.warn(`Container with id ${f.id} not found`);return}d.x!==void 0&&d.x!==f.x&&(m.x=d.x),d.y!==void 0&&d.y!==f.y&&(m.y=d.y),d.rotation!==void 0&&d.rotation!==f.rotation&&(m.rotation=d.rotation*Math.PI/180);let g=[0,.5,1],_=d.anchorX??0,b=d.anchorY??0;if(!g.includes(_))throw new Error(`Invalid anchorX value: ${_}. Must be 0, 0.5, or 1`);if(!g.includes(b))throw new Error(`Invalid anchorY value: ${b}. Must be 0, 0.5, or 1`);if(d.direction){let w=d.gap||0,B,k;d.direction==="horizontal"?(B=d.children.reduce((q,D)=>q+D.width+w,0),k=d.children.reduce((q,D)=>Math.max(q,D.height||0),0)):d.direction==="vertical"&&(B=d.children.reduce((q,D)=>Math.max(q,D.width||0),0),k=d.children.reduce((q,D)=>q+D.height+w,0));let N={x:_,y:b};d.direction==="horizontal"?this.layoutChildren({element:d,anchor:N,totalWidth:B,totalHeight:k,gap:w,direction:"horizontal",scroll:d.scroll}):d.direction==="vertical"&&this.layoutChildren({element:d,anchor:N,totalWidth:B,totalHeight:k,gap:w,direction:"vertical",scroll:d.scroll});let j=m.children.find(q=>q.label===`${d.id}-container-background`);if(j){j.destroy();let q=this.createContainerGraphic(d,B,k,N);q.label=`${d.id}-container-background`,m.addChildAt(q,0)}f.scroll!==d.scroll&&this.setupScrolling({container:m,element:d,totalHeight:k,totalWidth:B,eventHandler:u,sliderRef:{}})}let y=[],{toAddElements:v,toUpdateElements:T,toDeleteElements:C}=Wa(f.children,d.children);for(let w of C){let B=c(w);y.push(B.remove(t,{parent:m,element:w,elements:d.children||[],transitions:l,getTransitionByType:h,getRendererByElement:c,eventHandler:u},r))}for(let w of v){let B=c(w),k=d.width||0,N=d.height||0,j=_*k,q=b*N,D={...w,x:(w.x||0)+j,y:(w.y||0)+q};y.push(B.add(t,{parent:m,element:D,elements:d.children||[],transitions:l,getTransitionByType:h,getRendererByElement:c,eventHandler:u},r))}for(let w of T){let B=c(w.next),k=d.width||0,N=d.height||0,j=_*k,q=b*N,D=f.anchorX??0,U=f.anchorY??0,ee=f.width||0,Z=f.height||0,Ft=D*ee,he=U*Z,or={...w.prev,x:(w.prev.x||0)+Ft,y:(w.prev.y||0)+he},nr={...w.next,x:(w.next.x||0)+j,y:(w.next.y||0)+q};y.push(B.update(t,{parent:m,prevElement:or,nextElement:nr,elements:d.children||[],transitions:l,getTransitionByType:h,getRendererByElement:c,eventHandler:u},r))}d.children&&d.children.length>0&&m.children.sort((w,B)=>{let k=d.children.find(j=>j.id===w.label),N=d.children.find(j=>j.id===B.label);if(k&&N){let j=k.zIndex??0,q=N.zIndex??0;if(j!==q)return j-q;let D=d.children.indexOf(k),U=d.children.indexOf(N);return D-U}if(!k&&!N)return 0;if(!k)return-1;if(!N)return 1}),await Promise.all(y);let{width:S,height:A}=this.getContainerDimensions(d,m),M=_*S,R=b*A;m.pivot.x=M,m.pivot.y=R};layoutChildren({element:t,anchor:e,totalWidth:r,totalHeight:s,gap:o,direction:n,scroll:a}){let c=n==="horizontal",l=c?"x":"y",h=c?"y":"x",u=c?"width":"height",f=c?"height":"width",d=c?r:s,m=c?s:r,g=c?e.x:e.y,_=c?e.y:e.x;if(!a&&t[u]!==void 0&&t[u]<d){let y=0,v=0,T=0,C=0;(t.children||[]).forEach((S,A)=>{y>0&&y+S[u]>t[u]&&(this.alignRowElements(t.children.slice(C,A),l,g,t[u]),y=0,v+=T+o,T=0,C=A),S[l]=y,S[h]=v,y+=S[u]+o,T=Math.max(T,S[f]||0)}),C<t.children.length&&this.alignRowElements(t.children.slice(C),l,g,t[u])}else{if(g===0){let y=0;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}else if(g===1){let y=-d;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}else if(g===.5){let y=-d/2;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}_===0?(t.children||[]).forEach(y=>{y[h]=0}):_===.5?(t.children||[]).forEach(y=>{y[h]=-m/2}):_===1&&(t.children||[]).forEach(y=>{y[h]=-m})}}alignRowElements(t,e,r,s){if(!t.length)return;let o=t.reduce((n,a,c)=>n+a[e==="x"?"width":"height"]+(c>0,0),0);if(r===.5){let a=(s-o)/2;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}else if(r===1){let a=s-o;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}}createContainerGraphic(t,e,r,s){let o=new zt().roundRect(0,0,e,r,1).fill(t.fill?t.fill.color:"transparent");return s.x===1&&(o.x-=t.width),s.x===.5&&(o.x-=t.width/2),s.y===1&&(o.y-=t.height),s.y===.5&&(o.y-=t.height/2),o}getContainerDimensions(t,e){let r=t.width||0,s=t.height||0;if(!t.direction&&(!t.width||!t.height)&&e.children&&e.children.length>0){let o=1/0,n=-1/0,a=1/0,c=-1/0;e.children.forEach(l=>{let h=l.x||0,u=l.y||0,f=l.width||0,d=l.height||0;o=Math.min(o,h),n=Math.max(n,h+f),a=Math.min(a,u),c=Math.max(c,u+d)}),t.width||(r=n-o,(isNaN(r)||!isFinite(r))&&(r=0)),t.height||(s=c-a,(isNaN(s)||!isFinite(s))&&(s=0))}return{width:r,height:s}}setupScrolling({container:t,element:e,totalHeight:r,totalWidth:s,eventHandler:o,sliderRef:n}){let a=e.scroll&&e.height&&r>e.height,c=e.scroll&&e.width&&s>e.width;if(a||c){let l=0,h=0,u=-r+e.height,f=-s+e.width,d=new zt().rect(0,0,e.width||s,e.height||r).fill("red");t.mask=d,t.eventMode="static",t.addChild(d),t.on("wheel",m=>{if(a&&m.deltaY!==0&&(l-m.deltaY>0||l-m.deltaY<u||(l-=m.deltaY,t.y-=m.deltaY,d.y+=m.deltaY)),c&&(m.deltaX!==0||m.shiftKey&&m.deltaY!==0)){let g=m.deltaX!==0?m.deltaX:m.deltaY;if(h-g>0||h-g<f)return;h-=g,t.x-=g,d.x+=g}})}}};var $w={linear:i=>i},Yw=(i,t,e,r)=>i+(t-i)*$w[r](e);function b0(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r}function v0(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i}var jw=(i,t)=>{let e=[],r=0,s;i.forEach(({value:n,duration:a,easing:c,relative:l},h)=>{h===0?(s=n,e.push({time:r,value:n,easing:"linear"})):a!==void 0&&c!==void 0&&(r+=a,l?s=s+n:s=n,e.push({time:r,value:s,easing:c}))});let o=0;for(let n=0;n<e.length-1;n++){let{time:a,value:c,easing:l}=e[n],{time:h,value:u}=e[n+1];if(t>=a&&t<=h){let f=(t-a)/(h-a);o=Yw(c,u,f,l);break}else t>h&&(o=u)}return o};function Kw(i){return Math.max.apply(null,i)}var Du=class{static rendererName="pixi";rendererName="pixi";transitionType="keyframes";_transition=async(t,e,r,s)=>new Promise((o,n)=>{if(s?.aborted){n(new DOMException("Operation aborted","AbortError"));return}let{properties:a}=r,c=Array.isArray(a)?a:Object.entries(a).map(([_,b])=>({...b,property:_})),l=c.map(_=>_.keyframes.reduce((b,y)=>b+y.duration||0,0)),h=Kw(l),u=0,f={};c.forEach(_=>{f[_.property]=b0(e,_.property)});let d=_=>{let b={};c.forEach(y=>{let v=[];y.initialValue!==void 0?v=[{value:y.initialValue,duration:0}]:v=[{value:f[y.property],duration:0}],v=v.concat(y.keyframes),v0(b,y.property,jw(v,_))}),c.forEach(y=>{let{property:v}=y;e&&!e.destroyed&&v0(e,v,b0(b,v))})},m=()=>{t.ticker.remove(g),d(h)};s&&s.addEventListener("abort",()=>{m(),n(new DOMException("Operation aborted","AbortError"))});let g=_=>{if(u+=_.deltaMS,u>=h){t.ticker.remove(g),o();return}d(u)};if(s?.aborted){m(),n(new DOMException("Operation aborted","AbortError"));return}t.ticker.add(g)});add=async(t,e,r,s)=>this._transition(t,e,r,s);remove=async(t,e,r,s)=>this._transition(t,e,r,s)};var Ou=class{static rendererName="pixi";rendererName="pixi";rendererType="rect";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=new zt;l.label=o.id,o.x!==void 0&&(l.x=o.x),o.y!==void 0&&(l.y=o.y),o.alpha!==void 0&&(l.alpha=o.alpha),o.scaleX!==void 0&&(l.scale.x=o.scaleX),o.scaleY!==void 0&&(l.scale.y=o.scaleY),o.rotation!==void 0&&(l.rotation=o.rotation*Math.PI/180);let h=o.width,u=o.height;l.rect(0,0,h,u),l.fill(o.fill),o.anchorX!==void 0&&(l.pivot.x=h*o.anchorX),o.anchorY!==void 0&&(l.pivot.y=u*o.anchorY),(o.clickEventName||o.rightClickEventName)&&c&&(l.eventMode="static",l.on("pointerup",d=>{d.button===0?c(o.clickEventName):d.button===2&&c(o.rightClickEventName)})),o.wheelEventName&&c&&(l.eventMode="static",l.on("wheel",d=>{c(o.wheelEventName,{deltaY:d.deltaY})}));let f=[];for(let d of n)if(d.elementId===o.id&&d.event===Ct.Add){let m=a(d.type);if(!m)throw new Error(`Transition class not found for type ${d.type}`);f.push(m.add(t,l,d,r))}s.addChild(l),await Promise.all(f)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c)throw new Error(`Rect with id ${o.id} not found`);let l=[];for(let h of n)if(h.elementId===o.id&&h.event===Ct.Remove){let u=a(h.type);if(!u)throw new Error(`Transition class not found for type ${h.type}`);l.push(u.remove(t,c,h,r))}await Promise.all(l),c&&c.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a},c)=>{if(c?.aborted)throw new DOMException("Operation aborted","AbortError");let l=e.getChildByName(r.id);if(!l)throw new Error(`Rect with id ${r.id} not found`);let h=[];for(let u of o)if(u.elementId===r.id&&u.event===Ct.Update){let f=n(u.type);if(!f)throw new Error(`Transition class not found for type ${u.type}`);h.push(f.add(t,l,u,c))}h.length>0?(await Promise.all(h),(r.width!==s.width||r.height!==s.height||r.fill!==s.fill)&&(l.clear(),l.rect(0,0,s.width,s.height),l.fill(s.fill)),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY)):(r.x!==void 0&&s.x!==r.x&&(l.x=s.x),r.y!==void 0&&s.y!==r.y&&(l.y=s.y),r.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),r.scaleX!==void 0&&s.scaleX!==r.scaleX&&(l.scale.x=s.scaleX),r.scaleY!==void 0&&s.scaleY!==r.scaleY&&(l.scale.y=s.scaleY),r.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180),(r.width!==s.width||r.height!==s.height||r.fill!==s.fill)&&(l.clear(),l.rect(0,0,s.width,s.height),l.fill(s.fill)),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY))}};var Lu=class extends sr{static rendererName="pixi";rendererName="pixi";rendererType="slider";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o,eventHandler:n,ref:a})=>{let{direction:c,idleThumb:l,hoverThumb:h,idleBar:u,hoverBar:f,dragEndEventName:d,dragEventName:m,dragEventPayload:g,initialValue:_}=r,b={horizontal:{axis:"x",size:"width"},vertical:{axis:"y",size:"height"}},y=b[c].axis,v=b[c].size,T=E.from(l),C=E.from(h),S=E.from(u),A=E.from(f),M=new Nt({texture:S,anchor:{x:0,y:0}});M.label=r.id;let R=M[v];M.x=r.x||0,M.y=r.y||0;let w=new Nt({texture:T,anchor:{x:.5,y:.5}});if(w.y=M.height/2,w.x=M.width/2,w.eventMode="static",w.cursor="pointer",M.eventMode="static",M.cursor="pointer",w.on("pointerdown",N).on("pointerup",j).on("pointerupoutside",j),M.on("pointerdown",B).on("pointerup",k).on("pointerupoutside",k),M.addChild(w),_!==void 0){let U=w[v]/2;w[y]=_/100*(R-w[v])+U}function B(U){w.texture=C,M.texture=A,q(U),t.stage.eventMode="static",t.stage.addEventListener("pointermove",q)}function k(U){w.texture=T,M.texture=S,q(U),t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",q)}function N(U){U.stopPropagation(),w.texture=C,M.texture=A,t.stage.eventMode="static",t.stage.addEventListener("pointermove",q)}function j(U){if(w.texture=T,M.texture=S,t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",q),d){let ee=M.toLocal(U.global)[y],Z=w[v]/2;w[y]=Math.max(0+Z,Math.min(ee,R-Z));let Ft=Math.floor((w[y]-Z)/(R-w[v])*100),he=JSON.stringify(g);n&&n(d,JSON.parse(he.replace('"{{ value }}"',String(Ft))))}}function q(U){let ee=M.toLocal(U.global)[y],Z=w[v]/2;w[y]=Math.max(0+Z,Math.min(ee,R-Z));let Ft=Math.floor((w[y]-Z)/(R-w[v])*100);if(m){let he=JSON.stringify(g);n&&n(m,JSON.parse(he.replace('"{{ value }}"',String(Ft))))}return Ft}a&&(a.current={updateValue:U=>{let ee=w[v]/2;w[y]=U/100*(R-w[v])+ee}});let D=[];for(let U of s)if(U.elementId===r.id&&U.event===Ct.Add){let ee=o(U.type);if(!ee)throw new Error(`Transition class not found for type ${U.type}`);D.push(ee.add(t,M,U))}e.addChild(M),await Promise.all(D)};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Sprite with id ${s.id} not found`);return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Ct.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>{if(!e.getChildByName(r.id)){console.warn(`Slider with id ${r.id} not found`,{parent:e});return}JSON.stringify(r)!==JSON.stringify(s)&&await Promise.all([this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n,eventHandler:a}),this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a})])}};var Nu=class extends sr{static rendererName="pixi";rendererName="pixi";rendererType="audio";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o})=>{r.delay?setTimeout(()=>{t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})},r.delay):t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})};remove=async(t,e)=>{let{element:r}=e;t.audioStage.remove(r.id)};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n})=>{if(r.url!==s.url||r.volume!==s.volume){let a=t.audioStage.getById(r.id);a&&(a.url=s.url,a.volume=s.volume??1)}}};var Hu=class{constructor(){this.cache=new Map}async load(t){let e=[];for(let[r,s]of Object.entries(t))this.cache.has(r)||e.push([r,s]);e.length>0&&await Promise.all(e.map(async([r,s])=>{let a={buffer:await(await fetch(s.url)).arrayBuffer(),type:s.type};this.cache.set(r,a)}))}getBufferMap(){let t={};for(let[e,r]of this.cache.entries())t[e]=r;return t}clear(){this.cache.clear()}size(){return this.cache.size}has(t){return this.cache.has(t)}},qw=()=>new Hu;var tj=y0;export{Nu as AudioPlugin,Uu as ContainerRendererPlugin,Du as KeyframeTransitionPlugin,Ou as RectRendererPlugin,Lu as SliderRendererPlugin,ku as SpriteRendererPlugin,Iu as TextRendererPlugin,Fu as TextRevealingRendererPlugin,qw as createAssetBufferManager,tj as default};