route-graphics 0.0.2-rc4 → 0.0.2-rc6

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 OT=Object.create;var Rc=Object.defineProperty;var LT=Object.getOwnPropertyDescriptor;var NT=Object.getOwnPropertyNames;var HT=Object.getPrototypeOf,WT=Object.prototype.hasOwnProperty;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var Gc=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Dd=(i,t)=>{for(var e in t)Rc(i,e,{get:t[e],enumerable:!0})},zT=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of NT(t))!WT.call(i,s)&&s!==e&&Rc(i,s,{get:()=>t[s],enumerable:!(r=LT(t,s))||r.enumerable});return i};var tn=(i,t,e)=>(e=i!=null?OT(HT(i)):{},zT(t||!i||!i.__esModule?Rc(e,"default",{value:i,enumerable:!0}):e,i));var x,kc,ts,R,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||{}),kc=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},ts=(i,t)=>kc(i).priority??t,R={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(kc).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(kc).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)=>ts(n.value,e)-ts(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)=>ts(o,e)-ts(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 Ld=Gc((MP,Ic)=>{"use strict";var VT=Object.prototype.hasOwnProperty,Ft="~";function es(){}Object.create&&(es.prototype=Object.create(null),new es().__proto__||(Ft=!1));function jT(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function Od(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new jT(e,r||i,s),n=Ft?Ft+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 en(i,t){--i._eventsCount===0?i._events=new es:delete i._events[t]}function Gt(){this._events=new es,this._eventsCount=0}Gt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)VT.call(e,r)&&t.push(Ft?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Gt.prototype.listeners=function(t){var e=Ft?Ft+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=Ft?Ft+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=Ft?Ft+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 Od(this,t,e,r,!1)};Gt.prototype.once=function(t,e,r){return Od(this,t,e,r,!0)};Gt.prototype.removeListener=function(t,e,r,s){var o=Ft?Ft+t:t;if(!this._events[o])return this;if(!e)return en(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&en(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:en(this,o)}return this};Gt.prototype.removeAllListeners=function(t){var e;return t?(e=Ft?Ft+t:t,this._events[e]&&en(this,e)):(this._events=new es,this._eventsCount=0),this};Gt.prototype.off=Gt.prototype.removeListener;Gt.prototype.addListener=Gt.prototype.on;Gt.prefixed=Ft;Gt.EventEmitter=Gt;typeof Ic<"u"&&(Ic.exports=Gt)});var Nd,ot,kt=p(()=>{Nd=tn(Ld(),1),ot=Nd.default});var $T,Le,wt,oe,Yd,Hd,Fc,XT,rn,Kd,qd,Wd,zd,Vd,rs,YT,KT,qT,ZT,Oc,jd,QT,Uc,Dc,$d,Lc,pe,Xd,Zd,Qd=p(()=>{$T={grad:.9,turn:360,rad:360/(2*Math.PI)},Le=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},wt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},oe=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Yd=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Hd=function(i){return{r:oe(i.r,0,255),g:oe(i.g,0,255),b:oe(i.b,0,255),a:oe(i.a)}},Fc=function(i){return{r:wt(i.r),g:wt(i.g),b:wt(i.b),a:wt(i.a,3)}},XT=/^#([0-9a-f]{3,8})$/i,rn=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Kd=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}},qd=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}},Wd=function(i){return{h:Yd(i.h),s:oe(i.s,0,100),l:oe(i.l,0,100),a:oe(i.a)}},zd=function(i){return{h:wt(i.h),s:wt(i.s),l:wt(i.l),a:wt(i.a,3)}},Vd=function(i){return qd((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},rs=function(i){return{h:(t=Kd(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},YT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,KT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,qT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ZT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Oc={string:[[function(i){var t=XT.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?wt(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?wt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=qT.exec(i)||ZT.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Hd({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=YT.exec(i)||KT.exec(i);if(!t)return null;var e,r,s=Wd({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*($T[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Vd(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 Le(t)&&Le(e)&&Le(r)?Hd({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(!Le(t)||!Le(e)||!Le(r))return null;var n=Wd({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Vd(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Le(t)||!Le(e)||!Le(r))return null;var n=function(a){return{h:Yd(a.h),s:oe(a.s,0,100),v:oe(a.v,0,100),a:oe(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return qd(n)},"hsv"]]},jd=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]},QT=function(i){return typeof i=="string"?jd(i.trim(),Oc.string):typeof i=="object"&&i!==null?jd(i,Oc.object):[null,void 0]},Uc=function(i,t){var e=rs(i);return{h:e.h,s:oe(e.s+100*t,0,100),l:e.l,a:e.a}},Dc=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},$d=function(i,t){var e=rs(i);return{h:e.h,s:e.s,l:oe(e.l+100*t,0,100),a:e.a}},Lc=function(){function i(t){this.parsed=QT(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 wt(Dc(this.rgba),2)},i.prototype.isDark=function(){return Dc(this.rgba)<.5},i.prototype.isLight=function(){return Dc(this.rgba)>=.5},i.prototype.toHex=function(){return t=Fc(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?rn(wt(255*o)):"","#"+rn(e)+rn(r)+rn(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return Fc(this.rgba)},i.prototype.toRgbString=function(){return t=Fc(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 zd(rs(this.rgba))},i.prototype.toHslString=function(){return t=zd(rs(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=Kd(this.rgba),{h:wt(t.h),s:wt(t.s),v:wt(t.v),a:wt(t.a,3)};var t},i.prototype.invert=function(){return pe({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),pe(Uc(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),pe(Uc(this.rgba,-t))},i.prototype.grayscale=function(){return pe(Uc(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),pe($d(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),pe($d(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"?pe({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):wt(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=rs(this.rgba);return typeof t=="number"?pe({h:t,s:e.s,l:e.l,a:e.a}):wt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===pe(t).toHex()},i}(),pe=function(i){return i instanceof Lc?i:new Lc(i)},Xd=[],Zd=function(i){i.forEach(function(t){Xd.indexOf(t)<0&&(t(Lc,Oc),Xd.push(t))})}});function Jd(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 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,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 tf=p(()=>{});var Vr,V,Mt=p(()=>{Qd();tf();Zd([Jd]);Vr=class is{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 is)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]=is._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=is.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=pe(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 is||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}};Vr.shared=new Vr;Vr._temp=new Vr;Vr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;V=Vr});var ef,rf=p(()=>{"use strict";ef={cullArea:null,cullable:!1,cullableChildren:!0}});var sf,of,nf,Nc=p(()=>{"use strict";sf=Math.PI*2,of=180/Math.PI,nf=Math.PI/180});var X,Hc,ne=p(()=>{"use strict";X=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 Hc.x=0,Hc.y=0,Hc}},Hc=new X});var B,JT,tS,K=p(()=>{Nc();ne();B=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 X;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 X;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(sf-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 tS.identity()}static get shared(){return JT.identity()}},JT=new B,tS=new B});var Bt,sn=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 $(i="default"){return Wc[i]===void 0&&(Wc[i]=-1),++Wc[i]}var Wc,Rt=p(()=>{"use strict";Wc={default:-1}});function U(i,t,e=3){if(af[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1
+ var UT=Object.create;var Bc=Object.defineProperty;var DT=Object.getOwnPropertyDescriptor;var OT=Object.getOwnPropertyNames;var LT=Object.getPrototypeOf,NT=Object.prototype.hasOwnProperty;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var Rc=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Ud=(i,t)=>{for(var e in t)Bc(i,e,{get:t[e],enumerable:!0})},HT=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of OT(t))!NT.call(i,s)&&s!==e&&Bc(i,s,{get:()=>t[s],enumerable:!(r=DT(t,s))||r.enumerable});return i};var Jo=(i,t,e)=>(e=i!=null?UT(LT(i)):{},HT(t||!i||!i.__esModule?Bc(e,"default",{value:i,enumerable:!0}):e,i));var x,Gc,Ji,G,E=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||{}),Gc=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},Ji=(i,t)=>Gc(i).priority??t,G={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Gc).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Gc).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)=>Ji(n.value,e)-Ji(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)=>Ji(o,e)-Ji(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 Od=Rc((AP,kc)=>{"use strict";var WT=Object.prototype.hasOwnProperty,Ft="~";function ts(){}Object.create&&(ts.prototype=Object.create(null),new ts().__proto__||(Ft=!1));function zT(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function Dd(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new zT(e,r||i,s),n=Ft?Ft+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 tn(i,t){--i._eventsCount===0?i._events=new ts:delete i._events[t]}function Gt(){this._events=new ts,this._eventsCount=0}Gt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)WT.call(e,r)&&t.push(Ft?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Gt.prototype.listeners=function(t){var e=Ft?Ft+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=Ft?Ft+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=Ft?Ft+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 Dd(this,t,e,r,!1)};Gt.prototype.once=function(t,e,r){return Dd(this,t,e,r,!0)};Gt.prototype.removeListener=function(t,e,r,s){var o=Ft?Ft+t:t;if(!this._events[o])return this;if(!e)return tn(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&tn(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:tn(this,o)}return this};Gt.prototype.removeAllListeners=function(t){var e;return t?(e=Ft?Ft+t:t,this._events[e]&&tn(this,e)):(this._events=new ts,this._eventsCount=0),this};Gt.prototype.off=Gt.prototype.removeListener;Gt.prototype.addListener=Gt.prototype.on;Gt.prefixed=Ft;Gt.EventEmitter=Gt;typeof kc<"u"&&(kc.exports=Gt)});var Ld,ot,kt=p(()=>{Ld=Jo(Od(),1),ot=Ld.default});var VT,Oe,wt,oe,$d,Nd,Ic,jT,en,Yd,Kd,Hd,Wd,zd,es,XT,$T,YT,KT,Dc,Vd,qT,Fc,Uc,jd,Oc,pe,Xd,qd,Zd=p(()=>{VT={grad:.9,turn:360,rad:360/(2*Math.PI)},Oe=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},wt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},oe=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},$d=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Nd=function(i){return{r:oe(i.r,0,255),g:oe(i.g,0,255),b:oe(i.b,0,255),a:oe(i.a)}},Ic=function(i){return{r:wt(i.r),g:wt(i.g),b:wt(i.b),a:wt(i.a,3)}},jT=/^#([0-9a-f]{3,8})$/i,en=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Yd=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}},Kd=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}},Hd=function(i){return{h:$d(i.h),s:oe(i.s,0,100),l:oe(i.l,0,100),a:oe(i.a)}},Wd=function(i){return{h:wt(i.h),s:wt(i.s),l:wt(i.l),a:wt(i.a,3)}},zd=function(i){return Kd((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},es=function(i){return{h:(t=Yd(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},XT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$T=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,YT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,KT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dc={string:[[function(i){var t=jT.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?wt(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?wt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=YT.exec(i)||KT.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Nd({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=XT.exec(i)||$T.exec(i);if(!t)return null;var e,r,s=Hd({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(VT[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return zd(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return Oe(t)&&Oe(e)&&Oe(r)?Nd({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!Oe(t)||!Oe(e)||!Oe(r))return null;var n=Hd({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return zd(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Oe(t)||!Oe(e)||!Oe(r))return null;var n=function(a){return{h:$d(a.h),s:oe(a.s,0,100),v:oe(a.v,0,100),a:oe(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Kd(n)},"hsv"]]},Vd=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]},qT=function(i){return typeof i=="string"?Vd(i.trim(),Dc.string):typeof i=="object"&&i!==null?Vd(i,Dc.object):[null,void 0]},Fc=function(i,t){var e=es(i);return{h:e.h,s:oe(e.s+100*t,0,100),l:e.l,a:e.a}},Uc=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},jd=function(i,t){var e=es(i);return{h:e.h,s:e.s,l:oe(e.l+100*t,0,100),a:e.a}},Oc=function(){function i(t){this.parsed=qT(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 wt(Uc(this.rgba),2)},i.prototype.isDark=function(){return Uc(this.rgba)<.5},i.prototype.isLight=function(){return Uc(this.rgba)>=.5},i.prototype.toHex=function(){return t=Ic(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?en(wt(255*o)):"","#"+en(e)+en(r)+en(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return Ic(this.rgba)},i.prototype.toRgbString=function(){return t=Ic(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 Wd(es(this.rgba))},i.prototype.toHslString=function(){return t=Wd(es(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=Yd(this.rgba),{h:wt(t.h),s:wt(t.s),v:wt(t.v),a:wt(t.a,3)};var t},i.prototype.invert=function(){return pe({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),pe(Fc(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),pe(Fc(this.rgba,-t))},i.prototype.grayscale=function(){return pe(Fc(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),pe(jd(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),pe(jd(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"?pe({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):wt(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=es(this.rgba);return typeof t=="number"?pe({h:t,s:e.s,l:e.l,a:e.a}):wt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===pe(t).toHex()},i}(),pe=function(i){return i instanceof Oc?i:new Oc(i)},Xd=[],qd=function(i){i.forEach(function(t){Xd.indexOf(t)<0&&(t(Oc,Dc),Xd.push(t))})}});function Qd(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 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,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 Jd=p(()=>{});var zr,V,Mt=p(()=>{Zd();Jd();qd([Qd]);zr=class rs{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 rs)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]=rs._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=rs.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=pe(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 rs||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}};zr.shared=new zr;zr._temp=new zr;zr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;V=zr});var tf,ef=p(()=>{"use strict";tf={cullArea:null,cullable:!1,cullableChildren:!0}});var rf,sf,of,Lc=p(()=>{"use strict";rf=Math.PI*2,sf=180/Math.PI,of=Math.PI/180});var Y,Nc,ne=p(()=>{"use strict";Y=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 Nc.x=0,Nc.y=0,Nc}},Nc=new Y});var B,ZT,QT,K=p(()=>{Lc();ne();B=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 Y;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 Y;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(rf-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 QT.identity()}static get shared(){return ZT.identity()}},ZT=new B,QT=new B});var Bt,rn=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 $(i="default"){return Hc[i]===void 0&&(Hc[i]=-1),++Hc[i]}var Hc,Rt=p(()=>{"use strict";Hc={default:-1}});function D(i,t,e=3){if(nf[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))),af[t]=!0}var af,H,cf,dt=p(()=>{"use strict";af={},H="8.0.0",cf="8.3.4"});var _r,zc=p(()=>{"use strict";_r=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 Vc,W,Ut=p(()=>{zc();Vc=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 _r(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},W=new Vc});var lf,hf=p(()=>{dt();lf={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){U("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function on(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 jc=p(()=>{"use strict"});var uf,df=p(()=>{jc();dt();uf={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)}on(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||U(H,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!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 ff,pf=p(()=>{"use strict";ff={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 Ne,nn=p(()=>{"use strict";Ne=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 $c,an,mf=p(()=>{w();Ut();$c=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 W.get(r.maskClass,t)}return t}returnMaskEffect(t){W.return(t)}},an=new $c;R.handleByList(x.MaskEffect,an._effectClasses)});var gf,xf=p(()=>{nn();mf();gf={_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),an.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=an.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 Ne);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 Ne),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var _f,yf=p(()=>{dt();_f={label:null,get name(){return U(H,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){U(H,"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 cn,z,vt=p(()=>{ne();cn=[new X,new X,new X,new X],z=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!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,g=a+h,_=a+o-h,y=c+h,b=c+n-h;return t>=u&&t<=d&&e>=f&&e<=m&&!(t>g&&t<_&&e>y&&e<b)}intersects(t,e){if(!e){let C=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=C)return!1;let M=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>M}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=cn[0].set(t.left,t.top),c=cn[1].set(t.left,t.bottom),l=cn[2].set(t.right,t.top),h=cn[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,g=d*s+f*o,_=d*r+f*n,y=d*s+f*n;if(Math.max(m,g,_,y)<=d*a.x+f*a.y||Math.min(m,g,_,y)>=d*h.x+f*h.y)return!1;let b=u*(a.y-l.y),v=u*(l.x-a.x),T=b*r+v*o,P=b*s+v*o,S=b*r+v*n,E=b*s+v*n;return!(Math.max(T,P,S,E)<=b*a.x+v*a.y||Math.min(T,P,S,E)>=b*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 bf,rt,Xt=p(()=>{K();vt();bf=new B,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=bf,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new z);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=bf,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,g=this.maxY,_=n*t+c*e+h,y=a*t+l*e+u;_<d&&(d=_),y<f&&(f=y),_>m&&(m=_),y>g&&(g=y),_=n*r+c*e+h,y=a*r+l*e+u,_<d&&(d=_),y<f&&(f=y),_>m&&(m=_),y>g&&(g=y),_=n*t+c*s+h,y=a*t+l*s+u,_<d&&(d=_),y<f&&(f=y),_>m&&(m=_),y>g&&(g=y),_=n*r+c*s+h,y=a*r+l*s+u,_<d&&(d=_),y<f&&(f=y),_>m&&(m=_),y>g&&(g=y),this.minX=d,this.minY=f,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,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 g=e;g<r;g+=2){let _=t[g],y=t[g+1],b=l*_+u*y+f,v=h*_+d*y+m;o=b<o?b:o,n=v<n?v:n,a=b>a?b: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 yt,re,yr=p(()=>{K();zc();Xt();yt=new _r(B),re=new _r(rt)});var eS,vf,Tf=p(()=>{K();Xt();yr();eS=new B,vf={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=re.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(eS).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),re.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),re.return(r))}}});function jr(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=yt.get().identity(),r=ln(i,s)):r=B.IDENTITY,Sf(i,e,r,t),s&&yt.return(s),e.isValid||e.set(0,0,0,0),e}function Sf(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=yt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=re.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++)Sf(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,B.IDENTITY),re.return(t)}r||yt.return(s)}function ln(i,t){let e=i.parent;return e&&(ln(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var ss=p(()=>{K();yr()});function hn(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 Xc=p(()=>{"use strict"});function $r(i,t){return i===wf?t:t===wf?i:hn(i,t)}var wf,Yc=p(()=>{Xc();wf=16777215});function os(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var Ef,Pf=p(()=>{ss();yr();Yc();Ef={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=ln(this,yt.get().identity());return i.appendFrom(this.localTransform,e),yt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?os(this.renderGroup.worldColor):this.parentRenderGroup?os($r(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=$r(t,e.localColor),e=e.parent;return os(t)}}});function G(...i){Kc!==Af&&(Kc++,Kc===Af?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var Kc,Af,it=p(()=>{"use strict";Kc=0,Af=500});function Xr(i,t,e){return t.clear(),e||(e=B.IDENTITY),Cf(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function Cf(i,t,e,r,s){let o;if(s)o=yt.get(),o=e.copyTo(o);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let c=i.localTransform;o=yt.get(),o.appendFrom(c,e)}let n=t,a=!!i.effects.length;if(a&&(t=re.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++)Cf(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,B.IDENTITY),re.return(t)}yt.return(o)}var un=p(()=>{K();yr()});function qc(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&&qc(s,t)}return t.didChange}var Mf=p(()=>{"use strict"});var rS,Bf,Rf=p(()=>{K();Xt();ss();un();Mf();rS=new B,Bf={_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),qc(this,i),i.didChange&&Xr(this,i.localBounds,rS),i.localBounds},getBounds(i,t){return jr(this,i,t||new rt)}}});var Gf,kf=p(()=>{"use strict";Gf={_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 iS(i,t){return i._zIndex-t._zIndex}var If,Ff=p(()=>{"use strict";If={_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(iS))}}});var Uf,Df=p(()=>{ne();yr();Uf={getGlobalPosition(i=new X,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(yt.get(),e);return t=r.apply(i,t),yt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(yt.get(),r);return e=s.applyInverse(i,e),yt.return(s),e}}});var Yr,Zc=p(()=>{Rt();Yr=class{constructor(){this.uid=$("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function He(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Qc(i){return!(i&i-1)&&!!i}var ns=p(()=>{"use strict"});function dn(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var Jc=p(()=>{"use strict"});function sS(i){let t=Of[i];return t===void 0&&(Of[i]=$("resource")),t}var Of,Lf,fn,tl=p(()=>{kt();Rt();dt();Of=Object.create(null);Lf=class Nf extends ot{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...Nf.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){U(H,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=sS(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Lf.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};fn=Lf});var Hf,J,Yt=p(()=>{kt();ns();Jc();Rt();tl();Hf=class Wf extends ot{constructor(t={}){super(),this.options=t,this.uid=$("textureSource"),this._resourceType="textureSource",this._resourceId=$("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...Wf.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 fn(dn(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=$("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=$("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=Qc(this.pixelWidth)&&Qc(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Hf.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};J=Hf});function oS(){for(let i=0;i<16;i++){let t=[];el.push(t);for(let e=0;e<16;e++){let r=pn(br[i]*br[e]+Tr[i]*vr[e]),s=pn(vr[i]*br[e]+Sr[i]*vr[e]),o=pn(br[i]*Tr[e]+Tr[i]*Sr[e]),n=pn(vr[i]*Tr[e]+Sr[i]*Sr[e]);for(let a=0;a<16;a++)if(br[a]===r&&vr[a]===s&&Tr[a]===o&&Sr[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new B;t.set(br[i],vr[i],Tr[i],Sr[i],0,0),zf.push(t)}}var br,vr,Tr,Sr,el,zf,pn,ht,Vf=p(()=>{K();br=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],vr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Tr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Sr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],el=[],zf=[],pn=Math.sign;oS();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=>br[i],uY:i=>vr[i],vX:i=>Tr[i],vY:i=>Sr[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>el[i][t],sub:(i,t)=>el[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=zf[ht.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var rl,jf=p(()=>{"use strict";rl=()=>{}});var wr,il=p(()=>{w();Yt();wr=class extends J{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}};wr.extension=x.TextureSource});var $f,Kr,sl=p(()=>{K();$f=new B,Kr=class{constructor(t,e){this.mapCoord=new B,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&&($f.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append($f));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 A,tt=p(()=>{kt();Vf();vt();Rt();dt();jf();il();Yt();sl();A=class extends ot{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:c,dynamic:l}={}){if(super(),this.uid=$("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new z,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new J,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 Kr(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 U(H,"Texture.baseTexture is now Texture.source"),this._source}};A.EMPTY=new A({label:"EMPTY",source:new J({label:"EMPTY"})});A.EMPTY.destroy=rl;A.WHITE=new A({source:new wr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});A.WHITE.destroy=rl});var nS,ol,ft,Ze=p(()=>{ns();Yt();tt();nS=0,ol=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new J({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new A({source:s,label:`texturePool_${nS++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=He(o),n=He(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let 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 ol});var mn,Xf=p(()=>{K();Zc();Ze();mn=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new B,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 Yr,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 B),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new B),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 B),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 Yf(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var Kf=p(()=>{"use strict"});var nl,al,cl,qr,as,Er,nt,me=p(()=>{kt();Mt();rf();w();K();Nc();sn();Rt();dt();Ut();hf();df();pf();xf();yf();Tf();Pf();Rf();kf();Ff();Df();Xf();Kf();nl=new Bt(null),al=new Bt(null),cl=new Bt(null,1,1),qr=1,as=2,Er=4,nt=class i extends ot{constructor(t={}){super(),this.uid=$("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 B,this.relativeGroupTransform=new B,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Bt(this,0,0),this._scale=cl,this._pivot=al,this._skew=nl,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=[],Yf(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){U("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),R.mixin(i,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||U(H,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!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=W.get(mn,this),this.groupTransform=B.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),W.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new B),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*of}set angle(t){this.rotation=t*nf}get pivot(){return this._pivot===al&&(this._pivot=new Bt(this,0,0)),this._pivot}set pivot(t){this._pivot===al&&(this._pivot=new Bt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===nl&&(this._skew=new Bt(this,0,0)),this._skew}set skew(t){this._skew===nl&&(this._skew=new Bt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===cl&&(this._scale=new Bt(this,1,1)),this._scale}set scale(t){this._scale===cl&&(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|=qr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=V.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=qr,this._onUpdate())}get tint(){return os(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=as,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|=Er,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|=Er,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|=Er,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}};R.mixin(nt,uf,vf,Uf,Gf,Bf,gf,_f,If,ef,lf,Ef,ff)});var Qe,gn=p(()=>{ne();Qe=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 X,this.page=new X,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 aS(i){return function(t){return t.test(i)}}function cs(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=aS(e),o={apple:{phone:s(ll)&&!s(We),ipod:s(qf),tablet:!s(ll)&&(s(Zf)||np(t))&&!s(We),universal:s(Qf),device:(s(ll)||s(qf)||s(Zf)||s(Qf)||np(t))&&!s(We)},amazon:{phone:s(Zr),tablet:!s(Zr)&&s(xn),device:s(Zr)||s(xn)},android:{phone:!s(We)&&s(Zr)||!s(We)&&s(hl),tablet:!s(We)&&!s(Zr)&&!s(hl)&&(s(xn)||s(Jf)),device:!s(We)&&(s(Zr)||s(xn)||s(hl)||s(Jf))||s(/\bokhttp\b/i)},windows:{phone:s(We),tablet:s(tp),device:s(We)||s(tp)},other:{blackberry:s(ep),blackberry10:s(rp),opera:s(ip),firefox:s(op),chrome:s(sp),device:s(ep)||s(rp)||s(ip)||s(op)||s(sp)},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 ll,qf,Zf,Qf,hl,Jf,Zr,xn,We,tp,ep,rp,ip,sp,op,np,ul=p(()=>{ll=/iPhone/i,qf=/iPod/i,Zf=/iPad/i,Qf=/\biOS-universal(?:.+)Mac\b/i,hl=/\bAndroid(?:.+)Mobile\b/i,Jf=/Android/i,Zr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,xn=/Silk/i,We=/Windows Phone/i,tp=/\bWindows(?:.+)ARM\b/i,ep=/BlackBerry/i,rp=/BB10/i,ip=/Opera Mini/i,sp=/\b(CriOS|Chrome)(?:.+)Mobile/i,op=/Mobile(?:.+)Firefox\b/i,np=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var ap=p(()=>{ul();ul()});var cS,cp,lp=p(()=>{ap();cS=cs.default??cs,cp=cS(globalThis.navigator)});var lS,_n,hS,uS,hp,up,dS,fS,pS,dl,fp,pp=p(()=>{gn();w();lp();jc();lS=9,_n=100,hS=0,uS=0,hp=2,up=1,dS=-1e3,fS=-1e3,pS=2,dl=class dp{constructor(t,e=cp){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=`${up}px`,t.style.height=`${up}px`,t.style.position="absolute",t.style.top=`${dS}px`,t.style.left=`${fS}px`,t.style.zIndex=pS.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=`${_n}px`,this._div.style.height=`${_n}px`,this._div.style.position="absolute",this._div.style.top=`${hS}px`,this._div.style.left=`${uS}px`,this._div.style.zIndex=hp.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:{...dp.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,on(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))),nf[t]=!0}var nf,H,af,dt=p(()=>{"use strict";nf={},H="8.0.0",af="8.3.4"});var xr,Wc=p(()=>{"use strict";xr=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 zc,W,Ut=p(()=>{Wc();zc=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 xr(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},W=new zc});var cf,lf=p(()=>{dt();cf={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 sn(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 Vc=p(()=>{"use strict"});var hf,uf=p(()=>{Vc();dt();hf={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)}sn(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(H,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!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 df,ff=p(()=>{"use strict";df={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 Le,on=p(()=>{"use strict";Le=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 jc,nn,pf=p(()=>{E();Ut();jc=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 W.get(r.maskClass,t)}return t}returnMaskEffect(t){W.return(t)}},nn=new jc;G.handleByList(x.MaskEffect,nn._effectClasses)});var mf,gf=p(()=>{on();pf();mf={_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),nn.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=nn.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 Le);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 Le),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var xf,_f=p(()=>{dt();xf={label:null,get name(){return D(H,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){D(H,"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 an,z,vt=p(()=>{ne();an=[new Y,new Y,new Y,new Y],z=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!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,g=a+h,_=a+o-h,b=c+h,y=c+n-h;return t>=u&&t<=d&&e>=f&&e<=m&&!(t>g&&t<_&&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 C=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>C}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=an[0].set(t.left,t.top),c=an[1].set(t.left,t.bottom),l=an[2].set(t.right,t.top),h=an[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,g=d*s+f*o,_=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),T=u*(l.x-a.x),v=y*r+T*o,P=y*s+T*o,S=y*r+T*n,w=y*s+T*n;return!(Math.max(v,P,S,w)<=y*a.x+T*a.y||Math.min(v,P,S,w)>=y*h.x+T*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 yf,rt,$t=p(()=>{K();vt();yf=new B,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=yf,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new z);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=yf,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,g=this.maxY,_=n*t+c*e+h,b=a*t+l*e+u;_<d&&(d=_),b<f&&(f=b),_>m&&(m=_),b>g&&(g=b),_=n*r+c*e+h,b=a*r+l*e+u,_<d&&(d=_),b<f&&(f=b),_>m&&(m=_),b>g&&(g=b),_=n*t+c*s+h,b=a*t+l*s+u,_<d&&(d=_),b<f&&(f=b),_>m&&(m=_),b>g&&(g=b),_=n*r+c*s+h,b=a*r+l*s+u,_<d&&(d=_),b<f&&(f=b),_>m&&(m=_),b>g&&(g=b),this.minX=d,this.minY=f,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,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 g=e;g<r;g+=2){let _=t[g],b=t[g+1],y=l*_+u*b+f,T=h*_+d*b+m;o=y<o?y:o,n=T<n?T:n,a=y>a?y:a,c=T>c?T: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 yt,re,_r=p(()=>{K();Wc();$t();yt=new xr(B),re=new xr(rt)});var JT,bf,vf=p(()=>{K();$t();_r();JT=new B,bf={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=re.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(JT).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),re.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),re.return(r))}}});function Vr(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=yt.get().identity(),r=cn(i,s)):r=B.IDENTITY,Tf(i,e,r,t),s&&yt.return(s),e.isValid||e.set(0,0,0,0),e}function Tf(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=yt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=re.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++)Tf(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,B.IDENTITY),re.return(t)}r||yt.return(s)}function cn(i,t){let e=i.parent;return e&&(cn(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var is=p(()=>{K();_r()});function ln(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 Xc=p(()=>{"use strict"});function jr(i,t){return i===Sf?t:t===Sf?i:ln(i,t)}var Sf,$c=p(()=>{Xc();Sf=16777215});function ss(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var wf,Ef=p(()=>{is();_r();$c();wf={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=cn(this,yt.get().identity());return i.appendFrom(this.localTransform,e),yt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?ss(this.renderGroup.worldColor):this.parentRenderGroup?ss(jr(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=jr(t,e.localColor),e=e.parent;return ss(t)}}});function k(...i){Yc!==Pf&&(Yc++,Yc===Pf?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var Yc,Pf,it=p(()=>{"use strict";Yc=0,Pf=500});function Xr(i,t,e){return t.clear(),e||(e=B.IDENTITY),Af(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function Af(i,t,e,r,s){let o;if(s)o=yt.get(),o=e.copyTo(o);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let c=i.localTransform;o=yt.get(),o.appendFrom(c,e)}let n=t,a=!!i.effects.length;if(a&&(t=re.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++)Af(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,B.IDENTITY),re.return(t)}yt.return(o)}var hn=p(()=>{K();_r()});function Kc(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&&Kc(s,t)}return t.didChange}var Cf=p(()=>{"use strict"});var tS,Mf,Bf=p(()=>{K();$t();is();hn();Cf();tS=new B,Mf={_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),Kc(this,i),i.didChange&&Xr(this,i.localBounds,tS),i.localBounds},getBounds(i,t){return Vr(this,i,t||new rt)}}});var Rf,Gf=p(()=>{"use strict";Rf={_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 eS(i,t){return i._zIndex-t._zIndex}var kf,If=p(()=>{"use strict";kf={_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(eS))}}});var Ff,Uf=p(()=>{ne();_r();Ff={getGlobalPosition(i=new Y,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(yt.get(),e);return t=r.apply(i,t),yt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(yt.get(),r);return e=s.applyInverse(i,e),yt.return(s),e}}});var $r,qc=p(()=>{Rt();$r=class{constructor(){this.uid=$("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function Ne(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Zc(i){return!(i&i-1)&&!!i}var os=p(()=>{"use strict"});function un(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var Qc=p(()=>{"use strict"});function rS(i){let t=Df[i];return t===void 0&&(Df[i]=$("resource")),t}var Df,Of,dn,Jc=p(()=>{kt();Rt();dt();Df=Object.create(null);Of=class Lf extends ot{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...Lf.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(H,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=rS(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Of.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};dn=Of});var Nf,J,Yt=p(()=>{kt();os();Qc();Rt();Jc();Nf=class Hf extends ot{constructor(t={}){super(),this.options=t,this.uid=$("textureSource"),this._resourceType="textureSource",this._resourceId=$("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...Hf.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 dn(un(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=$("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=$("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=Zc(this.pixelWidth)&&Zc(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Nf.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};J=Nf});function iS(){for(let i=0;i<16;i++){let t=[];tl.push(t);for(let e=0;e<16;e++){let r=fn(yr[i]*yr[e]+vr[i]*br[e]),s=fn(br[i]*yr[e]+Tr[i]*br[e]),o=fn(yr[i]*vr[e]+vr[i]*Tr[e]),n=fn(br[i]*vr[e]+Tr[i]*Tr[e]);for(let a=0;a<16;a++)if(yr[a]===r&&br[a]===s&&vr[a]===o&&Tr[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new B;t.set(yr[i],br[i],vr[i],Tr[i],0,0),Wf.push(t)}}var yr,br,vr,Tr,tl,Wf,fn,ht,zf=p(()=>{K();yr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],br=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],vr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Tr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],tl=[],Wf=[],fn=Math.sign;iS();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=>yr[i],uY:i=>br[i],vX:i=>vr[i],vY:i=>Tr[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>tl[i][t],sub:(i,t)=>tl[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=Wf[ht.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var el,Vf=p(()=>{"use strict";el=()=>{}});var Sr,rl=p(()=>{E();Yt();Sr=class extends J{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}};Sr.extension=x.TextureSource});var jf,Yr,il=p(()=>{K();jf=new B,Yr=class{constructor(t,e){this.mapCoord=new B,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&&(jf.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(jf));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 M,tt=p(()=>{kt();zf();vt();Rt();dt();Vf();rl();Yt();il();M=class extends ot{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:c,dynamic:l}={}){if(super(),this.uid=$("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new z,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new J,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 Yr(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(H,"Texture.baseTexture is now Texture.source"),this._source}};M.EMPTY=new M({label:"EMPTY",source:new J({label:"EMPTY"})});M.EMPTY.destroy=el;M.WHITE=new M({source:new Sr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});M.WHITE.destroy=el});var sS,sl,ft,qe=p(()=>{os();Yt();tt();sS=0,sl=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new J({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new M({source:s,label:`texturePool_${sS++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=Ne(o),n=Ne(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let 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 sl});var pn,Xf=p(()=>{K();qc();qe();pn=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new B,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 $r,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 B),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new B),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 B),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 $f(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var Yf=p(()=>{"use strict"});var ol,nl,al,Kr,ns,wr,nt,me=p(()=>{kt();Mt();ef();E();K();Lc();rn();Rt();dt();Ut();lf();uf();ff();gf();_f();vf();Ef();Bf();Gf();If();Uf();Xf();Yf();ol=new Bt(null),nl=new Bt(null),al=new Bt(null,1,1),Kr=1,ns=2,wr=4,nt=class i extends ot{constructor(t={}){super(),this.uid=$("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 B,this.relativeGroupTransform=new B,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Bt(this,0,0),this._scale=al,this._pivot=nl,this._skew=ol,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=[],$f(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."),G.mixin(i,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||D(H,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!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=W.get(pn,this),this.groupTransform=B.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),W.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new B),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*sf}set angle(t){this.rotation=t*of}get pivot(){return this._pivot===nl&&(this._pivot=new Bt(this,0,0)),this._pivot}set pivot(t){this._pivot===nl&&(this._pivot=new Bt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===ol&&(this._skew=new Bt(this,0,0)),this._skew}set skew(t){this._skew===ol&&(this._skew=new Bt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===al&&(this._scale=new Bt(this,1,1)),this._scale}set scale(t){this._scale===al&&(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|=Kr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=V.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Kr,this._onUpdate())}get tint(){return ss(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ns,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|=wr,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|=wr,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|=wr,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}};G.mixin(nt,hf,bf,Ff,Rf,Mf,mf,xf,kf,tf,cf,wf,df)});var Ze,mn=p(()=>{ne();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 Y,this.page=new Y,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 oS(i){return function(t){return t.test(i)}}function as(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=oS(e),o={apple:{phone:s(cl)&&!s(He),ipod:s(Kf),tablet:!s(cl)&&(s(qf)||op(t))&&!s(He),universal:s(Zf),device:(s(cl)||s(Kf)||s(qf)||s(Zf)||op(t))&&!s(He)},amazon:{phone:s(qr),tablet:!s(qr)&&s(gn),device:s(qr)||s(gn)},android:{phone:!s(He)&&s(qr)||!s(He)&&s(ll),tablet:!s(He)&&!s(qr)&&!s(ll)&&(s(gn)||s(Qf)),device:!s(He)&&(s(qr)||s(gn)||s(ll)||s(Qf))||s(/\bokhttp\b/i)},windows:{phone:s(He),tablet:s(Jf),device:s(He)||s(Jf)},other:{blackberry:s(tp),blackberry10:s(ep),opera:s(rp),firefox:s(sp),chrome:s(ip),device:s(tp)||s(ep)||s(rp)||s(sp)||s(ip)},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 cl,Kf,qf,Zf,ll,Qf,qr,gn,He,Jf,tp,ep,rp,ip,sp,op,hl=p(()=>{cl=/iPhone/i,Kf=/iPod/i,qf=/iPad/i,Zf=/\biOS-universal(?:.+)Mac\b/i,ll=/\bAndroid(?:.+)Mobile\b/i,Qf=/Android/i,qr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,gn=/Silk/i,He=/Windows Phone/i,Jf=/\bWindows(?:.+)ARM\b/i,tp=/BlackBerry/i,ep=/BB10/i,rp=/Opera Mini/i,ip=/\b(CriOS|Chrome)(?:.+)Mobile/i,sp=/Mobile(?:.+)Firefox\b/i,op=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var np=p(()=>{hl();hl()});var nS,ap,cp=p(()=>{np();nS=as.default??as,ap=nS(globalThis.navigator)});var aS,xn,cS,lS,lp,hp,hS,uS,dS,ul,dp,fp=p(()=>{mn();E();cp();Vc();aS=9,xn=100,cS=0,lS=0,lp=2,hp=1,hS=-1e3,uS=-1e3,dS=2,ul=class up{constructor(t,e=ap){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=`${hp}px`,t.style.height=`${hp}px`,t.style.position="absolute",t.style.top=`${hS}px`,t.style.left=`${uS}px`,t.style.zIndex=dS.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=`${xn}px`,this._div.style.height=`${xn}px`,this._div.style.position="absolute",this._div.style.top=`${cS}px`,this._div.style.left=`${lS}px`,this._div.style.zIndex=lp.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:{...up.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,sn(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))),af[t]=!0}var af,H,cf,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=`${_n}px`,e.style.height=`${_n}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=hp.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 Qe(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!==lS||!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()}};dl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"accessibility"};dl.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};fp=dl});var mp,gp=p(()=>{"use strict";mp={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var xp=p(()=>{w();me();pp();gp();R.add(fp);R.mixin(nt,mp)});var ls,_p=p(()=>{w();ls=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}};ls.extension=x.Application});var Je,yn=p(()=>{"use strict";Je=(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))(Je||{})});var Qr,yp=p(()=>{"use strict";Qr=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 bp,Kt,hs=p(()=>{yn();yp();bp=class ie{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 Qr(null,null,1/0),this.deltaMS=1/ie.targetFPMS,this.elapsedMS=1/ie.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=Je.NORMAL){return this._addListener(new Qr(t,e,r))}addOnce(t,e,r=Je.NORMAL){return this._addListener(new Qr(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*ie.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,ie.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(!ie._shared){let t=ie._shared=new ie;t.autoStart=!0,t._protected=!0}return ie._shared}static get system(){if(!ie._system){let t=ie._system=new ie;t.autoStart=!0,t._protected=!0}return ie._system}};bp.targetFPMS=.06;Kt=bp});var us,vp=p(()=>{w();yn();hs();us=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,Je.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Kt.shared:new Kt,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};us.extension=x.Application});var fl=p(()=>{w();_p();vp();R.add(ls);R.add(us)});var pl,we,ml=p(()=>{yn();hs();pl=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||(Kt.system.add(this._tickerUpdate,this,Je.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Kt.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())}},we=new pl});var ze,bn=p(()=>{ne();gn();ze=class extends Qe{constructor(){super(...arguments),this.client=new X,this.movement=new X,this.offset=new X,this.global=new X,this.screen=new X}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,g){throw new Error("Method not implemented.")}}});var Dt,gl=p(()=>{bn();Dt=class extends ze{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 Ee,xl=p(()=>{bn();Ee=class extends ze{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Ee.DOM_DELTA_PIXEL=0;Ee.DOM_DELTA_LINE=1;Ee.DOM_DELTA_PAGE=2});var mS,gS,ds,vn,Tp=p(()=>{kt();ne();it();ml();bn();gl();xl();mS=2048,gS=new X,ds=new X,vn=class{constructor(t){this.dispatch=new ot,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 G(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){we.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,gS.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<mS&&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")&&(we.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")&&(we.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,ds),!t.hitArea.contains(ds.x,ds.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,ds),t.containsPoint(ds)):!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 Dt)){G("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 Dt)){G("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 Dt)){G("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 Dt)){G("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 Dt)){G("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 Dt)){G("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 Ee)){G("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(Dt);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(Ee);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(Dt);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 Dt&&e instanceof Dt&&(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 ze&&e instanceof ze&&(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 xS,_S,yl,Tn,bl=p(()=>{w();Tp();ml();gl();xl();xS=1,_S={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},yl=class _l{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new vn(null),we.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Dt(null),this._rootWheelEvent=new Ee(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({..._l.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,_l._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,we.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,we.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;we.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;we.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=xS),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=_S[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}};yl.extension={name:"events",type:[x.WebGLSystem,x.CanvasSystem,x.WebGPUSystem],priority:-1};yl.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};Tn=yl});var Sp,wp=p(()=>{bl();gn();Sp={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??Tn.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 Qe))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 Ep=p(()=>{w();me();bl();wp();R.add(Tn);R.mixin(nt,Sp)});var fs,Pp=p(()=>{w();fs=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}};fs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"dom"}});var tr,Sn=p(()=>{Xt();me();tr=class extends nt{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 Ap=p(()=>{w();Pp();R.add(fs)});var Et,Ve=p(()=>{"use strict";Et=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Et||{})});var Cp,Mp=p(()=>{"use strict";Cp={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 Bp,D,ct=p(()=>{Mp();Bp=Cp,D={get(){return Bp},set(i){Bp=i}}});function ge(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function ps(i){return i.split("?")[0].split("#")[0]}function yS(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bS(i,t,e){return i.replace(new RegExp(yS(t),"g"),e)}function vS(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 Tt,Pr=p(()=>{ct();Tt={toPosix(i){return bS(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){ge(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(ge(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=ps(this.toPosix(t??D.get().getBaseUrl())),s=ps(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?Tt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(ge(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=vS(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return ge(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(ge(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(ge(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){ge(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){ge(i),t&&ge(t),i=ps(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){ge(i),i=ps(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){ge(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=ps(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 Ot,ms=p(()=>{"use strict";Ot=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function Rp(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?Rp(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function Gp(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)}),Rp(i,s,0,e,r)}else r.push(i);return r}var kp=p(()=>{"use strict"});var Ar,wn=p(()=>{"use strict";Ar=i=>!Array.isArray(i)});function TS(i){return i.split(".").pop().split("?").shift().split("#").shift()}var se,Jr=p(()=>{it();Pr();ms();kp();wn();se=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 Ot(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&&G("[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)&&G(`[Resolver] already has key: ${o} overwriting`)},Ot(e).forEach(o=>{let{src:n}=o,{data:a,format:c,loadParser:l}=o,h=Ot(n).map(f=>typeof f=="string"?Gp(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 g={};if(typeof m!="object"){g.src=m;for(let _=0;_<this._parsers.length;_++){let y=this._parsers[_];if(y.test(m)){g=y.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}),d.push(g)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=Ar(t);t=Ot(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=Ar(t);t=Ot(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=Tt.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??TS(t.src),t}};se.RETINA_PREFIX=/@([0-9\.]+)x/});var gs,vl=p(()=>{"use strict";gs=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var Ip,Tl,Fp=p(()=>{vt();tt();Ip=class xs{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof A?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<=xs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=xs.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 z(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new z(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new z(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(c=new z(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new A({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*xs.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*xs.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=[]}};Ip.BATCH_SIZE=1e3;Tl=Ip});function Up(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=Tt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Up([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var SS,Dp,Op=p(()=>{Ve();Jr();vl();w();tt();Pr();Fp();SS=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Dp={extension:x.Asset,cache:{test:i=>i instanceof Tl,getCacheableAssets:(i,t)=>Up(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"&&SS.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(se.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:x.LoadParser,priority:Et.Normal,name:"spritesheetLoader"},async testParse(i,t){return Tt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=Tt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof A)a=r;else{let h=gs(n+(s??i.meta.image),t.src);a=(await e.load([{src:h,data:o}]))[h]}let c=new Tl(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=gs(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 En=p(()=>{w();Op();R.add(Dp)});function Pn(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 Sl=p(()=>{"use strict"});var Lt,An=p(()=>{sn();tt();Sl();dt();Sn();Lt=class i extends tr{constructor(t=A.EMPTY){t instanceof A&&(t={texture:t});let{texture:e=A.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 A?new i(t):new i(A.from(t,e))}set texture(t){t||(t=A.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 Pn(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return U("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=wS;i.measurable=!0,jr(i,e,r),t.addBoundsMask(r),i.measurable=!1}var wS,wl=p(()=>{Xt();ss();wS=new rt});function Mn(i,t,e){let r=re.get();i.measurable=!0;let s=yt.get().identity(),o=Lp(i,e,s);Xr(i,r,o),i.measurable=!1,t.addBoundsMask(r),yt.return(s),re.return(r)}function Lp(i,t,e){return i?(i!==t&&(Lp(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(G("Mask bounds, renderable is not inside the root container"),e)}var El=p(()=>{un();yr();it()});var _s,Np=p(()=>{w();An();wl();El();_s=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 Lt),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){Mn(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Lt}};_s.extension=x.MaskEffect});var ys,Hp=p(()=>{w();ys=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"}};ys.extension=x.MaskEffect});var bs,Wp=p(()=>{w();me();wl();El();bs=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){Mn(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}};bs.extension=x.MaskEffect});var It,ti=p(()=>{ct();w();Yt();It=class extends J{constructor(t){t.resource||(t.resource=D.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 qt,ei=p(()=>{ct();w();it();Yt();qt=class extends J{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=D.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,G("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}};qt.extension=x.TextureSource});async function Bn(){return Pl??(Pl=(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"})()),Pl}var Pl,Al=p(()=>{"use strict"});var Rn,ri,Cl=p(()=>{w();hs();Al();Yt();Rn=class zp extends J{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...zp.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=Kt.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 Bn(),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&&(Kt.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||(Kt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Kt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Rn.extension=x.TextureSource;Rn.defaultOptions={...J.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Rn.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};ri=Rn});var Ml,Q,er=p(()=>{it();ms();Ml=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||G(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Ot(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&&G("[Cache] already has key:",c),this._cache.set(c,o.get(c))})}remove(t){if(!this._cacheMap.has(t)){G(`[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}},Q=new Ml});function Vp(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Bl.length;s++){let o=Bl[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function jp(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&Q.has(r))return Q.get(r);let o=new A({source:Vp(s)});return o.on("destroy",()=>{Q.has(r)&&Q.remove(r)}),t||Q.set(r,o),o}function $p(i,t=!1){return typeof i=="string"?Q.get(i):i instanceof J?new A({source:i}):jp(i,t)}var Bl,Rl=p(()=>{er();w();Yt();tt();Bl=[];R.handleByList(x.TextureSource,Bl);A.from=$p;J.from=Vp});var Gn=p(()=>{w();Np();Hp();Wp();il();ti();ei();Cl();Rl();R.add(_s,ys,bs,ri,qt,It,wr)});var Pt,rr=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 In(){return(!kn||kn?.isContextLost())&&(kn=D.get().createCanvas().getContext("webgl",{})),kn}var kn,Gl=p(()=>{ct()});function PS(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
20
- else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Xp(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=ES.replace(/%forloop%/gi,PS(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 ES,Yp=p(()=>{"use strict";ES=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
- `)});function ae(){if(ii)return ii;let i=In();return ii=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),ii=Xp(ii,i),i.getExtension("WEBGL_lose_context")?.loseContext(),ii}var ii,Cr=p(()=>{Gl();Yp();ii=null});function si(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return Kp[e]||AS(i,t,e)}function AS(i,t,e){let r={},s=0;kl||(kl=ae());for(let n=0;n<kl;n++){let a=n<t?i[n]:A.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new Pt(r);return Kp[e]=o,o}var Kp,kl,Fn=p(()=>{rr();tt();Cr();Kp={};kl=0});var Pe,Il=p(()=>{"use strict";Pe=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function vs(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 Fl=p(()=>{"use strict"});var qp,lt,Mr=p(()=>{"use strict";qp={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 je(i,t){return t.alphaMode==="no-premultiply-alpha"&&qp[i]||i}var Ts=p(()=>{Mr()});var Un,Zp=p(()=>{"use strict";Un=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 Qp(){return Dl>0?tm[--Dl]:new Ul}function Jp(i){tm[Dl++]=i}var Ul,tm,Dl,Ss,em,rm,im=p(()=>{Rt();Il();Fl();Ts();Cr();Zp();Ul=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Un,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},tm=[],Dl=0;Ss=0,em=class Dn{constructor(t={}){this.uid=$("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Dn.defaultOptions.maxTextures=Dn.defaultOptions.maxTextures??ae(),t={...Dn.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Pe(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Jp(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=Qp(),s=r.textures;s.clear();let o=e[this.elementStart],n=je(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 g=this.elementStart;g<this.elementSize;++g){let _=e[g];e[g]=null;let b=_.texture._source,v=je(_.blendMode,b),T=n!==v||a!==_.topology;if(b._batchTick===Ss&&!T){_._textureId=b._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}b._batchTick=Ss,(s.count>=m||T)&&(this._finishBatch(r,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=v,a=_.topology,r=Qp(),s=r.textures,s.clear(),++Ss),_._textureId=b._textureBindLocation=s.count,s.ids[b.uid]=s.count,s.textures[s.count++]=b,_._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,d,u-d,s,n,a,t,f),d=u,++Ss),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,++Ss,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Pe(e);vs(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 vs(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++)Jp(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}};em.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};rm=em});var j,$e=p(()=>{"use strict";j=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(j||{})});var gt,ir=p(()=>{kt();Rt();$e();gt=class extends ot{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=$("buffer"),this._resourceType="buffer",this._resourceId=$("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!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&j.STATIC)}set static(t){t?this.descriptor.usage|=j.STATIC:this.descriptor.usage&=~j.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=$("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 Ol(i,t){if(!(i instanceof gt)){let e=t?j.INDEX:j.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=j.INDEX|j.COPY_DST):(i=new Float32Array(i),e=j.VERTEX|j.COPY_DST)),i=new gt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var sm=p(()=>{ir();$e()});function om(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 nm=p(()=>{"use strict"});function CS(i){return(i instanceof gt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Ol(i.buffer,!1),i}var ce,oi=p(()=>{kt();Xt();Rt();ir();sm();nm();ce=class extends ot{constructor(t={}){super(),this.uid=$("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=CS(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=Ol(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,om(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 MS,BS,On,am=p(()=>{ir();$e();oi();MS=new Float32Array(1),BS=new Uint32Array(1),On=class extends ce{constructor(){let e=new gt({data:MS,label:"attribute-batch-buffer",usage:j.VERTEX|j.COPY_DST,shrinkToFit:!1}),r=new gt({data:BS,label:"index-batch-buffer",usage:j.INDEX|j.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 Xe(i,t){let e=cm[i];return e===void 0&&(Ll[t]===void 0&&(Ll[t]=1),cm[i]=e=Ll[t]++),e}var Ll,cm,ws=p(()=>{"use strict";Ll=Object.create(null),cm=Object.create(null)});function lm(){if(!Ln){Ln="mediump";let i=In();i&&i.getShaderPrecisionFormat&&(Ln=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return Ln}var Ln,hm=p(()=>{Gl()});function um(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
19
+ `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${xn}px`,e.style.height=`${xn}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=lp.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!==aS||!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()}};ul.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"accessibility"};ul.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};dp=ul});var pp,mp=p(()=>{"use strict";pp={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var gp=p(()=>{E();me();fp();mp();G.add(dp);G.mixin(nt,pp)});var cs,xp=p(()=>{E();cs=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}};cs.extension=x.Application});var Qe,_n=p(()=>{"use strict";Qe=(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))(Qe||{})});var Zr,_p=p(()=>{"use strict";Zr=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 yp,Kt,ls=p(()=>{_n();_p();yp=class ie{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 Zr(null,null,1/0),this.deltaMS=1/ie.targetFPMS,this.elapsedMS=1/ie.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=Qe.NORMAL){return this._addListener(new Zr(t,e,r))}addOnce(t,e,r=Qe.NORMAL){return this._addListener(new Zr(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*ie.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,ie.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(!ie._shared){let t=ie._shared=new ie;t.autoStart=!0,t._protected=!0}return ie._shared}static get system(){if(!ie._system){let t=ie._system=new ie;t.autoStart=!0,t._protected=!0}return ie._system}};yp.targetFPMS=.06;Kt=yp});var hs,bp=p(()=>{E();_n();ls();hs=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,Qe.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Kt.shared:new Kt,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};hs.extension=x.Application});var dl=p(()=>{E();xp();bp();G.add(cs);G.add(hs)});var fl,Se,pl=p(()=>{_n();ls();fl=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||(Kt.system.add(this._tickerUpdate,this,Qe.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Kt.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())}},Se=new fl});var We,yn=p(()=>{ne();mn();We=class extends Ze{constructor(){super(...arguments),this.client=new Y,this.movement=new Y,this.offset=new Y,this.global=new Y,this.screen=new Y}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,g){throw new Error("Method not implemented.")}}});var Dt,ml=p(()=>{yn();Dt=class extends We{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 we,gl=p(()=>{yn();we=class extends We{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};we.DOM_DELTA_PIXEL=0;we.DOM_DELTA_LINE=1;we.DOM_DELTA_PAGE=2});var fS,pS,us,bn,vp=p(()=>{kt();ne();it();pl();yn();ml();gl();fS=2048,pS=new Y,us=new Y,bn=class{constructor(t){this.dispatch=new ot,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 k(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Se.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,pS.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<fS&&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")&&(Se.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")&&(Se.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,us),!t.hitArea.contains(us.x,us.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,us),t.containsPoint(us)):!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 Dt)){k("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 Dt)){k("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 Dt)){k("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 Dt)){k("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 Dt)){k("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 Dt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof we)){k("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(Dt);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(we);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Dt);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 Dt&&e instanceof Dt&&(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 We&&e instanceof We&&(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 mS,gS,_l,vn,yl=p(()=>{E();vp();pl();ml();gl();mS=1,gS={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},_l=class xl{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new bn(null),Se.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Dt(null),this._rootWheelEvent=new we(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...xl.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,xl._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,Se.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Se.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Se.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!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;Se.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!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=mS),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=gS[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}};_l.extension={name:"events",type:[x.WebGLSystem,x.CanvasSystem,x.WebGPUSystem],priority:-1};_l.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};vn=_l});var Tp,Sp=p(()=>{yl();mn();Tp={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??vn.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 wp=p(()=>{E();me();yl();Sp();G.add(vn);G.mixin(nt,Tp)});var ds,Ep=p(()=>{E();ds=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}};ds.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"dom"}});var Je,Tn=p(()=>{$t();me();Je=class extends nt{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 Pp=p(()=>{E();Ep();G.add(ds)});var Et,ze=p(()=>{"use strict";Et=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Et||{})});var Ap,Cp=p(()=>{"use strict";Ap={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 Mp,O,ct=p(()=>{Cp();Mp=Ap,O={get(){return Mp},set(i){Mp=i}}});function ge(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function fs(i){return i.split("?")[0].split("#")[0]}function xS(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _S(i,t,e){return i.replace(new RegExp(xS(t),"g"),e)}function yS(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 Tt,Er=p(()=>{ct();Tt={toPosix(i){return _S(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){ge(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(ge(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=fs(this.toPosix(t??O.get().getBaseUrl())),s=fs(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?Tt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(ge(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=yS(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return ge(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(ge(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(ge(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){ge(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){ge(i),t&&ge(t),i=fs(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){ge(i),i=fs(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){ge(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=fs(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 Ot,ps=p(()=>{"use strict";Ot=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function Bp(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?Bp(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function Rp(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)}),Bp(i,s,0,e,r)}else r.push(i);return r}var Gp=p(()=>{"use strict"});var Pr,Sn=p(()=>{"use strict";Pr=i=>!Array.isArray(i)});function bS(i){return i.split(".").pop().split("?").shift().split("#").shift()}var se,Qr=p(()=>{it();Er();ps();Gp();Sn();se=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 Ot(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&&k("[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)&&k(`[Resolver] already has key: ${o} overwriting`)},Ot(e).forEach(o=>{let{src:n}=o,{data:a,format:c,loadParser:l}=o,h=Ot(n).map(f=>typeof f=="string"?Rp(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 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}),d.push(g)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=Pr(t);t=Ot(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=Pr(t);t=Ot(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=Tt.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??bS(t.src),t}};se.RETINA_PREFIX=/@([0-9\.]+)x/});var ms,bl=p(()=>{"use strict";ms=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var kp,vl,Ip=p(()=>{vt();tt();kp=class gs{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof M?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<=gs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=gs.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 z(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new z(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new z(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(c=new z(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new M({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*gs.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*gs.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=[]}};kp.BATCH_SIZE=1e3;vl=kp});function Fp(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=Tt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Fp([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var vS,Up,Dp=p(()=>{ze();Qr();bl();E();tt();Er();Ip();vS=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Up={extension:x.Asset,cache:{test:i=>i instanceof vl,getCacheableAssets:(i,t)=>Fp(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"&&vS.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(se.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:x.LoadParser,priority:Et.Normal,name:"spritesheetLoader"},async testParse(i,t){return Tt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=Tt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof M)a=r;else{let h=ms(n+(s??i.meta.image),t.src);a=(await e.load([{src:h,data:o}]))[h]}let c=new vl(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=ms(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 wn=p(()=>{E();Dp();G.add(Up)});function En(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 Tl=p(()=>{"use strict"});var Lt,Pn=p(()=>{rn();tt();Tl();dt();Tn();Lt=class i extends Je{constructor(t=M.EMPTY){t instanceof M&&(t={texture:t});let{texture:e=M.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 M?new i(t):new i(M.from(t,e))}set texture(t){t||(t=M.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 En(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 An(i,t,e){let r=TS;i.measurable=!0,Vr(i,e,r),t.addBoundsMask(r),i.measurable=!1}var TS,Sl=p(()=>{$t();is();TS=new rt});function Cn(i,t,e){let r=re.get();i.measurable=!0;let s=yt.get().identity(),o=Op(i,e,s);Xr(i,r,o),i.measurable=!1,t.addBoundsMask(r),yt.return(s),re.return(r)}function Op(i,t,e){return i?(i!==t&&(Op(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(k("Mask bounds, renderable is not inside the root container"),e)}var wl=p(()=>{hn();_r();it()});var xs,Lp=p(()=>{E();Pn();Sl();wl();xs=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 Lt),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||An(this.mask,t,e)}addLocalBounds(t,e){Cn(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Lt}};xs.extension=x.MaskEffect});var _s,Np=p(()=>{E();_s=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"}};_s.extension=x.MaskEffect});var ys,Hp=p(()=>{E();me();Sl();wl();ys=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){An(this.mask,t,e)}addLocalBounds(t,e){Cn(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}};ys.extension=x.MaskEffect});var It,Jr=p(()=>{ct();E();Yt();It=class extends J{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 qt,ti=p(()=>{ct();E();it();Yt();qt=class extends J{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,k("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}};qt.extension=x.TextureSource});async function Mn(){return El??(El=(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"})()),El}var El,Pl=p(()=>{"use strict"});var Bn,ei,Al=p(()=>{E();ls();Pl();Yt();Bn=class Wp extends J{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Wp.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=Kt.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 Mn(),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&&(Kt.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||(Kt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Kt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Bn.extension=x.TextureSource;Bn.defaultOptions={...J.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Bn.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};ei=Bn});var Cl,Q,tr=p(()=>{it();ps();Cl=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||k(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Ot(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&&k("[Cache] already has key:",c),this._cache.set(c,o.get(c))})}remove(t){if(!this._cacheMap.has(t)){k(`[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}},Q=new Cl});function zp(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Ml.length;s++){let o=Ml[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function Vp(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&Q.has(r))return Q.get(r);let o=new M({source:zp(s)});return o.on("destroy",()=>{Q.has(r)&&Q.remove(r)}),t||Q.set(r,o),o}function jp(i,t=!1){return typeof i=="string"?Q.get(i):i instanceof J?new M({source:i}):Vp(i,t)}var Ml,Bl=p(()=>{tr();E();Yt();tt();Ml=[];G.handleByList(x.TextureSource,Ml);M.from=jp;J.from=zp});var Rn=p(()=>{E();Lp();Np();Hp();rl();Jr();ti();Al();Bl();G.add(xs,_s,ys,ei,qt,It,Sr)});var Pt,er=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 kn(){return(!Gn||Gn?.isContextLost())&&(Gn=O.get().createCanvas().getContext("webgl",{})),Gn}var Gn,Rl=p(()=>{ct()});function wS(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
20
+ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Xp(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=SS.replace(/%forloop%/gi,wS(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 SS,$p=p(()=>{"use strict";SS=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
+ `)});function ae(){if(ri)return ri;let i=kn();return ri=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),ri=Xp(ri,i),i.getExtension("WEBGL_lose_context")?.loseContext(),ri}var ri,Ar=p(()=>{Rl();$p();ri=null});function ii(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return Yp[e]||ES(i,t,e)}function ES(i,t,e){let r={},s=0;Gl||(Gl=ae());for(let n=0;n<Gl;n++){let a=n<t?i[n]:M.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new Pt(r);return Yp[e]=o,o}var Yp,Gl,In=p(()=>{er();tt();Ar();Yp={};Gl=0});var Ee,kl=p(()=>{"use strict";Ee=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 bs(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 Il=p(()=>{"use strict"});var Kp,lt,Cr=p(()=>{"use strict";Kp={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 Ve(i,t){return t.alphaMode==="no-premultiply-alpha"&&Kp[i]||i}var vs=p(()=>{Cr()});var Fn,qp=p(()=>{"use strict";Fn=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 Zp(){return Ul>0?Jp[--Ul]:new Fl}function Qp(i){Jp[Ul++]=i}var Fl,Jp,Ul,Ts,tm,em,rm=p(()=>{Rt();kl();Il();vs();Ar();qp();Fl=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Fn,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Jp=[],Ul=0;Ts=0,tm=class Un{constructor(t={}){this.uid=$("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Un.defaultOptions.maxTextures=Un.defaultOptions.maxTextures??ae(),t={...Un.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Ee(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++)Qp(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=Zp(),s=r.textures;s.clear();let o=e[this.elementStart],n=Ve(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 g=this.elementStart;g<this.elementSize;++g){let _=e[g];e[g]=null;let y=_.texture._source,T=Ve(_.blendMode,y),v=n!==T||a!==_.topology;if(y._batchTick===Ts&&!v){_._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=Ts,(s.count>=m||v)&&(this._finishBatch(r,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=T,a=_.topology,r=Zp(),s=r.textures,s.clear(),++Ts),_._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,d,u-d,s,n,a,t,f),d=u,++Ts),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,++Ts,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Ee(e);bs(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 bs(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++)Qp(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}};tm.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};em=tm});var X,je=p(()=>{"use strict";X=(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))(X||{})});var gt,rr=p(()=>{kt();Rt();je();gt=class extends ot{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=$("buffer"),this._resourceType="buffer",this._resourceId=$("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!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&X.STATIC)}set static(t){t?this.descriptor.usage|=X.STATIC:this.descriptor.usage&=~X.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=$("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function Dl(i,t){if(!(i instanceof gt)){let e=t?X.INDEX:X.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=X.INDEX|X.COPY_DST):(i=new Float32Array(i),e=X.VERTEX|X.COPY_DST)),i=new gt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var im=p(()=>{rr();je()});function sm(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 om=p(()=>{"use strict"});function PS(i){return(i instanceof gt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Dl(i.buffer,!1),i}var ce,si=p(()=>{kt();$t();Rt();rr();im();om();ce=class extends ot{constructor(t={}){super(),this.uid=$("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=PS(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=Dl(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,sm(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 AS,CS,Dn,nm=p(()=>{rr();je();si();AS=new Float32Array(1),CS=new Uint32Array(1),Dn=class extends ce{constructor(){let e=new gt({data:AS,label:"attribute-batch-buffer",usage:X.VERTEX|X.COPY_DST,shrinkToFit:!1}),r=new gt({data:CS,label:"index-batch-buffer",usage:X.INDEX|X.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 Xe(i,t){let e=am[i];return e===void 0&&(Ol[t]===void 0&&(Ol[t]=1),am[i]=e=Ol[t]++),e}var Ol,am,Ss=p(()=>{"use strict";Ol=Object.create(null),am=Object.create(null)});function cm(){if(!On){On="mediump";let i=kn();i&&i.getShaderPrecisionFormat&&(On=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return On}var On,lm=p(()=>{Rl()});function hm(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
22
22
 
23
23
  #ifdef GL_ES // This checks if it is WebGL1
24
24
  #define in varying
@@ -33,27 +33,27 @@ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Xp(i,t){if(i===0)th
33
33
  #define out varying
34
34
  #endif
35
35
  ${i}
36
- `}var dm=p(()=>{"use strict"});function fm(i,t,e){let r=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(i.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
37
- ${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var pm=p(()=>{"use strict"});function mm(i,t){return t?`#version 300 es
38
- ${i}`:i}var gm=p(()=>{"use strict"});function xm(i,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?RS:GS;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 RS,GS,_m=p(()=>{"use strict";RS={},GS={}});function ym(i,t){return t?i.replace("#version 300 es",""):i}var bm=p(()=>{"use strict"});var Nl,Hl,vm,le,Br=p(()=>{ws();hm();dm();pm();gm();_m();bm();Nl={stripVersion:ym,ensurePrecision:fm,addProgramDefines:um,setProgramName:xm,insertVersion:mm},Hl=Object.create(null),vm=class Wl{constructor(t){t={...Wl.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:lm()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(Nl).forEach(n=>{let a=r[n];s=Nl[n](s,a,!0),o=Nl[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Xe(`${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 Hl[e]||(Hl[e]=new Wl(t)),Hl[e]}};vm.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};le=vm});function Zt(i){return Tm[i]??Tm.float32}var Tm,Rr=p(()=>{"use strict";Tm={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 Sm({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=kS[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:c,stride:Zt(c).stride,offset:0,instance:!1,start:0}}}}return e}var kS,wm=p(()=>{Rr();kS={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 Nn(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,g)=>{let[_,y]=g.split(":");return m[_.trim()]=y.trim(),m},{});return f?{name:d,members:f}:null}).filter(({name:u})=>l.some(d=>d.type===u))??[];return{groups:l,structs:h}}var Em=p(()=>{"use strict"});var ni,Pm=p(()=>{"use strict";ni=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(ni||{})});function Am({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:ni.VERTEX|ni.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:ni.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:ni.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var Cm=p(()=>{Pm()});function Mm({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 Bm=p(()=>{"use strict"});function Rm(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 Gm=p(()=>{"use strict"});var zl,he,ai=p(()=>{ws();wm();Em();Cm();Bm();Gm();zl=Object.create(null),he=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=Nn(e.source);this.structsAndGroups=a}else{let a=Nn(r.source),c=Nn(e.source);this.structsAndGroups=Rm(a,c)}this.layout=s??Mm(this.structsAndGroups),this.gpuLayout=o??Am(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=Xe(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Sm(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 zl[e]||(zl[e]=new i(t)),zl[e]}}});function Vl(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 G(`${r} placement hook does not exist in shader`)}}var km=p(()=>{it()});function jl(i){let t={};return(i.match(IS)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[]}),t}var IS,Im=p(()=>{"use strict";IS=/\{\{(.*?)\}\}/g});function Fm(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function $l(i,t,e=!1){let r=[];Fm(t,r),i.forEach(a=>{a.header&&Fm(a.header,r)});let s=r;e&&s.sort();let o=s.map((a,c)=>` @location(${c}) ${a},`).join(`
36
+ `}var um=p(()=>{"use strict"});function dm(i,t,e){let r=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(i.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
37
+ ${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var fm=p(()=>{"use strict"});function pm(i,t){return t?`#version 300 es
38
+ ${i}`:i}var mm=p(()=>{"use strict"});function gm(i,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?MS:BS;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 MS,BS,xm=p(()=>{"use strict";MS={},BS={}});function _m(i,t){return t?i.replace("#version 300 es",""):i}var ym=p(()=>{"use strict"});var Ll,Nl,bm,le,Mr=p(()=>{Ss();lm();um();fm();mm();xm();ym();Ll={stripVersion:_m,ensurePrecision:dm,addProgramDefines:hm,setProgramName:gm,insertVersion:pm},Nl=Object.create(null),bm=class Hl{constructor(t){t={...Hl.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:cm()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(Ll).forEach(n=>{let a=r[n];s=Ll[n](s,a,!0),o=Ll[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Xe(`${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 Nl[e]||(Nl[e]=new Hl(t)),Nl[e]}};bm.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};le=bm});function Zt(i){return vm[i]??vm.float32}var vm,Br=p(()=>{"use strict";vm={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 Tm({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=RS[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:c,stride:Zt(c).stride,offset:0,instance:!1,start:0}}}}return e}var RS,Sm=p(()=>{Br();RS={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 Ln(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,g)=>{let[_,b]=g.split(":");return m[_.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 wm=p(()=>{"use strict"});var oi,Em=p(()=>{"use strict";oi=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(oi||{})});function Pm({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:oi.VERTEX|oi.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:oi.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:oi.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var Am=p(()=>{Em()});function Cm({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 Mm=p(()=>{"use strict"});function Bm(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 Rm=p(()=>{"use strict"});var Wl,he,ni=p(()=>{Ss();Sm();wm();Am();Mm();Rm();Wl=Object.create(null),he=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=Ln(e.source);this.structsAndGroups=a}else{let a=Ln(r.source),c=Ln(e.source);this.structsAndGroups=Bm(a,c)}this.layout=s??Cm(this.structsAndGroups),this.gpuLayout=o??Pm(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=Xe(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Tm(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 Wl[e]||(Wl[e]=new i(t)),Wl[e]}}});function zl(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 k(`${r} placement hook does not exist in shader`)}}var Gm=p(()=>{it()});function Vl(i){let t={};return(i.match(GS)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[]}),t}var GS,km=p(()=>{"use strict";GS=/\{\{(.*?)\}\}/g});function Im(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function jl(i,t,e=!1){let r=[];Im(t,r),i.forEach(a=>{a.header&&Im(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
- `),n}var Um=p(()=>{"use strict"});function Dm(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function FS(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function US(i){let t=/@.*?\s+/g;return i.replace(t,"")}function Om(i,t){let e=[];Dm(t,e),i.forEach(c=>{c.header&&Dm(c.header,e)});let r=0,s=e.sort().map(c=>c.indexOf("builtin")>-1?c:`@location(${r++}) ${c}`).join(`,
43
- `),o=e.sort().map(c=>` var ${US(c)};`).join(`
42
+ `),n}var Fm=p(()=>{"use strict"});function Um(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function kS(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function IS(i){let t=/@.*?\s+/g;return i.replace(t,"")}function Dm(i,t){let e=[];Um(t,e),i.forEach(c=>{c.header&&Um(c.header,e)});let r=0,s=e.sort().map(c=>c.indexOf("builtin")>-1?c:`@location(${r++}) ${c}`).join(`,
43
+ `),o=e.sort().map(c=>` var ${IS(c)};`).join(`
44
44
  `),n=`return VSOutput(
45
- ${e.sort().map(c=>` ${FS(c)}`).join(`,
45
+ ${e.sort().map(c=>` ${kS(c)}`).join(`,
46
46
  `)});`,a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
47
47
  ${s}
48
48
  `),a=a.replace("{{start}}",`
49
49
  ${o}
50
50
  `),a=a.replace("{{return}}",`
51
51
  ${n}
52
- `),a}var Lm=p(()=>{"use strict"});function Xl(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
52
+ `),a}var Om=p(()=>{"use strict"});function Xl(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
53
53
  `).length?e=e.replace(`{{${r}}}`,`//-----${r} START-----//
54
54
  ${s.join(`
55
55
  `)}
56
- //----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"")}return e}var Nm=p(()=>{"use strict"});function Hm({template:i,bits:t}){let e=zm(i,t);if(sr[e])return sr[e];let{vertex:r,fragment:s}=OS(i,t);return sr[e]=Vm(r,s,t),sr[e]}function Wm({template:i,bits:t}){let e=zm(i,t);return sr[e]||(sr[e]=Vm(i.vertex,i.fragment,t)),sr[e]}function OS(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=$l(e,i.vertex,!0);s=Om(e,s);let o=$l(r,i.fragment,!0);return{vertex:s,fragment:o}}function zm(i,t){return t.map(e=>(Yl.has(e)||Yl.set(e,DS++),Yl.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function Vm(i,t,e){let r=jl(i),s=jl(t);return e.forEach(o=>{Vl(o.vertex,r,o.name),Vl(o.fragment,s,o.name)}),{vertex:Xl(i,r),fragment:Xl(t,s)}}var sr,Yl,DS,jm=p(()=>{km();Im();Um();Lm();Nm();sr=Object.create(null),Yl=new Map,DS=0});var $m,Xm,Ym,Km,qm=p(()=>{"use strict";$m=`
56
+ //----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"")}return e}var Lm=p(()=>{"use strict"});function Nm({template:i,bits:t}){let e=Wm(i,t);if(ir[e])return ir[e];let{vertex:r,fragment:s}=US(i,t);return ir[e]=zm(r,s,t),ir[e]}function Hm({template:i,bits:t}){let e=Wm(i,t);return ir[e]||(ir[e]=zm(i.vertex,i.fragment,t)),ir[e]}function US(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=jl(e,i.vertex,!0);s=Dm(e,s);let o=jl(r,i.fragment,!0);return{vertex:s,fragment:o}}function Wm(i,t){return t.map(e=>($l.has(e)||$l.set(e,FS++),$l.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function zm(i,t,e){let r=Vl(i),s=Vl(t);return e.forEach(o=>{zl(o.vertex,r,o.name),zl(o.fragment,s,o.name)}),{vertex:Xl(i,r),fragment:Xl(t,s)}}var ir,$l,FS,Vm=p(()=>{Gm();km();Fm();Om();Lm();ir=Object.create(null),$l=new Map,FS=0});var jm,Xm,$m,Ym,Km=p(()=>{"use strict";jm=`
57
57
  @in aPosition: vec2<f32>;
58
58
  @in aUV: vec2<f32>;
59
59
 
@@ -120,7 +120,7 @@ ${s.join(`
120
120
 
121
121
  return finalColor;
122
122
  };
123
- `,Ym=`
123
+ `,$m=`
124
124
  in vec2 aPosition;
125
125
  in vec2 aUV;
126
126
 
@@ -156,7 +156,7 @@ ${s.join(`
156
156
 
157
157
  {{end}}
158
158
  }
159
- `,Km=`
159
+ `,Ym=`
160
160
 
161
161
  in vec4 vColor;
162
162
  in vec2 vUV;
@@ -177,7 +177,7 @@ ${s.join(`
177
177
 
178
178
  {{end}}
179
179
  }
180
- `});var Zm,Qm,Jm=p(()=>{"use strict";Zm={name:"global-uniforms-bit",vertex:{header:`
180
+ `});var qm,Zm,Qm=p(()=>{"use strict";qm={name:"global-uniforms-bit",vertex:{header:`
181
181
  struct GlobalUniforms {
182
182
  uProjectionMatrix:mat3x3<f32>,
183
183
  uWorldTransformMatrix:mat3x3<f32>,
@@ -186,22 +186,22 @@ ${s.join(`
186
186
  }
187
187
 
188
188
  @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
189
- `}},Qm={name:"global-uniforms-bit",vertex:{header:`
189
+ `}},Zm={name:"global-uniforms-bit",vertex:{header:`
190
190
  uniform mat3 uProjectionMatrix;
191
191
  uniform mat3 uWorldTransformMatrix;
192
192
  uniform vec4 uWorldColorAlpha;
193
193
  uniform vec2 uResolution;
194
- `}}});function Ae({bits:i,name:t}){let e=Hm({template:{fragment:Xm,vertex:$m},bits:[Zm,...i]});return he.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Ce({bits:i,name:t}){return new le({name:t,...Wm({template:{vertex:Ym,fragment:Km},bits:[Qm,...i]})})}var or=p(()=>{Br();ai();jm();qm();Jm()});var ci,li,Es=p(()=>{"use strict";ci={name:"color-bit",vertex:{header:`
194
+ `}}});function Pe({bits:i,name:t}){let e=Nm({template:{fragment:Xm,vertex:jm},bits:[qm,...i]});return he.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Ae({bits:i,name:t}){return new le({name:t,...Hm({template:{vertex:$m,fragment:Ym},bits:[Zm,...i]})})}var sr=p(()=>{Mr();ni();Vm();Km();Qm()});var ai,ci,ws=p(()=>{"use strict";ai={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
- `}},li={name:"color-bit",vertex:{header:`
198
+ `}},ci={name:"color-bit",vertex:{header:`
199
199
  in vec4 aColor;
200
200
  `,main:`
201
201
  vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
202
- `}}});function LS(i){let t=[];if(i===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let r=0;r<i;r++)t.push(`@group(1) @binding(${e++}) var textureSource${r+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${r+1}: sampler;`)}return t.join(`
203
- `)}function NS(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 hi(i){return Kl[i]||(Kl[i]={name:"texture-batch-bit",vertex:{header:`
202
+ `}}});function DS(i){let t=[];if(i===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let r=0;r<i;r++)t.push(`@group(1) @binding(${e++}) var textureSource${r+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${r+1}: sampler;`)}return t.join(`
203
+ `)}function OS(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 li(i){return Yl[i]||(Yl[i]={name:"texture-batch-bit",vertex:{header:`
205
205
  @in aTextureIdAndRound: vec2<u32>;
206
206
  @out @interpolate(flat) vTextureId : u32;
207
207
  `,main:`
@@ -214,14 +214,14 @@ ${s.join(`
214
214
  `},fragment:{header:`
215
215
  @in @interpolate(flat) vTextureId: u32;
216
216
 
217
- ${LS(i)}
217
+ ${DS(i)}
218
218
  `,main:`
219
219
  var uvDx = dpdx(vUV);
220
220
  var uvDy = dpdy(vUV);
221
221
 
222
- ${NS(i)}
223
- `}}),Kl[i]}function HS(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 ui(i){return ql[i]||(ql[i]={name:"texture-batch-bit",vertex:{header:`
222
+ ${OS(i)}
223
+ `}}),Yl[i]}function LS(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 hi(i){return Kl[i]||(Kl[i]={name:"texture-batch-bit",vertex:{header:`
225
225
  in vec2 aTextureIdAndRound;
226
226
  out float vTextureId;
227
227
 
@@ -239,18 +239,18 @@ ${s.join(`
239
239
 
240
240
  `,main:`
241
241
 
242
- ${HS(i)}
243
- `}}),ql[i]}var Kl,ql,Ps=p(()=>{"use strict";Kl={};ql={}});var Me,Be,nr=p(()=>{"use strict";Me={name:"round-pixels-bit",vertex:{header:`
242
+ ${LS(i)}
243
+ `}}),Kl[i]}var Yl,Kl,Es=p(()=>{"use strict";Yl={};Kl={}});var Ce,Me,or=p(()=>{"use strict";Ce={name:"round-pixels-bit",vertex:{header:`
244
244
  fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
245
245
  {
246
246
  return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
247
247
  }
248
- `}},Be={name:"round-pixels-bit",vertex:{header:`
248
+ `}},Me={name:"round-pixels-bit",vertex:{header:`
249
249
  vec2 roundPixels(vec2 position, vec2 targetSize)
250
250
  {
251
251
  return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
252
252
  }
253
- `}}});var Zl,tg,eg=p(()=>{"use strict";Zl=["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>"],tg=Zl.reduce((i,t)=>(i[t]=!0,i),{})});function rg(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 ig=p(()=>{"use strict"});var sg,st,Nt=p(()=>{Rt();ws();eg();ig();sg=class og{constructor(t,e){this._touched=0,this.uid=$("uniform"),this._resourceType="uniformGroup",this._resourceId=$("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...og.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,!tg[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${Zl.join(", ")}`);o.value??(o.value=rg(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Xe(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};sg.defaultOptions={ubo:!1,isStatic:!1};st=sg});function di(i){let t=ng[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=ng[i]=new st({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var ng,Hn=p(()=>{Nt();ng={}});var bt,Re=p(()=>{"use strict";bt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(bt||{})});var xt,xe=p(()=>{kt();Rt();Br();rr();ai();Re();Nt();xt=class i extends ot{constructor(t){super(),this.uid=$("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=bt.WEBGPU),r&&(n|=bt.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=he.from(e)),r&&(n=le.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var Wn,ag=p(()=>{or();Es();Ps();nr();Hn();xe();Wn=class extends xt{constructor(t){let e=Ce({name:"batch",bits:[li,ui(t),Be]}),r=Ae({name:"batch",bits:[ci,hi(t),Me]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:di(t)}})}}});var cg,lg,As,Ql=p(()=>{w();im();am();ag();cg=null,lg=class hg extends rm{constructor(){super(...arguments),this.geometry=new On,this.shader=cg||(cg=new Wn(this.maxTextures)),this.name=hg.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:g}=t,_=t.color,y=t.attributeOffset,b=y+t.attributeSize;for(let v=y;v<b;v++){let T=v*2,P=m[T],S=m[T+1];e[s++]=c*P+h*S+d,e[s++]=u*S+l*P+f,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,d=a.tx,f=a.ty,m=t.bounds,g=m.maxX,_=m.minX,y=m.maxY,b=m.minY,v=n.uvs,T=t.color,P=o<<16|t.roundPixels&65535;e[s+0]=c*_+h*b+d,e[s+1]=u*b+l*_+f,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=T,r[s+5]=P,e[s+6]=c*g+h*b+d,e[s+7]=u*b+l*g+f,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=T,r[s+11]=P,e[s+12]=c*g+h*y+d,e[s+13]=u*y+l*g+f,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=T,r[s+17]=P,e[s+18]=c*_+h*y+d,e[s+19]=u*y+l*_+f,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=T,r[s+23]=P}};lg.extension={type:[x.Batcher],name:"default"};As=lg});function ug(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 g=i[e],_=i[e+1];r[s]=l*g+u*_+f,r[s+1]=h*g+d*_+m,s+=o,e+=t,c++}}function dg(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var fg=p(()=>{"use strict"});function Jl(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 pg=p(()=>{"use strict"});var WS,Gr,th=p(()=>{K();Xc();WS=new B,Gr=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?hn(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||WS}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 fi,mg,gg,xg=p(()=>{w();fi={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,P=T.width/2,S=T.height/2;e=T.x+P,r=T.y+S,n=a=Math.max(0,Math.min(T.radius,Math.min(P,S))),s=P-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,g=o,_=e+m,y=e-m,b=r+g;if(t[h++]=_,t[h++]=b,t[--u]=b,t[--u]=y,o){let T=r-g;t[d++]=y,t[d++]=T,t[--f]=T,t[--f]=_}for(let T=1;T<c;T++){let P=Math.PI/2*(T/c),S=s+Math.cos(P)*n,E=o+Math.sin(P)*a,C=e+S,I=e-S,M=r+E,k=r-E;t[h++]=C,t[h++]=M,t[--u]=M,t[--u]=I,t[d++]=I,t[d++]=k,t[--f]=k,t[--f]=C}m=s,g=o+a,_=e+m,y=e-m,b=r+g;let v=r-g;return t[h++]=_,t[h++]=b,t[--f]=v,t[--f]=_,s&&(t[h++]=y,t[h++]=b,t[--f]=v,t[--f]=y),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}},mg={...fi,extension:{...fi.extension,name:"ellipse"}},gg={...fi,extension:{...fi.extension,name:"roundedRectangle"}}});function _g(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 yg=p(()=>{"use strict"});function bg(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,g=l+f,_=h+d,y=u+f;return a.push(m,g),a.push(_,y),2}function kr(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),g=Math.sqrt(c*c+l*l),_=(15*m*Math.sqrt(g)/Math.PI>>0)+1,y=f/_;if(d+=y,a){n.push(i,t),n.push(e,r);for(let b=1,v=d;b<_;b++,v+=y)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 b=1,v=d;b<_;b++,v+=y)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 vg(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=_g(i);e&&(q*=-1),c=(c-.5)*q+.5}let l=new X(i[0],i[1]),h=new X(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,ee=(h.y+l.y)*.5;i.unshift(q,ee),i.push(q,ee)}let f=s,m=i.length/2,g=i.length,_=f.length/2,y=a.width/2,b=y*y,v=a.miterLimit*a.miterLimit,T=i[0],P=i[1],S=i[2],E=i[3],C=0,I=0,M=-(P-E),k=T-S,L=0,Y=0,mt=Math.sqrt(M*M+k*k);M/=mt,k/=mt,M*=y,k*=y;let $t=c,N=(1-$t)*2,F=$t*2;u||(a.cap==="round"?g+=kr(T-M*(N-F)*.5,P-k*(N-F)*.5,T-M*N,P-k*N,T+M*F,P+k*F,f,!0)+2:a.cap==="square"&&(g+=bg(T,P,M,k,N,F,!0,f))),f.push(T-M*N,P-k*N),f.push(T+M*F,P+k*F);for(let q=1;q<m-1;++q){T=i[(q-1)*2],P=i[(q-1)*2+1],S=i[q*2],E=i[q*2+1],C=i[(q+1)*2],I=i[(q+1)*2+1],M=-(P-E),k=T-S,mt=Math.sqrt(M*M+k*k),M/=mt,k/=mt,M*=y,k*=y,L=-(E-I),Y=S-C,mt=Math.sqrt(L*L+Y*Y),L/=mt,Y/=mt,L*=y,Y*=y;let ee=S-T,Oe=P-E,Zi=S-C,Qi=I-E,kd=ee*Zi+Oe*Qi,Zo=Oe*Zi-Qi*ee,Ji=Zo<0;if(Math.abs(Zo)<.001*Math.abs(kd)){f.push(S-M*N,E-k*N),f.push(S+M*F,E+k*F),kd>=0&&(a.join==="round"?g+=kr(S,E,S-M*N,E-k*N,S-L*N,E-Y*N,f,!1)+4:g+=2,f.push(S-L*F,E-Y*F),f.push(S+L*N,E+Y*N));continue}let Id=(-M+T)*(-k+E)-(-M+S)*(-k+P),Fd=(-L+C)*(-Y+E)-(-L+S)*(-Y+I),Qo=(ee*Fd-Zi*Id)/Zo,Jo=(Qi*Id-Oe*Fd)/Zo,Bc=(Qo-S)*(Qo-S)+(Jo-E)*(Jo-E),pr=S+(Qo-S)*N,mr=E+(Jo-E)*N,gr=S-(Qo-S)*F,xr=E-(Jo-E)*F,UT=Math.min(ee*ee+Oe*Oe,Zi*Zi+Qi*Qi),Ud=Ji?N:F,DT=UT+Ud*Ud*b;Bc<=DT?a.join==="bevel"||Bc/b>v?(Ji?(f.push(pr,mr),f.push(S+M*F,E+k*F),f.push(pr,mr),f.push(S+L*F,E+Y*F)):(f.push(S-M*N,E-k*N),f.push(gr,xr),f.push(S-L*N,E-Y*N),f.push(gr,xr)),g+=2):a.join==="round"?Ji?(f.push(pr,mr),f.push(S+M*F,E+k*F),g+=kr(S,E,S+M*F,E+k*F,S+L*F,E+Y*F,f,!0)+4,f.push(pr,mr),f.push(S+L*F,E+Y*F)):(f.push(S-M*N,E-k*N),f.push(gr,xr),g+=kr(S,E,S-M*N,E-k*N,S-L*N,E-Y*N,f,!1)+4,f.push(S-L*N,E-Y*N),f.push(gr,xr)):(f.push(pr,mr),f.push(gr,xr)):(f.push(S-M*N,E-k*N),f.push(S+M*F,E+k*F),a.join==="round"?Ji?g+=kr(S,E,S+M*F,E+k*F,S+L*F,E+Y*F,f,!0)+2:g+=kr(S,E,S-M*N,E-k*N,S-L*N,E-Y*N,f,!1)+2:a.join==="miter"&&Bc/b<=v&&(Ji?(f.push(gr,xr),f.push(gr,xr)):(f.push(pr,mr),f.push(pr,mr)),g+=2),f.push(S-L*N,E-Y*N),f.push(S+L*F,E+Y*F),g+=2)}T=i[(m-2)*2],P=i[(m-2)*2+1],S=i[(m-1)*2],E=i[(m-1)*2+1],M=-(P-E),k=T-S,mt=Math.sqrt(M*M+k*k),M/=mt,k/=mt,M*=y,k*=y,f.push(S-M*N,E-k*N),f.push(S+M*F,E+k*F),u||(a.cap==="round"?g+=kr(S-M*(N-F)*.5,E-k*(N-F)*.5,S-M*N,E-k*N,S+M*F,E+k*F,f,!1)+2:a.cap==="square"&&(g+=bg(S,E,M,k,N,F,!1,f)));let Se=1e-4*1e-4;for(let q=_;q<g+_-2;++q)T=f[q*2],P=f[q*2+1],S=f[(q+1)*2],E=f[(q+1)*2+1],C=f[(q+2)*2],I=f[(q+2)*2+1],!(Math.abs(T*(E-I)+S*(I-P)+C*(P-E))<Se)&&o.push(q,q+1,q+2)}var Tg=p(()=>{ne();yg()});function Sg(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 wg=p(()=>{});var oh=Gc((FG,sh)=>{"use strict";sh.exports=jn;sh.exports.default=jn;function jn(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Pg(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=KS(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 Cs(o,n,e,a,c,f,0),n}function Pg(i,t,e,r,s){var o,n;if(s===ih(i,t,e,r)>0)for(o=t;o<e;o+=r)n=Eg(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=Eg(o,i[o],i[o+1],n);return n&&$n(n,n.next)&&(Bs(n),n=n.next),n}function Ir(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&($n(e,e.next)||pt(e.prev,e,e.next)===0)){if(Bs(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function Cs(i,t,e,r,s,o,n){if(i){!n&&o&&tw(i,r,s,o);for(var a=i,c,l;i.prev!==i.next;){if(c=i.prev,l=i.next,o?$S(i,r,s,o):jS(i)){t.push(c.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),Bs(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=XS(Ir(i),t,e),Cs(i,t,e,r,s,o,2)):n===2&&YS(i,t,e,r,s,o):Cs(Ir(i),t,e,r,s,o,1);break}}}}function jS(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&&pi(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 $S(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,g=a>c?a>l?a:l:c>l?c:l,_=h>u?h>d?h:d:u>d?u:d,y=eh(f,m,t,e,r),b=eh(g,_,t,e,r),v=i.prevZ,T=i.nextZ;v&&v.z>=y&&T&&T.z<=b;){if(v.x>=f&&v.x<=g&&v.y>=m&&v.y<=_&&v!==s&&v!==n&&pi(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<=g&&T.y>=m&&T.y<=_&&T!==s&&T!==n&&pi(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>=y;){if(v.x>=f&&v.x<=g&&v.y>=m&&v.y<=_&&v!==s&&v!==n&&pi(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<=b;){if(T.x>=f&&T.x<=g&&T.y>=m&&T.y<=_&&T!==s&&T!==n&&pi(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 XS(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!$n(s,o)&&Ag(s,r,r.next,o)&&Ms(s,o)&&Ms(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),Bs(r),Bs(r.next),r=i=o),r=r.next}while(r!==i);return Ir(r)}function YS(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&iw(n,a)){var c=Cg(n,a);n=Ir(n,n.next),c=Ir(c,c.next),Cs(n,t,e,r,s,o,0),Cs(c,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function KS(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=Pg(i,a,c,r,!1),l===l.next&&(l.steiner=!0),s.push(rw(l));for(s.sort(qS),o=0;o<s.length;o++)e=ZS(s[o],e);return e}function qS(i,t){return i.x-t.x}function ZS(i,t){var e=QS(i,t);if(!e)return t;var r=Cg(e,i);return Ir(r,r.next),Ir(e,e.next)}function QS(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&&pi(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),Ms(e,i)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&JS(n,e)))&&(n=e,u=d)),e=e.next;while(e!==c);return n}function JS(i,t){return pt(i.prev,i,t.prev)<0&&pt(t.next,i,i.next)<0}function tw(i,t,e,r){var s=i;do s.z===0&&(s.z=eh(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,ew(s)}function ew(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 eh(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 rw(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 pi(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 iw(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!sw(i,t)&&(Ms(i,t)&&Ms(t,i)&&ow(i,t)&&(pt(i.prev,i,t.prev)||pt(i,t.prev,t))||$n(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 $n(i,t){return i.x===t.x&&i.y===t.y}function Ag(i,t,e,r){var s=Vn(pt(i,t,e)),o=Vn(pt(i,t,r)),n=Vn(pt(e,r,i)),a=Vn(pt(e,r,t));return!!(s!==o&&n!==a||s===0&&zn(i,e,t)||o===0&&zn(i,r,t)||n===0&&zn(e,i,r)||a===0&&zn(e,t,r))}function zn(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 Vn(i){return i>0?1:i<0?-1:0}function sw(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&&Ag(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function Ms(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 ow(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 Cg(i,t){var e=new rh(i.i,i.x,i.y),r=new rh(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 Eg(i,t,e,r){var s=new rh(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 Bs(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 rh(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}jn.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(ih(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(ih(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 ih(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}jn.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 Xn(i,t,e,r,s,o,n){let a=(0,Mg.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 Mg,nh=p(()=>{Mg=tn(oh(),1)});var nw,Bg,Rg=p(()=>{w();nh();nw=[],Bg={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){Xn(i,nw,t,e,r,s,o)}}});var Gg,kg=p(()=>{w();Gg={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 Ig,Fg=p(()=>{w();Ig={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 Dg(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function Og(i,t){let e=D.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function aw(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(U("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 Ug,ch,Qt,mi=p(()=>{Mt();ct();K();ei();tt();Rt();dt();Jc();Ug=[{offset:0,color:"white"},{offset:1,color:"black"}],ch=class ah{constructor(...t){this.uid=$("fillGradient"),this.type="linear",this.colorStops=[];let e=aw(t);e={...e.type==="radial"?ah.defaultRadialOptions:ah.defaultLinearOptions,...dn(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:V.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let _=t;t=r,r=_,o*=-1}if(n<0){let _=e;e=s,s=_,n*=-1}}let c=this.colorStops.length?this.colorStops:Ug,l=this._textureSize,{canvas:h,context:u}=Og(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);Dg(d,c),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new A({source:new qt({resource:h,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),g=new B;g.scale(f/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:Ug,e=this._textureSize,{canvas:r,context:s}=Og(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,g=(n-d)*f,_=s.createRadialGradient(m,g,l*f,(a-u)*f,(c-d)*f,h*f);Dg(_,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 A({source:new qt({resource:r,addressMode:this._wrapMode})});let y=new B;y.scale(1/f,1/f),y.translate(u,d),this.textureSpace==="local"&&y.scale(e,e),this.transform=y}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};ch.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};ch.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Qt=ch});function Lg(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(lw);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,g=s.c,_=s.d;s.a*=l,s.b*=l,s.c*=h,s.d*=h,s.tx=u*f+d*g+s.tx,s.ty=u*m+d*_+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(cw.copyFrom(r).invert()),s}var cw,lw,Ng=p(()=>{K();vt();mi();cw=new B,lw=new z});function Wg(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")dw(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&&Hg(l.shapePath,c,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),Hg(a,c,n,r,e)}}}function dw(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,c=[],l=Yn.rectangle,h=hw,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&&Jl(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=W.get(Gr);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 Hg(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=Yn[c.type],g="triangle-list";if(m.build(c,f),l&&Jl(f,l),e){let v=c.closePath??!0,T=t;T.pixelLine?(Sg(f,v,o,a),g="line-list"):vg(f,T,!1,v,o,a)}else if(h){let v=[],T=f.slice();fw(h).forEach(S=>{v.push(T.length/2),T.push(...S)}),Xn(T,v,o,2,d,a,u)}else m.triangulate(f,o,2,d,a,u);let _=n.length/2,y=t.texture;if(y!==A.WHITE){let v=Lg(uw,t,c,l);ug(o,2,d,n,_,2,o.length/2-d,v)}else dg(n,_,2,o.length/2-d);let b=W.get(Gr);b.indexOffset=u,b.indexSize=a.length-u,b.attributeOffset=d,b.attributeSize=o.length/2-d,b.baseColor=t.color,b.alpha=t.alpha,b.texture=y,b.geometryData=s,b.topology=g,r.push(b)})}function fw(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];Yn[r.type].build(r,s),t.push(s)}return t}var Yn,hw,uw,zg=p(()=>{w();K();vt();fg();pg();tt();Ut();th();xg();Tg();wg();Rg();kg();Fg();Ng();nh();Yn={};R.handleByMap(x.ShapeBuilder,Yn);R.add(Gg,Bg,Ig,fi,mg,gg);hw=new z,uw=new B});var lh,hh,dh,gi,Kn=p(()=>{w();Fn();Ql();Zc();dt();Ut();zg();lh=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},hh=class{constructor(){this.batcher=new As,this.instructions=new Yr}init(){this.instructions.reset()}get geometry(){return U(cf,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},dh=class uh{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){uh.defaultOptions.bezierSmoothness=t?.bezierSmoothness??uh.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),Wg(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=W.get(hh),{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=si(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new lh;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(W.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{W.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};dh.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"graphicsContext"};dh.defaultOptions={bezierSmoothness:.5};gi=dh});var pw,fh,ph,mh,gh,xh,_h,yh,_t,_e=p(()=>{"use strict";pw={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},fh=0,ph=1,mh=2,gh=3,xh=4,_h=5,yh=class Vg{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<fh)}set blend(t){!!(this.data&1<<fh)!==t&&(this.data^=1<<fh)}get offsets(){return!!(this.data&1<<ph)}set offsets(t){!!(this.data&1<<ph)!==t&&(this.data^=1<<ph)}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<<mh)}set culling(t){!!(this.data&1<<mh)!==t&&(this.data^=1<<mh)}get depthTest(){return!!(this.data&1<<gh)}set depthTest(t){!!(this.data&1<<gh)!==t&&(this.data^=1<<gh)}get depthMask(){return!!(this.data&1<<_h)}set depthMask(t){!!(this.data&1<<_h)!==t&&(this.data^=1<<_h)}get clockwiseFrontFace(){return!!(this.data&1<<xh)}set clockwiseFrontFace(t){!!(this.data&1<<xh)!==t&&(this.data^=1<<xh)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=pw[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 Vg;return t.depthTest=!1,t.blend=!0,t}};yh.default2d=yh.for2d();_t=yh});function Ge(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 xi=p(()=>{"use strict"});var Rs,jg=p(()=>{w();_e();Ut();xi();th();Rs=class{constructor(t,e){this.state=_t.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,Ge(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=W.get(Gr);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{W.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};Rs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"graphics"}});var bh=p(()=>{w();Kn();jg();R.add(Rs);R.add(gi)});var ar,qn=p(()=>{"use strict";ar=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 Gs,$g=p(()=>{w();K();rr();Nt();Ts();Ut();xi();qn();Gs=class{constructor(t,e){this.localUniforms=new st({uTransformMatrix:{value:new B,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&&(W.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=je(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Ge(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=W.get(ar);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&W.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};Gs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"mesh"}});var vh=p(()=>{w();$g();R.add(Gs)});var Zn,Xg=p(()=>{"use strict";Zn=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 Th(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 Yg=p(()=>{"use strict"});function qg(i){return{dynamicUpdate:Kg(i,!0),staticUpdate:Kg(i,!1)}}function Kg(i,t){let e=[];e.push(`
253
+ `}}});var ql,Jm,tg=p(()=>{"use strict";ql=["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>"],Jm=ql.reduce((i,t)=>(i[t]=!0,i),{})});function eg(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 rg=p(()=>{"use strict"});var ig,st,Nt=p(()=>{Rt();Ss();tg();rg();ig=class sg{constructor(t,e){this._touched=0,this.uid=$("uniform"),this._resourceType="uniformGroup",this._resourceId=$("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...sg.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,!Jm[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${ql.join(", ")}`);o.value??(o.value=eg(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Xe(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};ig.defaultOptions={ubo:!1,isStatic:!1};st=ig});function ui(i){let t=og[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=og[i]=new st({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var og,Nn=p(()=>{Nt();og={}});var bt,Be=p(()=>{"use strict";bt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(bt||{})});var xt,xe=p(()=>{kt();Rt();Mr();er();ni();Be();Nt();xt=class i extends ot{constructor(t){super(),this.uid=$("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=bt.WEBGPU),r&&(n|=bt.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=he.from(e)),r&&(n=le.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var Hn,ng=p(()=>{sr();ws();Es();or();Nn();xe();Hn=class extends xt{constructor(t){let e=Ae({name:"batch",bits:[ci,hi(t),Me]}),r=Pe({name:"batch",bits:[ai,li(t),Ce]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:ui(t)}})}}});var ag,cg,Ps,Zl=p(()=>{E();rm();nm();ng();ag=null,cg=class lg extends em{constructor(){super(...arguments),this.geometry=new Dn,this.shader=ag||(ag=new Hn(this.maxTextures)),this.name=lg.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:g}=t,_=t.color,b=t.attributeOffset,y=b+t.attributeSize;for(let T=b;T<y;T++){let v=T*2,P=m[v],S=m[v+1];e[s++]=c*P+h*S+d,e[s++]=u*S+l*P+f,e[s++]=g[v],e[s++]=g[v+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,d=a.tx,f=a.ty,m=t.bounds,g=m.maxX,_=m.minX,b=m.maxY,y=m.minY,T=n.uvs,v=t.color,P=o<<16|t.roundPixels&65535;e[s+0]=c*_+h*y+d,e[s+1]=u*y+l*_+f,e[s+2]=T.x0,e[s+3]=T.y0,r[s+4]=v,r[s+5]=P,e[s+6]=c*g+h*y+d,e[s+7]=u*y+l*g+f,e[s+8]=T.x1,e[s+9]=T.y1,r[s+10]=v,r[s+11]=P,e[s+12]=c*g+h*b+d,e[s+13]=u*b+l*g+f,e[s+14]=T.x2,e[s+15]=T.y2,r[s+16]=v,r[s+17]=P,e[s+18]=c*_+h*b+d,e[s+19]=u*b+l*_+f,e[s+20]=T.x3,e[s+21]=T.y3,r[s+22]=v,r[s+23]=P}};cg.extension={type:[x.Batcher],name:"default"};Ps=cg});function hg(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 g=i[e],_=i[e+1];r[s]=l*g+u*_+f,r[s+1]=h*g+d*_+m,s+=o,e+=t,c++}}function ug(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var dg=p(()=>{"use strict"});function Ql(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 fg=p(()=>{"use strict"});var NS,Rr,Jl=p(()=>{K();Xc();NS=new B,Rr=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?ln(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||NS}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 di,pg,mg,gg=p(()=>{E();di={extension:{type:x.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let v=i;e=v.x,r=v.y,n=a=v.radius,s=o=0}else if(i.type==="ellipse"){let v=i;e=v.x,r=v.y,n=v.halfWidth,a=v.halfHeight,s=o=0}else{let v=i,P=v.width/2,S=v.height/2;e=v.x+P,r=v.y+S,n=a=Math.max(0,Math.min(v.radius,Math.min(P,S))),s=P-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,g=o,_=e+m,b=e-m,y=r+g;if(t[h++]=_,t[h++]=y,t[--u]=y,t[--u]=b,o){let v=r-g;t[d++]=b,t[d++]=v,t[--f]=v,t[--f]=_}for(let v=1;v<c;v++){let P=Math.PI/2*(v/c),S=s+Math.cos(P)*n,w=o+Math.sin(P)*a,A=e+S,I=e-S,C=r+w,R=r-w;t[h++]=A,t[h++]=C,t[--u]=C,t[--u]=I,t[d++]=I,t[d++]=R,t[--f]=R,t[--f]=A}m=s,g=o+a,_=e+m,b=e-m,y=r+g;let T=r-g;return t[h++]=_,t[h++]=y,t[--f]=T,t[--f]=_,s&&(t[h++]=b,t[h++]=y,t[--f]=T,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}},pg={...di,extension:{...di.extension,name:"ellipse"}},mg={...di,extension:{...di.extension,name:"roundedRectangle"}}});function xg(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 _g=p(()=>{"use strict"});function yg(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,g=l+f,_=h+d,b=u+f;return a.push(m,g),a.push(_,b),2}function Gr(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),g=Math.sqrt(c*c+l*l),_=(15*m*Math.sqrt(g)/Math.PI>>0)+1,b=f/_;if(d+=b,a){n.push(i,t),n.push(e,r);for(let y=1,T=d;y<_;y++,T+=b)n.push(i,t),n.push(i+Math.sin(T)*g,t+Math.cos(T)*g);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let y=1,T=d;y<_;y++,T+=b)n.push(i+Math.sin(T)*g,t+Math.cos(T)*g),n.push(i,t);n.push(s,o),n.push(i,t)}return _*2}function bg(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=xg(i);e&&(q*=-1),c=(c-.5)*q+.5}let l=new Y(i[0],i[1]),h=new Y(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,ee=(h.y+l.y)*.5;i.unshift(q,ee),i.push(q,ee)}let f=s,m=i.length/2,g=i.length,_=f.length/2,b=a.width/2,y=b*b,T=a.miterLimit*a.miterLimit,v=i[0],P=i[1],S=i[2],w=i[3],A=0,I=0,C=-(P-w),R=v-S,F=0,j=0,mt=Math.sqrt(C*C+R*R);C/=mt,R/=mt,C*=b,R*=b;let Xt=c,N=(1-Xt)*2,U=Xt*2;u||(a.cap==="round"?g+=Gr(v-C*(N-U)*.5,P-R*(N-U)*.5,v-C*N,P-R*N,v+C*U,P+R*U,f,!0)+2:a.cap==="square"&&(g+=yg(v,P,C,R,N,U,!0,f))),f.push(v-C*N,P-R*N),f.push(v+C*U,P+R*U);for(let q=1;q<m-1;++q){v=i[(q-1)*2],P=i[(q-1)*2+1],S=i[q*2],w=i[q*2+1],A=i[(q+1)*2],I=i[(q+1)*2+1],C=-(P-w),R=v-S,mt=Math.sqrt(C*C+R*R),C/=mt,R/=mt,C*=b,R*=b,F=-(w-I),j=S-A,mt=Math.sqrt(F*F+j*j),F/=mt,j/=mt,F*=b,j*=b;let ee=S-v,De=P-w,qi=S-A,Zi=I-w,Gd=ee*qi+De*Zi,qo=De*qi-Zi*ee,Qi=qo<0;if(Math.abs(qo)<.001*Math.abs(Gd)){f.push(S-C*N,w-R*N),f.push(S+C*U,w+R*U),Gd>=0&&(a.join==="round"?g+=Gr(S,w,S-C*N,w-R*N,S-F*N,w-j*N,f,!1)+4:g+=2,f.push(S-F*U,w-j*U),f.push(S+F*N,w+j*N));continue}let kd=(-C+v)*(-R+w)-(-C+S)*(-R+P),Id=(-F+A)*(-j+w)-(-F+S)*(-j+I),Zo=(ee*Id-qi*kd)/qo,Qo=(Zi*kd-De*Id)/qo,Mc=(Zo-S)*(Zo-S)+(Qo-w)*(Qo-w),fr=S+(Zo-S)*N,pr=w+(Qo-w)*N,mr=S-(Zo-S)*U,gr=w-(Qo-w)*U,IT=Math.min(ee*ee+De*De,qi*qi+Zi*Zi),Fd=Qi?N:U,FT=IT+Fd*Fd*y;Mc<=FT?a.join==="bevel"||Mc/y>T?(Qi?(f.push(fr,pr),f.push(S+C*U,w+R*U),f.push(fr,pr),f.push(S+F*U,w+j*U)):(f.push(S-C*N,w-R*N),f.push(mr,gr),f.push(S-F*N,w-j*N),f.push(mr,gr)),g+=2):a.join==="round"?Qi?(f.push(fr,pr),f.push(S+C*U,w+R*U),g+=Gr(S,w,S+C*U,w+R*U,S+F*U,w+j*U,f,!0)+4,f.push(fr,pr),f.push(S+F*U,w+j*U)):(f.push(S-C*N,w-R*N),f.push(mr,gr),g+=Gr(S,w,S-C*N,w-R*N,S-F*N,w-j*N,f,!1)+4,f.push(S-F*N,w-j*N),f.push(mr,gr)):(f.push(fr,pr),f.push(mr,gr)):(f.push(S-C*N,w-R*N),f.push(S+C*U,w+R*U),a.join==="round"?Qi?g+=Gr(S,w,S+C*U,w+R*U,S+F*U,w+j*U,f,!0)+2:g+=Gr(S,w,S-C*N,w-R*N,S-F*N,w-j*N,f,!1)+2:a.join==="miter"&&Mc/y<=T&&(Qi?(f.push(mr,gr),f.push(mr,gr)):(f.push(fr,pr),f.push(fr,pr)),g+=2),f.push(S-F*N,w-j*N),f.push(S+F*U,w+j*U),g+=2)}v=i[(m-2)*2],P=i[(m-2)*2+1],S=i[(m-1)*2],w=i[(m-1)*2+1],C=-(P-w),R=v-S,mt=Math.sqrt(C*C+R*R),C/=mt,R/=mt,C*=b,R*=b,f.push(S-C*N,w-R*N),f.push(S+C*U,w+R*U),u||(a.cap==="round"?g+=Gr(S-C*(N-U)*.5,w-R*(N-U)*.5,S-C*N,w-R*N,S+C*U,w+R*U,f,!1)+2:a.cap==="square"&&(g+=yg(S,w,C,R,N,U,!1,f)));let Te=1e-4*1e-4;for(let q=_;q<g+_-2;++q)v=f[q*2],P=f[q*2+1],S=f[(q+1)*2],w=f[(q+1)*2+1],A=f[(q+2)*2],I=f[(q+2)*2+1],!(Math.abs(v*(w-I)+S*(I-P)+A*(P-w))<Te)&&o.push(q,q+1,q+2)}var vg=p(()=>{ne();_g()});function Tg(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 Sg=p(()=>{});var sh=Rc((kG,ih)=>{"use strict";ih.exports=Vn;ih.exports.default=Vn;function Vn(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Eg(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=$S(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 As(o,n,e,a,c,f,0),n}function Eg(i,t,e,r,s){var o,n;if(s===rh(i,t,e,r)>0)for(o=t;o<e;o+=r)n=wg(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=wg(o,i[o],i[o+1],n);return n&&jn(n,n.next)&&(Ms(n),n=n.next),n}function kr(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(jn(e,e.next)||pt(e.prev,e,e.next)===0)){if(Ms(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function As(i,t,e,r,s,o,n){if(i){!n&&o&&QS(i,r,s,o);for(var a=i,c,l;i.prev!==i.next;){if(c=i.prev,l=i.next,o?VS(i,r,s,o):zS(i)){t.push(c.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),Ms(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=jS(kr(i),t,e),As(i,t,e,r,s,o,2)):n===2&&XS(i,t,e,r,s,o):As(kr(i),t,e,r,s,o,1);break}}}}function zS(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&&fi(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 VS(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,g=a>c?a>l?a:l:c>l?c:l,_=h>u?h>d?h:d:u>d?u:d,b=th(f,m,t,e,r),y=th(g,_,t,e,r),T=i.prevZ,v=i.nextZ;T&&T.z>=b&&v&&v.z<=y;){if(T.x>=f&&T.x<=g&&T.y>=m&&T.y<=_&&T!==s&&T!==n&&fi(a,h,c,u,l,d,T.x,T.y)&&pt(T.prev,T,T.next)>=0||(T=T.prevZ,v.x>=f&&v.x<=g&&v.y>=m&&v.y<=_&&v!==s&&v!==n&&fi(a,h,c,u,l,d,v.x,v.y)&&pt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;T&&T.z>=b;){if(T.x>=f&&T.x<=g&&T.y>=m&&T.y<=_&&T!==s&&T!==n&&fi(a,h,c,u,l,d,T.x,T.y)&&pt(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;v&&v.z<=y;){if(v.x>=f&&v.x<=g&&v.y>=m&&v.y<=_&&v!==s&&v!==n&&fi(a,h,c,u,l,d,v.x,v.y)&&pt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function jS(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!jn(s,o)&&Pg(s,r,r.next,o)&&Cs(s,o)&&Cs(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),Ms(r),Ms(r.next),r=i=o),r=r.next}while(r!==i);return kr(r)}function XS(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&ew(n,a)){var c=Ag(n,a);n=kr(n,n.next),c=kr(c,c.next),As(n,t,e,r,s,o,0),As(c,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function $S(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=Eg(i,a,c,r,!1),l===l.next&&(l.steiner=!0),s.push(tw(l));for(s.sort(YS),o=0;o<s.length;o++)e=KS(s[o],e);return e}function YS(i,t){return i.x-t.x}function KS(i,t){var e=qS(i,t);if(!e)return t;var r=Ag(e,i);return kr(r,r.next),kr(e,e.next)}function qS(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&&fi(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),Cs(e,i)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&ZS(n,e)))&&(n=e,u=d)),e=e.next;while(e!==c);return n}function ZS(i,t){return pt(i.prev,i,t.prev)<0&&pt(t.next,i,i.next)<0}function QS(i,t,e,r){var s=i;do s.z===0&&(s.z=th(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,JS(s)}function JS(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 th(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 tw(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 fi(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 ew(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!rw(i,t)&&(Cs(i,t)&&Cs(t,i)&&iw(i,t)&&(pt(i.prev,i,t.prev)||pt(i,t.prev,t))||jn(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 jn(i,t){return i.x===t.x&&i.y===t.y}function Pg(i,t,e,r){var s=zn(pt(i,t,e)),o=zn(pt(i,t,r)),n=zn(pt(e,r,i)),a=zn(pt(e,r,t));return!!(s!==o&&n!==a||s===0&&Wn(i,e,t)||o===0&&Wn(i,r,t)||n===0&&Wn(e,i,r)||a===0&&Wn(e,t,r))}function Wn(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 zn(i){return i>0?1:i<0?-1:0}function rw(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&&Pg(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function Cs(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 iw(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 Ag(i,t){var e=new eh(i.i,i.x,i.y),r=new eh(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 wg(i,t,e,r){var s=new eh(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 Ms(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 eh(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}Vn.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(rh(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(rh(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 rh(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}Vn.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 Xn(i,t,e,r,s,o,n){let a=(0,Cg.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 Cg,oh=p(()=>{Cg=Jo(sh(),1)});var sw,Mg,Bg=p(()=>{E();oh();sw=[],Mg={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){Xn(i,sw,t,e,r,s,o)}}});var Rg,Gg=p(()=>{E();Rg={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 kg,Ig=p(()=>{E();kg={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 Ug(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function Dg(i,t){let e=O.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function ow(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 Fg,ah,Qt,pi=p(()=>{Mt();ct();K();ti();tt();Rt();dt();Qc();Fg=[{offset:0,color:"white"},{offset:1,color:"black"}],ah=class nh{constructor(...t){this.uid=$("fillGradient"),this.type="linear",this.colorStops=[];let e=ow(t);e={...e.type==="radial"?nh.defaultRadialOptions:nh.defaultLinearOptions,...un(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:V.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let _=t;t=r,r=_,o*=-1}if(n<0){let _=e;e=s,s=_,n*=-1}}let c=this.colorStops.length?this.colorStops:Fg,l=this._textureSize,{canvas:h,context:u}=Dg(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);Ug(d,c),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new M({source:new qt({resource:h,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),g=new B;g.scale(f/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:Fg,e=this._textureSize,{canvas:r,context:s}=Dg(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,g=(n-d)*f,_=s.createRadialGradient(m,g,l*f,(a-u)*f,(c-d)*f,h*f);Ug(_,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 M({source:new qt({resource:r,addressMode:this._wrapMode})});let b=new B;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}};ah.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};ah.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Qt=ah});function Og(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(aw);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,g=s.c,_=s.d;s.a*=l,s.b*=l,s.c*=h,s.d*=h,s.tx=u*f+d*g+s.tx,s.ty=u*m+d*_+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(nw.copyFrom(r).invert()),s}var nw,aw,Lg=p(()=>{K();vt();pi();nw=new B,aw=new z});function Hg(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")hw(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&&Ng(l.shapePath,c,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),Ng(a,c,n,r,e)}}}function hw(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,c=[],l=$n.rectangle,h=cw,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&&Ql(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=W.get(Rr);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 Ng(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=$n[c.type],g="triangle-list";if(m.build(c,f),l&&Ql(f,l),e){let T=c.closePath??!0,v=t;v.pixelLine?(Tg(f,T,o,a),g="line-list"):bg(f,v,!1,T,o,a)}else if(h){let T=[],v=f.slice();uw(h).forEach(S=>{T.push(v.length/2),v.push(...S)}),Xn(v,T,o,2,d,a,u)}else m.triangulate(f,o,2,d,a,u);let _=n.length/2,b=t.texture;if(b!==M.WHITE){let T=Og(lw,t,c,l);hg(o,2,d,n,_,2,o.length/2-d,T)}else ug(n,_,2,o.length/2-d);let y=W.get(Rr);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=g,r.push(y)})}function uw(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];$n[r.type].build(r,s),t.push(s)}return t}var $n,cw,lw,Wg=p(()=>{E();K();vt();dg();fg();tt();Ut();Jl();gg();vg();Sg();Bg();Gg();Ig();Lg();oh();$n={};G.handleByMap(x.ShapeBuilder,$n);G.add(Rg,Mg,kg,di,pg,mg);cw=new z,lw=new B});var ch,lh,uh,mi,Yn=p(()=>{E();In();Zl();qc();dt();Ut();Wg();ch=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},lh=class{constructor(){this.batcher=new Ps,this.instructions=new $r}init(){this.instructions.reset()}get geometry(){return D(af,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},uh=class hh{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){hh.defaultOptions.bezierSmoothness=t?.bezierSmoothness??hh.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),Hg(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=W.get(lh),{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=ii(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new ch;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(W.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{W.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};uh.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"graphicsContext"};uh.defaultOptions={bezierSmoothness:.5};mi=uh});var dw,dh,fh,ph,mh,gh,xh,_h,_t,_e=p(()=>{"use strict";dw={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},dh=0,fh=1,ph=2,mh=3,gh=4,xh=5,_h=class zg{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<dh)}set blend(t){!!(this.data&1<<dh)!==t&&(this.data^=1<<dh)}get offsets(){return!!(this.data&1<<fh)}set offsets(t){!!(this.data&1<<fh)!==t&&(this.data^=1<<fh)}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<<ph)}set culling(t){!!(this.data&1<<ph)!==t&&(this.data^=1<<ph)}get depthTest(){return!!(this.data&1<<mh)}set depthTest(t){!!(this.data&1<<mh)!==t&&(this.data^=1<<mh)}get depthMask(){return!!(this.data&1<<xh)}set depthMask(t){!!(this.data&1<<xh)!==t&&(this.data^=1<<xh)}get clockwiseFrontFace(){return!!(this.data&1<<gh)}set clockwiseFrontFace(t){!!(this.data&1<<gh)!==t&&(this.data^=1<<gh)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=dw[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 zg;return t.depthTest=!1,t.blend=!0,t}};_h.default2d=_h.for2d();_t=_h});function Re(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 gi=p(()=>{"use strict"});var Bs,Vg=p(()=>{E();_e();Ut();gi();Jl();Bs=class{constructor(t,e){this.state=_t.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,Re(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=W.get(Rr);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{W.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};Bs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"graphics"}});var yh=p(()=>{E();Yn();Vg();G.add(Bs);G.add(mi)});var nr,Kn=p(()=>{"use strict";nr=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 Rs,jg=p(()=>{E();K();er();Nt();vs();Ut();gi();Kn();Rs=class{constructor(t,e){this.localUniforms=new st({uTransformMatrix:{value:new B,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&&(W.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Ve(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Re(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=W.get(nr);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&W.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};Rs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"mesh"}});var bh=p(()=>{E();jg();G.add(Rs)});var qn,Xg=p(()=>{"use strict";qn=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 vh(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 $g=p(()=>{"use strict"});function Kg(i){return{dynamicUpdate:Yg(i,!0),staticUpdate:Yg(i,!1)}}function Yg(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 Zg=p(()=>{Rr()});function mw(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 Qn,Qg=p(()=>{ir();$e();oi();Rr();Il();Yg();Zg();Qn=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=Zt(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Pe(e*4*s),this.dynamicAttributeBuffer=new Pe(e*4*o),this.indexBuffer=Th(e);let n=new ce,a=0,c=0;this._staticBuffer=new gt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:j.VERTEX|j.COPY_DST}),this._dynamicBuffer=new gt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:j.VERTEX|j.COPY_DST});for(let h in r){let u=r[h],d=Zt(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=mw(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return qg(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Pe(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Pe(this._size*this._dynamicStride*4*4),this.indexBuffer=Th(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 Jg,tx=p(()=>{Jg=`varying vec2 vUV;
267
+ `);return new Function("ps","f32v","u32v",s)}var qg=p(()=>{Br()});function fw(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 Zn,Zg=p(()=>{rr();je();si();Br();kl();$g();qg();Zn=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=Zt(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Ee(e*4*s),this.dynamicAttributeBuffer=new Ee(e*4*o),this.indexBuffer=vh(e);let n=new ce,a=0,c=0;this._staticBuffer=new gt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:X.VERTEX|X.COPY_DST}),this._dynamicBuffer=new gt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:X.VERTEX|X.COPY_DST});for(let h in r){let u=r[h],d=Zt(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=fw(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return Kg(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Ee(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Ee(this._size*this._dynamicStride*4*4),this.indexBuffer=vh(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 Qg,Jg=p(()=>{Qg=`varying vec2 vUV;
268
268
  varying vec4 vColor;
269
269
 
270
270
  uniform sampler2D uTexture;
@@ -272,7 +272,7 @@ uniform sampler2D uTexture;
272
272
  void main(void){
273
273
  vec4 color = texture2D(uTexture, vUV) * vColor;
274
274
  gl_FragColor = color;
275
- }`});var ex,rx=p(()=>{ex=`attribute vec2 aVertex;
275
+ }`});var tx,ex=p(()=>{tx=`attribute vec2 aVertex;
276
276
  attribute vec2 aUV;
277
277
  attribute vec4 aColor;
278
278
 
@@ -311,7 +311,7 @@ void main(void){
311
311
  vUV = aUV;
312
312
  vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
313
313
  }
314
- `});var Sh,ix=p(()=>{Sh=`
314
+ `});var Th,rx=p(()=>{Th=`
315
315
  struct ParticleUniforms {
316
316
  uProjectionMatrix:mat3x3<f32>,
317
317
  uColor:vec4<f32>,
@@ -364,8 +364,8 @@ fn mainFragment(
364
364
  var sample = textureSample(uTexture, uSampler, uv) * color;
365
365
 
366
366
  return sample;
367
- }`});var Jn,sx=p(()=>{Mt();K();Br();ai();xe();tt();tl();tx();rx();ix();Jn=class extends xt{constructor(){let t=le.from({vertex:ex,fragment:Jg}),e=he.from({fragment:{source:Sh,entryPoint:"mainFragment"},vertex:{source:Sh,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:A.WHITE.source,uSampler:new fn({}),uniforms:{uTranslationMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new V(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var _i,wh=p(()=>{K();Nt();Ts();_e();xi();Qg();sx();_i=class{constructor(t,e){this.state=_t.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new st({uTranslationMatrix:{value:new B,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 Jn,this.state=_t.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 Qn({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=je(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,Ge(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var ks,ox=p(()=>{w();Xg();wh();ks=class extends _i{constructor(t){super(t,new Zn)}};ks.extension={type:[x.WebGLPipes],name:"particle"}});var ta,nx=p(()=>{"use strict";ta=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 Is,ax=p(()=>{w();nx();wh();Is=class extends _i{constructor(t){super(t,new ta)}};Is.extension={type:[x.WebGPUPipes],name:"particle"}});var Eh=p(()=>{w();ox();ax();R.add(ks);R.add(Is)});var ke,Fs=p(()=>{"use strict";ke=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 Us(i,t){let{texture:e,bounds:r}=i;Pn(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var Ph=p(()=>{Sl()});var Ds,cx=p(()=>{w();Ut();Fs();Ph();Ds=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),W.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,Us(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:W.get(ke)};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}};Ds.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"text"}});var Ah,Jt,yi=p(()=>{ct();ns();Ah=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=D.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return{canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=He(t),e=He(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},Jt=new Ah});function lx(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 hx(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 ux(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&&lx(n,e,c);)++c;if(c===r)return z.EMPTY;for(;lx(n,e,h);)--h;for(;hx(n,e,a,c,h);)++a;for(;hx(n,e,l,c,h);)--l;return++l,++h,new z(a/t,c/t,(l-a)/t,(h-c)/t)}var dx=p(()=>{vt()});var fx,Ye,ea=p(()=>{K();Rt();fx={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"}},Ye=class{constructor(t,e){this.uid=$("fillPattern"),this.transform=new B,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=fx[e].addressModeU,t.source.style.addressModeV=fx[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 mx=Gc((oF,px)=>{px.exports=xw;var Ch={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},gw=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function xw(i){var t=[];return i.replace(gw,function(e,r,s){var o=r.toLowerCase();for(s=yw(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Ch[o])return s.unshift(r),t.push(s);if(s.length<Ch[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Ch[o])))}}),t}var _w=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function yw(i){var t=i.match(_w);return t?t.map(Number):[]}});function xx(i,t){let e=(0,gx.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:G(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var gx,_x=p(()=>{gx=tn(mx(),1);it()});var ra,yx=p(()=>{vt();ra=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 z),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var ia,bx=p(()=>{vt();ia=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,g=f*f/(l*l)+m*m/(h*h),_=f*f/(u*u)+m*m/(d*d);return g>1&&_<=1}getBounds(t){return t||(t=new z),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function vx(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 g=i-f,_=t-m;return g*g+_*_}var Tx=p(()=>{"use strict"});var bw,vw,bi,Sx=p(()=>{Tx();vt();bi=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(bw),r=t.getBounds(vw);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],g=vx(t,e,u,d,f,m),_=Math.sign((f-u)*(e-d)-(m-d)*(t-u));if(g<=(_<0?a:n))return!0}return!1}getBounds(t){t||(t=new z);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,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 sa,oa,wx=p(()=>{vt();sa=(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},oa=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o}getBounds(t){return t||(t=new z),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!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,g=c-l*2,_=o+a,y=n+c;return(t>=o-h&&t<=o+u||t>=_-u&&t<=_+h)&&e>=f&&e<=f+g||(e>=n-h&&e<=n+u||e>=y-u&&e<=y+h)&&t>=d&&t<=d+m?!0:t<d&&e<f&&sa(t,e,d,f,l,u,h)||t>_-l&&e<f&&sa(t,e,_-l,f,l,u,h)||t>_-l&&e>y-l&&sa(t,e,_-l,y-l,l,u,h)||t<d&&e>y-l&&sa(t,e,d,y-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 aa(i,t,e,r,s,o,n,a,c,l){let u=Math.min(.99,Math.max(0,l??gi.defaultOptions.bezierSmoothness)),d=(Sw-u)/1;return d*=d,ww(t,e,r,s,o,n,a,c,i,d),i}function ww(i,t,e,r,s,o,n,a,c,l){Bh(i,t,e,r,s,o,n,a,c,l,0),c.push(n,a)}function Bh(i,t,e,r,s,o,n,a,c,l,h){if(h>Tw)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,m=(e+s)/2,g=(r+o)/2,_=(s+n)/2,y=(o+a)/2,b=(d+m)/2,v=(f+g)/2,T=(m+_)/2,P=(g+y)/2,S=(b+T)/2,E=(v+P)/2;if(h>0){let C=n-i,I=a-t,M=Math.abs((e-n)*I-(r-a)*C),k=Math.abs((s-n)*I-(o-a)*C),L,Y;if(M>na&&k>na){if((M+k)*(M+k)<=l*(C*C+I*I)){if(vi<Mh){c.push(S,E);return}let mt=Math.atan2(o-r,s-e);if(L=Math.abs(mt-Math.atan2(r-t,e-i)),Y=Math.abs(Math.atan2(a-o,n-s)-mt),L>=u&&(L=2*u-L),Y>=u&&(Y=2*u-Y),L+Y<vi){c.push(S,E);return}if(Fr!==0){if(L>Fr){c.push(e,r);return}if(Y>Fr){c.push(s,o);return}}}}else if(M>na){if(M*M<=l*(C*C+I*I)){if(vi<Mh){c.push(S,E);return}if(L=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),L>=u&&(L=2*u-L),L<vi){c.push(e,r),c.push(s,o);return}if(Fr!==0&&L>Fr){c.push(e,r);return}}}else if(k>na){if(k*k<=l*(C*C+I*I)){if(vi<Mh){c.push(S,E);return}if(L=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),L>=u&&(L=2*u-L),L<vi){c.push(e,r),c.push(s,o);return}if(Fr!==0&&L>Fr){c.push(s,o);return}}}else if(C=S-(i+n)/2,I=E-(t+a)/2,C*C+I*I<=l){c.push(S,E);return}}Bh(i,t,d,f,b,v,S,E,c,l,h+1),Bh(S,E,T,P,_,y,n,a,c,l,h+1)}var Tw,na,Sw,Mh,vi,Fr,Rh=p(()=>{Kn();Tw=8,na=11920929e-14,Sw=1,Mh=.01,vi=0,Fr=0});function Px(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??gi.defaultOptions.bezierSmoothness)),h=(Aw-l)/1;return h*=h,Mw(t,e,r,s,o,n,i,h),i}function Mw(i,t,e,r,s,o,n,a){Gh(n,i,t,e,r,s,o,a,0),n.push(s,o)}function Gh(i,t,e,r,s,o,n,a,c){if(c>Ew)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,g=(u+f)/2,_=o-t,y=n-e,b=Math.abs((r-o)*y-(s-n)*_);if(b>Pw){if(b*b<=a*(_*_+y*y)){if(Ex<Cw){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<Ex){i.push(m,g);return}}}else if(_=m-(t+o)/2,y=g-(e+n)/2,_*_+y*y<=a){i.push(m,g);return}Gh(i,t,e,h,u,m,g,a,c+1),Gh(i,m,g,d,f,o,n,a,c+1)}var Ew,Pw,Aw,Cw,Ex,Ax=p(()=>{Kn();Ew=8,Pw=11920929e-14,Aw=1,Cw=.01,Ex=0});function ca(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,g=e+f*r;i.push(m,g),h+=l}}var kh=p(()=>{"use strict"});function Cx(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,g=c*h+l*u,_=o*Math.sqrt(f)/d,y=o*Math.sqrt(m)/d,b=_*g/f,v=y*g/m,T=_*u+y*l,P=_*h+y*c,S=l*(y+b),E=c*(y+b),C=u*(_+v),I=h*(_+v),M=Math.atan2(E-P,S-T),k=Math.atan2(I-P,C-T);ca(i,T+t,P+e,o,M,k,l*h>u*c)}var Mx=p(()=>{kh()});function Bw(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 Rx(i,t,e,r,s,o,n,a=0,c=0,l=0){if(o===0||n===0)return;let h=Math.sin(a*Os/360),u=Math.cos(a*Os/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)),Rw(t,e,r,s,o,n,c,l,h,u,d,f,Ih);let{ang1:g,ang2:_}=Ih,{centerX:y,centerY:b}=Ih,v=Math.abs(_)/(Os/4);Math.abs(1-v)<1e-7&&(v=1);let T=Math.max(Math.ceil(v),1);_/=T;let P=i[i.length-2],S=i[i.length-1],E={x:0,y:0};for(let C=0;C<T;C++){let I=Bw(g,_),{x:M,y:k}=Fh(I[0],o,n,u,h,y,b,E),{x:L,y:Y}=Fh(I[1],o,n,u,h,y,b,E),{x:mt,y:$t}=Fh(I[2],o,n,u,h,y,b,E);aa(i,P,S,M,k,L,Y,mt,$t),P=mt,S=$t,g+=_}}var Os,Ih,Fh,Bx,Rw,Gx=p(()=>{Rh();Os=Math.PI*2,Ih={centerX:0,centerY:0,ang1:0,ang2:0},Fh=({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};Bx=(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)},Rw=(i,t,e,r,s,o,n,a,c,l,h,u,d)=>{let f=Math.pow(s,2),m=Math.pow(o,2),g=Math.pow(h,2),_=Math.pow(u,2),y=f*m-f*_-m*g;y<0&&(y=0),y/=f*_+m*g,y=Math.sqrt(y)*(n===a?-1:1);let b=y*s/o*u,v=y*-o/s*h,T=l*b-c*v+(i+e)/2,P=c*b+l*v+(t+r)/2,S=(h-b)/s,E=(u-v)/o,C=(-h-b)/s,I=(-u-v)/o,M=Bx(1,0,S,E),k=Bx(S,E,C,I);a===0&&k>0&&(k-=Os),a===1&&k<0&&(k+=Os),d.centerX=T,d.centerY=P,d.ang1=M,d.ang2=k}});function kx(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 g=d/2,_,y=Math.abs(Math.cos(g)*c/Math.sin(g));y>Math.min(h.len/2,u.len/2)?(y=Math.min(h.len/2,u.len/2),_=Math.abs(y*Math.sin(g)/Math.cos(g))):_=c;let b=a.x+u.nx*y+-u.ny*_*f,v=a.y+u.ny*y+u.nx*_*f,T=Math.atan2(h.ny,h.nx)+Math.PI/2*f,P=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&i.moveTo(b+Math.cos(T)*_,v+Math.sin(T)*_),i.arc(b,v,_,T,P,m),o=a}}function Ix(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 _=Math.min(d/2,l);f=o(c,h,_/d)}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(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(c.x,c.y,g.x,g.y,r)}}var Fx=p(()=>{"use strict"});var Gw,la,Ux=p(()=>{yx();bx();Sx();vt();wx();Xt();Rh();Ax();kh();Mx();Gx();Fx();Gw=new z,la=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 ca(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Cx(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let c=this._currentPoly.points;return Rx(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 aa(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 Px(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 z(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new ra(t,e,r),s),this}poly(t,e,r){let s=new bi(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),g=e+r*Math.sin(f),_=f+Math.PI+u,y=f-Math.PI-u,b=m+o*Math.cos(_),v=g+o*Math.sin(_),T=m+o*Math.cos(y),P=g+o*Math.sin(y);d===0?this.moveTo(b,v):this.lineTo(b,v),this.quadraticCurveTo(m,g,T,P,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?Ix(this,t,e,s):kx(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 ia(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new oa(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 bi,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 bi,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(Gw);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function Ls(i,t){return i?i.prepend(t):t.clone()}var cr,Uh=p(()=>{ne();Rt();it();_x();Ux();cr=class i{constructor(t,e=!1){this.instructions=[],this.uid=$("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?xx(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new la(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(X.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(X.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,g=0;for(let _=0;_<this.instructions.length;_++){let y=this.instructions[_],b=y.data;switch(y.action){case"moveTo":case"lineTo":c=b[0],l=b[1],b[0]=e*c+s*l+n,b[1]=r*c+o*l+a;break;case"bezierCurveTo":h=b[0],u=b[1],d=b[2],f=b[3],c=b[4],l=b[5],b[0]=e*h+s*u+n,b[1]=r*h+o*u+a,b[2]=e*d+s*f+n,b[3]=r*d+o*f+a,b[4]=e*c+s*l+n,b[5]=r*c+o*l+a;break;case"quadraticCurveTo":h=b[0],u=b[1],c=b[2],l=b[3],b[0]=e*h+s*u+n,b[1]=r*h+o*u+a,b[2]=e*c+s*l+n,b[3]=r*c+o*l+a;break;case"arcToSvg":c=b[5],l=b[6],m=b[0],g=b[1],b[0]=e*m+s*g,b[1]=r*m+o*g,b[5]=e*c+s*l+n,b[6]=r*c+o*l+a;break;case"circle":b[4]=Ls(b[3],t);break;case"rect":b[4]=Ls(b[4],t);break;case"ellipse":b[8]=Ls(b[8],t);break;case"roundRect":b[5]=Ls(b[5],t);break;case"addPath":b[0].transform(t);break;case"poly":b[2]=Ls(b[2],t);break;default:G("unknown transform action",y.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 Dh=p(()=>{"use strict"});function Dx(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]=kw(n);break;case"radialgradient":t.defs[n.id]=Iw(n);break;default:break}}}}function kw(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=V.shared.setValue(c.getAttribute("stop-color")).toNumber();n.addColorStop(l,h)}return n}function Iw(i){return G("[SVG Parser] Radial gradients are not yet supported"),new Qt(0,0,1,0)}var Ox=p(()=>{Mt();it();mi();Dh()});function Oh(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var Lx=p(()=>{"use strict"});function Lh(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Nx){let a=i.getAttribute(n);a&&Hx(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(":");Nx[l]&&Hx(t,o,l,h.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function Hx(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Oh(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=V.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=Oh(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=V.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 Nx,Wx=p(()=>{Mt();Lx();Nx={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 zx(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 cr};Dx(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=Lh(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&Vx(a,e,s,o)}return t}function Vx(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=Lh(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,_,y,b,v,T,P,S,E,C;switch(i.nodeName.toLowerCase()){case"path":P=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&G("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new cr(P,!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),E=ut(i,"width",0),C=ut(i,"height",0),y=ut(i,"rx",0),b=ut(i,"ry",0),y||b?t.context.roundRect(c,l,E,C,y||b):t.context.rect(c,l,E,C),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":m=ut(i,"cx",0),g=ut(i,"cy",0),y=ut(i,"rx",0),b=ut(i,"ry",0),t.context.beginPath(),t.context.ellipse(m,g,y,b),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(I=>parseInt(I,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(I=>parseInt(I,10)),t.context.poly(v,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{G(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let I=0;I<s.length;I++)Vx(s[I],t,e,r)}var jx=p(()=>{it();Uh();Ox();Dh();Wx()});function Fw(i){return V.isColorLike(i)}function $x(i){return i instanceof Ye}function Xx(i){return i instanceof Qt}function Uw(i){return i instanceof A}function Dw(i,t,e){let r=V.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=A.WHITE,{...e,...i}}function Ow(i,t,e){return i.texture=t,{...e,...i}}function Yx(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function Kx(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 Lw(i,t){let e={...t,...i},r=V.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Ke(i,t){if(i==null)return null;let e={},r=i;return Fw(i)?Dw(e,i,t):Uw(i)?Ow(e,i,t):$x(i)?Yx(e,i,t):Xx(i)?Kx(e,i,t):r.fill&&$x(r.fill)?Yx(r,r.fill,t):r.fill&&Xx(r.fill)?Kx(r,r.fill,t):Lw(r,t)}function Ti(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...c}=t,l=Ke(i,c);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var Nh=p(()=>{Mt();tt();mi();ea()});var Nw,qx,Hh,Ht,ha=p(()=>{kt();Mt();K();ne();tt();Rt();dt();Xt();Uh();jx();Nh();Nw=new X,qx=new B,Hh=class Ie extends ot{constructor(){super(...arguments),this.uid=$("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new cr,this._transform=new B,this._fillStyle={...Ie.defaultFillStyle},this._strokeStyle={...Ie.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new rt,this._boundsDirty=!0}clone(){let t=new Ie;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=Ke(t,Ie.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Ti(t,Ie.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Ke(t,Ie.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Ke(t,Ie.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?V.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new cr,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"&&(U(H,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Ke(t,Ie.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(X.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=Ti(t,Ie.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++,zx(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 B?(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 B?(this._transform.append(t),this):(qx.set(t,e,r,s,o,n),this._transform.append(qx),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,Nw):t;if(o.action==="fill")r=u.contains(f.x,f.y);else{let g=c;r=u.strokeContains(f.x,f.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(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}};Hh.defaultFillStyle={color:16777215,alpha:1,texture:A.WHITE,matrix:null,fill:null,textureSpace:"local"};Hh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:A.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Ht=Hh});function ua(i){let t=[],e=0;for(let r=0;r<Zx.length;r++){let s=`_${Zx[r]}`;t[e++]=i[s]}return e=Qx(i._fill,t,e),e=Hw(i._stroke,t,e),e=Ww(i.dropShadow,t,e),t.join("-")}function Qx(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function Hw(i,t,e){return i&&(e=Qx(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 Ww(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=V.shared.setValue(i.color).toNumber()),e}var Zx,Wh=p(()=>{Mt();Zx=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function zw(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=St.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){U(H,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(V.isColorLike(e))r.color=e;else if(e instanceof Qt||e instanceof Ye)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)){U(H,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=St.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=>V.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o)}),i.fill={fill:r}}}var zh,St,Ur=p(()=>{kt();Mt();dt();mi();ea();ha();Nh();Wh();zh=class Si extends ot{constructor(t={}){super(),zw(t);let e={...Si.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...Si.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Si.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Ht.defaultFillStyle,...t},()=>{this._fill=Ke({...this._originalFill},Ht.defaultFillStyle)})),this._fill=Ke(t===0?"black":t,Ht.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ht.defaultStrokeStyle,...t},()=>{this._stroke=Ti({...this._originalStroke},Ht.defaultStrokeStyle)})),this._stroke=Ti(t,Ht.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=ua(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Si.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Si({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!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&&!(V.isColorLike(t)||t instanceof Qt||t instanceof Ye)}};zh.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};zh.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};St=zh});function da(i,t,e,r){let s=Vw;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 Vw,Vh=p(()=>{Ze();Xt();Vw=new rt});function Dr(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)&&!jw.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var jw,fa=p(()=>{"use strict";jw=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var jh,ye,At,Ns=p(()=>{ct();fa();jh={willReadFrequently:!0},ye=class O{static get experimentalLetterSpacingSupported(){let t=O._experimentalLetterSpacingSupported;if(t!==void 0){let e=D.get().getCanvasRenderingContext2D().prototype;t=O._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=O._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(O._measurementCache[o])return O._measurementCache[o];let n=Dr(e),a=O.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let c=O.__context;c.font=n;let h=(s?O._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let b=0;b<h.length;b++){let v=O._measureText(h[b],e.letterSpacing,c);u[b]=v,d=Math.max(d,v)}let f=e._stroke?.width||0,m=d+f;e.dropShadow&&(m+=e.dropShadow.distance);let g=e.lineHeight||a.fontSize,_=Math.max(g,a.fontSize+f)+(h.length-1)*(g+e.leading);return e.dropShadow&&(_+=e.dropShadow.distance),new O(t,e,m,_,h,u,g+e.leading,d,a)}static _measureText(t,e,r){let s=!1;O.experimentalLetterSpacingSupported&&(O.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=(O.graphemeSegmenter(t).length-1)*e;n+=h,l+=h}return Math.max(n,l)}static _wordWrap(t,e,r=O._canvas){let s=r.getContext("2d",jh),o=0,n="",a="",c=Object.create(null),{letterSpacing:l,whiteSpace:h}=e,u=O._collapseSpaces(h),d=O._collapseNewlines(h),f=!u,m=e.wordWrapWidth+l,g=O._tokenize(t);for(let _=0;_<g.length;_++){let y=g[_];if(O._isNewline(y)){if(!d){a+=O._addLine(n),f=!u,n="",o=0;continue}y=" "}if(u){let v=O.isBreakingSpace(y),T=O.isBreakingSpace(n[n.length-1]);if(v&&T)continue}let b=O._getFromCache(y,l,c,s);if(b>m)if(n!==""&&(a+=O._addLine(n),n="",o=0),O.canBreakWords(y,e.breakWords)){let v=O.wordWrapSplit(y);for(let T=0;T<v.length;T++){let P=v[T],S=P,E=1;for(;v[T+E];){let I=v[T+E];if(!O.canBreakChars(S,I,y,T,e.breakWords))P+=I;else break;S=I,E++}T+=E-1;let C=O._getFromCache(P,l,c,s);C+o>m&&(a+=O._addLine(n),f=!1,n="",o=0),n+=P,o+=C}}else{n.length>0&&(a+=O._addLine(n),n="",o=0);let v=_===g.length-1;a+=O._addLine(y,!v),f=!1,n="",o=0}else b+o>m&&(f=!1,a+=O._addLine(n),n="",o=0),(n.length>0||!O.isBreakingSpace(y)||f)&&(n+=y,o+=b)}return a+=O._addLine(n,!1),a}static _addLine(t,e=!0){return t=O._trimRight(t),t=e?`${t}
368
- `:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=O._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(!O.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:O._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:O._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(O.isBreakingSpace(o,n)||O._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 O.graphemeSegmenter(t)}static measureFont(t){if(O._fonts[t])return O._fonts[t];let e=O._context;e.font=t;let r=e.measureText(O.METRICS_STRING+O.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return O._fonts[t]=s,s}static clearMetrics(t=""){t?delete O._fonts[t]:O._fonts={}}static get _canvas(){if(!O.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",jh)?.measureText)return O.__canvas=e,e;t=D.get().createCanvas()}catch{t=D.get().createCanvas()}t.width=t.height=10,O.__canvas=t}return O.__canvas}static get _context(){return O.__context||(O.__context=O._canvas.getContext("2d",jh)),O.__context}};ye.METRICS_STRING="|\xC9q\xC5";ye.BASELINE_SYMBOL="M";ye.BASELINE_MULTIPLIER=1.4;ye.HEIGHT_MULTIPLIER=2;ye.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();ye.experimentalLetterSpacing=!1;ye._fonts={};ye._newlines=[10,13];ye._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];ye._measurementCache={};At=ye});function wi(i,t,e,r=0){if(i.texture===A.WHITE&&!i.fill)return V.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof Ye){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(B.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 g=f+m.offset*u;l.addColorStop(Math.floor(g*Jx)/Jx,V.shared.setValue(m.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,V.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(B.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return G("FillStyle not recognised",i),"red"}var Jx,$h=p(()=>{Mt();K();tt();it();mi();ea();Jx=1e5});var Hs,t_=p(()=>{Mt();w();ns();yi();Ze();dx();dt();Ur();Vh();Ns();fa();$h();Hs=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=He(o),n=He(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(U("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof St||(t.style=new St(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Jt.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=Jt.getOptimalCanvasAndContext(n,a),{canvas:l}=c;this.renderTextToCanvas(e,r,s,c);let h=da(l,n,a,s);if(r.trim){let u=ux(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&&(Jt.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=Dr(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 b=e._stroke;n.lineWidth=b.width,n.miterLimit=b.miterLimit,n.lineJoin=b.join,n.lineCap=b.cap}n.font=a;let g,_,y=e.dropShadow?2:1;for(let b=0;b<y;++b){let v=e.dropShadow&&b===0,T=v?Math.ceil(Math.max(1,m)+e.padding*2):0,P=T*r;if(v){n.fillStyle="black",n.strokeStyle="black";let C=e.dropShadow,I=C.color,M=C.alpha;n.shadowColor=V.shared.setValue(I).setAlpha(M).toRgbaString();let k=C.blur*r,L=C.distance*r;n.shadowBlur=k,n.shadowOffsetX=Math.cos(C.angle)*L,n.shadowOffsetY=Math.sin(C.angle)*L+P}else{if(n.fillStyle=e._fill?wi(e._fill,n,c):null,e._stroke?.width){let C=e._stroke.width*e._stroke.alignment;n.strokeStyle=wi(e._stroke,n,c,C)}n.shadowColor="black"}let S=(h-f.fontSize)/2;h-f.fontSize<0&&(S=0);let E=e._stroke?.width??0;for(let C=0;C<l.length;C++)g=E/2,_=E/2+C*h+f.ascent+S,e.align==="right"?g+=d-u[C]:e.align==="center"&&(g+=(d-u[C])/2),e._stroke?.width&&this._drawLetterSpacing(l[C],e,s,g+e.padding,_+e.padding-T,!0),e._fill!==void 0&&this._drawLetterSpacing(l[C],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),d=a.measureText(t).width,f=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 y=m+1;y<u.length;++y)_+=u[y];f=a.measureText(_).width,h+=d-f+c,d=f}}destroy(){this._activeTextures=null}};Hs.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"canvasText"}});var Xh=p(()=>{w();cx();t_();R.add(Hs);R.add(Ds)});var Wt,Yh=p(()=>{dt();Sn();ha();Wt=class i extends tr{constructor(t){t instanceof Ht&&(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 Ht,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){U(H,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){U(H,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){U(H,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Ht.defaultStrokeStyle.width||t.color!==Ht.defaultStrokeStyle.color||t.alpha!==Ht.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return U(H,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return U(H,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return U(H,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return U(H,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return U(H,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return U(H,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var e_,r_,i_=p(()=>{"use strict";e_={name:"local-uniform-msdf-bit",vertex:{header:`
367
+ }`});var Qn,ix=p(()=>{Mt();K();Mr();ni();xe();tt();Jc();Jg();ex();rx();Qn=class extends xt{constructor(){let t=le.from({vertex:tx,fragment:Qg}),e=he.from({fragment:{source:Th,entryPoint:"mainFragment"},vertex:{source:Th,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:M.WHITE.source,uSampler:new dn({}),uniforms:{uTranslationMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new V(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var xi,Sh=p(()=>{K();Nt();vs();_e();gi();Zg();ix();xi=class{constructor(t,e){this.state=_t.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new st({uTranslationMatrix:{value:new B,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 Qn,this.state=_t.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 Zn({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=Ve(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,Re(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Gs,sx=p(()=>{E();Xg();Sh();Gs=class extends xi{constructor(t){super(t,new qn)}};Gs.extension={type:[x.WebGLPipes],name:"particle"}});var Jn,ox=p(()=>{"use strict";Jn=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 ks,nx=p(()=>{E();ox();Sh();ks=class extends xi{constructor(t){super(t,new Jn)}};ks.extension={type:[x.WebGPUPipes],name:"particle"}});var wh=p(()=>{E();sx();nx();G.add(Gs);G.add(ks)});var Ge,Is=p(()=>{"use strict";Ge=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 Fs(i,t){let{texture:e,bounds:r}=i;En(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var Eh=p(()=>{Tl()});var Us,ax=p(()=>{E();Ut();Is();Eh();Us=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),W.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,Fs(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:W.get(Ge)};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}};Us.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"text"}});var Ph,Jt,_i=p(()=>{ct();os();Ph=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=Ne(t),e=Ne(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},Jt=new Ph});function cx(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 lx(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 hx(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&&cx(n,e,c);)++c;if(c===r)return z.EMPTY;for(;cx(n,e,h);)--h;for(;lx(n,e,a,c,h);)++a;for(;lx(n,e,l,c,h);)--l;return++l,++h,new z(a/t,c/t,(l-a)/t,(h-c)/t)}var ux=p(()=>{vt()});var dx,$e,ta=p(()=>{K();Rt();dx={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"}},$e=class{constructor(t,e){this.uid=$("fillPattern"),this.transform=new B,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=dx[e].addressModeU,t.source.style.addressModeV=dx[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 px=Rc((iF,fx)=>{fx.exports=mw;var Ah={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},pw=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function mw(i){var t=[];return i.replace(pw,function(e,r,s){var o=r.toLowerCase();for(s=xw(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Ah[o])return s.unshift(r),t.push(s);if(s.length<Ah[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Ah[o])))}}),t}var gw=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function xw(i){var t=i.match(gw);return t?t.map(Number):[]}});function gx(i,t){let e=(0,mx.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:k(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var mx,xx=p(()=>{mx=Jo(px(),1);it()});var ea,_x=p(()=>{vt();ea=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 z),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var ra,yx=p(()=>{vt();ra=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,g=f*f/(l*l)+m*m/(h*h),_=f*f/(u*u)+m*m/(d*d);return g>1&&_<=1}getBounds(t){return t||(t=new z),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function bx(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 g=i-f,_=t-m;return g*g+_*_}var vx=p(()=>{"use strict"});var _w,yw,yi,Tx=p(()=>{vx();vt();yi=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(_w),r=t.getBounds(yw);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],g=bx(t,e,u,d,f,m),_=Math.sign((f-u)*(e-d)-(m-d)*(t-u));if(g<=(_<0?a:n))return!0}return!1}getBounds(t){t||(t=new z);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,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 ia,sa,Sx=p(()=>{vt();ia=(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},sa=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o}getBounds(t){return t||(t=new z),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!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,g=c-l*2,_=o+a,b=n+c;return(t>=o-h&&t<=o+u||t>=_-u&&t<=_+h)&&e>=f&&e<=f+g||(e>=n-h&&e<=n+u||e>=b-u&&e<=b+h)&&t>=d&&t<=d+m?!0:t<d&&e<f&&ia(t,e,d,f,l,u,h)||t>_-l&&e<f&&ia(t,e,_-l,f,l,u,h)||t>_-l&&e>b-l&&ia(t,e,_-l,b-l,l,u,h)||t<d&&e>b-l&&ia(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 na(i,t,e,r,s,o,n,a,c,l){let u=Math.min(.99,Math.max(0,l??mi.defaultOptions.bezierSmoothness)),d=(vw-u)/1;return d*=d,Tw(t,e,r,s,o,n,a,c,i,d),i}function Tw(i,t,e,r,s,o,n,a,c,l){Mh(i,t,e,r,s,o,n,a,c,l,0),c.push(n,a)}function Mh(i,t,e,r,s,o,n,a,c,l,h){if(h>bw)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,m=(e+s)/2,g=(r+o)/2,_=(s+n)/2,b=(o+a)/2,y=(d+m)/2,T=(f+g)/2,v=(m+_)/2,P=(g+b)/2,S=(y+v)/2,w=(T+P)/2;if(h>0){let A=n-i,I=a-t,C=Math.abs((e-n)*I-(r-a)*A),R=Math.abs((s-n)*I-(o-a)*A),F,j;if(C>oa&&R>oa){if((C+R)*(C+R)<=l*(A*A+I*I)){if(bi<Ch){c.push(S,w);return}let mt=Math.atan2(o-r,s-e);if(F=Math.abs(mt-Math.atan2(r-t,e-i)),j=Math.abs(Math.atan2(a-o,n-s)-mt),F>=u&&(F=2*u-F),j>=u&&(j=2*u-j),F+j<bi){c.push(S,w);return}if(Ir!==0){if(F>Ir){c.push(e,r);return}if(j>Ir){c.push(s,o);return}}}}else if(C>oa){if(C*C<=l*(A*A+I*I)){if(bi<Ch){c.push(S,w);return}if(F=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),F>=u&&(F=2*u-F),F<bi){c.push(e,r),c.push(s,o);return}if(Ir!==0&&F>Ir){c.push(e,r);return}}}else if(R>oa){if(R*R<=l*(A*A+I*I)){if(bi<Ch){c.push(S,w);return}if(F=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),F>=u&&(F=2*u-F),F<bi){c.push(e,r),c.push(s,o);return}if(Ir!==0&&F>Ir){c.push(s,o);return}}}else if(A=S-(i+n)/2,I=w-(t+a)/2,A*A+I*I<=l){c.push(S,w);return}}Mh(i,t,d,f,y,T,S,w,c,l,h+1),Mh(S,w,v,P,_,b,n,a,c,l,h+1)}var bw,oa,vw,Ch,bi,Ir,Bh=p(()=>{Yn();bw=8,oa=11920929e-14,vw=1,Ch=.01,bi=0,Ir=0});function Ex(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??mi.defaultOptions.bezierSmoothness)),h=(Ew-l)/1;return h*=h,Aw(t,e,r,s,o,n,i,h),i}function Aw(i,t,e,r,s,o,n,a){Rh(n,i,t,e,r,s,o,a,0),n.push(s,o)}function Rh(i,t,e,r,s,o,n,a,c){if(c>Sw)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,g=(u+f)/2,_=o-t,b=n-e,y=Math.abs((r-o)*b-(s-n)*_);if(y>ww){if(y*y<=a*(_*_+b*b)){if(wx<Pw){i.push(m,g);return}let T=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(T>=l&&(T=2*l-T),T<wx){i.push(m,g);return}}}else if(_=m-(t+o)/2,b=g-(e+n)/2,_*_+b*b<=a){i.push(m,g);return}Rh(i,t,e,h,u,m,g,a,c+1),Rh(i,m,g,d,f,o,n,a,c+1)}var Sw,ww,Ew,Pw,wx,Px=p(()=>{Yn();Sw=8,ww=11920929e-14,Ew=1,Pw=.01,wx=0});function aa(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,g=e+f*r;i.push(m,g),h+=l}}var Gh=p(()=>{"use strict"});function Ax(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,g=c*h+l*u,_=o*Math.sqrt(f)/d,b=o*Math.sqrt(m)/d,y=_*g/f,T=b*g/m,v=_*u+b*l,P=_*h+b*c,S=l*(b+y),w=c*(b+y),A=u*(_+T),I=h*(_+T),C=Math.atan2(w-P,S-v),R=Math.atan2(I-P,A-v);aa(i,v+t,P+e,o,C,R,l*h>u*c)}var Cx=p(()=>{Gh()});function Cw(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 Bx(i,t,e,r,s,o,n,a=0,c=0,l=0){if(o===0||n===0)return;let h=Math.sin(a*Ds/360),u=Math.cos(a*Ds/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)),Mw(t,e,r,s,o,n,c,l,h,u,d,f,kh);let{ang1:g,ang2:_}=kh,{centerX:b,centerY:y}=kh,T=Math.abs(_)/(Ds/4);Math.abs(1-T)<1e-7&&(T=1);let v=Math.max(Math.ceil(T),1);_/=v;let P=i[i.length-2],S=i[i.length-1],w={x:0,y:0};for(let A=0;A<v;A++){let I=Cw(g,_),{x:C,y:R}=Ih(I[0],o,n,u,h,b,y,w),{x:F,y:j}=Ih(I[1],o,n,u,h,b,y,w),{x:mt,y:Xt}=Ih(I[2],o,n,u,h,b,y,w);na(i,P,S,C,R,F,j,mt,Xt),P=mt,S=Xt,g+=_}}var Ds,kh,Ih,Mx,Mw,Rx=p(()=>{Bh();Ds=Math.PI*2,kh={centerX:0,centerY:0,ang1:0,ang2:0},Ih=({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};Mx=(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)},Mw=(i,t,e,r,s,o,n,a,c,l,h,u,d)=>{let f=Math.pow(s,2),m=Math.pow(o,2),g=Math.pow(h,2),_=Math.pow(u,2),b=f*m-f*_-m*g;b<0&&(b=0),b/=f*_+m*g,b=Math.sqrt(b)*(n===a?-1:1);let y=b*s/o*u,T=b*-o/s*h,v=l*y-c*T+(i+e)/2,P=c*y+l*T+(t+r)/2,S=(h-y)/s,w=(u-T)/o,A=(-h-y)/s,I=(-u-T)/o,C=Mx(1,0,S,w),R=Mx(S,w,A,I);a===0&&R>0&&(R-=Ds),a===1&&R<0&&(R+=Ds),d.centerX=v,d.centerY=P,d.ang1=C,d.ang2=R}});function Gx(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 g=d/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*_*f,T=a.y+u.ny*b+u.nx*_*f,v=Math.atan2(h.ny,h.nx)+Math.PI/2*f,P=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&i.moveTo(y+Math.cos(v)*_,T+Math.sin(v)*_),i.arc(y,T,_,v,P,m),o=a}}function kx(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 _=Math.min(d/2,l);f=o(c,h,_/d)}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(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(c.x,c.y,g.x,g.y,r)}}var Ix=p(()=>{"use strict"});var Bw,ca,Fx=p(()=>{_x();yx();Tx();vt();Sx();$t();Bh();Px();Gh();Cx();Rx();Ix();Bw=new z,ca=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 aa(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Ax(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let c=this._currentPoly.points;return Bx(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 na(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 Ex(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 z(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new ea(t,e,r),s),this}poly(t,e,r){let s=new yi(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),g=e+r*Math.sin(f),_=f+Math.PI+u,b=f-Math.PI-u,y=m+o*Math.cos(_),T=g+o*Math.sin(_),v=m+o*Math.cos(b),P=g+o*Math.sin(b);d===0?this.moveTo(y,T):this.lineTo(y,T),this.quadraticCurveTo(m,g,v,P,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?kx(this,t,e,s):Gx(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 ra(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new sa(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 yi,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 yi,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(Bw);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function Os(i,t){return i?i.prepend(t):t.clone()}var ar,Fh=p(()=>{ne();Rt();it();xx();Fx();ar=class i{constructor(t,e=!1){this.instructions=[],this.uid=$("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?gx(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new ca(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(Y.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(Y.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,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],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],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]=Os(y[3],t);break;case"rect":y[4]=Os(y[4],t);break;case"ellipse":y[8]=Os(y[8],t);break;case"roundRect":y[5]=Os(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=Os(y[2],t);break;default:k("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 Uh=p(()=>{"use strict"});function Ux(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]=Rw(n);break;case"radialgradient":t.defs[n.id]=Gw(n);break;default:break}}}}function Rw(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=V.shared.setValue(c.getAttribute("stop-color")).toNumber();n.addColorStop(l,h)}return n}function Gw(i){return k("[SVG Parser] Radial gradients are not yet supported"),new Qt(0,0,1,0)}var Dx=p(()=>{Mt();it();pi();Uh()});function Dh(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var Ox=p(()=>{"use strict"});function Oh(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Lx){let a=i.getAttribute(n);a&&Nx(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(":");Lx[l]&&Nx(t,o,l,h.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function Nx(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Dh(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=V.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=Dh(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=V.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 Lx,Hx=p(()=>{Mt();Ox();Lx={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 Wx(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 ar};Ux(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=Oh(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&zx(a,e,s,o)}return t}function zx(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=Oh(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,T,v,P,S,w,A;switch(i.nodeName.toLowerCase()){case"path":P=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&k("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new ar(P,!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),w=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,w,A,b||y):t.context.rect(c,l,w,A),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),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":v=i.getAttribute("points"),T=v.match(/\d+/g).map(I=>parseInt(I,10)),t.context.poly(T,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":v=i.getAttribute("points"),T=v.match(/\d+/g).map(I=>parseInt(I,10)),t.context.poly(T,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{k(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let I=0;I<s.length;I++)zx(s[I],t,e,r)}var Vx=p(()=>{it();Fh();Dx();Uh();Hx()});function kw(i){return V.isColorLike(i)}function jx(i){return i instanceof $e}function Xx(i){return i instanceof Qt}function Iw(i){return i instanceof M}function Fw(i,t,e){let r=V.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=M.WHITE,{...e,...i}}function Uw(i,t,e){return i.texture=t,{...e,...i}}function $x(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function Yx(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 Dw(i,t){let e={...t,...i},r=V.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Ye(i,t){if(i==null)return null;let e={},r=i;return kw(i)?Fw(e,i,t):Iw(i)?Uw(e,i,t):jx(i)?$x(e,i,t):Xx(i)?Yx(e,i,t):r.fill&&jx(r.fill)?$x(r,r.fill,t):r.fill&&Xx(r.fill)?Yx(r,r.fill,t):Dw(r,t)}function vi(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...c}=t,l=Ye(i,c);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var Lh=p(()=>{Mt();tt();pi();ta()});var Ow,Kx,Nh,Ht,la=p(()=>{kt();Mt();K();ne();tt();Rt();dt();$t();Fh();Vx();Lh();Ow=new Y,Kx=new B,Nh=class ke extends ot{constructor(){super(...arguments),this.uid=$("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new ar,this._transform=new B,this._fillStyle={...ke.defaultFillStyle},this._strokeStyle={...ke.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new rt,this._boundsDirty=!0}clone(){let t=new ke;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=Ye(t,ke.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=vi(t,ke.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Ye(t,ke.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Ye(t,ke.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?V.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new ar,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(H,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Ye(t,ke.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(Y.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=vi(t,ke.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++,Wx(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 B?(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 B?(this._transform.append(t),this):(Kx.set(t,e,r,s,o,n),this._transform.append(Kx),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,Ow):t;if(o.action==="fill")r=u.contains(f.x,f.y);else{let g=c;r=u.strokeContains(f.x,f.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(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}};Nh.defaultFillStyle={color:16777215,alpha:1,texture:M.WHITE,matrix:null,fill:null,textureSpace:"local"};Nh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:M.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Ht=Nh});function ha(i){let t=[],e=0;for(let r=0;r<qx.length;r++){let s=`_${qx[r]}`;t[e++]=i[s]}return e=Zx(i._fill,t,e),e=Lw(i._stroke,t,e),e=Nw(i.dropShadow,t,e),t.join("-")}function Zx(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function Lw(i,t,e){return i&&(e=Zx(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 Nw(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=V.shared.setValue(i.color).toNumber()),e}var qx,Hh=p(()=>{Mt();qx=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function Hw(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=St.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(H,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(V.isColorLike(e))r.color=e;else if(e instanceof Qt||e instanceof $e)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(H,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=St.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=>V.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o)}),i.fill={fill:r}}}var Wh,St,Fr=p(()=>{kt();Mt();dt();pi();ta();la();Lh();Hh();Wh=class Ti extends ot{constructor(t={}){super(),Hw(t);let e={...Ti.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({...Ti.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Ti.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({...Ht.defaultFillStyle,...t},()=>{this._fill=Ye({...this._originalFill},Ht.defaultFillStyle)})),this._fill=Ye(t===0?"black":t,Ht.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ht.defaultStrokeStyle,...t},()=>{this._stroke=vi({...this._originalStroke},Ht.defaultStrokeStyle)})),this._stroke=vi(t,Ht.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=ha(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Ti.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Ti({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&&!(V.isColorLike(t)||t instanceof Qt||t instanceof $e)}};Wh.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Wh.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};St=Wh});function ua(i,t,e,r){let s=Ww;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 Ww,zh=p(()=>{qe();$t();Ww=new rt});function Ur(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)&&!zw.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var zw,da=p(()=>{"use strict";zw=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Vh,ye,At,Ls=p(()=>{ct();da();Vh={willReadFrequently:!0},ye=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=Ur(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 T=L._measureText(h[y],e.letterSpacing,c);u[y]=T,d=Math.max(d,T)}let f=e._stroke?.width||0,m=d+f;e.dropShadow&&(m+=e.dropShadow.distance);let g=e.lineHeight||a.fontSize,_=Math.max(g,a.fontSize+f)+(h.length-1)*(g+e.leading);return e.dropShadow&&(_+=e.dropShadow.distance),new L(t,e,m,_,h,u,g+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",Vh),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,g=L._tokenize(t);for(let _=0;_<g.length;_++){let b=g[_];if(L._isNewline(b)){if(!d){a+=L._addLine(n),f=!u,n="",o=0;continue}b=" "}if(u){let T=L.isBreakingSpace(b),v=L.isBreakingSpace(n[n.length-1]);if(T&&v)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 T=L.wordWrapSplit(b);for(let v=0;v<T.length;v++){let P=T[v],S=P,w=1;for(;T[v+w];){let I=T[v+w];if(!L.canBreakChars(S,I,b,v,e.breakWords))P+=I;else break;S=I,w++}v+=w-1;let A=L._getFromCache(P,l,c,s);A+o>m&&(a+=L._addLine(n),f=!1,n="",o=0),n+=P,o+=A}}else{n.length>0&&(a+=L._addLine(n),n="",o=0);let T=_===g.length-1;a+=L._addLine(b,!T),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",Vh)?.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",Vh)),L.__context}};ye.METRICS_STRING="|\xC9q\xC5";ye.BASELINE_SYMBOL="M";ye.BASELINE_MULTIPLIER=1.4;ye.HEIGHT_MULTIPLIER=2;ye.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();ye.experimentalLetterSpacing=!1;ye._fonts={};ye._newlines=[10,13];ye._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];ye._measurementCache={};At=ye});function Si(i,t,e,r=0){if(i.texture===M.WHITE&&!i.fill)return V.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof $e){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(B.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 g=f+m.offset*u;l.addColorStop(Math.floor(g*Qx)/Qx,V.shared.setValue(m.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,V.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(B.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return k("FillStyle not recognised",i),"red"}var Qx,jh=p(()=>{Mt();K();tt();it();pi();ta();Qx=1e5});var Ns,Jx=p(()=>{Mt();E();os();_i();qe();ux();dt();Fr();zh();Ls();da();jh();Ns=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=Ne(o),n=Ne(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 St||(t.style=new St(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Jt.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=Jt.getOptimalCanvasAndContext(n,a),{canvas:l}=c;this.renderTextToCanvas(e,r,s,c);let h=ua(l,n,a,s);if(r.trim){let u=hx(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&&(Jt.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=Ur(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 T=e.dropShadow&&y===0,v=T?Math.ceil(Math.max(1,m)+e.padding*2):0,P=v*r;if(T){n.fillStyle="black",n.strokeStyle="black";let A=e.dropShadow,I=A.color,C=A.alpha;n.shadowColor=V.shared.setValue(I).setAlpha(C).toRgbaString();let R=A.blur*r,F=A.distance*r;n.shadowBlur=R,n.shadowOffsetX=Math.cos(A.angle)*F,n.shadowOffsetY=Math.sin(A.angle)*F+P}else{if(n.fillStyle=e._fill?Si(e._fill,n,c):null,e._stroke?.width){let A=e._stroke.width*e._stroke.alignment;n.strokeStyle=Si(e._stroke,n,c,A)}n.shadowColor="black"}let S=(h-f.fontSize)/2;h-f.fontSize<0&&(S=0);let w=e._stroke?.width??0;for(let A=0;A<l.length;A++)g=w/2,_=w/2+A*h+f.ascent+S,e.align==="right"?g+=d-u[A]:e.align==="center"&&(g+=(d-u[A])/2),e._stroke?.width&&this._drawLetterSpacing(l[A],e,s,g+e.padding,_+e.padding-v,!0),e._fill!==void 0&&this._drawLetterSpacing(l[A],e,s,g+e.padding,_+e.padding-v)}}_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 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];f=a.measureText(_).width,h+=d-f+c,d=f}}destroy(){this._activeTextures=null}};Ns.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"canvasText"}});var Xh=p(()=>{E();ax();Jx();G.add(Ns);G.add(Us)});var Wt,$h=p(()=>{dt();Tn();la();Wt=class i extends Je{constructor(t){t instanceof Ht&&(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 Ht,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(H,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){D(H,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){D(H,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Ht.defaultStrokeStyle.width||t.color!==Ht.defaultStrokeStyle.color||t.alpha!==Ht.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return D(H,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return D(H,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return D(H,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return D(H,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return D(H,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return D(H,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var t_,e_,r_=p(()=>{"use strict";t_={name:"local-uniform-msdf-bit",vertex:{header:`
369
369
  struct LocalUniforms {
370
370
  uColor:vec4<f32>,
371
371
  uTransformMatrix:mat3x3<f32>,
@@ -392,7 +392,7 @@ fn mainFragment(
392
392
  @group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
393
393
  `,main:`
394
394
  outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
395
- `}},r_={name:"local-uniform-msdf-bit",vertex:{header:`
395
+ `}},e_={name:"local-uniform-msdf-bit",vertex:{header:`
396
396
  uniform mat3 uTransformMatrix;
397
397
  uniform vec4 uColor;
398
398
  uniform float uRound;
@@ -408,7 +408,7 @@ fn mainFragment(
408
408
  uniform float uDistance;
409
409
  `,main:`
410
410
  outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
411
- `}}});var s_,o_,n_=p(()=>{"use strict";s_={name:"msdf-bit",fragment:{header:`
411
+ `}}});var i_,s_,o_=p(()=>{"use strict";i_={name:"msdf-bit",fragment:{header:`
412
412
  fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
413
413
 
414
414
  // MSDF
@@ -435,7 +435,7 @@ fn mainFragment(
435
435
  return coverage;
436
436
 
437
437
  }
438
- `}},o_={name:"msdf-bit",fragment:{header:`
438
+ `}},s_={name:"msdf-bit",fragment:{header:`
439
439
  float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
440
440
 
441
441
  // MSDF
@@ -462,16 +462,16 @@ fn mainFragment(
462
462
 
463
463
  return coverage;
464
464
  }
465
- `}}});var Kh,qh,pa,a_=p(()=>{K();Cr();or();Es();Ps();nr();Hn();xe();Nt();i_();n_();pa=class extends xt{constructor(){let t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=ae();Kh??(Kh=Ae({name:"sdf-shader",bits:[ci,hi(e),e_,s_,Me]})),qh??(qh=Ce({name:"sdf-shader",bits:[li,ui(e),r_,o_,Be]})),super({glProgram:qh,gpuProgram:Kh,resources:{localUniforms:t,batchSamplers:di(e)}})}}});var Ei,Zh=p(()=>{kt();dt();Ei=class extends ot{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 U(H,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return U(H,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return U(H,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return U(H,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return U(H,"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 ma(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 Qh=p(()=>{"use strict"});var c_,Jh,h_=p(()=>{Mt();vt();yi();ei();tt();dt();Ns();fa();$h();Ur();Zh();Qh();c_=class l_ extends Ei{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={...l_.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=A.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=Dr(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=ma(t).filter(_=>!this._currentChars.includes(_)).filter((_,y,b)=>b.indexOf(_)===y);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:s,context:o}=r.canvasAndContext,n=r.texture.source,a=this._style,c=this._currentX,l=this._currentY,h=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*h,d=0,f=!1,m=s.width/this.resolution,g=s.height/this.resolution;for(let _=0;_<e.length;_++){let y=e[_],b=At.measureText(y,a,s,!1);b.lineHeight=b.height;let v=b.width*h,T=Math.ceil((a.fontStyle==="italic"?2:1)*v),P=b.height*h,S=T+u*2,E=P+u*2;if(f=!1,y!==`
466
- `&&y!=="\r"&&y!==" "&&y!==" "&&(f=!0,d=Math.ceil(Math.max(E,d))),c+S>m&&(l+=d,d=E,c=0,l+d>g)){n.update();let I=this._nextPage();s=I.canvasAndContext.canvas,o=I.canvasAndContext.context,n=I.texture.source,l=0}let C=v/h-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[y]={id:y.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:C,kerning:{}},f){this._drawGlyph(o,b,c+u,l+u,h,a);let I=n.width*h,M=n.height*h,k=new z(c/I*n.width,l/M*n.height,S/I*n.width,E/M*n.height);this.chars[y].texture=new A({source:n,frame:k}),c+=Math.ceil(S)}}n.update(),this._currentX=c,this._currentY=l,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return U(H,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],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=Jt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new A({source:new qt({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=Dr(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=wi(s,t)),e._fill&&(t.fillStyle=wi(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=V.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];Jt.returnCanvasAndContext(e),r.destroy(!0)}this.pages=null}};c_.defaultOptions={textureSize:512,style:new St,mipmap:!0};Jh=c_});function ga(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 y=m.positions[_];o.chars.push(m.chars[_]),o.charPositions.push(y+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,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 y=e.chars[g]||e.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
465
+ `}}});var Yh,Kh,fa,n_=p(()=>{K();Ar();sr();ws();Es();or();Nn();xe();Nt();r_();o_();fa=class extends xt{constructor(){let t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=ae();Yh??(Yh=Pe({name:"sdf-shader",bits:[ai,li(e),t_,i_,Ce]})),Kh??(Kh=Ae({name:"sdf-shader",bits:[ci,hi(e),e_,s_,Me]})),super({glProgram:Kh,gpuProgram:Yh,resources:{localUniforms:t,batchSamplers:ui(e)}})}}});var wi,qh=p(()=>{kt();dt();wi=class extends ot{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(H,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return D(H,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return D(H,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return D(H,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return D(H,"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 pa(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 Zh=p(()=>{"use strict"});var a_,Qh,l_=p(()=>{Mt();vt();_i();ti();tt();dt();Ls();da();jh();Fr();qh();Zh();a_=class c_ extends wi{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={...c_.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=M.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=Ur(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=pa(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,d=0,f=!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 T=y.width*h,v=Math.ceil((a.fontStyle==="italic"?2:1)*T),P=y.height*h,S=v+u*2,w=P+u*2;if(f=!1,b!==`
466
+ `&&b!=="\r"&&b!==" "&&b!==" "&&(f=!0,d=Math.ceil(Math.max(w,d))),c+S>m&&(l+=d,d=w,c=0,l+d>g)){n.update();let I=this._nextPage();s=I.canvasAndContext.canvas,o=I.canvasAndContext.context,n=I.texture.source,l=0}let A=T/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 I=n.width*h,C=n.height*h,R=new z(c/I*n.width,l/C*n.height,S/I*n.width,w/C*n.height);this.chars[b].texture=new M({source:n,frame:R}),c+=Math.ceil(S)}}n.update(),this._currentX=c,this._currentY=l,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return D(H,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],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=Jt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new M({source:new qt({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=Ur(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=Si(s,t)),e._fill&&(t.fillStyle=Si(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=V.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];Jt.returnCanvasAndContext(e),r.destroy(!0)}this.pages=null}};a_.defaultOptions={textureSize:512,style:new St,mipmap:!0};Qh=a_});function ma(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,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[g]||e.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
467
467
  `||_){if(!a&&t.wordWrap&&o.width+c.width-d>f?(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 P=y.xAdvance+(y.kerning[n]||0)+d;o.width+=P,o.spaceWidth=P,o.spacesIndex.push(o.charPositions.length),o.chars.push(g)}}else{let T=y.kerning[n]||0,P=y.xAdvance+T+d;c.positions[c.index++]=c.width+T,c.chars.push(g),c.width+=P}n=g}return h(),t.align==="center"?$w(s):t.align==="right"?Xw(s):t.align==="justify"&&Yw(s),s}function $w(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 Xw(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 Yw(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 tu=p(()=>{"use strict"});var xa,eu,Ws,ru=p(()=>{er();dt();it();Ur();h_();tu();Qh();xa=0,eu=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(!Q.has(r)){let n=new Jh({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});xa++,xa>50&&G("BitmapText",`You have dynamically created ${xa} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{xa--,Q.remove(r)}),Q.set(r,n)}let o=Q.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return ga([...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},U(H,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof St?s:new St(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Jh({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),c=ma(e.chars);return a.ensureCharacters(c.join("")),Q.set(`${r}-bitmap`,a),a.once("destroy",()=>Q.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=Q.get(e);r&&r.destroy()}},Ws=new eu});function u_(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 zs,d_=p(()=>{er();w();Ut();Yh();a_();ru();tu();zs=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);u_(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&&(W.return(e.customShader),e.customShader=null),W.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);u_(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Ws.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=W.get(pa)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,c=ga(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 g=0;g<c.lines.length;g++){let _=c.lines[g];for(let y=0;y<_.charPositions.length;y++){let b=o[l++],v=s.chars[b];v?.texture&&r.texture(v.texture,m||"black",Math.round(_.charPositions[y]+v.xOffset),Math.round(a+v.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=W.get(Wt);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=Q.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}};zs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"bitmapText"}});var iu=p(()=>{w();d_();R.add(zs)});var Vs,f_=p(()=>{w();tt();Ut();Fs();Ph();Vs=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),W.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,Us(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(),Us(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:A.EMPTY,currentKey:"--",batchableSprite:W.get(ke),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=A.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}};Vs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"htmlText"}});function p_(){let{userAgent:i}=D.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var m_=p(()=>{ct()});var g_,x_,Pi,su=p(()=>{"use strict";g_="http://www.w3.org/2000/svg",x_="http://www.w3.org/1999/xhtml",Pi=class{constructor(){this.svgRoot=document.createElementNS(g_,"svg"),this.foreignObject=document.createElementNS(g_,"foreignObject"),this.domElement=document.createElementNS(x_,"div"),this.styleElement=document.createElementNS(x_,"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 b_(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${V.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[T_(t)]:[],...i.dropShadow?[v_(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return Kw(i.tagStyles,s),s.join(" ")}function v_(i){let t=V.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function T_(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${V.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${V.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function Kw(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)y_[o]?s.push(y_[o](r[o])):__[o]&&s.push(__[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var __,y_,S_=p(()=>{Mt();__={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"},y_={fill:i=>`color: ${V.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:T_,dropShadow:v_}});var _a,w_=p(()=>{it();Ur();Wh();S_();_a=class i extends St{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=ua(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=b_(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"&&G("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&G("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function E_(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 P_=p(()=>{"use strict"});async function A_(i){let e=await(await D.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 C_=p(()=>{ct()});async function ou(i,t){let e=await A_(t);return`@font-face {
468
+ `)o.width!==0&&h();else if(!_){let P=b.xAdvance+(b.kerning[n]||0)+d;o.width+=P,o.spaceWidth=P,o.spacesIndex.push(o.charPositions.length),o.chars.push(g)}}else{let v=b.kerning[n]||0,P=b.xAdvance+v+d;c.positions[c.index++]=c.width+v,c.chars.push(g),c.width+=P}n=g}return h(),t.align==="center"?Vw(s):t.align==="right"?jw(s):t.align==="justify"&&Xw(s),s}function Vw(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 jw(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 Xw(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 Jh=p(()=>{"use strict"});var ga,tu,Hs,eu=p(()=>{tr();dt();it();Fr();l_();Jh();Zh();ga=0,tu=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(!Q.has(r)){let n=new Qh({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});ga++,ga>50&&k("BitmapText",`You have dynamically created ${ga} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{ga--,Q.remove(r)}),Q.set(r,n)}let o=Q.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return ma([...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(H,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof St?s:new St(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Qh({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),c=pa(e.chars);return a.ensureCharacters(c.join("")),Q.set(`${r}-bitmap`,a),a.once("destroy",()=>Q.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=Q.get(e);r&&r.destroy()}},Hs=new tu});function h_(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 Ws,u_=p(()=>{tr();E();Ut();$h();n_();eu();Jh();Ws=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);h_(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&&(W.return(e.customShader),e.customShader=null),W.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);h_(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Hs.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=W.get(fa)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,c=ma(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 g=0;g<c.lines.length;g++){let _=c.lines[g];for(let b=0;b<_.charPositions.length;b++){let y=o[l++],T=s.chars[y];T?.texture&&r.texture(T.texture,m||"black",Math.round(_.charPositions[b]+T.xOffset),Math.round(a+T.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=W.get(Wt);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=Q.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}};Ws.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"bitmapText"}});var ru=p(()=>{E();u_();G.add(Ws)});var zs,d_=p(()=>{E();tt();Ut();Is();Eh();zs=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),W.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,Fs(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(),Fs(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:M.EMPTY,currentKey:"--",batchableSprite:W.get(Ge),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=M.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}};zs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"htmlText"}});function f_(){let{userAgent:i}=O.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var p_=p(()=>{ct()});var m_,g_,Ei,iu=p(()=>{"use strict";m_="http://www.w3.org/2000/svg",g_="http://www.w3.org/1999/xhtml",Ei=class{constructor(){this.svgRoot=document.createElementNS(m_,"svg"),this.foreignObject=document.createElementNS(m_,"foreignObject"),this.domElement=document.createElementNS(g_,"div"),this.styleElement=document.createElementNS(g_,"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 y_(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${V.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[v_(t)]:[],...i.dropShadow?[b_(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return $w(i.tagStyles,s),s.join(" ")}function b_(i){let t=V.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function v_(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${V.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${V.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function $w(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)__[o]?s.push(__[o](r[o])):x_[o]&&s.push(x_[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var x_,__,T_=p(()=>{Mt();x_={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"},__={fill:i=>`color: ${V.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:v_,dropShadow:b_}});var xa,S_=p(()=>{it();Fr();Hh();T_();xa=class i extends St{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=ha(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=y_(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"&&k("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&k("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function w_(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 E_=p(()=>{"use strict"});async function P_(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 A_=p(()=>{ct()});async function su(i,t){let e=await P_(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 M_=p(()=>{C_()});async function B_(i,t,e){let r=i.filter(s=>Q.has(`${s}-and-url`)).map((s,o)=>{if(!ya.has(s)){let{url:n}=Q.get(`${s}-and-url`);o===0?ya.set(s,ou({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):ya.set(s,ou({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return ya.get(s)});return(await Promise.all(r)).join(`
474
- `)}var ya,R_=p(()=>{er();M_();ya=new Map});function G_(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 k_=p(()=>{"use strict"});function I_(i,t){let e=Jt.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 F_=p(()=>{yi()});function U_(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 D_=p(()=>{"use strict"});function L_(i,t,e,r){r||(r=O_||(O_=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 O_,N_=p(()=>{su()});var Ai,H_=p(()=>{w();yi();Ze();Re();m_();it();Ut();Vh();su();w_();P_();R_();k_();F_();D_();N_();Ai=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===bt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,r).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,r){let s=W.get(Pi),o=E_(t,r),n=await B_(o,r,_a.defaultTextStyle),a=L_(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=G_(t,r,e,n,s);await U_(h,d,p_()&&o.length>0);let f=h,m;this._createCanvas&&(m=I_(h,e));let g=da(m?m.canvas:f,h.width-u,h.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(g.source),Jt.returnCanvasAndContext(m)),W.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(()=>{G("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}};Ai.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"htmlText"};Ai.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var nu=p(()=>{w();f_();H_();R.add(Ai);R.add(Vs)});var W_,Ci,ba=p(()=>{ir();$e();oi();dt();W_=class z_ extends ce{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(U(H,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...z_.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new gt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:j.VERTEX|j.COPY_DST}),c=new gt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:j.VERTEX|j.COPY_DST}),l=new gt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:j.INDEX|j.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer: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}};W_.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};Ci=W_});var Or,V_,Mi,Bi=p(()=>{"use strict";Or={name:"local-uniform-bit",vertex:{header:`
473
+ }`}var C_=p(()=>{A_()});async function M_(i,t,e){let r=i.filter(s=>Q.has(`${s}-and-url`)).map((s,o)=>{if(!_a.has(s)){let{url:n}=Q.get(`${s}-and-url`);o===0?_a.set(s,su({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):_a.set(s,su({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return _a.get(s)});return(await Promise.all(r)).join(`
474
+ `)}var _a,B_=p(()=>{tr();C_();_a=new Map});function R_(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 G_=p(()=>{"use strict"});function k_(i,t){let e=Jt.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 I_=p(()=>{_i()});function F_(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 U_=p(()=>{"use strict"});function O_(i,t,e,r){r||(r=D_||(D_=new Ei));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 D_,L_=p(()=>{iu()});var Pi,N_=p(()=>{E();_i();qe();Be();p_();it();Ut();zh();iu();S_();E_();B_();G_();I_();U_();L_();Pi=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===bt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,r).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,r){let s=W.get(Ei),o=w_(t,r),n=await M_(o,r,xa.defaultTextStyle),a=O_(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=R_(t,r,e,n,s);await F_(h,d,f_()&&o.length>0);let f=h,m;this._createCanvas&&(m=k_(h,e));let g=ua(m?m.canvas:f,h.width-u,h.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(g.source),Jt.returnCanvasAndContext(m)),W.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(()=>{k("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}};Pi.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"htmlText"};Pi.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var ou=p(()=>{E();d_();N_();G.add(Pi);G.add(zs)});var H_,Ai,ya=p(()=>{rr();je();si();dt();H_=class W_ extends ce{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(D(H,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...W_.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new gt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:X.VERTEX|X.COPY_DST}),c=new gt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:X.VERTEX|X.COPY_DST}),l=new gt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:X.INDEX|X.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}};H_.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};Ai=H_});var Dr,z_,Ci,Mi=p(()=>{"use strict";Dr={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
- `}},V_={...Or,vertex:{...Or.vertex,header:Or.vertex.header.replace("group(1)","group(2)")}},Mi={name:"local-uniform-bit",vertex:{header:`
491
+ `}},z_={...Dr,vertex:{...Dr.vertex,header:Dr.vertex.header.replace("group(1)","group(2)")}},Ci={name:"local-uniform-bit",vertex:{header:`
492
492
 
493
493
  uniform mat3 uTransformMatrix;
494
494
  uniform vec4 uColor;
@@ -501,7 +501,7 @@ fn mainFragment(
501
501
  {
502
502
  gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
503
503
  }
504
- `}}});var j_,$_,X_=p(()=>{"use strict";j_={name:"tiling-bit",vertex:{header:`
504
+ `}}});var V_,j_,X_=p(()=>{"use strict";V_={name:"tiling-bit",vertex:{header:`
505
505
  struct TilingUniforms {
506
506
  uMapCoord:mat3x3<f32>,
507
507
  uClampFrame:vec4<f32>,
@@ -544,7 +544,7 @@ fn mainFragment(
544
544
  }
545
545
 
546
546
  outColor = textureSampleBias(uTexture, uSampler, coord, bias);
547
- `}},$_={name:"tiling-bit",vertex:{header:`
547
+ `}},j_={name:"tiling-bit",vertex:{header:`
548
548
  uniform mat3 uTextureTransform;
549
549
  uniform vec4 uSizeAnchor;
550
550
 
@@ -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 au,cu,va,Y_=p(()=>{K();or();Bi();nr();xe();Nt();tt();X_();va=class extends xt{constructor(){au??(au=Ae({name:"tiling-sprite-shader",bits:[Or,j_,Me]})),cu??(cu=Ce({name:"tiling-sprite-shader",bits:[Mi,$_,Be]}));let t=new st({uMapCoord:{value:new B,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 B,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:cu,gpuProgram:au,resources:{localUniforms:new st({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:A.EMPTY.source,uSampler:A.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 Ta,K_=p(()=>{ba();Ta=class extends Ci{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 q_(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 Z_=p(()=>{"use strict"});function Q_(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 J_=p(()=>{"use strict"});function ty(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=B.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),Q_(t,2,0,a)}var ey=p(()=>{K();J_()});var Sa,js,ry=p(()=>{w();Ts();_e();Re();xi();qn();ba();Y_();K_();Z_();ey();Sa=new Ta,js=class{constructor(t){this._state=_t.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 ar);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 va),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,Ge(t.groupColorAlpha,r.uColor,0),this._state.blendMode=je(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Sa,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 Ci({indices:Sa.indices,positions:Sa.positions.slice(),uvs:Sa.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()),ty(t,r.uvs),q_(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===bt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};js.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"tilingSprite"}});var lu=p(()=>{w();ry();R.add(js)});var iy,oy,ny=p(()=>{dt();ba();iy=class sy extends Ci{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(U(H,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...sy.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,g=f*this.verticesX+d+1,_=(f+1)*this.verticesX+d,y=(f+1)*this.verticesX+d+1;o.push(m,g,_,g,y,_)}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()}};iy.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};oy=iy});var ay,ly,hy=p(()=>{ny();ay=class cy extends oy{constructor(t={}){t={...cy.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),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()}};ay.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};ly=ay});var $s,uy=p(()=>{w();Ut();qn();hy();$s=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];W.return(e.geometry),W.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=W.get(ar);return e.geometry=W.get(ly),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}};$s.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"nineSliceSprite"}});var hu=p(()=>{w();uy();R.add($s)});var Xs,dy=p(()=>{w();Xs=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}};Xs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"filter"}});function fy(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 py=p(()=>{"use strict"});var qw,Ys,my=p(()=>{w();K();ne();rr();oi();Nt();tt();Ze();Re();Xt();py();it();qw=new ce({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Ys=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?fy(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)){G("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=A.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=X.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,g=m.uOutputFrame,_=m.uInputSize,y=m.uInputPixel,b=m.uInputClamp,v=m.uGlobalFrame,T=m.uOutputTexture;if(h){let E=this._filterStackIndex;for(;E>0;){E--;let C=this._filterStack[this._filterStackIndex-1];if(!C.skip){c.x=C.bounds.minX,c.y=C.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],y[0]=e.source.pixelWidth,y[1]=e.source.pixelHeight,y[2]=1/y[0],y[3]=1/y[1],b[0]=.5*y[2],b[1]=.5*y[3],b[2]=e.frame.width*_[2]-.5*y[2],b[3]=e.frame.height*_[3]-.5*y[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=c.x*u,v[1]=c.y*u,v[2]=P.source.width*u,v[3]=P.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof A?(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 E=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(E,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:qw,shader:t,state:t._state,topology:"triangle-list"}),o.type===bt.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(B.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}};Ys.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"filter"}});var uu=p(()=>{w();dy();my();R.add(Ys);R.add(Xs)});var Zw={};var gy=p(()=>{xp();fl();Ep();Ap();En();Gn();bh();vh();Eh();Xh();iu();nu();lu();hu();uu()});var Qw={};var _y=p(()=>{fl();En();Gn();bh();vh();Eh();Xh();iu();nu();lu();hu();uu()});var by,vy,Ty=p(()=>{Br();ai();xe();_e();by=class du extends xt{constructor(t){t={...du.defaultOptions,...t},super(t),this.enabled=!0,this._state=_t.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=he.from(e)),r&&(n=le.from(r)),new du({gpuProgram:o,glProgram:n,...s})}};by.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};vy=by});async function Sy(i){if(!i)for(let t=0;t<fu.length;t++){let e=fu[t];if(e.value.test()){await e.value.load();return}}}var fu,wy=p(()=>{w();fu=[];R.handleByNamedList(x.Environment,fu)});function wa(){if(typeof Ks=="boolean")return Ks;try{Ks=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Ks=!1}return Ks}var Ks,pu=p(()=>{"use strict"});var Ct,Ri=p(()=>{"use strict";Ct=(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))(Ct||{})});var Gi,mu=p(()=>{"use strict";Gi=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 Jw,Ey,lr,qs=p(()=>{Mt();wy();me();pu();dt();Ri();mu();kt();Jw=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],Ey=class Py extends ot{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=[...Jw,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Sy(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={...Py.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 nt&&(r={container:r},e&&(U(H,"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:V.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=Ct.ALL);let{clear:r,clearColor:s,target:o}=t;V.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,V.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 Gi(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(!wa())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()}};Ey.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};lr=Ey});var Zs,My=p(()=>{w();K();Cr();Fn();or();Es();Ps();Bi();nr();xe();Nt();Zs=class{init(){let t=new st({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Ae({name:"graphics",bits:[ci,hi(ae()),V_,Me]});this.shader=new xt({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 g=d[m];if(g.topology!==f&&(f=g.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,g.topology)),s.groups[1]=g.bindGroup,!g.gpuBindGroup){let _=g.textures;g.bindGroup=si(_.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}};Zs.extension={type:[x.WebGPUPipesAdaptor],name:"graphics"}});var By,Ry,gu=p(()=>{"use strict";By={name:"texture-bit",vertex:{header:`
569
+ `}}});var nu,au,ba,$_=p(()=>{K();sr();Mi();or();xe();Nt();tt();X_();ba=class extends xt{constructor(){nu??(nu=Pe({name:"tiling-sprite-shader",bits:[Dr,V_,Ce]})),au??(au=Ae({name:"tiling-sprite-shader",bits:[Ci,j_,Me]}));let t=new st({uMapCoord:{value:new B,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 B,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:au,gpuProgram:nu,resources:{localUniforms:new st({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:M.EMPTY.source,uSampler:M.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 va,Y_=p(()=>{ya();va=class extends Ai{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 K_(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 q_=p(()=>{"use strict"});function Z_(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 Q_=p(()=>{"use strict"});function J_(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=B.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),Z_(t,2,0,a)}var ty=p(()=>{K();Q_()});var Ta,Vs,ey=p(()=>{E();vs();_e();Be();gi();Kn();ya();$_();Y_();q_();ty();Ta=new va,Vs=class{constructor(t){this._state=_t.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 nr);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 ba),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,Re(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Ve(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Ta,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 Ai({indices:Ta.indices,positions:Ta.positions.slice(),uvs:Ta.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()),J_(t,r.uvs),K_(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===bt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Vs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"tilingSprite"}});var cu=p(()=>{E();ey();G.add(Vs)});var ry,sy,oy=p(()=>{dt();ya();ry=class iy extends Ai{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(D(H,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...iy.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,g=f*this.verticesX+d+1,_=(f+1)*this.verticesX+d,b=(f+1)*this.verticesX+d+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()}};ry.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};sy=ry});var ny,cy,ly=p(()=>{oy();ny=class ay extends sy{constructor(t={}){t={...ay.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),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()}};ny.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};cy=ny});var js,hy=p(()=>{E();Ut();Kn();ly();js=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];W.return(e.geometry),W.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=W.get(nr);return e.geometry=W.get(cy),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}};js.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"nineSliceSprite"}});var lu=p(()=>{E();hy();G.add(js)});var Xs,uy=p(()=>{E();Xs=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}};Xs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"filter"}});function dy(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 fy=p(()=>{"use strict"});var Yw,$s,py=p(()=>{E();K();ne();er();si();Nt();tt();qe();Be();$t();fy();it();Yw=new ce({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),$s=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?dy(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)){k("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=M.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=Y.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,g=m.uOutputFrame,_=m.uInputSize,b=m.uInputPixel,y=m.uInputClamp,T=m.uGlobalFrame,v=m.uOutputTexture;if(h){let w=this._filterStackIndex;for(;w>0;){w--;let A=this._filterStack[this._filterStackIndex-1];if(!A.skip){c.x=A.bounds.minX,c.y=A.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 P=this.renderer.renderTarget.rootRenderTarget.colorTexture;T[0]=c.x*u,T[1]=c.y*u,T[2]=P.source.width*u,T[3]=P.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof M?(v[0]=r.frame.width,v[1]=r.frame.height):(v[0]=S.width,v[1]=S.height),v[2]=S.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(w,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:Yw,shader:t,state:t._state,topology:"triangle-list"}),o.type===bt.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(B.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}};$s.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"filter"}});var hu=p(()=>{E();uy();py();G.add($s);G.add(Xs)});var Kw={};var my=p(()=>{gp();dl();wp();Pp();wn();Rn();yh();bh();wh();Xh();ru();ou();cu();lu();hu()});var qw={};var xy=p(()=>{dl();wn();Rn();yh();bh();wh();Xh();ru();ou();cu();lu();hu()});var yy,by,vy=p(()=>{Mr();ni();xe();_e();yy=class uu extends xt{constructor(t){t={...uu.defaultOptions,...t},super(t),this.enabled=!0,this._state=_t.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=he.from(e)),r&&(n=le.from(r)),new uu({gpuProgram:o,glProgram:n,...s})}};yy.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};by=yy});async function Ty(i){if(!i)for(let t=0;t<du.length;t++){let e=du[t];if(e.value.test()){await e.value.load();return}}}var du,Sy=p(()=>{E();du=[];G.handleByNamedList(x.Environment,du)});function Sa(){if(typeof Ys=="boolean")return Ys;try{Ys=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Ys=!1}return Ys}var Ys,fu=p(()=>{"use strict"});var Ct,Bi=p(()=>{"use strict";Ct=(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))(Ct||{})});var Ri,pu=p(()=>{"use strict";Ri=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 Zw,wy,cr,Ks=p(()=>{Mt();Sy();me();fu();dt();Bi();pu();kt();Zw=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],wy=class Ey extends ot{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=[...Zw,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Ty(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={...Ey.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 nt&&(r={container:r},e&&(D(H,"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:V.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=Ct.ALL);let{clear:r,clearColor:s,target:o}=t;V.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,V.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 Ri(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()}};wy.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};cr=wy});var qs,Cy=p(()=>{E();K();Ar();In();sr();ws();Es();Mi();or();xe();Nt();qs=class{init(){let t=new st({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Pe({name:"graphics",bits:[ai,li(ae()),z_,Ce]});this.shader=new xt({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 g=d[m];if(g.topology!==f&&(f=g.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,g.topology)),s.groups[1]=g.bindGroup,!g.gpuBindGroup){let _=g.textures;g.bindGroup=ii(_.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}};qs.extension={type:[x.WebGPUPipesAdaptor],name:"graphics"}});var My,By,mu=p(()=>{"use strict";My={name:"texture-bit",vertex:{header:`
570
570
 
571
571
  struct TextureUniforms {
572
572
  uTextureMatrix:mat3x3<f32>,
@@ -582,7 +582,7 @@ fn mainFragment(
582
582
 
583
583
  `,main:`
584
584
  outColor = textureSample(uTexture, uSampler, vUV);
585
- `}},Ry={name:"texture-bit",vertex:{header:`
585
+ `}},By={name:"texture-bit",vertex:{header:`
586
586
  uniform mat3 uTextureMatrix;
587
587
  `,main:`
588
588
  uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
@@ -592,7 +592,7 @@ fn mainFragment(
592
592
 
593
593
  `,main:`
594
594
  outColor = texture(uTexture, vUV);
595
- `}}});var Qs,Gy=p(()=>{w();K();or();Bi();nr();gu();xe();tt();it();Qs=class{init(){let t=Ae({name:"mesh",bits:[Or,By,Me]});this._shader=new xt({gpuProgram:t,resources:{uTexture:A.EMPTY._source,uSampler:A.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}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){G("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}};Qs.extension={type:[x.WebGPUPipesAdaptor],name:"mesh"}});var Aa,Js,ky=p(()=>{w();_e();Fn();Aa=_t.for2d(),Js=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=si(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)}};Js.extension={type:[x.WebGPUPipesAdaptor],name:"batch"}});var to,Iy=p(()=>{w();to=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}};to.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"customRender"}});function eo(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 xu=p(()=>{"use strict"});var tE,ro,Fy=p(()=>{w();K();Ut();Fs();xu();tE=new B,ro=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&&(W.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=W.get(ke));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=tE.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}),eo(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}),eo(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};ro.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"renderGroup"}});function io(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var _u=p(()=>{"use strict"});function yu(i,t=!1){rE(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&&Oy(h,r,0)}io(a,c),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)yu(i.renderGroupChildren[s],t)}function rE(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=$r(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 Oy(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&Uy&&Dy(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&Uy&&Dy(i,eE,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)Oy(o[l],t,e);let a=i.parentRenderGroup,c=i;c.renderPipeId&&!a.structureDidChange&&a.updateRenderable(c)}}function Dy(i,t,e){if(e&qr){i.groupColor=$r(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&as&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&Er&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var eE,Uy,Ly=p(()=>{me();_u();Yc();eE=new nt,Uy=Er|qr|as});function Ny(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 Hy=p(()=>{"use strict"});var iE,so,Wy=p(()=>{w();K();Ze();Xt();_u();xu();Ly();Hy();iE=new B,so=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=iE;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}),eo(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?io(t.childrenRenderablesToUpdate.list,0):Ny(t,r),yu(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)}io(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)}};so.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"renderGroup"}});var oo,zy=p(()=>{w();Ut();Fs();oo=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];W.return(e),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=W.get(ke);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)W.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};oo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"sprite"}});var ki,bu=p(()=>{kt();ki="8.9.2"});var no,ao,vu=p(()=>{w();bu();no=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,ki)}static destroy(){}};no.extension=x.Application;ao=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,ki)}destroy(){this._renderer=null}};ao.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"initHook",priority:-10}});var Tu,Su,jy=p(()=>{w();_e();Ql();Tu=class Vy{constructor(t,e){this.state=_t.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 As)),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]=Vy.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}};Tu.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"batch"};Tu._availableBatchers=Object.create(null);Su=Tu;R.handleByMap(x.Batcher,Su._availableBatchers);R.add(As)});var $y,Xy=p(()=>{$y=`in vec2 vMaskCoord;
595
+ `}}});var Zs,Ry=p(()=>{E();K();sr();Mi();or();mu();xe();tt();it();Zs=class{init(){let t=Pe({name:"mesh",bits:[Dr,My,Ce]});this._shader=new xt({gpuProgram:t,resources:{uTexture:M.EMPTY._source,uSampler:M.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}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){k("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}};Zs.extension={type:[x.WebGPUPipesAdaptor],name:"mesh"}});var Pa,Qs,Gy=p(()=>{E();_e();In();Pa=_t.for2d(),Qs=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),Pa.blendMode="normal",s.pipeline.getPipeline(e,n,Pa);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=ii(c.textures,c.count)}Pa.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,Pa,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Qs.extension={type:[x.WebGPUPipesAdaptor],name:"batch"}});var Js,ky=p(()=>{E();Js=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}};Js.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"customRender"}});function to(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 gu=p(()=>{"use strict"});var Qw,eo,Iy=p(()=>{E();K();Ut();Is();gu();Qw=new B,eo=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&&(W.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=W.get(Ge));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=Qw.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}),to(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}),to(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};eo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"renderGroup"}});function ro(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var xu=p(()=>{"use strict"});function _u(i,t=!1){tE(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&&Dy(h,r,0)}ro(a,c),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)_u(i.renderGroupChildren[s],t)}function tE(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=jr(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 Dy(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&Fy&&Uy(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&Fy&&Uy(i,Jw,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)Dy(o[l],t,e);let a=i.parentRenderGroup,c=i;c.renderPipeId&&!a.structureDidChange&&a.updateRenderable(c)}}function Uy(i,t,e){if(e&Kr){i.groupColor=jr(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&ns&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&wr&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var Jw,Fy,Oy=p(()=>{me();xu();$c();Jw=new nt,Fy=wr|Kr|ns});function Ly(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 Ny=p(()=>{"use strict"});var eE,io,Hy=p(()=>{E();K();qe();$t();xu();gu();Oy();Ny();eE=new B,io=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=eE;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}),to(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?ro(t.childrenRenderablesToUpdate.list,0):Ly(t,r),_u(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)}ro(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)}};io.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"renderGroup"}});var so,Wy=p(()=>{E();Ut();Is();so=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];W.return(e),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=W.get(Ge);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)W.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};so.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"sprite"}});var Gi,yu=p(()=>{kt();Gi="8.9.2"});var oo,no,bu=p(()=>{E();yu();oo=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Gi)}static destroy(){}};oo.extension=x.Application;no=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Gi)}destroy(){this._renderer=null}};no.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"initHook",priority:-10}});var vu,Tu,Vy=p(()=>{E();_e();Zl();vu=class zy{constructor(t,e){this.state=_t.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 Ps)),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]=zy.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}};vu.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"batch"};vu._availableBatchers=Object.create(null);Tu=vu;G.handleByMap(x.Batcher,Tu._availableBatchers);G.add(Ps)});var jy,Xy=p(()=>{jy=`in vec2 vMaskCoord;
596
596
  in vec2 vTextureCoord;
597
597
 
598
598
  uniform sampler2D uTexture;
@@ -626,7 +626,7 @@ void main(void)
626
626
 
627
627
  finalColor = original * a;
628
628
  }
629
- `});var Yy,Ky=p(()=>{Yy=`in vec2 aPosition;
629
+ `});var $y,Yy=p(()=>{$y=`in vec2 aPosition;
630
630
 
631
631
  out vec2 vTextureCoord;
632
632
  out vec2 vMaskCoord;
@@ -663,7 +663,7 @@ void main(void)
663
663
  vTextureCoord = filterTextureCoord(aPosition);
664
664
  vMaskCoord = getFilterCoord(aPosition);
665
665
  }
666
- `});var wu,qy=p(()=>{wu=`struct GlobalFilterUniforms {
666
+ `});var Su,Ky=p(()=>{Su=`struct GlobalFilterUniforms {
667
667
  uInputSize:vec4<f32>,
668
668
  uInputPixel:vec4<f32>,
669
669
  uInputClamp:vec4<f32>,
@@ -761,9 +761,9 @@ fn mainFragment(
761
761
 
762
762
  return source * a;
763
763
  }
764
- `});var Ca,Zy=p(()=>{K();Br();ai();Nt();sl();Ty();Xy();Ky();qy();Ca=class extends vy{constructor(t){let{sprite:e,...r}=t,s=new Kr(e.texture),o=new st({uFilterMatrix:{value:new B,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=he.from({vertex:{source:wu,entryPoint:"mainVertex"},fragment:{source:wu,entryPoint:"mainFragment"}}),a=le.from({vertex:Yy,fragment:$y,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 sE,Eu,co,Qy=p(()=>{w();nn();Zy();Xt();ss();An();Ut();tt();Ze();Re();sE=new rt,Eu=class extends Ne{constructor(){super(),this.filters=[new Ca({sprite:new Lt(A.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}},co=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=W.get(Eu);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=jr(t.mask.mask,!0,sE);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===bt.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),W.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};co.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"alphaMask"}});var lo,Jy=p(()=>{w();lo=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}};lo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"colorMask"}});var ho,tb=p(()=>{w();Ri();Mr();ho=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,Ct.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}};ho.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"stencilMask"}});var Pu,rb,ib=p(()=>{Mt();w();Pu=class eb{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new V(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...eb.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(){}};Pu.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"background",priority:0};Pu.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};rb=Pu});var uo,fo,sb=p(()=>{w();nn();it();uo={};R.handle(x.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");uo[i.name]=i.ref},i=>{delete uo[i.name]});fo=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=!!uo[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!uo[e]){G(`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 Ne,r.filters=[new uo[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}};fo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"blendMode"}});var Au,Cu,nb,ab=p(()=>{w();me();tt();Au={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Cu=class ob{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof nt||t instanceof A?{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,ob.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)},Au[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(Au[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Au[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 A)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 A?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof nt&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof A?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}};Cu.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"extract"};Cu.defaultImageOptions={format:"png",quality:1};nb=Cu});var Ma,cb=p(()=>{Yt();tt();Ma=class i extends A{static create(t){return new i({source:new J(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var oE,nE,aE,po,lb=p(()=>{Mt();w();K();vt();Xt();un();me();cb();oE=new z,nE=new rt,aE=[0,0,0,0],po=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof nt&&(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:V.shared.setValue(o).toArray():o=aE;let n=t.frame?.copyTo(oE)||Xr(s,nE).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=Ma.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),c=B.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}};po.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGenerator"}});var mo,hb=p(()=>{w();K();ne();xi();rr();Re();Nt();mo=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 B,worldColor:4294967295,offset:new X},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,Ge(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===bt.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 B,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new B,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};mo.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"globalUniforms"}});var cE,go,ub=p(()=>{w();hs();cE=1,go=class{constructor(){this._tasks=[],this._offset=0}init(){Kt.system.add(this._update,this)}repeat(t,e,r=!0){let s=cE++,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(){Kt.system.remove(this._update,this),this._tasks.length=0}};go.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"scheduler",priority:0}});function fb(i){if(!db){if(D.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${ki} (${i}) http://www.pixijs.com/
764
+ `});var Aa,qy=p(()=>{K();Mr();ni();Nt();il();vy();Xy();Yy();Ky();Aa=class extends by{constructor(t){let{sprite:e,...r}=t,s=new Yr(e.texture),o=new st({uFilterMatrix:{value:new B,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=he.from({vertex:{source:Su,entryPoint:"mainVertex"},fragment:{source:Su,entryPoint:"mainFragment"}}),a=le.from({vertex:$y,fragment:jy,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 rE,wu,ao,Zy=p(()=>{E();on();qy();$t();is();Pn();Ut();tt();qe();Be();rE=new rt,wu=class extends Le{constructor(){super(),this.filters=[new Aa({sprite:new Lt(M.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}},ao=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=W.get(wu);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=Vr(t.mask.mask,!0,rE);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===bt.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),W.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};ao.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"alphaMask"}});var co,Qy=p(()=>{E();co=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}};co.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"colorMask"}});var lo,Jy=p(()=>{E();Bi();Cr();lo=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,Ct.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}};lo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"stencilMask"}});var Eu,eb,rb=p(()=>{Mt();E();Eu=class tb{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new V(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...tb.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(){}};Eu.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"background",priority:0};Eu.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};eb=Eu});var ho,uo,ib=p(()=>{E();on();it();ho={};G.handle(x.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");ho[i.name]=i.ref},i=>{delete ho[i.name]});uo=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=!!ho[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!ho[e]){k(`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 Le,r.filters=[new ho[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}};uo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"blendMode"}});var Pu,Au,ob,nb=p(()=>{E();me();tt();Pu={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Au=class sb{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof nt||t instanceof M?{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,sb.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)},Pu[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(Pu[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Pu[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 M)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 M?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof nt&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof M?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}};Au.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"extract"};Au.defaultImageOptions={format:"png",quality:1};ob=Au});var Ca,ab=p(()=>{Yt();tt();Ca=class i extends M{static create(t){return new i({source:new J(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var iE,sE,oE,fo,cb=p(()=>{Mt();E();K();vt();$t();hn();me();ab();iE=new z,sE=new rt,oE=[0,0,0,0],fo=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof nt&&(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:V.shared.setValue(o).toArray():o=oE;let n=t.frame?.copyTo(iE)||Xr(s,sE).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=Ca.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),c=B.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}};fo.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGenerator"}});var po,lb=p(()=>{E();K();ne();gi();er();Be();Nt();po=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 B,worldColor:4294967295,offset:new Y},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,Re(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===bt.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 B,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new B,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};po.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"globalUniforms"}});var nE,mo,hb=p(()=>{E();ls();nE=1,mo=class{constructor(){this._tasks=[],this._offset=0}init(){Kt.system.add(this._update,this)}repeat(t,e,r=!0){let s=nE++,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(){Kt.system.remove(this._update,this),this._tasks.length=0}};mo.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"scheduler",priority:0}});function db(i){if(!ub){if(O.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Gi} (${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 ${ki} - ${i} - http://www.pixijs.com/`);db=!0}}var db,pb=p(()=>{ct();bu();db=!1});var Ii,mb=p(()=>{w();pb();Re();Ii=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===bt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),fb(e)}}};Ii.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"hello",priority:-2};Ii.defaultOptions={hello:!1}});function gb(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 xb(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 _b=p(()=>{"use strict"});var lE,Mu,bb,vb=p(()=>{w();_b();lE=0,Mu=class yb{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...yb.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]=gb(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)xb(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=lE++,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)}};Mu.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"renderableGC",priority:0};Mu.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};bb=Mu});var Bu,Sb,wb=p(()=>{w();Bu=class Tb{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...Tb.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}};Bu.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGC"};Bu.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};Sb=Bu});var Eb,xo,Ru=p(()=>{Rt();Yt();tt();Eb=class Pb{constructor(t={}){if(this.uid=$("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...Pb.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 J({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 A||t.depthStencilTexture instanceof J?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 J({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)}};Eb.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};xo=Eb});function Ba(i,t){if(!_o.has(i)){let e=new A({source:new It({resource:i,...t})}),r=()=>{_o.get(i)===e&&_o.delete(i)};e.once("destroy",r),e.source.once("destroy",r),_o.set(i,e)}return _o.get(i)}var _o,Gu=p(()=>{ti();tt();_o=new Map});var ku,Cb,Mb=p(()=>{ct();w();vt();dt();Ru();Gu();ku=class Ab{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={...Ab.defaultOptions,...t},t.view&&(U(H,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new z(0,0,t.width,t.height),this.canvas=t.canvas||D.get().createCanvas(),this.antialias=!!t.antialias,this.texture=Ba(this.canvas,t),this.renderTarget=new xo({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)}};ku.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"view",priority:0};ku.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};Cb=ku});var Ra,Ga,Iu=p(()=>{Iy();Fy();Wy();zy();vu();jy();Qy();Jy();tb();ib();sb();ab();lb();hb();ub();mb();vb();wb();Mb();Ra=[rb,mo,Ii,Cb,so,Sb,po,nb,ao,bb,go],Ga=[fo,Su,oo,ro,co,ho,lo,to]});var yo,Bb=p(()=>{w();yo=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}};yo.extension={type:[x.WebGPUSystem],name:"bindGroup"}});var bo,Rb=p(()=>{w();Fl();bo=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&&(vs(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}};bo.extension={type:[x.WebGPUSystem],name:"buffer"}});var vo,Gb=p(()=>{w();vo=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}};vo.extension={type:[x.WebGPUSystem],name:"colorMask"}});var Fi,kb=p(()=>{ct();w();Fi=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 D.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}};Fi.extension={type:[x.WebGPUSystem],name:"device"};Fi.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var To,Ib=p(()=>{w();To=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}};To.extension={type:[x.WebGPUSystem],name:"encoder",priority:1}});var So,Fb=p(()=>{w();Mr();So=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}};So.extension={type:[x.WebGPUSystem],name:"stencil"}});var Ui,Fu=p(()=>{pu();ir();$e();Ui=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!wa())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 gt({data:new Float32Array(e.layout.size/4),usage:j.UNIFORM|j.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 gt({data:new Float32Array(s.layout.size/4),usage:j.UNIFORM|j.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 Ub(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=wo[s.data.type].size,n=wo[s.data.type].align;if(!wo[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 wo,Uu=p(()=>{"use strict";wo={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 qe,Du=p(()=>{"use strict";qe=[{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 ${Gi} - ${i} - http://www.pixijs.com/`);ub=!0}}var ub,fb=p(()=>{ct();yu();ub=!1});var ki,pb=p(()=>{E();fb();Be();ki=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===bt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),db(e)}}};ki.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"hello",priority:-2};ki.defaultOptions={hello:!1}});function mb(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 gb(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 xb=p(()=>{"use strict"});var aE,Cu,yb,bb=p(()=>{E();xb();aE=0,Cu=class _b{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={..._b.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]=mb(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)gb(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=aE++,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)}};Cu.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"renderableGC",priority:0};Cu.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};yb=Cu});var Mu,Tb,Sb=p(()=>{E();Mu=class vb{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...vb.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}};Mu.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGC"};Mu.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};Tb=Mu});var wb,go,Bu=p(()=>{Rt();Yt();tt();wb=class Eb{constructor(t={}){if(this.uid=$("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...Eb.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 J({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 M||t.depthStencilTexture instanceof J?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 J({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)}};wb.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};go=wb});function Ma(i,t){if(!xo.has(i)){let e=new M({source:new It({resource:i,...t})}),r=()=>{xo.get(i)===e&&xo.delete(i)};e.once("destroy",r),e.source.once("destroy",r),xo.set(i,e)}return xo.get(i)}var xo,Ru=p(()=>{Jr();tt();xo=new Map});var Gu,Ab,Cb=p(()=>{ct();E();vt();dt();Bu();Ru();Gu=class Pb{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={...Pb.defaultOptions,...t},t.view&&(D(H,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new z(0,0,t.width,t.height),this.canvas=t.canvas||O.get().createCanvas(),this.antialias=!!t.antialias,this.texture=Ma(this.canvas,t),this.renderTarget=new go({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)}};Gu.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"view",priority:0};Gu.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};Ab=Gu});var Ba,Ra,ku=p(()=>{ky();Iy();Hy();Wy();bu();Vy();Zy();Qy();Jy();rb();ib();nb();cb();lb();hb();pb();bb();Sb();Cb();Ba=[eb,po,ki,Ab,io,Tb,fo,ob,no,yb,mo],Ra=[uo,Tu,so,eo,ao,lo,co,Js]});var _o,Mb=p(()=>{E();_o=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}};_o.extension={type:[x.WebGPUSystem],name:"bindGroup"}});var yo,Bb=p(()=>{E();Il();yo=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&&(bs(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}};yo.extension={type:[x.WebGPUSystem],name:"buffer"}});var bo,Rb=p(()=>{E();bo=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}};bo.extension={type:[x.WebGPUSystem],name:"colorMask"}});var Ii,Gb=p(()=>{ct();E();Ii=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}};Ii.extension={type:[x.WebGPUSystem],name:"device"};Ii.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var vo,kb=p(()=>{E();vo=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}};vo.extension={type:[x.WebGPUSystem],name:"encoder",priority:1}});var To,Ib=p(()=>{E();Cr();To=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}};To.extension={type:[x.WebGPUSystem],name:"stencil"}});var Fi,Iu=p(()=>{fu();rr();je();Fi=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 gt({data:new Float32Array(e.layout.size/4),usage:X.UNIFORM|X.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 gt({data:new Float32Array(s.layout.size/4),usage:X.UNIFORM|X.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 Fb(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=So[s.data.type].size,n=So[s.data.type].align;if(!So[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 So,Fu=p(()=>{"use strict";So={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 Ke,Uu=p(()=>{"use strict";Ke=[{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];
@@ -834,23 +834,23 @@ fn mainFragment(
834
834
  cv[2] = v.blue;
835
835
  gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
836
836
  }
837
- `}]});function ka(i,t,e,r){let s=[`
837
+ `}]});function Ga(i,t,e,r){let s=[`
838
838
  var v = null;
839
839
  var v2 = null;
840
840
  var t = 0;
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<qe.length;d++)if(qe[d].test(c.data)){u=c.offset/4,s.push(`name = "${l}";`,`offset += ${u-o};`,qe[d][t]||qe[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 d=0;d<Ke.length;d++)if(Ke[d].test(c.data)){u=c.offset/4,s.push(`name = "${l}";`,`offset += ${u-o};`,Ke[d][t]||Ke[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(`
845
845
  v = uv.${l};
846
846
  offset += ${u-o};
847
847
  ${d};
848
848
  `)}o=u}let n=s.join(`
849
- `);return new Function("uv","data","dataInt32","offset",n)}var Ou=p(()=>{Du()});function Di(i,t){return`
849
+ `);return new Function("uv","data","dataInt32","offset",n)}var Du=p(()=>{Uu()});function Ui(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
  }
853
- `}var Lu,Db,Nu=p(()=>{"use strict";Lu={f32:`
853
+ `}var Ou,Ub,Lu=p(()=>{"use strict";Ou={f32:`
854
854
  data[offset] = v;`,i32:`
855
855
  dataInt32[offset] = v;`,"vec2<f32>":`
856
856
  data[offset] = v[0];
@@ -886,12 +886,12 @@ 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>":Di(3,2),"mat4x2<f32>":Di(4,2),"mat2x3<f32>":Di(2,3),"mat4x3<f32>":Di(4,3),"mat2x4<f32>":Di(2,4),"mat3x4<f32>":Di(3,4)},Db={...Lu,"mat2x2<f32>":`
889
+ }`,"mat3x2<f32>":Ui(3,2),"mat4x2<f32>":Ui(4,2),"mat2x3<f32>":Ui(2,3),"mat4x3<f32>":Ui(4,3),"mat2x4<f32>":Ui(2,4),"mat3x4<f32>":Ui(3,4)},Ub={...Ou,"mat2x2<f32>":`
890
890
  data[offset] = v[0];
891
891
  data[offset + 1] = v[1];
892
892
  data[offset + 2] = v[2];
893
893
  data[offset + 3] = v[3];
894
- `}});function Ob(i,t){let{size:e,align:r}=wo[i.data.type],s=(r-e)/4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
894
+ `}});function Db(i,t){let{size:e,align:r}=So[i.data.type],s=(r-e)/4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
895
895
  v = uv.${i.data.name};
896
896
  ${t!==0?`offset += ${t};`:""}
897
897
 
@@ -907,7 +907,7 @@ fn mainFragment(
907
907
  }
908
908
  ${s!==0?`arrayOffset += ${s};`:""}
909
909
  }
910
- `}var Lb=p(()=>{Uu()});function Nb(i){return ka(i,"uboWgsl",Ob,Db)}var Hb=p(()=>{Ou();Nu();Lb()});var Eo,Wb=p(()=>{w();Fu();Uu();Hb();Eo=class extends Ui{constructor(){super({createUboElements:Ub,generateUboSync:Nb})}};Eo.extension={type:[x.WebGPUSystem],name:"ubo"}});var hr,Ia=p(()=>{kt();Rt();hr=class extends ot{constructor({buffer:t,offset:e,size:r}){super(),this.uid=$("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=$("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=$("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var Fa,zb=p(()=>{"use strict";Fa=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 ur,Po,Vb=p(()=>{w();ir();Ia();$e();zb();rr();ur=128,Po=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 Fa({minUniformOffsetAlignment:ur});let e=256/ur;for(let r=0;r<e;r++){let s=j.UNIFORM|j.COPY_DST;r===0&&(s|=j.COPY_SRC),this._buffers.push(new gt({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/ur),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/ur)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/ur)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/ur;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new hr({buffer:e,offset:(t/2|0)*256,size:ur})}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),ur,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}};Po.extension={type:[x.WebGPUPipes],name:"uniformBatch"}});function Ua(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)):G(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}hE(i)}function hE(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]+=Zt(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]+=Zt(n.format).stride}}var Hu=p(()=>{it();Rr()});var Fe,Wu=p(()=>{Mr();Fe=[];Fe[lt.NONE]=void 0;Fe[lt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Fe[lt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Fe[lt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Fe[lt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Fe[lt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function dE(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function fE(i,t,e,r){return e<<6|i<<3|r<<1|t}var uE,Ao,jb=p(()=>{w();it();Hu();Mr();ws();Wu();uE={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Ao=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=Fe[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||(Ua(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=dE(t._layoutKey,e._layoutKey,r.data,r._blendModeId,uE[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=Xe(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=Xe(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&&G(`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=fE(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}};Ao.extension={type:[x.WebGPUSystem],name:"pipeline"}});function $b(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 Xb=p(()=>{"use strict"});function Yb(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var Kb=p(()=>{"use strict"});var Oi,zu=p(()=>{K();vt();Ri();Xb();mu();ti();Yt();tt();Gu();Kb();Ru();Oi=class{constructor(t){this.rootViewPort=new z,this.viewport=new z,this.onRenderTargetChange=new Gi("onRenderTargetChange"),this.projectionMatrix=new B,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=Yb(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 A&&(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 $b(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=Ct.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=Ct.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=Ba(t).source),t instanceof xo?e=t:t instanceof J&&(e=new xo({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 Da,qb=p(()=>{"use strict";Da=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var Oa,Zb=p(()=>{Ri();ti();Yt();qb();Oa=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?Ct.ALL:Ct.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&Ct.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&Ct.STENCIL?"clear":"load",h=e&Ct.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 Da;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 J({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 Co,Qb=p(()=>{w();zu();Zb();Co=class extends Oi{constructor(t){super(t),this.adaptor=new Oa,this.adaptor.init(t,this)}};Co.extension={type:[x.WebGPUSystem],name:"renderTarget"}});var Mo,Jb=p(()=>{w();Mo=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}};Mo.extension={type:[x.WebGPUSystem],name:"shader"}});var zt,tv=p(()=>{"use strict";zt={};zt.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};zt.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};zt.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};zt.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};zt.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};zt.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};zt["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};zt["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};zt["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};zt.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};zt.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};zt.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Bo,ev=p(()=>{w();_e();tv();Bo=class{constructor(){this.defaultState=new _t,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:zt[t.blendMode]||zt.normal}]}destroy(){this.gpu=null}};Bo.extension={type:[x.WebGPUSystem],name:"state"}});var rv,iv=p(()=>{"use strict";rv={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 Vu,pE,sv,ov=p(()=>{"use strict";Vu={"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}},pE={blockBytes:4,blockWidth:1,blockHeight:1},sv={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=Vu[i.format]||pE;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 La,ju=p(()=>{"use strict";La={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 nv,av=p(()=>{ju();nv={type:"video",upload(i,t,e){La.upload(i,t,e)}}});var Na,cv=p(()=>{"use strict";Na=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 Ob=p(()=>{Fu()});function Lb(i){return Ga(i,"uboWgsl",Db,Ub)}var Nb=p(()=>{Du();Lu();Ob()});var wo,Hb=p(()=>{E();Iu();Fu();Nb();wo=class extends Fi{constructor(){super({createUboElements:Fb,generateUboSync:Lb})}};wo.extension={type:[x.WebGPUSystem],name:"ubo"}});var lr,ka=p(()=>{kt();Rt();lr=class extends ot{constructor({buffer:t,offset:e,size:r}){super(),this.uid=$("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=$("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=$("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var Ia,Wb=p(()=>{"use strict";Ia=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 hr,Eo,zb=p(()=>{E();rr();ka();je();Wb();er();hr=128,Eo=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 Ia({minUniformOffsetAlignment:hr});let e=256/hr;for(let r=0;r<e;r++){let s=X.UNIFORM|X.COPY_DST;r===0&&(s|=X.COPY_SRC),this._buffers.push(new gt({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/hr),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/hr)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/hr)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/hr;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new lr({buffer:e,offset:(t/2|0)*256,size:hr})}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),hr,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}};Eo.extension={type:[x.WebGPUPipes],name:"uniformBatch"}});function Fa(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)):k(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}cE(i)}function cE(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]+=Zt(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]+=Zt(n.format).stride}}var Nu=p(()=>{it();Br()});var Ie,Hu=p(()=>{Cr();Ie=[];Ie[lt.NONE]=void 0;Ie[lt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Ie[lt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Ie[lt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Ie[lt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Ie[lt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function hE(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function uE(i,t,e,r){return e<<6|i<<3|r<<1|t}var lE,Po,Vb=p(()=>{E();it();Nu();Cr();Ss();Hu();lE={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Po=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=Ie[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||(Fa(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=hE(t._layoutKey,e._layoutKey,r.data,r._blendModeId,lE[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=Xe(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=Xe(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&&k(`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=uE(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}};Po.extension={type:[x.WebGPUSystem],name:"pipeline"}});function jb(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 Xb=p(()=>{"use strict"});function $b(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var Yb=p(()=>{"use strict"});var Di,Wu=p(()=>{K();vt();Bi();Xb();pu();Jr();Yt();tt();Ru();Yb();Bu();Di=class{constructor(t){this.rootViewPort=new z,this.viewport=new z,this.onRenderTargetChange=new Ri("onRenderTargetChange"),this.projectionMatrix=new B,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=$b(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 M&&(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 jb(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=Ct.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=Ct.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=Ma(t).source),t instanceof go?e=t:t instanceof J&&(e=new go({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 Ua,Kb=p(()=>{"use strict";Ua=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var Da,qb=p(()=>{Bi();Jr();Yt();Kb();Da=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?Ct.ALL:Ct.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&Ct.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&Ct.STENCIL?"clear":"load",h=e&Ct.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 Ua;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 J({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 Ao,Zb=p(()=>{E();Wu();qb();Ao=class extends Di{constructor(t){super(t),this.adaptor=new Da,this.adaptor.init(t,this)}};Ao.extension={type:[x.WebGPUSystem],name:"renderTarget"}});var Co,Qb=p(()=>{E();Co=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}};Co.extension={type:[x.WebGPUSystem],name:"shader"}});var zt,Jb=p(()=>{"use strict";zt={};zt.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};zt.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};zt.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};zt.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};zt.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};zt.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};zt["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};zt["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};zt["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};zt.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};zt.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};zt.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Mo,tv=p(()=>{E();_e();Jb();Mo=class{constructor(){this.defaultState=new _t,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:zt[t.blendMode]||zt.normal}]}destroy(){this.gpu=null}};Mo.extension={type:[x.WebGPUSystem],name:"state"}});var ev,rv=p(()=>{"use strict";ev={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 zu,dE,iv,sv=p(()=>{"use strict";zu={"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}},dE={blockBytes:4,blockWidth:1,blockHeight:1},iv={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=zu[i.format]||dE;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 Oa,Vu=p(()=>{"use strict";Oa={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 ov,nv=p(()=>{Vu();ov={type:"video",upload(i,t,e){Oa.upload(i,t,e)}}});var La,av=p(()=>{"use strict";La=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 Ro,lv=p(()=>{ct();w();Nt();yi();rr();iv();ov();ju();av();cv();Ro=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:La,buffer:rv,video:nv,compressed:sv},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=Vu[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 Na(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=D.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:D.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=Jt.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 Jt.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}};Ro.extension={type:[x.WebGPUSystem],name:"texture"}});var fv={};Dd(fv,{WebGPURenderer:()=>$u});var mE,gE,xE,hv,uv,dv,$u,pv=p(()=>{w();My();Gy();ky();qs();Iu();Re();Bb();Rb();Gb();kb();Ib();Fb();Wb();Vb();jb();Qb();Jb();ev();lv();mE=[...Ra,Eo,To,Fi,bo,Ro,Co,Mo,Bo,Ao,vo,So,yo],gE=[...Ga,Po],xE=[Js,Qs,Zs],hv=[],uv=[],dv=[];R.handleByNamedList(x.WebGPUSystem,hv);R.handleByNamedList(x.WebGPUPipes,uv);R.handleByNamedList(x.WebGPUPipesAdaptor,dv);R.add(...mE,...gE,...xE);$u=class extends lr{constructor(){let t={name:"webgpu",type:bt.WEBGPU,systems:hv,renderPipes:uv,renderPipeAdaptors:dv};super(t)}}});var Go,mv=p(()=>{w();K();Cr();or();Es();Ps();Bi();nr();Hn();xe();Nt();Go=class{init(){let t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=ae(),r=Ce({name:"graphics",bits:[li,ui(e),Mi,Be]});this.shader=new xt({glProgram:r,resources:{localUniforms:t,batchSamplers:di(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}};Go.extension={type:[x.WebGLPipesAdaptor],name:"graphics"}});var ko,gv=p(()=>{w();K();or();Bi();nr();gu();xe();tt();it();ko=class{init(){let t=Ce({name:"mesh",bits:[Mi,Ry,Be]});this._shader=new xt({glProgram:t,resources:{uTexture:A.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){G("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}};ko.extension={type:[x.WebGLPipesAdaptor],name:"mesh"}});var Io,xv=p(()=>{w();_e();Io=class{constructor(){this._tempState=_t.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)}};Io.extension={type:[x.WebGLPipesAdaptor],name:"batch"}});var Fo,_v=p(()=>{"use strict";Fo=(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))(Fo||{})});var Ha,yv=p(()=>{"use strict";Ha=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var Uo,bv=p(()=>{w();$e();_v();yv();Uo=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&j.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=Fo.ARRAY_BUFFER;t.descriptor.usage&j.INDEX?r=Fo.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&j.UNIFORM&&(r=Fo.UNIFORM_BUFFER);let s=new Ha(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};Uo.extension={type:[x.WebGLSystem],name:"buffer"}});var Xu,Tv,Sv=p(()=>{ct();w();it();Xu=class vv{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={...vv.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(G("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=D.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&&G("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 D.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&&G("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||G("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};Xu.extension={type:[x.WebGLSystem],name:"context"};Xu.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};Tv=Xu});var Wa,Yu,Z,Ku=p(()=>{"use strict";Wa=(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))(Wa||{}),Yu=(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))(Yu||{}),Z=(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))(Z||{})});function Ev(i){return wv[i]??wv.float32}var wv,Pv=p(()=>{Ku();wv={uint8x2:Z.UNSIGNED_BYTE,uint8x4:Z.UNSIGNED_BYTE,sint8x2:Z.BYTE,sint8x4:Z.BYTE,unorm8x2:Z.UNSIGNED_BYTE,unorm8x4:Z.UNSIGNED_BYTE,snorm8x2:Z.BYTE,snorm8x4:Z.BYTE,uint16x2:Z.UNSIGNED_SHORT,uint16x4:Z.UNSIGNED_SHORT,sint16x2:Z.SHORT,sint16x4:Z.SHORT,unorm16x2:Z.UNSIGNED_SHORT,unorm16x4:Z.UNSIGNED_SHORT,snorm16x2:Z.SHORT,snorm16x4:Z.SHORT,float16x2:Z.HALF_FLOAT,float16x4:Z.HALF_FLOAT,float32:Z.FLOAT,float32x2:Z.FLOAT,float32x3:Z.FLOAT,float32x4:Z.FLOAT,uint32:Z.UNSIGNED_INT,uint32x2:Z.UNSIGNED_INT,uint32x3:Z.UNSIGNED_INT,uint32x4:Z.UNSIGNED_INT,sint32:Z.INT,sint32x2:Z.INT,sint32x3:Z.INT,sint32x4:Z.INT}});var _E,Do,Av=p(()=>{w();Rr();Hu();Pv();_E={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},Do=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;Ua(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=Zt(c.format),m=Ev(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 g=c.divisor??1;r.vertexAttribDivisor(d,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=_E[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}};Do.extension={type:[x.WebGLSystem],name:"geometry"}});var yE,qu,Mv,Bv=p(()=>{w();it();oi();xe();_e();Yt();tt();Br();yE=new ce({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),qu=class Cv{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...Cv.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(G("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=_t.for2d();let s=new le({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 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 Bo,cv=p(()=>{ct();E();Nt();_i();er();rv();sv();Vu();nv();av();Bo=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:Oa,buffer:ev,video:ov,compressed:iv},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=zu[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 La(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=Jt.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 Jt.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}};Bo.extension={type:[x.WebGPUSystem],name:"texture"}});var dv={};Ud(dv,{WebGPURenderer:()=>ju});var fE,pE,mE,lv,hv,uv,ju,fv=p(()=>{E();Cy();Ry();Gy();Ks();ku();Be();Mb();Bb();Rb();Gb();kb();Ib();Hb();zb();Vb();Zb();Qb();tv();cv();fE=[...Ba,wo,vo,Ii,yo,Bo,Ao,Co,Mo,Po,bo,To,_o],pE=[...Ra,Eo],mE=[Qs,Zs,qs],lv=[],hv=[],uv=[];G.handleByNamedList(x.WebGPUSystem,lv);G.handleByNamedList(x.WebGPUPipes,hv);G.handleByNamedList(x.WebGPUPipesAdaptor,uv);G.add(...fE,...pE,...mE);ju=class extends cr{constructor(){let t={name:"webgpu",type:bt.WEBGPU,systems:lv,renderPipes:hv,renderPipeAdaptors:uv};super(t)}}});var Ro,pv=p(()=>{E();K();Ar();sr();ws();Es();Mi();or();Nn();xe();Nt();Ro=class{init(){let t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=ae(),r=Ae({name:"graphics",bits:[ci,hi(e),Ci,Me]});this.shader=new xt({glProgram:r,resources:{localUniforms:t,batchSamplers:ui(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}};Ro.extension={type:[x.WebGLPipesAdaptor],name:"graphics"}});var Go,mv=p(()=>{E();K();sr();Mi();or();mu();xe();tt();it();Go=class{init(){let t=Ae({name:"mesh",bits:[Ci,By,Me]});this._shader=new xt({glProgram:t,resources:{uTexture:M.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){k("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 ko,gv=p(()=>{E();_e();ko=class{constructor(){this._tempState=_t.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)}};ko.extension={type:[x.WebGLPipesAdaptor],name:"batch"}});var Io,xv=p(()=>{"use strict";Io=(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))(Io||{})});var Na,_v=p(()=>{"use strict";Na=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var Fo,yv=p(()=>{E();je();xv();_v();Fo=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&X.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=Io.ARRAY_BUFFER;t.descriptor.usage&X.INDEX?r=Io.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&X.UNIFORM&&(r=Io.UNIFORM_BUFFER);let s=new Na(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};Fo.extension={type:[x.WebGLSystem],name:"buffer"}});var Xu,vv,Tv=p(()=>{ct();E();it();Xu=class bv{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={...bv.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(k("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&&k("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&&k("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||k("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};Xu.extension={type:[x.WebGLSystem],name:"context"};Xu.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};vv=Xu});var Ha,$u,Z,Yu=p(()=>{"use strict";Ha=(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))(Ha||{}),$u=(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))($u||{}),Z=(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))(Z||{})});function wv(i){return Sv[i]??Sv.float32}var Sv,Ev=p(()=>{Yu();Sv={uint8x2:Z.UNSIGNED_BYTE,uint8x4:Z.UNSIGNED_BYTE,sint8x2:Z.BYTE,sint8x4:Z.BYTE,unorm8x2:Z.UNSIGNED_BYTE,unorm8x4:Z.UNSIGNED_BYTE,snorm8x2:Z.BYTE,snorm8x4:Z.BYTE,uint16x2:Z.UNSIGNED_SHORT,uint16x4:Z.UNSIGNED_SHORT,sint16x2:Z.SHORT,sint16x4:Z.SHORT,unorm16x2:Z.UNSIGNED_SHORT,unorm16x4:Z.UNSIGNED_SHORT,snorm16x2:Z.SHORT,snorm16x4:Z.SHORT,float16x2:Z.HALF_FLOAT,float16x4:Z.HALF_FLOAT,float32:Z.FLOAT,float32x2:Z.FLOAT,float32x3:Z.FLOAT,float32x4:Z.FLOAT,uint32:Z.UNSIGNED_INT,uint32x2:Z.UNSIGNED_INT,uint32x3:Z.UNSIGNED_INT,uint32x4:Z.UNSIGNED_INT,sint32:Z.INT,sint32x2:Z.INT,sint32x3:Z.INT,sint32x4:Z.INT}});var gE,Uo,Pv=p(()=>{E();Br();Nu();Ev();gE={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},Uo=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;Fa(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=Zt(c.format),m=wv(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 g=c.divisor??1;r.vertexAttribDivisor(d,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=gE[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}};Uo.extension={type:[x.WebGLSystem],name:"geometry"}});var xE,Ku,Cv,Mv=p(()=>{E();it();si();xe();_e();Yt();tt();Mr();xE=new ce({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Ku=class Av{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...Av.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(k("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=_t.for2d();let s=new le({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 xt({glProgram:s,resources:{uTexture:A.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:yE,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new A({source:new J({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)}};qu.extension={type:[x.WebGLSystem],name:"backBuffer",priority:1};qu.defaultOptions={useBackBuffer:!1};Mv=qu});var Oo,Rv=p(()=>{w();Oo=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)))}};Oo.extension={type:[x.WebGLSystem],name:"colorMask"}});var Lo,Gv=p(()=>{w();Lo=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}};Lo.extension={type:[x.WebGLSystem],name:"encoder"}});var No,kv=p(()=>{w();Wu();Mr();No=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=Fe[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]))}};No.extension={type:[x.WebGLSystem],name:"stencil"}});function Iv(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=Zu[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 Zu,Qu=p(()=>{"use strict";Zu={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 Fv(i,t){let e=Math.max(Zu[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 xt({glProgram:s,resources:{uTexture:M.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:xE,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new M({source:new J({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)}};Ku.extension={type:[x.WebGLSystem],name:"backBuffer",priority:1};Ku.defaultOptions={useBackBuffer:!1};Cv=Ku});var Do,Bv=p(()=>{E();Do=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)))}};Do.extension={type:[x.WebGLSystem],name:"colorMask"}});var Oo,Rv=p(()=>{E();Oo=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}};Oo.extension={type:[x.WebGLSystem],name:"encoder"}});var Lo,Gv=p(()=>{E();Hu();Cr();Lo=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=Ie[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]))}};Lo.extension={type:[x.WebGLSystem],name:"stencil"}});function kv(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=qu[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 qu,Zu=p(()=>{"use strict";qu={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 Iv(i,t){let e=Math.max(qu[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 Uv=p(()=>{Qu()});function Dv(i){return ka(i,"uboStd40",Fv,Lu)}var Ov=p(()=>{Ou();Nu();Uv()});var Ho,Lv=p(()=>{w();Fu();Qu();Ov();Ho=class extends Ui{constructor(){super({createUboElements:Iv,generateUboSync:Dv})}};Ho.extension={type:[x.WebGLSystem],name:"ubo"}});var za,Nv=p(()=>{"use strict";za=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var Va,Hv=p(()=>{vt();it();ti();Ri();Nv();Va=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new z}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new z}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 za,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?Ct.ALL:Ct.NONE);let o=this._renderer.gl;if(e&Ct.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:G("[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 Wo,Wv=p(()=>{w();zu();Hv();Wo=class extends Oi{constructor(t){super(t),this.adaptor=new Va,this.adaptor.init(t,this)}};Wo.extension={type:[x.WebGLSystem],name:"renderTarget"}});function zv(i,t){let e=[],r=[`
969
+ `}var Fv=p(()=>{Zu()});function Uv(i){return Ga(i,"uboStd40",Iv,Ou)}var Dv=p(()=>{Du();Lu();Fv()});var No,Ov=p(()=>{E();Iu();Zu();Dv();No=class extends Fi{constructor(){super({createUboElements:kv,generateUboSync:Uv})}};No.extension={type:[x.WebGLSystem],name:"ubo"}});var Wa,Lv=p(()=>{"use strict";Wa=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var za,Nv=p(()=>{vt();it();Jr();Bi();Lv();za=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new z}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new z}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 Wa,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?Ct.ALL:Ct.NONE);let o=this._renderer.gl;if(e&Ct.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:k("[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 Ho,Hv=p(()=>{E();Wu();Nv();Ho=class extends Di{constructor(t){super(t),this.adaptor=new za,this.adaptor.init(t,this)}};Ho.extension={type:[x.WebGLSystem],name:"renderTarget"}});function Wv(i,t){let e=[],r=[`
970
970
  var g = s.groups;
971
971
  var sS = r.shader;
972
972
  var p = s.glProgram;
@@ -982,7 +982,7 @@ fn mainFragment(
982
982
  );
983
983
  `)}else e.push(`
984
984
  ugS.updateUniformGroup(resources[${h}], p, sD);
985
- `);else if(u instanceof hr){let d=i._uniformBindMap[c][Number(h)];e.push(`
985
+ `);else if(u instanceof lr){let d=i._uniformBindMap[c][Number(h)];e.push(`
986
986
  sS.bindUniformBlock(
987
987
  resources[${h}],
988
988
  '${d}',
@@ -993,10 +993,10 @@ fn mainFragment(
993
993
  `)),t._gl.uniform1i(f.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 Vv=p(()=>{Ia();Nt();Yt()});var ja,jv=p(()=>{"use strict";ja=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 Ju(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}var $v=p(()=>{"use strict"});function td(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function $a(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 td(2*t);case"bvec3":return td(3*t);case"bvec4":return td(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 ed=p(()=>{"use strict"});function rd(i,t){if(!Xa){let e=Object.keys(Xv);Xa={};for(let r=0;r<e.length;++r){let s=e[r];Xa[i[s]]=Xv[s]}}return Xa[t]}function Yv(i,t){let e=rd(i,t);return bE[e]||"float32"}var Xa,Xv,bE,id=p(()=>{"use strict";Xa=null,Xv={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"},bE={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 Kv(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=Yv(t,a.type);r[a.name]={location:0,format:c,stride:Zt(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 qv=p(()=>{Rr();id()});function Zv(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 Qv=p(()=>{"use strict"});function Jv(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=rd(t,o.type);e[n]={name:n,index:s,type:c,size:o.size,isArray:a,value:$a(c,o.size)}}return e}var t0=p(()=>{ed();id()});function e0(i,t){let e=i.getShaderSource(t).split(`
996
+ `);return new Function("r","s","sD",a)}var zv=p(()=>{ka();Nt();Yt()});var Va,Vv=p(()=>{"use strict";Va=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 Qu(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}var jv=p(()=>{"use strict"});function Ju(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function ja(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 Ju(2*t);case"bvec3":return Ju(3*t);case"bvec4":return Ju(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 td=p(()=>{"use strict"});function ed(i,t){if(!Xa){let e=Object.keys(Xv);Xa={};for(let r=0;r<e.length;++r){let s=e[r];Xa[i[s]]=Xv[s]}}return Xa[t]}function $v(i,t){let e=ed(i,t);return _E[e]||"float32"}var Xa,Xv,_E,rd=p(()=>{"use strict";Xa=null,Xv={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"},_E={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 Yv(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=$v(t,a.type);r[a.name]={location:0,format:c,stride:Zt(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 Kv=p(()=>{Br();rd()});function qv(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 Zv=p(()=>{"use strict"});function Qv(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=ed(t,o.type);e[n]={name:n,index:s,type:c,size:o.size,isArray:a,value:ja(c,o.size)}}return e}var Jv=p(()=>{td();rd()});function t0(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 r0(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||e0(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||e0(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var i0=p(()=>{"use strict"});function s0(i,t){let e=Ju(i,i.VERTEX_SHADER,t.vertex),r=Ju(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"?G("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)||r0(i,s,e,r),t._attributeData=Kv(s,i,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=Jv(s,i),t._uniformBlockData=Zv(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:$a(l.type,l.size)}}return new ja(s,n)}var o0=p(()=>{it();jv();$v();ed();qv();Qv();t0();i0()});var Ya,zo,n0=p(()=>{w();Cr();Vv();o0();Ya={textureCount:0,blockIndex:0},zo=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=ae()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Ya.textureCount=0,Ya.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,Ya)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Ya)}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]=s0(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 zv(t,e)}resetState(){this._activeProgram=null}};zo.extension={type:[x.WebGLSystem],name:"shader"}});var a0,c0,l0=p(()=>{"use strict";a0={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 e0(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||t0(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||t0(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var r0=p(()=>{"use strict"});function i0(i,t){let e=Qu(i,i.VERTEX_SHADER,t.vertex),r=Qu(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"?k("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)||e0(i,s,e,r),t._attributeData=Yv(s,i,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=Qv(s,i),t._uniformBlockData=qv(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:ja(l.type,l.size)}}return new Va(s,n)}var s0=p(()=>{it();Vv();jv();td();Kv();Zv();Jv();r0()});var $a,Wo,o0=p(()=>{E();Ar();zv();s0();$a={textureCount:0,blockIndex:0},Wo=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=ae()}bind(t,e){if(this._setProgram(t.glProgram),e)return;$a.textureCount=0,$a.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,$a)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,$a)}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]=i0(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 Wv(t,e)}resetState(){this._activeProgram=null}};Wo.extension={type:[x.WebGLSystem],name:"shader"}});var n0,a0,c0=p(()=>{"use strict";n0={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]) {
@@ -1068,7 +1068,7 @@ fn mainFragment(
1068
1068
  cv[2] = v[2];
1069
1069
  cv[3] = v[3];
1070
1070
  gl.uniform4i(location, v[0], v[1], v[2], v[3]);
1071
- }`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},c0={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"}});function h0(i,t){let e=[`
1071
+ }`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},a0={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"}});function l0(i,t){let e=[`
1072
1072
  var v = null;
1073
1073
  var cv = null;
1074
1074
  var cu = null;
@@ -1079,15 +1079,15 @@ fn mainFragment(
1079
1079
  renderer.shader.bindUniformBlock(uv.${r}, "${r}");
1080
1080
  `):e.push(`
1081
1081
  renderer.shader.updateUniformGroup(uv.${r});
1082
- `):i.uniforms[r]instanceof hr&&e.push(`
1082
+ `):i.uniforms[r]instanceof lr&&e.push(`
1083
1083
  renderer.shader.bindBufferResource(uv.${r}, "${r}");
1084
- `);continue}let s=i.uniformStructures[r],o=!1;for(let n=0;n<qe.length;n++){let a=qe[n];if(s.type===a.type&&a.test(s)){e.push(`name = "${r}";`,qe[n].uniform),o=!0;break}}if(!o){let a=(s.size===1?a0:c0)[s.type].replace("location",`ud["${r}"].location`);e.push(`
1084
+ `);continue}let s=i.uniformStructures[r],o=!1;for(let n=0;n<Ke.length;n++){let a=Ke[n];if(s.type===a.type&&a.test(s)){e.push(`name = "${r}";`,Ke[n].uniform),o=!0;break}}if(!o){let a=(s.size===1?n0:a0)[s.type].replace("location",`ud["${r}"].location`);e.push(`
1085
1085
  cu = ud["${r}"];
1086
1086
  cv = cu.value;
1087
1087
  v = uv["${r}"];
1088
1088
  ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
1089
- `))}var u0=p(()=>{Ia();Nt();Du();l0()});var Vo,d0=p(()=>{w();u0();Vo=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 h0(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}};Vo.extension={type:[x.WebGLSystem],name:"uniformGroup"}});function f0(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 D.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 p0=p(()=>{ct()});var vE,TE,SE,wE,EE,PE,m0,g0,x0=p(()=>{w();_e();p0();vE=0,TE=1,SE=2,wE=3,EE=4,PE=5,m0=class sd{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[vE]=this.setBlend,this.map[TE]=this.setOffset,this.map[SE]=this.setCullFace,this.map[wE]=this.setDepthTest,this.map[EE]=this.setFrontFace,this.map[PE]=this.setDepthMask,this.checks=[],this.defaultState=_t.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=f0(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(sd._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(sd._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}};m0.extension={type:[x.WebGLSystem],name:"state"};g0=m0});var Ka,_0=p(()=>{Ku();Ka=class{constructor(t){this.target=Yu.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=Z.UNSIGNED_BYTE,this.internalFormat=Wa.RGBA,this.format=Wa.RGBA,this.samplerType=0}}});var y0,b0=p(()=>{"use strict";y0={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 AE,v0,T0=p(()=>{"use strict";AE={"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},v0={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!AE[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 qa,od=p(()=>{"use strict";qa={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 S0,w0=p(()=>{od();S0={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}qa.upload(i,t,e,r)}}});var nd,E0,Za,P0,A0=p(()=>{"use strict";nd={linear:9729,nearest:9728},E0={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Za={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},P0={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function ad(i,t,e,r,s,o,n,a){let c=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=Za[n?"clamp-to-edge":i.addressModeU],h=Za[n?"clamp-to-edge":i.addressModeV],u=Za[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,nd[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=E0[i.minFilter][i.mipmapFilter];t[s](c,t.TEXTURE_MIN_FILTER,l)}}else t[s](c,t.TEXTURE_MIN_FILTER,nd[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,P0[i.compare])}var C0=p(()=>{A0()});function M0(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 B0=p(()=>{"use strict"});function R0(i,t){let e={},r=i.RGBA;return i instanceof D.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 G0=p(()=>{ct()});function k0(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 I0=p(()=>{"use strict"});var CE,jo,F0=p(()=>{ct();w();tt();_0();b0();T0();od();w0();C0();B0();G0();I0();CE=4,jo=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:qa,buffer:y0,video:S0,compressed:v0},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=R0(t,this._renderer.context.extensions),this._mapFormatToType=k0(t),this._mapFormatToFormat=M0(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(A.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=A.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 Ka(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,ad(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,ad(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=D.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(CE*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(A.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};jo.extension={type:[x.WebGLSystem],name:"texture"}});var L0={};Dd(L0,{WebGLRenderer:()=>cd});var ME,BE,RE,U0,D0,O0,cd,N0=p(()=>{w();mv();gv();xv();qs();Iu();Re();bv();Sv();Av();Bv();Rv();Gv();kv();Lv();Wv();n0();d0();x0();F0();ME=[...Ra,Ho,Mv,Tv,Uo,jo,Wo,Do,Vo,zo,Lo,g0,No,Oo],BE=[...Ga],RE=[Io,ko,Go],U0=[],D0=[],O0=[];R.handleByNamedList(x.WebGLSystem,U0);R.handleByNamedList(x.WebGLPipes,D0);R.handleByNamedList(x.WebGLPipesAdaptor,O0);R.add(...ME,...BE,...RE);cd=class extends lr{constructor(){let t={name:"webgl",type:bt.WEBGL,systems:U0,renderPipes:D0,renderPipeAdaptors:O0};super(t)}}});w();var xy={extension:{type:x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(gy(),Zw))}};w();var yy={extension:{type:x.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(_y(),Qw))}};w();w();Gn();En();w();ct();qs();var Ea;function Ay(i){return Ea!==void 0||(Ea=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??lr.defaultOptions.failIfMajorPerformanceCaveat};try{if(!D.get().getWebGLRenderingContext())return!1;let r=D.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}})()),Ea}ct();var Pa;async function Cy(i={}){return Pa!==void 0||(Pa=await(async()=>{let t=D.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Pa}qs();var H0=["webgl","webgpu","canvas"];async function W0(i){let t=[];i.preference?(t.push(i.preference),H0.forEach(o=>{o!==i.preference&&t.push(o)})):t=H0.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await Cy()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(pv(),fv));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&Ay(i.failIfMajorPerformanceCaveat??lr.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(N0(),L0));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}me();vu();dt();var z0=class ld{constructor(...t){this.stage=new nt,t[0]!==void 0&&U(H,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await W0(t),ld._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return U(H,"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=ld._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}};z0._plugins=[];var Qa=z0;R.handleByList(x.Application,Qa._plugins);R.add(no);w();Ve();vl();ct();w();Pr();vt();tt();Zh();ru();var $o=class extends Ei{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 z(n.x+a.x,n.y+a.y,n.width,n.height),h=new A({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){Ws.install(t)}static uninstall(t){Ws.uninstall(t)}};var Ja={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 g in f){let _=f[g].split("="),y=_[0],b=_[1].replace(/"/gm,""),v=parseFloat(b),T=isNaN(v)?b:v;m[y]=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 hd={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 ud={test(i){return typeof i=="string"&&i.includes("<font>")?hd.test(D.get().parseXML(i)):!1},parse(i){return hd.parse(D.get().parseXML(i))}};var GE=[".xml",".fnt"],V0={extension:{type:x.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof $o,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},j0={extension:{type:x.LoadParser,priority:Et.Normal},name:"loadBitmapFont",test(i){return GE.includes(Tt.extname(i).toLowerCase())},async testParse(i){return Ja.test(i)||ud.test(i)},async parse(i,t,e){let r=Ja.test(i)?Ja.parse(i):ud.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=Tt.join(Tt.dirname(s),d);f=gs(f,s),n.push({src:f,data:a})}let c=await e.load(n),l=n.map(u=>c[u.src]);return new $o({data:r,textures:l},s)},async load(i,t){return await(await D.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 tc=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())}};er();w();tt();var $0={extension:{type:x.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof A),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};w();async function ec(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 X0={extension:{type:x.DetectionParser,priority:1},test:async()=>ec("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};w();var Y0=["png","jpg","jpeg"],K0={extension:{type:x.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...Y0],remove:async i=>i.filter(t=>!Y0.includes(t))};w();var kE="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Li(i){return kE?!1:document.createElement("video").canPlayType(i)!==""}var q0={extension:{type:x.DetectionParser,priority:0},test:async()=>Li("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};w();var Z0={extension:{type:x.DetectionParser,priority:0},test:async()=>Li("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};w();var Q0={extension:{type:x.DetectionParser,priority:0},test:async()=>Li("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};w();var J0={extension:{type:x.DetectionParser,priority:0},test:async()=>ec("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};it();Pr();ms();wn();var rc=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||G(`[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 G(`[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=Ar(t),n=Ot(t,l=>({alias:[l],src:l,data:{}})),a=n.length,c=n.map(async l=>{let h=Tt.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=Ot(t,s=>({alias:[s],src:s})).map(async s=>{let o=Tt.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]&&G(`[Assets] loadParser name conflict "${e.name}"`):G("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};ct();w();function ue(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}`)}Pr();function de(i,t){let e=i.split("?")[0],r=Tt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}Ve();var IE=".json",FE="application/json",tT={extension:{type:x.LoadParser,priority:Et.Low},name:"loadJson",test(i){return ue(i,FE)||de(i,IE)},async load(i){return await(await D.get().fetch(i)).json()}};ct();w();Ve();var UE=".txt",DE="text/plain",eT={name:"loadTxt",extension:{type:x.LoadParser,priority:Et.Low,name:"loadTxt"},test(i){return ue(i,DE)||de(i,UE)},async load(i){return await(await D.get().fetch(i)).text()}};ct();w();it();Pr();er();Ve();var OE=["normal","bold","100","200","300","400","500","600","700","800","900"],LE=[".ttf",".otf",".woff",".woff2"],NE=["font/ttf","font/otf","font/woff","font/woff2"],HE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function WE(i){let t=Tt.extname(i),s=Tt.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(HE)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var zE=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function VE(i){return zE.test(i)?i:encodeURI(i)}var rT={extension:{type:x.LoadParser,priority:Et.Low},name:"loadWebFont",test(i){return ue(i,NE)||de(i,LE)},async load(i,t){let e=D.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??WE(i),o=t.data?.weights?.filter(a=>OE.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let c=o[a],l=new FontFace(s,`url(${VE(i)})`,{...n,weight:c});await l.load(),e.add(l),r.push(l)}return Q.set(`${s}-and-url`,{url:i,fontFaces:r}),r.length===1?r[0]:r}return G("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>{Q.remove(`${t.family}-and-url`),D.get().getFontFaceSet().delete(t)})}};ct();w();ei();ha();Jr();function Ni(i,t=1){let e=se.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}Ve();tt();it();er();function Hi(i,t,e){i.label=e,i._sourceOrigin=e;let r=new A({source:i,label:e}),s=()=>{delete t.promiseCache[e],Q.has(e)&&Q.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(G("[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||(G("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var jE=".svg",$E="image/svg+xml",iT={extension:{type:x.LoadParser,priority:Et.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return ue(i,$E)||de(i,jE)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?YE(i):XE(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function XE(i,t,e,r){let o=await(await D.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||Ni(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??{},g=new qt({resource:c,alphaMode:"premultiply-alpha-on-upload",resolution:h,...m});return Hi(g,e,i)}async function YE(i){let e=await(await D.get().fetch(i)).text(),r=new Ht;return r.svg(e),r}ct();w();ei();var KE=`(function () {
1089
+ `))}var h0=p(()=>{ka();Nt();Uu();c0()});var zo,u0=p(()=>{E();h0();zo=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 l0(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}};zo.extension={type:[x.WebGLSystem],name:"uniformGroup"}});function d0(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 f0=p(()=>{ct()});var yE,bE,vE,TE,SE,wE,p0,m0,g0=p(()=>{E();_e();f0();yE=0,bE=1,vE=2,TE=3,SE=4,wE=5,p0=class id{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[yE]=this.setBlend,this.map[bE]=this.setOffset,this.map[vE]=this.setCullFace,this.map[TE]=this.setDepthTest,this.map[SE]=this.setFrontFace,this.map[wE]=this.setDepthMask,this.checks=[],this.defaultState=_t.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=d0(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(id._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(id._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}};p0.extension={type:[x.WebGLSystem],name:"state"};m0=p0});var Ya,x0=p(()=>{Yu();Ya=class{constructor(t){this.target=$u.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=Z.UNSIGNED_BYTE,this.internalFormat=Ha.RGBA,this.format=Ha.RGBA,this.samplerType=0}}});var _0,y0=p(()=>{"use strict";_0={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 EE,b0,v0=p(()=>{"use strict";EE={"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},b0={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!EE[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 Ka,sd=p(()=>{"use strict";Ka={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 T0,S0=p(()=>{sd();T0={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}Ka.upload(i,t,e,r)}}});var od,w0,qa,E0,P0=p(()=>{"use strict";od={linear:9729,nearest:9728},w0={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},qa={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},E0={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function nd(i,t,e,r,s,o,n,a){let c=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=qa[n?"clamp-to-edge":i.addressModeU],h=qa[n?"clamp-to-edge":i.addressModeV],u=qa[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,od[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=w0[i.minFilter][i.mipmapFilter];t[s](c,t.TEXTURE_MIN_FILTER,l)}}else t[s](c,t.TEXTURE_MIN_FILTER,od[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,E0[i.compare])}var A0=p(()=>{P0()});function C0(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 M0=p(()=>{"use strict"});function B0(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 R0=p(()=>{ct()});function G0(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 k0=p(()=>{"use strict"});var PE,Vo,I0=p(()=>{ct();E();tt();x0();y0();v0();sd();S0();A0();M0();R0();k0();PE=4,Vo=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:Ka,buffer:_0,video:T0,compressed:b0},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=B0(t,this._renderer.context.extensions),this._mapFormatToType=G0(t),this._mapFormatToFormat=C0(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(M.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=M.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 Ya(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,nd(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,nd(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(PE*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(M.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Vo.extension={type:[x.WebGLSystem],name:"texture"}});var O0={};Ud(O0,{WebGLRenderer:()=>ad});var AE,CE,ME,F0,U0,D0,ad,L0=p(()=>{E();pv();mv();gv();Ks();ku();Be();yv();Tv();Pv();Mv();Bv();Rv();Gv();Ov();Hv();o0();u0();g0();I0();AE=[...Ba,No,Cv,vv,Fo,Vo,Ho,Uo,zo,Wo,Oo,m0,Lo,Do],CE=[...Ra],ME=[ko,Go,Ro],F0=[],U0=[],D0=[];G.handleByNamedList(x.WebGLSystem,F0);G.handleByNamedList(x.WebGLPipes,U0);G.handleByNamedList(x.WebGLPipesAdaptor,D0);G.add(...AE,...CE,...ME);ad=class extends cr{constructor(){let t={name:"webgl",type:bt.WEBGL,systems:F0,renderPipes:U0,renderPipeAdaptors:D0};super(t)}}});E();var gy={extension:{type:x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(my(),Kw))}};E();var _y={extension:{type:x.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(xy(),qw))}};E();E();Rn();wn();E();ct();Ks();var wa;function Py(i){return wa!==void 0||(wa=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??cr.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}})()),wa}ct();var Ea;async function Ay(i={}){return Ea!==void 0||(Ea=await(async()=>{let t=O.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Ea}Ks();var N0=["webgl","webgpu","canvas"];async function H0(i){let t=[];i.preference?(t.push(i.preference),N0.forEach(o=>{o!==i.preference&&t.push(o)})):t=N0.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await Ay()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(fv(),dv));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&Py(i.failIfMajorPerformanceCaveat??cr.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(L0(),O0));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}me();bu();dt();var W0=class cd{constructor(...t){this.stage=new nt,t[0]!==void 0&&D(H,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await H0(t),cd._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(H,"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=cd._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}};W0._plugins=[];var Za=W0;G.handleByList(x.Application,Za._plugins);G.add(oo);E();ze();bl();ct();E();Er();vt();tt();qh();eu();var jo=class extends wi{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 z(n.x+a.x,n.y+a.y,n.width,n.height),h=new M({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){Hs.install(t)}static uninstall(t){Hs.uninstall(t)}};var Qa={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 g in f){let _=f[g].split("="),b=_[0],y=_[1].replace(/"/gm,""),T=parseFloat(y),v=isNaN(T)?y:T;m[b]=v}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 ld={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 hd={test(i){return typeof i=="string"&&i.includes("<font>")?ld.test(O.get().parseXML(i)):!1},parse(i){return ld.parse(O.get().parseXML(i))}};var BE=[".xml",".fnt"],z0={extension:{type:x.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof jo,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},V0={extension:{type:x.LoadParser,priority:Et.Normal},name:"loadBitmapFont",test(i){return BE.includes(Tt.extname(i).toLowerCase())},async testParse(i){return Qa.test(i)||hd.test(i)},async parse(i,t,e){let r=Qa.test(i)?Qa.parse(i):hd.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=Tt.join(Tt.dirname(s),d);f=ms(f,s),n.push({src:f,data:a})}let c=await e.load(n),l=n.map(u=>c[u.src]);return new jo({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 Ja=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())}};tr();E();tt();var j0={extension:{type:x.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof M),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};E();async function tc(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 X0={extension:{type:x.DetectionParser,priority:1},test:async()=>tc("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};E();var $0=["png","jpg","jpeg"],Y0={extension:{type:x.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...$0],remove:async i=>i.filter(t=>!$0.includes(t))};E();var RE="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Oi(i){return RE?!1:document.createElement("video").canPlayType(i)!==""}var K0={extension:{type:x.DetectionParser,priority:0},test:async()=>Oi("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};E();var q0={extension:{type:x.DetectionParser,priority:0},test:async()=>Oi("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};E();var Z0={extension:{type:x.DetectionParser,priority:0},test:async()=>Oi("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};E();var Q0={extension:{type:x.DetectionParser,priority:0},test:async()=>tc("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};it();Er();ps();Sn();var ec=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||k(`[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 k(`[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=Pr(t),n=Ot(t,l=>({alias:[l],src:l,data:{}})),a=n.length,c=n.map(async l=>{let h=Tt.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=Ot(t,s=>({alias:[s],src:s})).map(async s=>{let o=Tt.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]&&k(`[Assets] loadParser name conflict "${e.name}"`):k("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};ct();E();function ue(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}`)}Er();function de(i,t){let e=i.split("?")[0],r=Tt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}ze();var GE=".json",kE="application/json",J0={extension:{type:x.LoadParser,priority:Et.Low},name:"loadJson",test(i){return ue(i,kE)||de(i,GE)},async load(i){return await(await O.get().fetch(i)).json()}};ct();E();ze();var IE=".txt",FE="text/plain",tT={name:"loadTxt",extension:{type:x.LoadParser,priority:Et.Low,name:"loadTxt"},test(i){return ue(i,FE)||de(i,IE)},async load(i){return await(await O.get().fetch(i)).text()}};ct();E();it();Er();tr();ze();var UE=["normal","bold","100","200","300","400","500","600","700","800","900"],DE=[".ttf",".otf",".woff",".woff2"],OE=["font/ttf","font/otf","font/woff","font/woff2"],LE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function NE(i){let t=Tt.extname(i),s=Tt.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(LE)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var HE=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function WE(i){return HE.test(i)?i:encodeURI(i)}var eT={extension:{type:x.LoadParser,priority:Et.Low},name:"loadWebFont",test(i){return ue(i,OE)||de(i,DE)},async load(i,t){let e=O.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??NE(i),o=t.data?.weights?.filter(a=>UE.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let c=o[a],l=new FontFace(s,`url(${WE(i)})`,{...n,weight:c});await l.load(),e.add(l),r.push(l)}return Q.set(`${s}-and-url`,{url:i,fontFaces:r}),r.length===1?r[0]:r}return k("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>{Q.remove(`${t.family}-and-url`),O.get().getFontFaceSet().delete(t)})}};ct();E();ti();la();Qr();function Li(i,t=1){let e=se.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}ze();tt();it();tr();function Ni(i,t,e){i.label=e,i._sourceOrigin=e;let r=new M({source:i,label:e}),s=()=>{delete t.promiseCache[e],Q.has(e)&&Q.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(k("[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||(k("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var zE=".svg",VE="image/svg+xml",rT={extension:{type:x.LoadParser,priority:Et.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return ue(i,VE)||de(i,zE)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?XE(i):jE(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function jE(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||Li(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??{},g=new qt({resource:c,alphaMode:"premultiply-alpha-on-upload",resolution:h,...m});return Ni(g,e,i)}async function XE(i){let e=await(await O.get().fetch(i)).text(),r=new Ht;return r.svg(e),r}ct();E();ti();var $E=`(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=Ot(t
1108
1108
  });
1109
1109
 
1110
1110
  })();
1111
- `,Wi=null,zi=class{constructor(){Wi||(Wi=URL.createObjectURL(new Blob([KE],{type:"application/javascript"}))),this.worker=new Worker(Wi)}};zi.revokeObjectURL=function(){Wi&&(URL.revokeObjectURL(Wi),Wi=null)};var qE=`(function () {
1111
+ `,Hi=null,Wi=class{constructor(){Hi||(Hi=URL.createObjectURL(new Blob([$E],{type:"application/javascript"}))),this.worker=new Worker(Hi)}};Wi.revokeObjectURL=function(){Hi&&(URL.revokeObjectURL(Hi),Hi=null)};var YE=`(function () {
1112
1112
  'use strict';
1113
1113
 
1114
1114
  async function loadImageBitmap(url, alphaMode) {
@@ -1137,6 +1137,6 @@ ${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Ot(t
1137
1137
  };
1138
1138
 
1139
1139
  })();
1140
- `,Vi=null,Xo=class{constructor(){Vi||(Vi=URL.createObjectURL(new Blob([qE],{type:"application/javascript"}))),this.worker=new Worker(Vi)}};Xo.revokeObjectURL=function(){Vi&&(URL.revokeObjectURL(Vi),Vi=null)};var sT=0,dd,fd=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 zi;e.addEventListener("message",r=>{e.terminate(),zi.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(){dd===void 0&&(dd=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<dd&&(this._createdWorkers++,t=new Xo().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[sT]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:sT++,id:r})}},pd=new fd;Ve();var ZE=[".jpeg",".jpg",".png",".webp",".avif"],QE=["image/jpeg","image/png","image/webp","image/avif"];async function JE(i,t){let e=await D.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 ic={name:"loadTextures",extension:{type:x.LoadParser,priority:Et.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ue(i,QE)||de(i,ZE)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await pd.isImageBitmapSupported()?r=await pd.loadImageBitmap(i,t):r=await JE(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 qt({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Ni(i),...t.data});return Hi(s,e,i)},unload(i){i.destroy(!0)}};w();Cl();Al();var oT=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],tP=oT.map(i=>`video/${i.substring(1)}`);function eP(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=iP(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function rP(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 iP(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 nT={name:"loadVideo",extension:{type:x.LoadParser,name:"loadVideo"},test(i){let t=ue(i,tP),e=de(i,oT);return t||e},async load(i,t,e){let r={...ri.defaultOptions,resolution:t.data?.resolution||Ni(i),alphaMode:t.data?.alphaMode||await Bn(),...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),eP(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=ri.MIME_TYPES[c]||`video/${c}`}return n.src=i,a&&(n.type=a),new Promise(c=>{let l=async()=>{let h=new ri({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await rP(s),c(Hi(h,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};w();Jr();w();Jr();var sc={extension:{type:x.ResolveParser,name:"resolveTexture"},test:ic.test,parse:i=>({resolution:parseFloat(se.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var aT={extension:{type:x.ResolveParser,priority:-2,name:"resolveJson"},test:i=>se.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:sc.parse};Jr();ms();wn();var oc=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new se,this.loader=new rc,this.cache=Q,this._backgroundLoader=new tc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){G("[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=Ar(t),s=Ot(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 Q.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=Q.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}),Q.set(c,a)}),o}async unload(t){this._initialized||await this.init();let e=Ot(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=Ot(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=>{Q.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]})})}},be=new oc;R.handleByList(x.LoadParser,be.loader.parsers).handleByList(x.ResolveParser,be.resolver.parsers).handleByList(x.CacheParser,be.cache.parsers).handleByList(x.DetectionParser,be.detections);R.add($0,K0,X0,J0,q0,Z0,Q0,tT,eT,rT,iT,ic,nT,j0,V0,sc,aT);var cT={loader:x.LoadParser,resolver:x.ResolveParser,cache:x.CacheParser,detection:x.DetectionParser};R.handle(x.Asset,i=>{let t=i.ref;Object.entries(cT).filter(([e])=>!!t[e]).forEach(([e,r])=>R.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(cT).filter(e=>!!t[e]).forEach(e=>R.remove(t[e]))});sn();dt();Sn();var nc=class extends tr{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 lT(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(U(H,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Ns();Ur();var dr=class extends nc{constructor(...t){let e=lT(t,"Text");super(e,St),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}};Ve();vt();tt();Rl();me();Yh();An();Ns();Ur();kt();var sP=tn(oh(),1);R.add(xy,yy);var Vt={Add:"add",Remove:"remove"},ac=class{init(t){throw new Error("Method not implemented.")}render(t){throw new Error("Method not implemented.")}},fr=class{rendererName;rendererType;add=(t,e)=>{throw new Error("Method not implemented.")};remove=(t,e)=>{throw new Error("Method not implemented.")};update=(t,e)=>{throw new Error("Method not implemented.")}};var cc=(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 Lr=new(window.AudioContext||window.webkitAudioContext),ji=class i{static loadedAssets={};static load=async(t,e)=>{if(!i.loadedAssets[t]&&e.byteLength!==0)try{let r=await Lr.decodeAudioData(e);i.loadedAssets[t]=r}catch(r){console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}};static getAsset=t=>i.loadedAssets[t]},md=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=Lr.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Lr.destination)}play=()=>{let t=ji.getAsset(this.url);if(!t){console.warn("AudioPlayer.play: Asset not found",this.url);return}this._audioSource=Lr.createBufferSource(),this._audioSource.buffer=t,this._audioSource.loop=this.loop,this._gainNode.gain.setValueAtTime(this.volume,Lr.currentTime),this._audioSource.connect(this._gainNode),this._audioSource.start(0)};stop=()=>{this._audioSource&&(this._audioSource.stop(),this._audioSource.disconnect(),this._gainNode.disconnect(),this._gainNode=Lr.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Lr.destination))}},lc=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 md(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 gd=function(i,t){return gd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])},gd(i,t)};function Yo(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");gd(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function hT(i,t,e,r){function s(o){return o instanceof e?o:new e(function(n){n(o)})}return new(e||(e=Promise))(function(o,n){function a(h){try{l(r.next(h))}catch(u){n(u)}}function c(h){try{l(r.throw(h))}catch(u){n(u)}}function l(h){h.done?o(h.value):s(h.value).then(a,c)}l((r=r.apply(i,t||[])).next())})}function hc(i,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,s,o,n=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return n.next=a(0),n.throw=a(1),n.return=a(2),typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function a(l){return function(h){return c([l,h])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n&&(n=0,l[0]&&(e=0)),e;)try{if(r=1,s&&(o=l[0]&2?s.return:l[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,l[1])).done)return o;switch(s=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,s=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){e.label=l[1];break}if(l[0]===6&&e.label<o[1]){e.label=o[1],o=l;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(l);break}o[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(i,e)}catch(h){l=[6,h],s=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Nr(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],r=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function $i(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var r=e.call(i),s,o=[],n;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){n={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(n)throw n.error}}return o}function Xi(i,t,e){if(e||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return i.concat(o||Array.prototype.slice.call(t))}function Hr(i){return this instanceof Hr?(this.v=i,this):new Hr(i)}function uT(i,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(i,t||[]),s,o=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",n),s[Symbol.asyncIterator]=function(){return this},s;function n(f){return function(m){return Promise.resolve(m).then(f,u)}}function a(f,m){r[f]&&(s[f]=function(g){return new Promise(function(_,y){o.push([f,g,_,y])>1||c(f,g)})},m&&(s[f]=m(s[f])))}function c(f,m){try{l(r[f](m))}catch(g){d(o[0][3],g)}}function l(f){f.value instanceof Hr?Promise.resolve(f.value.v).then(h,u):d(o[0][2],f)}function h(f){c("next",f)}function u(f){c("throw",f)}function d(f,m){f(m),o.shift(),o.length&&c(o[0][0],o[0][1])}}function dT(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],e;return t?t.call(i):(i=typeof Nr=="function"?Nr(i):i[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(o){e[o]=i[o]&&function(n){return new Promise(function(a,c){n=i[o](n),s(a,c,n.done,n.value)})}}function s(o,n,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},n)}}function et(i){return typeof i=="function"}function fT(i){var t=function(r){Error.call(r),r.stack=new Error().stack},e=i(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var uc=fT(function(i){return function(e){i(this),this.message=e?e.length+` errors occurred during unsubscription:
1140
+ `,zi=null,Xo=class{constructor(){zi||(zi=URL.createObjectURL(new Blob([YE],{type:"application/javascript"}))),this.worker=new Worker(zi)}};Xo.revokeObjectURL=function(){zi&&(URL.revokeObjectURL(zi),zi=null)};var iT=0,ud,dd=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 Wi;e.addEventListener("message",r=>{e.terminate(),Wi.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(){ud===void 0&&(ud=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<ud&&(this._createdWorkers++,t=new Xo().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[iT]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:iT++,id:r})}},fd=new dd;ze();var KE=[".jpeg",".jpg",".png",".webp",".avif"],qE=["image/jpeg","image/png","image/webp","image/avif"];async function ZE(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 rc={name:"loadTextures",extension:{type:x.LoadParser,priority:Et.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ue(i,qE)||de(i,KE)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await fd.isImageBitmapSupported()?r=await fd.loadImageBitmap(i,t):r=await ZE(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 qt({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Li(i),...t.data});return Ni(s,e,i)},unload(i){i.destroy(!0)}};E();Al();Pl();var sT=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],QE=sT.map(i=>`video/${i.substring(1)}`);function JE(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=eP(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function tP(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 eP(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 oT={name:"loadVideo",extension:{type:x.LoadParser,name:"loadVideo"},test(i){let t=ue(i,QE),e=de(i,sT);return t||e},async load(i,t,e){let r={...ei.defaultOptions,resolution:t.data?.resolution||Li(i),alphaMode:t.data?.alphaMode||await Mn(),...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),JE(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=ei.MIME_TYPES[c]||`video/${c}`}return n.src=i,a&&(n.type=a),new Promise(c=>{let l=async()=>{let h=new ei({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await tP(s),c(Ni(h,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};E();Qr();E();Qr();var ic={extension:{type:x.ResolveParser,name:"resolveTexture"},test:rc.test,parse:i=>({resolution:parseFloat(se.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var nT={extension:{type:x.ResolveParser,priority:-2,name:"resolveJson"},test:i=>se.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:ic.parse};Qr();ps();Sn();var sc=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new se,this.loader=new ec,this.cache=Q,this._backgroundLoader=new Ja(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){k("[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=Pr(t),s=Ot(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 Q.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=Q.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}),Q.set(c,a)}),o}async unload(t){this._initialized||await this.init();let e=Ot(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=Ot(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=>{Q.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]})})}},be=new sc;G.handleByList(x.LoadParser,be.loader.parsers).handleByList(x.ResolveParser,be.resolver.parsers).handleByList(x.CacheParser,be.cache.parsers).handleByList(x.DetectionParser,be.detections);G.add(j0,Y0,X0,Q0,K0,q0,Z0,J0,tT,eT,rT,rc,oT,V0,z0,ic,nT);var aT={loader:x.LoadParser,resolver:x.ResolveParser,cache:x.CacheParser,detection:x.DetectionParser};G.handle(x.Asset,i=>{let t=i.ref;Object.entries(aT).filter(([e])=>!!t[e]).forEach(([e,r])=>G.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(aT).filter(e=>!!t[e]).forEach(e=>G.remove(t[e]))});rn();dt();Tn();var oc=class extends Je{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 cT(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(D(H,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Ls();Fr();var ur=class extends oc{constructor(...t){let e=cT(t,"Text");super(e,St),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}};ze();vt();tt();Bl();me();$h();Pn();Ls();Fr();kt();var rP=Jo(sh(),1);G.add(gy,_y);var Vt={Add:"add",Remove:"remove"},nc=class{init(t){throw new Error("Method not implemented.")}render(t){throw new Error("Method not implemented.")}},dr=class{rendererName;rendererType;add=(t,e)=>{throw new Error("Method not implemented.")};remove=(t,e)=>{throw new Error("Method not implemented.")};update=(t,e)=>{throw new Error("Method not implemented.")}};var ac=(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 Or=new(window.AudioContext||window.webkitAudioContext),Vi=class i{static loadedAssets={};static load=async(t,e)=>{if(!i.loadedAssets[t]&&e.byteLength!==0)try{let r=await Or.decodeAudioData(e);i.loadedAssets[t]=r}catch(r){console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}};static getAsset=t=>i.loadedAssets[t]},pd=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=Or.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Or.destination)}play=()=>{let t=Vi.getAsset(this.url);if(!t){console.warn("AudioPlayer.play: Asset not found",this.url);return}this._audioSource=Or.createBufferSource(),this._audioSource.buffer=t,this._audioSource.loop=this.loop,this._gainNode.gain.setValueAtTime(this.volume,Or.currentTime),this._audioSource.connect(this._gainNode),this._audioSource.start(0)};stop=()=>{this._audioSource&&(this._audioSource.stop(),this._audioSource.disconnect(),this._gainNode.disconnect(),this._gainNode=Or.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Or.destination))}},cc=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 pd(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 md=function(i,t){return md=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])},md(i,t)};function $o(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");md(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function lT(i,t,e,r){function s(o){return o instanceof e?o:new e(function(n){n(o)})}return new(e||(e=Promise))(function(o,n){function a(h){try{l(r.next(h))}catch(u){n(u)}}function c(h){try{l(r.throw(h))}catch(u){n(u)}}function l(h){h.done?o(h.value):s(h.value).then(a,c)}l((r=r.apply(i,t||[])).next())})}function lc(i,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,s,o,n=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return n.next=a(0),n.throw=a(1),n.return=a(2),typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function a(l){return function(h){return c([l,h])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n&&(n=0,l[0]&&(e=0)),e;)try{if(r=1,s&&(o=l[0]&2?s.return:l[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,l[1])).done)return o;switch(s=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,s=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){e.label=l[1];break}if(l[0]===6&&e.label<o[1]){e.label=o[1],o=l;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(l);break}o[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(i,e)}catch(h){l=[6,h],s=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Lr(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],r=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ji(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var r=e.call(i),s,o=[],n;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){n={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(n)throw n.error}}return o}function Xi(i,t,e){if(e||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return i.concat(o||Array.prototype.slice.call(t))}function Nr(i){return this instanceof Nr?(this.v=i,this):new Nr(i)}function hT(i,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(i,t||[]),s,o=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",n),s[Symbol.asyncIterator]=function(){return this},s;function n(f){return function(m){return Promise.resolve(m).then(f,u)}}function a(f,m){r[f]&&(s[f]=function(g){return new Promise(function(_,b){o.push([f,g,_,b])>1||c(f,g)})},m&&(s[f]=m(s[f])))}function c(f,m){try{l(r[f](m))}catch(g){d(o[0][3],g)}}function l(f){f.value instanceof Nr?Promise.resolve(f.value.v).then(h,u):d(o[0][2],f)}function h(f){c("next",f)}function u(f){c("throw",f)}function d(f,m){f(m),o.shift(),o.length&&c(o[0][0],o[0][1])}}function uT(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],e;return t?t.call(i):(i=typeof Lr=="function"?Lr(i):i[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(o){e[o]=i[o]&&function(n){return new Promise(function(a,c){n=i[o](n),s(a,c,n.done,n.value)})}}function s(o,n,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},n)}}function et(i){return typeof i=="function"}function dT(i){var t=function(r){Error.call(r),r.stack=new Error().stack},e=i(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var hc=dT(function(i){return function(e){i(this),this.message=e?e.length+` errors occurred during unsubscription:
1141
1141
  `+e.map(function(r,s){return s+1+") "+r.toString()}).join(`
1142
- `):"",this.name="UnsubscriptionError",this.errors=e}});function xd(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var dc=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,r,s,o;if(!this.closed){this.closed=!0;var n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=Nr(n),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(g){t={error:g}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else n.remove(this);var h=this.initialTeardown;if(et(h))try{h()}catch(g){o=g instanceof uc?g.errors:[g]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var d=Nr(u),f=d.next();!f.done;f=d.next()){var m=f.value;try{pT(m)}catch(g){o=o??[],g instanceof uc?o=Xi(Xi([],$i(o)),$i(g.errors)):o.push(g)}}}catch(g){r={error:g}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}if(o)throw new uc(o)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)pT(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&xd(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&xd(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}();var KY=dc.EMPTY;function fc(i){return i instanceof dc||i&&"closed"in i&&et(i.remove)&&et(i.add)&&et(i.unsubscribe)}function pT(i){et(i)?i():i.unsubscribe()}var ve={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Yi={setTimeout:function(i,t){for(var e=[],r=2;r<arguments.length;r++)e[r-2]=arguments[r];var s=Yi.delegate;return s?.setTimeout?s.setTimeout.apply(s,Xi([i,t],$i(e))):setTimeout.apply(void 0,Xi([i,t],$i(e)))},clearTimeout:function(i){var t=Yi.delegate;return(t?.clearTimeout||clearTimeout)(i)},delegate:void 0};function pc(i){Yi.setTimeout(function(){var t=ve.onUnhandledError;if(t)t(i);else throw i})}function _d(){}var mT=function(){return yd("C",void 0,void 0)}();function gT(i){return yd("E",void 0,i)}function xT(i){return yd("N",i,void 0)}function yd(i,t,e){return{kind:i,value:t,error:e}}var Wr=null;function _T(i){if(ve.useDeprecatedSynchronousErrorHandling){var t=!Wr;if(t&&(Wr={errorThrown:!1,error:null}),i(),t){var e=Wr,r=e.errorThrown,s=e.error;if(Wr=null,r)throw s}}else i()}function yT(i){ve.useDeprecatedSynchronousErrorHandling&&Wr&&(Wr.errorThrown=!0,Wr.error=i)}var Ko=function(i){Yo(t,i);function t(e){var r=i.call(this)||this;return r.isStopped=!1,e?(r.destination=e,fc(e)&&e.add(r)):r.destination=cP,r}return t.create=function(e,r,s){return new gc(e,r,s)},t.prototype.next=function(e){this.isStopped?vd(xT(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?vd(gT(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?vd(mT,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(dc);var oP=Function.prototype.bind;function bd(i,t){return oP.call(i,t)}var nP=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(r){mc(r)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(r){mc(r)}else mc(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){mc(e)}},i}(),gc=function(i){Yo(t,i);function t(e,r,s){var o=i.call(this)||this,n;if(et(e)||!e)n={next:e??void 0,error:r??void 0,complete:s??void 0};else{var a;o&&ve.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return o.unsubscribe()},n={next:e.next&&bd(e.next,a),error:e.error&&bd(e.error,a),complete:e.complete&&bd(e.complete,a)}):n=e}return o.destination=new nP(n),o}return t}(Ko);function mc(i){ve.useDeprecatedSynchronousErrorHandling?yT(i):pc(i)}function aP(i){throw i}function vd(i,t){var e=ve.onStoppedNotification;e&&Yi.setTimeout(function(){return e(i,t)})}var cP={closed:!0,next:_d,error:aP,complete:_d};var Ki=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function bT(i){return i}function vT(i){return i.length===0?bT:i.length===1?i[0]:function(e){return i.reduce(function(r,s){return s(r)},e)}}var at=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,r){var s=this,o=hP(t)?t:new gc(t,e,r);return _T(function(){var n=s,a=n.operator,c=n.source;o.add(a?a.call(o,c):c?s._subscribe(o):s._trySubscribe(o))}),o},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var r=this;return e=TT(e),new e(function(s,o){var n=new gc({next:function(a){try{t(a)}catch(c){o(c),n.unsubscribe()}},error:o,complete:s});r.subscribe(n)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[Ki]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return vT(t)(this)},i.prototype.toPromise=function(t){var e=this;return t=TT(t),new t(function(r,s){var o;e.subscribe(function(n){return o=n},function(n){return s(n)},function(){return r(o)})})},i.create=function(t){return new i(t)},i}();function TT(i){var t;return(t=i??ve.Promise)!==null&&t!==void 0?t:Promise}function lP(i){return i&&et(i.next)&&et(i.error)&&et(i.complete)}function hP(i){return i&&i instanceof Ko||lP(i)&&fc(i)}function uP(i){return et(i?.lift)}function Ue(i){return function(t){if(uP(t))return t.lift(function(e){try{return i(e,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function zr(i,t,e,r,s){return new dP(i,t,e,r,s)}var dP=function(i){Yo(t,i);function t(e,r,s,o,n,a){var c=i.call(this,e)||this;return c.onFinalize=n,c.shouldUnsubscribe=a,c._next=r?function(l){try{r(l)}catch(h){e.error(h)}}:i.prototype._next,c._error=o?function(l){try{o(l)}catch(h){e.error(h)}finally{this.unsubscribe()}}:i.prototype._error,c._complete=s?function(){try{s()}catch(l){e.error(l)}finally{this.unsubscribe()}}:i.prototype._complete,c}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;i.prototype.unsubscribe.call(this),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}(Ko);var xc=function(i){return i&&typeof i.length=="number"&&typeof i!="function"};function _c(i){return et(i?.then)}function yc(i){return et(i[Ki])}function bc(i){return Symbol.asyncIterator&&et(i?.[Symbol.asyncIterator])}function vc(i){return new TypeError("You provided "+(i!==null&&typeof i=="object"?"an invalid object":"'"+i+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function fP(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Tc=fP();function Sc(i){return et(i?.[Tc])}function wc(i){return uT(this,arguments,function(){var e,r,s,o;return hc(this,function(n){switch(n.label){case 0:e=i.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,Hr(e.read())];case 3:return r=n.sent(),s=r.value,o=r.done,o?[4,Hr(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,Hr(s)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function Ec(i){return et(i?.getReader)}function De(i){if(i instanceof at)return i;if(i!=null){if(yc(i))return pP(i);if(xc(i))return mP(i);if(_c(i))return gP(i);if(bc(i))return ST(i);if(Sc(i))return xP(i);if(Ec(i))return _P(i)}throw vc(i)}function pP(i){return new at(function(t){var e=i[Ki]();if(et(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function mP(i){return new at(function(t){for(var e=0;e<i.length&&!t.closed;e++)t.next(i[e]);t.complete()})}function gP(i){return new at(function(t){i.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,pc)})}function xP(i){return new at(function(t){var e,r;try{for(var s=Nr(i),o=s.next();!o.done;o=s.next()){var n=o.value;if(t.next(n),t.closed)return}}catch(a){e={error:a}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}t.complete()})}function ST(i){return new at(function(t){yP(i,t).catch(function(e){return t.error(e)})})}function _P(i){return ST(wc(i))}function yP(i,t){var e,r,s,o;return hT(this,void 0,void 0,function(){var n,a;return hc(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),e=dT(i),c.label=1;case 1:return[4,e.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(n=r.value,t.next(n),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),s={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=e.return)?[4,o.call(e)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function fe(i,t,e,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var o=t.schedule(function(){e(),s?i.add(this.schedule(null,r)):this.unsubscribe()},r);if(i.add(o),!s)return o}function Pc(i,t){return t===void 0&&(t=0),Ue(function(e,r){e.subscribe(zr(r,function(s){return fe(r,i,function(){return r.next(s)},t)},function(){return fe(r,i,function(){return r.complete()},t)},function(s){return fe(r,i,function(){return r.error(s)},t)}))})}function Ac(i,t){return t===void 0&&(t=0),Ue(function(e,r){r.add(i.schedule(function(){return e.subscribe(r)},t))})}function wT(i,t){return De(i).pipe(Ac(t),Pc(t))}function ET(i,t){return De(i).pipe(Ac(t),Pc(t))}function PT(i,t){return new at(function(e){var r=0;return t.schedule(function(){r===i.length?e.complete():(e.next(i[r++]),e.closed||this.schedule())})})}function AT(i,t){return new at(function(e){var r;return fe(e,t,function(){r=i[Tc](),fe(e,t,function(){var s,o,n;try{s=r.next(),o=s.value,n=s.done}catch(a){e.error(a);return}n?e.complete():e.next(o)},0,!0)}),function(){return et(r?.return)&&r.return()}})}function Cc(i,t){if(!i)throw new Error("Iterable cannot be null");return new at(function(e){fe(e,t,function(){var r=i[Symbol.asyncIterator]();fe(e,t,function(){r.next().then(function(s){s.done?e.complete():e.next(s.value)})},0,!0)})})}function CT(i,t){return Cc(wc(i),t)}function MT(i,t){if(i!=null){if(yc(i))return wT(i,t);if(xc(i))return PT(i,t);if(_c(i))return ET(i,t);if(bc(i))return Cc(i,t);if(Sc(i))return AT(i,t);if(Ec(i))return CT(i,t)}throw vc(i)}function te(i,t){return t?MT(i,t):De(i)}function BT(i,t){return Ue(function(e,r){var s=0;e.subscribe(zr(r,function(o){r.next(i.call(t,o,s++))}))})}function RT(i,t,e,r,s,o,n,a){var c=[],l=0,h=0,u=!1,d=function(){u&&!c.length&&!l&&t.complete()},f=function(g){return l<r?m(g):c.push(g)},m=function(g){o&&t.next(g),l++;var _=!1;De(e(g,h++)).subscribe(zr(t,function(y){s?.(y),o?f(y):t.next(y)},function(){_=!0},void 0,function(){if(_)try{l--;for(var y=function(){var b=c.shift();n?fe(t,n,function(){return m(b)}):m(b)};c.length&&l<r;)y();d()}catch(b){t.error(b)}}))};return i.subscribe(zr(t,f,function(){u=!0,d()})),function(){a?.()}}function jt(i,t,e){return e===void 0&&(e=1/0),et(t)?jt(function(r,s){return BT(function(o,n){return t(r,o,s,n)})(De(i(r,s)))},e):(typeof t=="number"&&(e=t),Ue(function(r,s){return RT(r,s,i,e)}))}function qo(i){return Ue(function(t,e){try{t.subscribe(e)}finally{e.add(i)}})}var bP=i=>i.split("/").pop(),Td=class{name="advancedBufferLoader";priority=2;constructor(t){this.bufferMap=t}test(t){return!0}async load(t){let e=t.startsWith("file:")?t:bP(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 A)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new A.from(r)}async unload(t){t.destroy(!0)}},Sd=class i extends ac{static rendererName="pixi";_app;_audioStage=new lc;_state={elements:[]};_eventHandler;_plugins;_currentSubscription;_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 Qa,this._app.audioStage=this._audioStage,await this._app.init({width:s,height:o,backgroundColor:n});let a=new Wt;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()};loadAssets=async t=>{if(!t)throw new Error("assetBufferMap is required");let e={},r={};for(let[o,n]of Object.entries(t))n.type&&n.type.startsWith("audio/")?r[o]=n:e[o]=n;await Promise.all(Object.entries(r).map(([o,n])=>ji.load(o,n.buffer))),this._advancedLoader?Object.assign(this._advancedLoader.bufferMap,e):(this._advancedLoader=new Td(e),be.loader.parsers.length=0,be.reset(),R.add({name:"advanced-buffer-loader",extension:x.Asset,priority:Et.High,loader:this._advancedLoader}),typeof be.registerPlugin=="function"&&be.registerPlugin(this._advancedLoader));let s=Object.keys(e);return Promise.all(s.map(o=>be.load(o)))};loadAudioAssets=async t=>Promise.all(t.map(async e=>{let s=await(await fetch(e)).arrayBuffer();return ji.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}=cc(r.elements,s.elements),h=[];for(let u of l){let d=this._getRendererByElement(u);h.push(d.remove(t,{parent:e,element:u,transitions:s.transitions,getRendererByElement:this._getRendererByElement,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of a){let d=this._getRendererByElement(u);h.push(d.add(t,{parent:e,element:u,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of c){let d=this._getRendererByElement(u.next);h.push(d.update(t,{parent:e,prevElement:u.prev,nextElement:u.next,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}t.stage.children.sort((u,d)=>{let f=s.elements.findIndex(g=>g.id===u.label),m=s.elements.findIndex(g=>g.id===d.label);return f-m}),this._currentSubscription&&(this._currentSubscription.closed||this._currentSubscription.unsubscribe()),this._currentSubscription=te(h).pipe(jt(u=>u),qo(()=>{o&&o("completed",{id:s.id,diffTime:Date.now()-n}),this._currentSubscription=void 0})).subscribe({error:u=>{console.error("Error:",u)}})}},GT=Sd;var wd=class extends fr{static rendererName="pixi";rendererName="pixi";rendererType="sprite";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=A.from(o.url),h,u;o.hoverUrl&&(h=A.from(o.hoverUrl)),o.clickUrl&&(u=A.from(o.clickUrl));let d=new Lt(l);d.label=o.id,(o.eventName||o.hoverUrl||o.clickUrl)&&(d.cursor="pointer",d.eventMode="static"),o.anchorX!==void 0&&(d.pivot.x=d.width*o.anchorX,console.log("sprite.width",d.width)),o.anchorY!==void 0&&(d.pivot.y=d.height*o.anchorY,console.log("sprite.height",d.height)),o.scaleX!==void 0&&(d.scale.x=o.scaleX),o.scaleY!==void 0&&(d.scale.y=o.scaleY),o.rotation!==void 0&&(d.rotation=o.rotation*Math.PI/180),o.x!==void 0&&(d.x=o.x),o.y!==void 0&&(d.y=o.y),o.width!==void 0&&(d.width=o.width),o.height!==void 0&&(d.height=o.height),o.zIndex!==void 0&&(d.zIndex=o.zIndex),o.alpha!==void 0&&(d.alpha=o.alpha),d.on("pointerup",()=>{d.texture=l}).on("pointerupoutside",()=>{d.texture=l}).on("pointerleave",()=>{d.texture=l}),u&&d.on("pointerdown",()=>{d.texture=u}),h&&d.on("pointerenter",()=>{d.texture=h}),d.on("pointerup",g=>{g.stopPropagation();let _=g.button;_===0?c&&c(o.eventName,o.eventPayload):_===2&&(o.rightClickEventName&&c?c(o.rightClickEventName):t.stage.emit("rightclick",event))});let f=[];for(let g of n)if(g.elementId===o.id&&g.event===Vt.Add){let _=a(g.type);if(!_)throw new Error(`Transition class not found for type ${g.type}`);f.push(_.add(t,d,g))}s.addChild(d);let m=te(f).pipe(jt(g=>g)).subscribe({error:g=>{console.error("Error:",g)},complete:()=>r.complete()});return()=>{m.unsubscribe()}});remove=(t,e)=>new at(r=>{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 u of n)if(u.elementId===o.id&&u.event===Vt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=te(l).pipe(jt(u=>u)).subscribe({error:u=>{console.error("Error:",u)},complete:()=>{r.complete(),c&&c.destroy()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>new at(c=>{let l=e.getChildByName(r.id);if(!l)throw new Error(`Sprite with id ${r.id} not found`);if(JSON.stringify(r)!==JSON.stringify(s)){let h=[this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a}),this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n})],u=te(h).pipe(jt(d=>d)).subscribe({error:d=>{console.error("Error:",d)},complete:()=>c.complete()});return()=>{u.unsubscribe()}}else s.x!==void 0&&(l.x=s.x),s.y!==void 0&&(l.y=s.y),s.width!==void 0&&s.width!==r.width&&(l.width=s.width),s.height!==void 0&&s.height!==r.height&&(l.height=s.height),s.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),c.complete();return()=>{}})};var Mc=(i,t=!1)=>new St({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}),Ed=class{static rendererName="pixi";rendererName="pixi";rendererType="text";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=Mc(o.style),h=new dr({text:o.text,style:l}),u;o.hoverStyle&&(u=Mc(o.hoverStyle));let d;if(o.clickedStyle&&(d=Mc(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.xa!==void 0&&(h.anchor.x=o.xa),o.ya!==void 0&&(h.anchor.y=o.ya),o.xa!==void 0||o.ya!==void 0){let g=h.getLocalBounds();h.hitArea=new z(-g.width*h.anchor.x,-g.height*h.anchor.y,g.width,g.height)}h.on("pointerupoutside",()=>{h.style=l}).on("pointerup",()=>{h.style=l}).on("pointerleave",()=>{h.style=l}),h.on("pointerup",g=>{o.clickSoundUrl&&t.soundStage&&t.soundStage.add({id:`${o.id}-click-${Math.random()}`,url:o.clickSoundUrl,loop:!1,volume:o.clickSoundVolume??50/100}),g.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 g of n)if(g.elementId===o.id&&g.event===Vt.Add){let _=a(g.type);if(!_)throw new Error(`Transition class not found for type ${g.type}`);f.push(_.add(t,h,g))}s.addChild(h);let m=te(f).pipe(jt(g=>g)).subscribe({error:g=>{console.error("Error:",g),r.error(g)},complete:()=>r.complete()});return()=>{m.unsubscribe()}});remove=(t,e)=>new at(r=>{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`),r.complete();return}let l=[];for(let u of n)if(u.elementId===o.id&&u.event===Vt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=te(l).pipe(jt(u=>u)).subscribe({error:u=>{console.error("Error:",u),r.error(u)},complete:()=>{c.destroy(),r.complete()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,e)=>new at(r=>{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`),r.complete();return}if(JSON.stringify(o)!==JSON.stringify(n)){let u=[this.add(t,{parent:s,element:n,transitions:a,getTransitionByType:c,eventHandler:l}),this.remove(t,{parent:s,element:o,transitions:a,getTransitionByType:c})],d=te(u).pipe(jt(f=>f)).subscribe({error:f=>{console.error("Error:",f),r.error(f)},complete:()=>r.complete()});return()=>{d.unsubscribe()}}else o.text!==n.text&&(h.text=n.text),JSON.stringify(o.style)!==JSON.stringify(n.style)&&(h.style=Mc(n?.style)),n.x!==void 0&&(h.x=n.x),n.y!==void 0&&(h.y=n.y),r.complete();return()=>{}})};var qi=(i,t=!1)=>new St({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}),Pd=class{static rendererName="pixi";rendererName="pixi";rendererType="text-revealing";add=async(t,{parent:e,element:r})=>{let s=qi(r.style,r.text),o=new dr({text:"",style:s});o.label=r.id,o.text_id=r.text;let n=new nt;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 E={...S.style,wordWrapWidth:a-u},C=At.measureText(S.text,qi(E));C.lineHeight>f&&(f=C.lineHeight);let I=At.measureText("a",qi(E)),k=At.measureText("a a",qi(E)).width-I.width*2;if(C.lineWidths[0]+u>a){u=0,l.push({lineParts:h,y:d}),d+=f,f=0,h=[];continue}let L=C.lines[0],Y=C.lines.slice(1).join(" "),mt={text:L,style:E,x:u,y:0};if(h.push(mt),Y&&Y.length>0?S.text=Y:c.shift(),!(!L||L.length===0)){if(S.furigana){let $t=At.measureText(S.furigana.text,qi(S.furigana.style)),N={text:S.furigana.text,style:S.furigana.style,x:u+(C.width-$t.width)/2,y:-10};h.push(N)}u+=C.lineWidths[0]+k}}l.forEach(S=>{let E=new nt;E.y=S.y,E.alpha=0,S.lineParts.forEach(C=>{let I=new dr({text:C.text,style:qi(C.style),x:C.x,y:C.y});E.addChild(I)}),n.addChild(E)});let m=new Wt,g=1e3,_=a/2,y=a/2;m.fill({color:16777215,alpha:1}),m.rect(0,0,_,g);for(let S=0;S<y;S++)m.fill({color:16777215,alpha:1-S/y}),m.rect(_+S,0,_+1,g);let b=t.renderer.generateTexture(m),v=new Lt(b);v.x=-1.35*_-y,t.stage.addChild(v);let T=0,P=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 E=C=>{if(P>n.children.length){S();return}n.getChildAt(P).mask||(n.getChildAt(P).mask=v,n.getChildAt(P).alpha=1),T+=C.deltaMS;let M=(r.displaySpeed||50)/1e3;v.x+=M*T,v.x>=0&&(n.getChildAt(P).mask=null,v.x=-1.35*_-y,P=P+1,T=0,P>=n.children.length&&(n.getChildAt(P-1).mask=null,t.ticker.remove(E),S()))};t.ticker.add(E)})}};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===Vt.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 Te={TopLeft:"TopLeft",TopCenter:"TopCenter",TopRight:"TopRight",CenterLeft:"CenterLeft",CenterCenter:"CenterCenter",CenterRight:"CenterRight",BottomLeft:"BottomLeft",BottomCenter:"BottomCenter",BottomRight:"BottomRight"},kT={[Te.TopLeft]:{x:0,y:0},[Te.TopCenter]:{x:.5,y:0},[Te.TopRight]:{x:1,y:0},[Te.CenterLeft]:{x:0,y:.5},[Te.CenterCenter]:{x:.5,y:.5},[Te.CenterRight]:{x:1,y:.5},[Te.BottomLeft]:{x:0,y:1},[Te.BottomCenter]:{x:.5,y:1},[Te.BottomRight]:{x:1,y:1}},Ad=class{static rendererName="pixi";rendererName="pixi";rendererType="container";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,getRendererByElement:c,eventHandler:l}=e,h=new nt;h.label=o.id;let u={};o.x!==void 0&&(typeof o.x=="string"&&o.x.endsWith("%")?h.x=Number(o.x.replace("%",""))*t.screen.width/100:h.x=o.x),o.y!==void 0&&(typeof o.y=="string"&&o.y.endsWith("%")?h.y=Number(o.y.replace("%",""))*t.screen.height/100:h.y=o.y),o.scaleX!==void 0&&(h.scale.x=o.scaleX),o.scaleY!==void 0&&(h.scale.y=o.scaleY),o.zIndex!==void 0&&(h.zIndex=o.zIndex),o.propagateEvents&&(h.eventMode="static",["pointerup","pointerupoutside","pointerleave","pointerdown","pointerenter"].forEach(y=>{h.on(y,b=>{b.stopPropagation();for(let v of h.children)v.emit(y)})}));let d=o.gap||0,f=new Wt().roundRect(0,0,o.width||0,o.height||0,1).fill(o.fill?o.fill.color:"transparent");if(o.direction){let y,b;o.direction==="horizontal"?(y=o.children.reduce((T,P)=>T+P.width+d,0),b=o.children.reduce((T,P)=>Math.max(T,P.height||0),0)):o.direction==="vertical"&&(y=o.children.reduce((T,P)=>Math.max(T,P.width||0),0),b=o.children.reduce((T,P)=>T+P.height+d,0));let v=kT[o.anchor||Te.TopLeft];o.direction==="horizontal"?this.layoutChildren({element:o,anchor:v,totalWidth:y,totalHeight:b,gap:d,direction:"horizontal",scroll:o.scroll}):o.direction==="vertical"&&this.layoutChildren({element:o,anchor:v,totalWidth:y,totalHeight:b,gap:d,direction:"vertical",scroll:o.scroll}),this.setupScrolling({container:h,element:o,totalHeight:b,totalWidth:y,eventHandler:l,sliderRef:u}),f=this.createContainerGraphic(o,y,b,v)}f.label=`${o.id}-container-background`,h.addChild(f);let m=[];(o.children||[]).forEach(y=>{let b=c(y);m.push(b.add(t,{parent:h,element:{zIndex:o.zIndex,...y},transitions:n,getTransitionByType:a,getRendererByElement:c,eventHandler:l}))});let g=[];for(let y of n)if(y.elementId===o.id&&y.event===Vt.Add){let b=a(y.type);if(!b)throw new Error(`Transition class not found for type ${y.type}`);g.push(b.add(t,h,y))}s.addChild(h);let _=te(m).pipe(jt(y=>y)).subscribe({error:y=>{console.error("Error:",y)},complete:()=>{console.log("complete"),r.complete()}});return()=>{_.unsubscribe()}});remove=(t,e)=>(console.log("remove container 11111111111"),new at(r=>{let{parent:s,element:o}=e,n=s.getChildByName(o.id);if(!n){console.warn(`Container with id ${o.id} not found`);return}return n.destroy(),()=>{n.destroy()}}));update=(t,e)=>new at(r=>{let{parent:s,prevElement:o,nextElement:n,getRendererByElement:a,transitions:c=[],getTransitionByType:l,eventHandler:h}=e,u=s.getChildByName(o.id);if(!u){console.warn(`Container with id ${o.id} not found`);return}if(n.x!==void 0&&n.x!==o.x&&(u.x=n.x),n.y!==void 0&&n.y!==o.y&&(u.y=n.y),n.direction){let _=n.gap||0,y,b;n.direction==="horizontal"?(y=n.children.reduce((P,S)=>P+S.width+_,0),b=n.children.reduce((P,S)=>Math.max(P,S.height||0),0)):n.direction==="vertical"&&(y=n.children.reduce((P,S)=>Math.max(P,S.width||0),0),b=n.children.reduce((P,S)=>P+S.height+_,0));let v=kT[n.anchor||Te.TopLeft];n.direction==="horizontal"?this.layoutChildren({element:n,anchor:v,totalWidth:y,totalHeight:b,gap:_,direction:"horizontal",scroll:n.scroll}):n.direction==="vertical"&&this.layoutChildren({element:n,anchor:v,totalWidth:y,totalHeight:b,gap:_,direction:"vertical",scroll:n.scroll});let T=u.children.find(P=>P.label===`${n.id}-container-background`);if(T){T.destroy();let P=this.createContainerGraphic(n,y,b,v);P.label=`${n.id}-container-background`,u.addChildAt(P,0)}o.scroll!==n.scroll&&this.setupScrolling({container:u,element:n,totalHeight:b,totalWidth:y,eventHandler:h,sliderRef:{}})}let d=[],{toAddElements:f,toUpdateElements:m,toDeleteElements:g}=cc(o.children,n.children);for(let _ of g){let y=a(_);d.push(y.remove(t,{parent:u,element:_,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let _ of f){let y=a(_);d.push(y.add(t,{parent:u,element:_,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let _ of m){let y=a(_.next);d.push(y.update(t,{parent:u,prevElement:_.prev,nextElement:_.next,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}return u.children.sort((_,y)=>{let b=n.children?.findIndex(T=>T.id===_.label),v=n.children?.findIndex(T=>T.id===y.label);return b-v}),this._currentSubscription=te(d).pipe(jt(_=>_),qo(()=>{r.complete()})).subscribe({error:_=>{r.error(_),console.error("Error:",_)}}),()=>{this._currentSubscription?.unsubscribe()}});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,g=c?e.x:e.y,_=c?e.y:e.x;if(!a&&t[u]!==void 0&&t[u]<f){let b=0,v=0,T=0,P=0;(t.children||[]).forEach((S,E)=>{b>0&&b+S[u]>t[u]&&(this.alignRowElements(t.children.slice(P,E),l,g,t[u]),b=0,v+=T+o,T=0,P=E),S[l]=b,S[h]=v,b+=S[u]+o,T=Math.max(T,S[d]||0)}),P<t.children.length&&this.alignRowElements(t.children.slice(P),l,g,t[u])}else{if(g===0){let b=0;(t.children||[]).forEach(v=>{v[l]=b,b+=v[u]+o})}else if(g===1){let b=-f;(t.children||[]).forEach(v=>{v[l]=b,b+=v[u]+o})}else if(g===.5){let b=-f/2;(t.children||[]).forEach(v=>{v[l]=b,b+=v[u]+o})}_===0?(t.children||[]).forEach(b=>{b[h]=0}):_===.5?(t.children||[]).forEach(b=>{b[h]=-m/2}):_===1&&(t.children||[]).forEach(b=>{b[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 Wt().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),o}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 Wt().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 g=m.deltaX!==0?m.deltaX:m.deltaY;if(h-g>0||h-g<d)return;h-=g,t.x-=g,f.x+=g}})}}};var vP={linear:i=>i},TP=(i,t,e,r)=>i+(t-i)*vP[r](e);function IT(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 FT(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 SP=(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=TP(c,u,d,l);break}else t>h&&(o=u)}return o};function wP(i){return Math.max.apply(null,i)}var Cd=class{static rendererName="pixi";rendererName="pixi";transitionType="keyframes";_transition=(t,e,r)=>(console.log("keyframe transition setup"),new at(s=>{console.log("keyframe transition start");let{animationProperties:o}=r,n=Array.isArray(o)?o:Object.entries(o).map(([d,f])=>({...f,property:d})),a=n.map(d=>d.keyframes.reduce((f,m)=>f+m.duration||0,0)),c=wP(a),l=0,h={};n.forEach(d=>{h[d.property]=IT(e,d.property)});let u=d=>{if(l+=d.deltaMS,l>=c){t.ticker.remove(u),s.complete();return}let f={};n.forEach(m=>{let g=[];m.initialValue!==void 0?g=[{value:m.initialValue,duration:0}]:g=[{value:h[m.property],duration:0}],g=g.concat(m.keyframes),FT(f,m.property,SP(g,l))}),n.forEach(m=>{let{property:g}=m;e&&!e.destroyed&&FT(e,g,IT(f,g))})};return t.ticker.add(u),()=>{t.ticker.remove(u),u({deltaMS:c-l})}}));add=(t,e,r)=>this._transition(t,e,r);remove=(t,e,r)=>this._transition(t,e,r)};var Md=class{static rendererName="pixi";rendererName="pixi";rendererType="rect";add=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n,eventHandler:a}=e,c=new Wt;c.label=s.id,s.x!==void 0&&(c.x=s.x),s.y!==void 0&&(c.y=s.y),s.alpha!==void 0&&(c.alpha=s.alpha),s.scaleX!==void 0&&(c.scale.x=s.scaleX),s.scaleY!==void 0&&(c.scale.y=s.scaleY),s.rotation!==void 0&&(c.rotation=s.rotation*Math.PI/180);let l=s.width,h=s.height;c.rect(0,0,l,h),c.fill(s.fill),s.anchorX!==void 0&&(c.pivot.x=l*s.anchorX),s.anchorY!==void 0&&(c.pivot.y=h*s.anchorY),(s.clickEventName||s.rightClickEventName)&&a&&(c.eventMode="static",c.on("pointerup",d=>{d.button===0?a(s.clickEventName):d.button===2&&a(s.rightClickEventName)})),s.wheelEventName&&a&&(c.eventMode="static",c.on("wheel",d=>{a(s.wheelEventName,{deltaY:d.deltaY})}));let u=[];for(let d of o)if(d.elementId===s.id&&d.event===Vt.Add){let f=n(d.type);if(!f)throw new Error(`Transition class not found for type ${d.type}`);u.push(f.add(t,c,d))}r.addChild(c),await Promise.all(u)};remove=async(t,e)=>{let{parent:r,element:s}=e,o=r.getChildByName(s.id);if(!o)throw new Error(`Sprite with id ${s.id} not found`);o.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e;if(!r.getChildByName(s.id))throw new Error(`Container with id ${s.id} not found`);JSON.stringify(s)!==JSON.stringify(o)&&await Promise.all([this.remove(t,{parent:r,element:s,transitions:n,getTransitionByType:a,eventHandler:c}),this.add(t,{parent:r,element:o,transitions:n,getTransitionByType:a,eventHandler:c})])}};var Bd=class extends fr{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:g,initialValue:_}=r,y={horizontal:{axis:"x",size:"width"},vertical:{axis:"y",size:"height"}},b=y[c].axis,v=y[c].size,T=A.from(l),P=A.from(h),S=A.from(u),E=A.from(d),C=new Lt({texture:S,anchor:{x:0,y:0}});C.label=r.id;let I=C[v];C.x=r.x||0,C.y=r.y||0;let M=new Lt({texture:T,anchor:{x:.5,y:.5}});if(M.y=C.height/2,M.x=C.width/2,M.eventMode="static",M.cursor="pointer",C.eventMode="static",C.cursor="pointer",M.on("pointerdown",Y).on("pointerup",mt).on("pointerupoutside",mt),C.on("pointerdown",k).on("pointerup",L).on("pointerupoutside",L),C.addChild(M),_!==void 0){let F=M[v]/2;M[b]=_/100*(I-M[v])+F}function k(F){M.texture=P,C.texture=E,$t(F),t.stage.eventMode="static",t.stage.addEventListener("pointermove",$t)}function L(F){M.texture=T,C.texture=S,$t(F),t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",$t)}function Y(F){F.stopPropagation(),M.texture=P,C.texture=E,t.stage.eventMode="static",t.stage.addEventListener("pointermove",$t)}function mt(F){if(M.texture=T,C.texture=S,t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",$t),f){let Se=C.toLocal(F.global)[b],q=M[v]/2;M[b]=Math.max(0+q,Math.min(Se,I-q));let ee=Math.floor((M[b]-q)/(I-M[v])*100),Oe=JSON.stringify(g);n&&n(f,JSON.parse(Oe.replace('"{{ value }}"',String(ee))))}}function $t(F){let Se=C.toLocal(F.global)[b],q=M[v]/2;M[b]=Math.max(0+q,Math.min(Se,I-q));let ee=Math.floor((M[b]-q)/(I-M[v])*100);if(m){let Oe=JSON.stringify(g);n&&n(m,JSON.parse(Oe.replace('"{{ value }}"',String(ee))))}return ee}a&&(a.current={updateValue:F=>{let Se=M[v]/2;M[b]=F/100*(I-M[v])+Se}});let N=[];for(let F of s)if(F.elementId===r.id&&F.event===Vt.Add){let Se=o(F.type);if(!Se)throw new Error(`Transition class not found for type ${F.type}`);N.push(Se.add(t,C,F))}e.addChild(C),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===Vt.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 Rd=class extends fr{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 Gd=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)}},EP=()=>new Gd;var y7=GT;export{Rd as AudioPlugin,Ad as ContainerRendererPlugin,Cd as KeyframeTransitionPlugin,Md as RectRendererPlugin,Bd as SliderRendererPlugin,wd as SpriteRendererPlugin,Ed as TextRendererPlugin,Pd as TextRevealingRendererPlugin,EP as createAssetBufferManager,y7 as default};
1142
+ `):"",this.name="UnsubscriptionError",this.errors=e}});function gd(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var uc=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,r,s,o;if(!this.closed){this.closed=!0;var n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=Lr(n),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(g){t={error:g}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else n.remove(this);var h=this.initialTeardown;if(et(h))try{h()}catch(g){o=g instanceof hc?g.errors:[g]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var d=Lr(u),f=d.next();!f.done;f=d.next()){var m=f.value;try{fT(m)}catch(g){o=o??[],g instanceof hc?o=Xi(Xi([],ji(o)),ji(g.errors)):o.push(g)}}}catch(g){r={error:g}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}if(o)throw new hc(o)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)fT(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&gd(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&gd(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}();var $Y=uc.EMPTY;function dc(i){return i instanceof uc||i&&"closed"in i&&et(i.remove)&&et(i.add)&&et(i.unsubscribe)}function fT(i){et(i)?i():i.unsubscribe()}var ve={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var $i={setTimeout:function(i,t){for(var e=[],r=2;r<arguments.length;r++)e[r-2]=arguments[r];var s=$i.delegate;return s?.setTimeout?s.setTimeout.apply(s,Xi([i,t],ji(e))):setTimeout.apply(void 0,Xi([i,t],ji(e)))},clearTimeout:function(i){var t=$i.delegate;return(t?.clearTimeout||clearTimeout)(i)},delegate:void 0};function fc(i){$i.setTimeout(function(){var t=ve.onUnhandledError;if(t)t(i);else throw i})}function xd(){}var pT=function(){return _d("C",void 0,void 0)}();function mT(i){return _d("E",void 0,i)}function gT(i){return _d("N",i,void 0)}function _d(i,t,e){return{kind:i,value:t,error:e}}var Hr=null;function xT(i){if(ve.useDeprecatedSynchronousErrorHandling){var t=!Hr;if(t&&(Hr={errorThrown:!1,error:null}),i(),t){var e=Hr,r=e.errorThrown,s=e.error;if(Hr=null,r)throw s}}else i()}function _T(i){ve.useDeprecatedSynchronousErrorHandling&&Hr&&(Hr.errorThrown=!0,Hr.error=i)}var Yo=function(i){$o(t,i);function t(e){var r=i.call(this)||this;return r.isStopped=!1,e?(r.destination=e,dc(e)&&e.add(r)):r.destination=nP,r}return t.create=function(e,r,s){return new mc(e,r,s)},t.prototype.next=function(e){this.isStopped?bd(gT(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?bd(mT(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?bd(pT,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(uc);var iP=Function.prototype.bind;function yd(i,t){return iP.call(i,t)}var sP=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(r){pc(r)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(r){pc(r)}else pc(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){pc(e)}},i}(),mc=function(i){$o(t,i);function t(e,r,s){var o=i.call(this)||this,n;if(et(e)||!e)n={next:e??void 0,error:r??void 0,complete:s??void 0};else{var a;o&&ve.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return o.unsubscribe()},n={next:e.next&&yd(e.next,a),error:e.error&&yd(e.error,a),complete:e.complete&&yd(e.complete,a)}):n=e}return o.destination=new sP(n),o}return t}(Yo);function pc(i){ve.useDeprecatedSynchronousErrorHandling?_T(i):fc(i)}function oP(i){throw i}function bd(i,t){var e=ve.onStoppedNotification;e&&$i.setTimeout(function(){return e(i,t)})}var nP={closed:!0,next:xd,error:oP,complete:xd};var Yi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function yT(i){return i}function bT(i){return i.length===0?yT:i.length===1?i[0]:function(e){return i.reduce(function(r,s){return s(r)},e)}}var at=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,r){var s=this,o=cP(t)?t:new mc(t,e,r);return xT(function(){var n=s,a=n.operator,c=n.source;o.add(a?a.call(o,c):c?s._subscribe(o):s._trySubscribe(o))}),o},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var r=this;return e=vT(e),new e(function(s,o){var n=new mc({next:function(a){try{t(a)}catch(c){o(c),n.unsubscribe()}},error:o,complete:s});r.subscribe(n)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[Yi]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return bT(t)(this)},i.prototype.toPromise=function(t){var e=this;return t=vT(t),new t(function(r,s){var o;e.subscribe(function(n){return o=n},function(n){return s(n)},function(){return r(o)})})},i.create=function(t){return new i(t)},i}();function vT(i){var t;return(t=i??ve.Promise)!==null&&t!==void 0?t:Promise}function aP(i){return i&&et(i.next)&&et(i.error)&&et(i.complete)}function cP(i){return i&&i instanceof Yo||aP(i)&&dc(i)}function lP(i){return et(i?.lift)}function Fe(i){return function(t){if(lP(t))return t.lift(function(e){try{return i(e,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Wr(i,t,e,r,s){return new hP(i,t,e,r,s)}var hP=function(i){$o(t,i);function t(e,r,s,o,n,a){var c=i.call(this,e)||this;return c.onFinalize=n,c.shouldUnsubscribe=a,c._next=r?function(l){try{r(l)}catch(h){e.error(h)}}:i.prototype._next,c._error=o?function(l){try{o(l)}catch(h){e.error(h)}finally{this.unsubscribe()}}:i.prototype._error,c._complete=s?function(){try{s()}catch(l){e.error(l)}finally{this.unsubscribe()}}:i.prototype._complete,c}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;i.prototype.unsubscribe.call(this),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}(Yo);var gc=function(i){return i&&typeof i.length=="number"&&typeof i!="function"};function xc(i){return et(i?.then)}function _c(i){return et(i[Yi])}function yc(i){return Symbol.asyncIterator&&et(i?.[Symbol.asyncIterator])}function bc(i){return new TypeError("You provided "+(i!==null&&typeof i=="object"?"an invalid object":"'"+i+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function uP(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var vc=uP();function Tc(i){return et(i?.[vc])}function Sc(i){return hT(this,arguments,function(){var e,r,s,o;return lc(this,function(n){switch(n.label){case 0:e=i.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,Nr(e.read())];case 3:return r=n.sent(),s=r.value,o=r.done,o?[4,Nr(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,Nr(s)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function wc(i){return et(i?.getReader)}function Ue(i){if(i instanceof at)return i;if(i!=null){if(_c(i))return dP(i);if(gc(i))return fP(i);if(xc(i))return pP(i);if(yc(i))return TT(i);if(Tc(i))return mP(i);if(wc(i))return gP(i)}throw bc(i)}function dP(i){return new at(function(t){var e=i[Yi]();if(et(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function fP(i){return new at(function(t){for(var e=0;e<i.length&&!t.closed;e++)t.next(i[e]);t.complete()})}function pP(i){return new at(function(t){i.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,fc)})}function mP(i){return new at(function(t){var e,r;try{for(var s=Lr(i),o=s.next();!o.done;o=s.next()){var n=o.value;if(t.next(n),t.closed)return}}catch(a){e={error:a}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}t.complete()})}function TT(i){return new at(function(t){xP(i,t).catch(function(e){return t.error(e)})})}function gP(i){return TT(Sc(i))}function xP(i,t){var e,r,s,o;return lT(this,void 0,void 0,function(){var n,a;return lc(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),e=uT(i),c.label=1;case 1:return[4,e.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(n=r.value,t.next(n),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),s={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=e.return)?[4,o.call(e)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function fe(i,t,e,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var o=t.schedule(function(){e(),s?i.add(this.schedule(null,r)):this.unsubscribe()},r);if(i.add(o),!s)return o}function Ec(i,t){return t===void 0&&(t=0),Fe(function(e,r){e.subscribe(Wr(r,function(s){return fe(r,i,function(){return r.next(s)},t)},function(){return fe(r,i,function(){return r.complete()},t)},function(s){return fe(r,i,function(){return r.error(s)},t)}))})}function Pc(i,t){return t===void 0&&(t=0),Fe(function(e,r){r.add(i.schedule(function(){return e.subscribe(r)},t))})}function ST(i,t){return Ue(i).pipe(Pc(t),Ec(t))}function wT(i,t){return Ue(i).pipe(Pc(t),Ec(t))}function ET(i,t){return new at(function(e){var r=0;return t.schedule(function(){r===i.length?e.complete():(e.next(i[r++]),e.closed||this.schedule())})})}function PT(i,t){return new at(function(e){var r;return fe(e,t,function(){r=i[vc](),fe(e,t,function(){var s,o,n;try{s=r.next(),o=s.value,n=s.done}catch(a){e.error(a);return}n?e.complete():e.next(o)},0,!0)}),function(){return et(r?.return)&&r.return()}})}function Ac(i,t){if(!i)throw new Error("Iterable cannot be null");return new at(function(e){fe(e,t,function(){var r=i[Symbol.asyncIterator]();fe(e,t,function(){r.next().then(function(s){s.done?e.complete():e.next(s.value)})},0,!0)})})}function AT(i,t){return Ac(Sc(i),t)}function CT(i,t){if(i!=null){if(_c(i))return ST(i,t);if(gc(i))return ET(i,t);if(xc(i))return wT(i,t);if(yc(i))return Ac(i,t);if(Tc(i))return PT(i,t);if(wc(i))return AT(i,t)}throw bc(i)}function te(i,t){return t?CT(i,t):Ue(i)}function MT(i,t){return Fe(function(e,r){var s=0;e.subscribe(Wr(r,function(o){r.next(i.call(t,o,s++))}))})}function BT(i,t,e,r,s,o,n,a){var c=[],l=0,h=0,u=!1,d=function(){u&&!c.length&&!l&&t.complete()},f=function(g){return l<r?m(g):c.push(g)},m=function(g){o&&t.next(g),l++;var _=!1;Ue(e(g,h++)).subscribe(Wr(t,function(b){s?.(b),o?f(b):t.next(b)},function(){_=!0},void 0,function(){if(_)try{l--;for(var b=function(){var y=c.shift();n?fe(t,n,function(){return m(y)}):m(y)};c.length&&l<r;)b();d()}catch(y){t.error(y)}}))};return i.subscribe(Wr(t,f,function(){u=!0,d()})),function(){a?.()}}function jt(i,t,e){return e===void 0&&(e=1/0),et(t)?jt(function(r,s){return MT(function(o,n){return t(r,o,s,n)})(Ue(i(r,s)))},e):(typeof t=="number"&&(e=t),Fe(function(r,s){return BT(r,s,i,e)}))}function Ko(i){return Fe(function(t,e){try{t.subscribe(e)}finally{e.add(i)}})}var _P=i=>i.split("/").pop(),vd=class{name="advancedBufferLoader";priority=2;constructor(t){this.bufferMap=t}test(t){return!0}async load(t){let e=t.startsWith("file:")?t:_P(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 M)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new M.from(r)}async unload(t){t.destroy(!0)}},Td=class i extends nc{static rendererName="pixi";_app;_audioStage=new cc;_state={elements:[]};_eventHandler;_plugins;_currentSubscription;_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 Za,this._app.audioStage=this._audioStage,await this._app.init({width:s,height:o,backgroundColor:n});let a=new Wt;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()};loadAssets=async t=>{if(!t)throw new Error("assetBufferMap is required");let e={},r={};for(let[o,n]of Object.entries(t))n.type&&n.type.startsWith("audio/")?r[o]=n:e[o]=n;await Promise.all(Object.entries(r).map(([o,n])=>Vi.load(o,n.buffer))),this._advancedLoader?Object.assign(this._advancedLoader.bufferMap,e):(this._advancedLoader=new vd(e),be.loader.parsers.length=0,be.reset(),G.add({name:"advanced-buffer-loader",extension:x.Asset,priority:Et.High,loader:this._advancedLoader}),typeof be.registerPlugin=="function"&&be.registerPlugin(this._advancedLoader));let s=Object.keys(e);return Promise.all(s.map(o=>be.load(o)))};loadAudioAssets=async t=>Promise.all(t.map(async e=>{let s=await(await fetch(e)).arrayBuffer();return Vi.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}=ac(r.elements,s.elements),h=[];for(let u of l){let d=this._getRendererByElement(u);h.push(d.remove(t,{parent:e,element:u,transitions:s.transitions,getRendererByElement:this._getRendererByElement,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of a){let d=this._getRendererByElement(u);h.push(d.add(t,{parent:e,element:u,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of c){let d=this._getRendererByElement(u.next);h.push(d.update(t,{parent:e,prevElement:u.prev,nextElement:u.next,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}t.stage.children.sort((u,d)=>{let f=s.elements.findIndex(g=>g.id===u.label),m=s.elements.findIndex(g=>g.id===d.label);return f-m}),this._currentSubscription&&(this._currentSubscription.closed||this._currentSubscription.unsubscribe()),this._currentSubscription=te(h).pipe(jt(u=>u),Ko(()=>{o&&o("completed",{id:s.id,diffTime:Date.now()-n}),this._currentSubscription=void 0})).subscribe({error:u=>{console.error("Error:",u)}})}},RT=Td;var Sd=class extends dr{static rendererName="pixi";rendererName="pixi";rendererType="sprite";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=M.from(o.url),h,u;o.hoverUrl&&(h=M.from(o.hoverUrl)),o.clickUrl&&(u=M.from(o.clickUrl));let d=new Lt(l);d.label=o.id,(o.eventName||o.hoverUrl||o.clickUrl)&&(d.cursor="pointer",d.eventMode="static"),o.anchorX!==void 0&&(d.pivot.x=d.width*o.anchorX,console.log("sprite.width",d.width)),o.anchorY!==void 0&&(d.pivot.y=d.height*o.anchorY,console.log("sprite.height",d.height)),o.scaleX!==void 0&&(d.scale.x=o.scaleX),o.scaleY!==void 0&&(d.scale.y=o.scaleY),o.rotation!==void 0&&(d.rotation=o.rotation*Math.PI/180),o.x!==void 0&&(d.x=o.x),o.y!==void 0&&(d.y=o.y),o.width!==void 0&&(d.width=o.width),o.height!==void 0&&(d.height=o.height),o.zIndex!==void 0&&(d.zIndex=o.zIndex),o.alpha!==void 0&&(d.alpha=o.alpha),d.on("pointerup",()=>{d.texture=l}).on("pointerupoutside",()=>{d.texture=l}).on("pointerleave",()=>{d.texture=l}),u&&d.on("pointerdown",()=>{d.texture=u}),h&&d.on("pointerenter",()=>{d.texture=h}),d.on("pointerup",g=>{g.stopPropagation();let _=g.button;_===0?c&&c(o.eventName,o.eventPayload):_===2&&(o.rightClickEventName&&c?c(o.rightClickEventName):t.stage.emit("rightclick",event))});let f=[];for(let g of n)if(g.elementId===o.id&&g.event===Vt.Add){let _=a(g.type);if(!_)throw new Error(`Transition class not found for type ${g.type}`);f.push(_.add(t,d,g))}s.addChild(d);let m=te(f).pipe(jt(g=>g)).subscribe({error:g=>{console.error("Error:",g)},complete:()=>r.complete()});return()=>{m.unsubscribe()}});remove=(t,e)=>new at(r=>{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 u of n)if(u.elementId===o.id&&u.event===Vt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=te(l).pipe(jt(u=>u)).subscribe({error:u=>{console.error("Error:",u)},complete:()=>{r.complete(),c&&c.destroy()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>new at(c=>{let l=e.getChildByName(r.id);if(!l)throw new Error(`Sprite with id ${r.id} not found`);if(JSON.stringify(r)!==JSON.stringify(s)){let h=[this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a}),this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n})],u=te(h).pipe(jt(d=>d)).subscribe({error:d=>{console.error("Error:",d)},complete:()=>c.complete()});return()=>{u.unsubscribe()}}else s.x!==void 0&&(l.x=s.x),s.y!==void 0&&(l.y=s.y),s.width!==void 0&&s.width!==r.width&&(l.width=s.width),s.height!==void 0&&s.height!==r.height&&(l.height=s.height),s.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),c.complete();return()=>{}})};var Cc=(i,t=!1)=>new St({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}),wd=class{static rendererName="pixi";rendererName="pixi";rendererType="text";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=Cc(o.style),h=new ur({text:o.text,style:l}),u;o.hoverStyle&&(u=Cc(o.hoverStyle));let d;if(o.clickedStyle&&(d=Cc(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.xa!==void 0&&(h.anchor.x=o.xa),o.ya!==void 0&&(h.anchor.y=o.ya),o.xa!==void 0||o.ya!==void 0){let g=h.getLocalBounds();h.hitArea=new z(-g.width*h.anchor.x,-g.height*h.anchor.y,g.width,g.height)}h.on("pointerupoutside",()=>{h.style=l}).on("pointerup",()=>{h.style=l}).on("pointerleave",()=>{h.style=l}),h.on("pointerup",g=>{o.clickSoundUrl&&t.soundStage&&t.soundStage.add({id:`${o.id}-click-${Math.random()}`,url:o.clickSoundUrl,loop:!1,volume:o.clickSoundVolume??50/100}),g.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 g of n)if(g.elementId===o.id&&g.event===Vt.Add){let _=a(g.type);if(!_)throw new Error(`Transition class not found for type ${g.type}`);f.push(_.add(t,h,g))}s.addChild(h);let m=te(f).pipe(jt(g=>g)).subscribe({error:g=>{console.error("Error:",g),r.error(g)},complete:()=>r.complete()});return()=>{m.unsubscribe()}});remove=(t,e)=>new at(r=>{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`),r.complete();return}let l=[];for(let u of n)if(u.elementId===o.id&&u.event===Vt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=te(l).pipe(jt(u=>u)).subscribe({error:u=>{console.error("Error:",u),r.error(u)},complete:()=>{c.destroy(),r.complete()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,e)=>new at(r=>{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`),r.complete();return}if(JSON.stringify(o)!==JSON.stringify(n)){let u=[this.add(t,{parent:s,element:n,transitions:a,getTransitionByType:c,eventHandler:l}),this.remove(t,{parent:s,element:o,transitions:a,getTransitionByType:c})],d=te(u).pipe(jt(f=>f)).subscribe({error:f=>{console.error("Error:",f),r.error(f)},complete:()=>r.complete()});return()=>{d.unsubscribe()}}else o.text!==n.text&&(h.text=n.text),JSON.stringify(o.style)!==JSON.stringify(n.style)&&(h.style=Cc(n?.style)),n.x!==void 0&&(h.x=n.x),n.y!==void 0&&(h.y=n.y),r.complete();return()=>{}})};var Ki=(i,t=!1)=>new St({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}),Ed=class{static rendererName="pixi";rendererName="pixi";rendererType="text-revealing";add=async(t,{parent:e,element:r})=>{let s=Ki(r.style,r.text),o=new ur({text:"",style:s});o.label=r.id,o.text_id=r.text;let n=new nt;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 w={...S.style,wordWrapWidth:a-u},A=At.measureText(S.text,Ki(w));A.lineHeight>f&&(f=A.lineHeight);let I=At.measureText("a",Ki(w)),R=At.measureText("a a",Ki(w)).width-I.width*2;if(A.lineWidths[0]+u>a){u=0,l.push({lineParts:h,y:d}),d+=f,f=0,h=[];continue}let F=A.lines[0],j=A.lines.slice(1).join(" "),mt={text:F,style:w,x:u,y:0};if(h.push(mt),j&&j.length>0?S.text=j:c.shift(),!(!F||F.length===0)){if(S.furigana){let Xt=At.measureText(S.furigana.text,Ki(S.furigana.style)),N={text:S.furigana.text,style:S.furigana.style,x:u+(A.width-Xt.width)/2,y:-10};h.push(N)}u+=A.lineWidths[0]+R}}l.forEach(S=>{let w=new nt;w.y=S.y,w.alpha=0,S.lineParts.forEach(A=>{let I=new ur({text:A.text,style:Ki(A.style),x:A.x,y:A.y});w.addChild(I)}),n.addChild(w)});let m=new Wt,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),T=new Lt(y);T.x=-1.35*_-b,t.stage.addChild(T);let v=0,P=1;if(l.length!==0){if(r.displaySpeed===100||r.hasEnded){n.children.forEach(S=>{t.stage.removeChild(T),S.mask=null,S.alpha=1});return}await new Promise(S=>{let w=A=>{if(P>n.children.length){S();return}n.getChildAt(P).mask||(n.getChildAt(P).mask=T,n.getChildAt(P).alpha=1),v+=A.deltaMS;let C=(r.displaySpeed||50)/1e3;T.x+=C*v,T.x>=0&&(n.getChildAt(P).mask=null,T.x=-1.35*_-b,P=P+1,v=0,P>=n.children.length&&(n.getChildAt(P-1).mask=null,t.ticker.remove(w),S()))};t.ticker.add(w)})}};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===Vt.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 Pd=class{static rendererName="pixi";rendererName="pixi";rendererType="container";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,getRendererByElement:c,eventHandler:l}=e,h=structuredClone(o),u=new nt;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(v=>{u.on(v,P=>{P.stopPropagation();for(let S of u.children)S.emit(v)})}));let f=h.gap||0,m=new Wt().roundRect(0,0,h.width||0,h.height||0,1).fill(h.fill?h.fill.color:"transparent");if(h.direction){let v,P;h.direction==="horizontal"?(v=h.children.reduce((C,R)=>C+R.width+f,0),P=h.children.reduce((C,R)=>Math.max(C,R.height||0),0)):h.direction==="vertical"&&(v=h.children.reduce((C,R)=>Math.max(C,R.width||0),0),P=h.children.reduce((C,R)=>C+R.height+f,0));let S=[0,.5,1],w=h.anchorX??0,A=h.anchorY??0;if(!S.includes(w))throw new Error(`Invalid anchorX value: ${w}. Must be 0, 0.5, or 1`);if(!S.includes(A))throw new Error(`Invalid anchorY value: ${A}. Must be 0, 0.5, or 1`);let I={x:w,y:A};h.direction==="horizontal"?this.layoutChildren({element:h,anchor:I,totalWidth:v,totalHeight:P,gap:f,direction:"horizontal",scroll:h.scroll}):h.direction==="vertical"&&this.layoutChildren({element:h,anchor:I,totalWidth:v,totalHeight:P,gap:f,direction:"vertical",scroll:h.scroll}),this.setupScrolling({container:u,element:h,totalHeight:P,totalWidth:v,eventHandler:l,sliderRef:d}),m=this.createContainerGraphic(h,v,P,I)}m.label=`${h.id}-container-background`,u.addChild(m);let g=[];(h.children||[]).forEach(v=>{let P=c(v);g.push(P.add(t,{parent:u,element:{zIndex:h.zIndex,...v},transitions:n,getTransitionByType:a,getRendererByElement:c,eventHandler:l}))});let _=[];for(let v of n)if(v.elementId===h.id&&v.event===Vt.Add){let P=a(v.type);if(!P)throw new Error(`Transition class not found for type ${v.type}`);_.push(P.add(t,u,v))}let b=(h.anchorX??0)*(h.width||0),y=(h.anchorY??0)*(h.height||0);u.pivot.x=b,u.pivot.y=y,s.addChild(u);let T=te(g).pipe(jt(v=>v)).subscribe({error:v=>{console.error("Error:",v)},complete:()=>{console.log("complete"),r.complete()}});return()=>{T.unsubscribe()}});remove=(t,e)=>(console.log("remove container 11111111111"),new at(r=>{let{parent:s,element:o}=e,n=s.getChildByName(o.id);if(!n){console.warn(`Container with id ${o.id} not found`);return}return n.destroy(),()=>{n.destroy()}}));update=(t,e)=>new at(r=>{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=(d.anchorX??0)*(d.width||0),g=(d.anchorY??0)*(d.height||0);if(f.pivot.x=m,f.pivot.y=g,d.direction){let v=d.gap||0,P,S;d.direction==="horizontal"?(P=d.children.reduce((F,j)=>F+j.width+v,0),S=d.children.reduce((F,j)=>Math.max(F,j.height||0),0)):d.direction==="vertical"&&(P=d.children.reduce((F,j)=>Math.max(F,j.width||0),0),S=d.children.reduce((F,j)=>F+j.height+v,0));let w=[0,.5,1],A=d.anchorX??0,I=d.anchorY??0;if(!w.includes(A))throw new Error(`Invalid anchorX value: ${A}. Must be 0, 0.5, or 1`);if(!w.includes(I))throw new Error(`Invalid anchorY value: ${I}. Must be 0, 0.5, or 1`);let C={x:A,y:I};d.direction==="horizontal"?this.layoutChildren({element:d,anchor:C,totalWidth:P,totalHeight:S,gap:v,direction:"horizontal",scroll:d.scroll}):d.direction==="vertical"&&this.layoutChildren({element:d,anchor:C,totalWidth:P,totalHeight:S,gap:v,direction:"vertical",scroll:d.scroll});let R=f.children.find(F=>F.label===`${d.id}-container-background`);if(R){R.destroy();let F=this.createContainerGraphic(d,P,S,C);F.label=`${d.id}-container-background`,f.addChildAt(F,0)}u.scroll!==d.scroll&&this.setupScrolling({container:f,element:d,totalHeight:S,totalWidth:P,eventHandler:h,sliderRef:{}})}let _=[],{toAddElements:b,toUpdateElements:y,toDeleteElements:T}=ac(u.children,d.children);for(let v of T){let P=a(v);_.push(P.remove(t,{parent:f,element:v,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let v of b){let P=a(v);_.push(P.add(t,{parent:f,element:v,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let v of y){let P=a(v.next);_.push(P.update(t,{parent:f,prevElement:v.prev,nextElement:v.next,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}return f.children.sort((v,P)=>{let S=d.children?.findIndex(A=>A.id===v.label),w=d.children?.findIndex(A=>A.id===P.label);return S-w}),this._currentSubscription=te(_).pipe(jt(v=>v),Ko(()=>{r.complete()})).subscribe({error:v=>{r.error(v),console.error("Error:",v)}}),()=>{this._currentSubscription?.unsubscribe()}});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,g=c?e.x:e.y,_=c?e.y:e.x;if(!a&&t[u]!==void 0&&t[u]<f){let y=0,T=0,v=0,P=0;(t.children||[]).forEach((S,w)=>{y>0&&y+S[u]>t[u]&&(this.alignRowElements(t.children.slice(P,w),l,g,t[u]),y=0,T+=v+o,v=0,P=w),S[l]=y,S[h]=T,y+=S[u]+o,v=Math.max(v,S[d]||0)}),P<t.children.length&&this.alignRowElements(t.children.slice(P),l,g,t[u])}else{if(g===0){let y=0;(t.children||[]).forEach(T=>{T[l]=y,y+=T[u]+o})}else if(g===1){let y=-f;(t.children||[]).forEach(T=>{T[l]=y,y+=T[u]+o})}else if(g===.5){let y=-f/2;(t.children||[]).forEach(T=>{T[l]=y,y+=T[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 Wt().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}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 Wt().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 g=m.deltaX!==0?m.deltaX:m.deltaY;if(h-g>0||h-g<d)return;h-=g,t.x-=g,f.x+=g}})}}};var yP={linear:i=>i},bP=(i,t,e,r)=>i+(t-i)*yP[r](e);function GT(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 kT(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 vP=(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=bP(c,u,d,l);break}else t>h&&(o=u)}return o};function TP(i){return Math.max.apply(null,i)}var Ad=class{static rendererName="pixi";rendererName="pixi";transitionType="keyframes";_transition=(t,e,r)=>(console.log("keyframe transition setup"),new at(s=>{console.log("keyframe transition start");let{animationProperties:o}=r,n=Array.isArray(o)?o:Object.entries(o).map(([d,f])=>({...f,property:d})),a=n.map(d=>d.keyframes.reduce((f,m)=>f+m.duration||0,0)),c=TP(a),l=0,h={};n.forEach(d=>{h[d.property]=GT(e,d.property)});let u=d=>{if(l+=d.deltaMS,l>=c){t.ticker.remove(u),s.complete();return}let f={};n.forEach(m=>{let g=[];m.initialValue!==void 0?g=[{value:m.initialValue,duration:0}]:g=[{value:h[m.property],duration:0}],g=g.concat(m.keyframes),kT(f,m.property,vP(g,l))}),n.forEach(m=>{let{property:g}=m;e&&!e.destroyed&&kT(e,g,GT(f,g))})};return t.ticker.add(u),()=>{t.ticker.remove(u),u({deltaMS:c-l})}}));add=(t,e,r)=>this._transition(t,e,r);remove=(t,e,r)=>this._transition(t,e,r)};var Cd=class{static rendererName="pixi";rendererName="pixi";rendererType="rect";add=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n,eventHandler:a}=e,c=new Wt;c.label=s.id,s.x!==void 0&&(c.x=s.x),s.y!==void 0&&(c.y=s.y),s.alpha!==void 0&&(c.alpha=s.alpha),s.scaleX!==void 0&&(c.scale.x=s.scaleX),s.scaleY!==void 0&&(c.scale.y=s.scaleY),s.rotation!==void 0&&(c.rotation=s.rotation*Math.PI/180);let l=s.width,h=s.height;c.rect(0,0,l,h),c.fill(s.fill),s.anchorX!==void 0&&(c.pivot.x=l*s.anchorX),s.anchorY!==void 0&&(c.pivot.y=h*s.anchorY),(s.clickEventName||s.rightClickEventName)&&a&&(c.eventMode="static",c.on("pointerup",d=>{d.button===0?a(s.clickEventName):d.button===2&&a(s.rightClickEventName)})),s.wheelEventName&&a&&(c.eventMode="static",c.on("wheel",d=>{a(s.wheelEventName,{deltaY:d.deltaY})}));let u=[];for(let d of o)if(d.elementId===s.id&&d.event===Vt.Add){let f=n(d.type);if(!f)throw new Error(`Transition class not found for type ${d.type}`);u.push(f.add(t,c,d))}r.addChild(c),await Promise.all(u)};remove=async(t,e)=>{let{parent:r,element:s}=e,o=r.getChildByName(s.id);if(!o)throw new Error(`Sprite with id ${s.id} not found`);o.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e;if(!r.getChildByName(s.id))throw new Error(`Container with id ${s.id} not found`);JSON.stringify(s)!==JSON.stringify(o)&&await Promise.all([this.remove(t,{parent:r,element:s,transitions:n,getTransitionByType:a,eventHandler:c}),this.add(t,{parent:r,element:o,transitions:n,getTransitionByType:a,eventHandler:c})])}};var Md=class extends dr{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:g,initialValue:_}=r,b={horizontal:{axis:"x",size:"width"},vertical:{axis:"y",size:"height"}},y=b[c].axis,T=b[c].size,v=M.from(l),P=M.from(h),S=M.from(u),w=M.from(d),A=new Lt({texture:S,anchor:{x:0,y:0}});A.label=r.id;let I=A[T];A.x=r.x||0,A.y=r.y||0;let C=new Lt({texture:v,anchor:{x:.5,y:.5}});if(C.y=A.height/2,C.x=A.width/2,C.eventMode="static",C.cursor="pointer",A.eventMode="static",A.cursor="pointer",C.on("pointerdown",j).on("pointerup",mt).on("pointerupoutside",mt),A.on("pointerdown",R).on("pointerup",F).on("pointerupoutside",F),A.addChild(C),_!==void 0){let U=C[T]/2;C[y]=_/100*(I-C[T])+U}function R(U){C.texture=P,A.texture=w,Xt(U),t.stage.eventMode="static",t.stage.addEventListener("pointermove",Xt)}function F(U){C.texture=v,A.texture=S,Xt(U),t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",Xt)}function j(U){U.stopPropagation(),C.texture=P,A.texture=w,t.stage.eventMode="static",t.stage.addEventListener("pointermove",Xt)}function mt(U){if(C.texture=v,A.texture=S,t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",Xt),f){let Te=A.toLocal(U.global)[y],q=C[T]/2;C[y]=Math.max(0+q,Math.min(Te,I-q));let ee=Math.floor((C[y]-q)/(I-C[T])*100),De=JSON.stringify(g);n&&n(f,JSON.parse(De.replace('"{{ value }}"',String(ee))))}}function Xt(U){let Te=A.toLocal(U.global)[y],q=C[T]/2;C[y]=Math.max(0+q,Math.min(Te,I-q));let ee=Math.floor((C[y]-q)/(I-C[T])*100);if(m){let De=JSON.stringify(g);n&&n(m,JSON.parse(De.replace('"{{ value }}"',String(ee))))}return ee}a&&(a.current={updateValue:U=>{let Te=C[T]/2;C[y]=U/100*(I-C[T])+Te}});let N=[];for(let U of s)if(U.elementId===r.id&&U.event===Vt.Add){let Te=o(U.type);if(!Te)throw new Error(`Transition class not found for type ${U.type}`);N.push(Te.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===Vt.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 Bd=class extends dr{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 Rd=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)}},SP=()=>new Rd;var m7=RT;export{Bd as AudioPlugin,Pd as ContainerRendererPlugin,Ad as KeyframeTransitionPlugin,Cd as RectRendererPlugin,Md as SliderRendererPlugin,Sd as SpriteRendererPlugin,wd as TextRendererPlugin,Ed as TextRevealingRendererPlugin,SP as createAssetBufferManager,m7 as default};