route-graphics 1.5.1 → 1.5.2

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 KF=Object.create;var fp=Object.defineProperty;var ZF=Object.getOwnPropertyDescriptor;var QF=Object.getOwnPropertyNames;var JF=Object.getPrototypeOf,tk=Object.prototype.hasOwnProperty;var y=(r,t)=>()=>(r&&(t=r(r=0)),t);var Z=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ab=(r,t)=>{for(var e in t)fp(r,e,{get:t[e],enumerable:!0})},ek=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of QF(t))!tk.call(r,s)&&s!==e&&fp(r,s,{get:()=>t[s],enumerable:!(i=ZF(t,s))||i.enumerable});return r};var ls=(r,t,e)=>(e=r!=null?KF(JF(r)):{},ek(t||!r||!r.__esModule?fp(e,"default",{value:r,enumerable:!0}):e,r));var E,pp,ah,D,F=y(()=>{"use strict";E=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(E||{}),pp=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},ah=(r,t)=>pp(r).priority??t,D={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(pp).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(pp).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(o=>o.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((o,n)=>ah(n.value,e)-ah(o.value,e)))},i=>{let s=t.findIndex(o=>o.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>ah(o,e)-ah(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})},mixin(r,...t){for(let e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}}});var cb=Z((q3,mp)=>{"use strict";var ik=Object.prototype.hasOwnProperty,Be="~";function Jn(){}Object.create&&(Jn.prototype=Object.create(null),new Jn().__proto__||(Be=!1));function sk(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function lb(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new sk(e,i||r,s),n=Be?Be+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function lh(r,t){--r._eventsCount===0?r._events=new Jn:delete r._events[t]}function Ee(){this._events=new Jn,this._eventsCount=0}Ee.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)ik.call(e,i)&&t.push(Be?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Ee.prototype.listeners=function(t){var e=Be?Be+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Ee.prototype.listenerCount=function(t){var e=Be?Be+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Ee.prototype.emit=function(t,e,i,s,o,n){var a=Be?Be+t:t;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,h,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,h=new Array(c-1);u<c;u++)h[u-1]=arguments[u];l.fn.apply(l.context,h)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),c){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!h)for(f=1,h=new Array(c-1);f<c;f++)h[f-1]=arguments[f];l[u].fn.apply(l[u].context,h)}}return!0};Ee.prototype.on=function(t,e,i){return lb(this,t,e,i,!1)};Ee.prototype.once=function(t,e,i){return lb(this,t,e,i,!0)};Ee.prototype.removeListener=function(t,e,i,s){var o=Be?Be+t:t;if(!this._events[o])return this;if(!e)return lh(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&lh(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:lh(this,o)}return this};Ee.prototype.removeAllListeners=function(t){var e;return t?(e=Be?Be+t:t,this._events[e]&&lh(this,e)):(this._events=new Jn,this._eventsCount=0),this};Ee.prototype.off=Ee.prototype.removeListener;Ee.prototype.addListener=Ee.prototype.on;Ee.prefixed=Be;Ee.EventEmitter=Ee;typeof mp<"u"&&(mp.exports=Ee)});var hb,Pt,Ae=y(()=>{hb=ls(cb(),1),Pt=hb.default});var ok,ni,fe,lr,yb,ub,gp,nk,ch,_b,bb,db,fb,pb,ta,ak,lk,ck,hk,_p,mb,uk,xp,yp,gb,bp,Ke,xb,hh,vp=y(()=>{ok={grad:.9,turn:360,rad:360/(2*Math.PI)},ni=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},fe=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},lr=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},yb=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},ub=function(r){return{r:lr(r.r,0,255),g:lr(r.g,0,255),b:lr(r.b,0,255),a:lr(r.a)}},gp=function(r){return{r:fe(r.r),g:fe(r.g),b:fe(r.b),a:fe(r.a,3)}},nk=/^#([0-9a-f]{3,8})$/i,ch=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},_b=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=Math.max(t,e,i),n=o-Math.min(t,e,i),a=n?o===t?(e-i)/n:o===e?2+(i-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}},bb=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var o=Math.floor(t),n=i*(1-e),a=i*(1-(t-o)*e),l=i*(1-(1-t+o)*e),c=o%6;return{r:255*[i,a,n,n,l,i][c],g:255*[l,i,i,a,n,n][c],b:255*[n,n,l,i,i,a][c],a:s}},db=function(r){return{h:yb(r.h),s:lr(r.s,0,100),l:lr(r.l,0,100),a:lr(r.a)}},fb=function(r){return{h:fe(r.h),s:fe(r.s),l:fe(r.l),a:fe(r.a,3)}},pb=function(r){return bb((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},ta=function(r){return{h:(t=_b(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},ak=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lk=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ck=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hk=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_p={string:[[function(r){var t=nk.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?fe(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?fe(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=ck.exec(r)||hk.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:ub({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(r){var t=ak.exec(r)||lk.exec(r);if(!t)return null;var e,i,s=db({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(ok[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return pb(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return ni(t)&&ni(e)&&ni(i)?ub({r:Number(t),g:Number(e),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!ni(t)||!ni(e)||!ni(i))return null;var n=db({h:Number(t),s:Number(e),l:Number(i),a:Number(o)});return pb(n)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!ni(t)||!ni(e)||!ni(i))return null;var n=function(a){return{h:yb(a.h),s:lr(a.s,0,100),v:lr(a.v,0,100),a:lr(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(o)});return bb(n)},"hsv"]]},mb=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},uk=function(r){return typeof r=="string"?mb(r.trim(),_p.string):typeof r=="object"&&r!==null?mb(r,_p.object):[null,void 0]},xp=function(r,t){var e=ta(r);return{h:e.h,s:lr(e.s+100*t,0,100),l:e.l,a:e.a}},yp=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},gb=function(r,t){var e=ta(r);return{h:e.h,s:e.s,l:lr(e.l+100*t,0,100),a:e.a}},bp=function(){function r(t){this.parsed=uk(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return fe(yp(this.rgba),2)},r.prototype.isDark=function(){return yp(this.rgba)<.5},r.prototype.isLight=function(){return yp(this.rgba)>=.5},r.prototype.toHex=function(){return t=gp(this.rgba),e=t.r,i=t.g,s=t.b,n=(o=t.a)<1?ch(fe(255*o)):"","#"+ch(e)+ch(i)+ch(s)+n;var t,e,i,s,o,n},r.prototype.toRgb=function(){return gp(this.rgba)},r.prototype.toRgbString=function(){return t=gp(this.rgba),e=t.r,i=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+i+", "+s+", "+o+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,o},r.prototype.toHsl=function(){return fb(ta(this.rgba))},r.prototype.toHslString=function(){return t=fb(ta(this.rgba)),e=t.h,i=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+o+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,o},r.prototype.toHsv=function(){return t=_b(this.rgba),{h:fe(t.h),s:fe(t.s),v:fe(t.v),a:fe(t.a,3)};var t},r.prototype.invert=function(){return Ke({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Ke(xp(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ke(xp(this.rgba,-t))},r.prototype.grayscale=function(){return Ke(xp(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ke(gb(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ke(gb(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Ke({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):fe(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=ta(this.rgba);return typeof t=="number"?Ke({h:t,s:e.s,l:e.l,a:e.a}):fe(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ke(t).toHex()},r}(),Ke=function(r){return r instanceof bp?r:new bp(r)},xb=[],hh=function(r){r.forEach(function(t){xb.indexOf(t)<0&&(t(bp,_p),xb.push(t))})}});function uh(r,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"},i={};for(var s in e)i[e[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=i[this.toHex()];if(c)return c;if(n?.closest){var h=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new r(e[f]).toRgb();for(var p in e){var m=(a=h,l=o[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));m<u&&(u=m,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new r(l).toRgb():null},"name"])}var Tp=y(()=>{});var so,st,_e=y(()=>{vp();Tp();hh([uh]);so=class ea{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 ea)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 i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="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,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=ea._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,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 i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<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,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(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,i,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,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=ea.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=Ke(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,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,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof ea||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}};so.shared=new so;so._temp=new so;so.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;st=so});var vb,Tb=y(()=>{"use strict";vb={cullArea:null,cullable:!1,cullableChildren:!0}});var Sb,wb,Eb,Sp=y(()=>{"use strict";Sb=Math.PI*2,wb=180/Math.PI,Eb=Math.PI/180});var ct,wp,cr=y(()=>{"use strict";ct=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(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 wp.x=0,wp.y=0,wp}},wp=new ct});var U,dk,fk,ft=y(()=>{Sp();cr();U=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,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,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new ct;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ct;let i=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,l=this.ty,c=1/(i*n+o*-s),h=t.x,u=t.y;return e.x=n*c*h+-o*c*u+(l*o-a*n)*c,e.y=i*c*u+-s*c*h+(-l*i+a*s)*c,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),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}appendFrom(t,e){let i=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,l=t.ty,c=e.a,h=e.b,u=e.c,d=e.d;return this.a=i*c+s*u,this.b=i*h+s*d,this.c=o*c+n*u,this.d=o*h+n*d,this.tx=a*c+l*u+e.tx,this.ty=a*h+l*d+e.ty,this}setTransform(t,e,i,s,o,n,a,l,c){return this.a=Math.cos(a+c)*o,this.b=Math.sin(a+c)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*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 i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*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,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),c=Math.abs(a+l);return c<1e-5||Math.abs(Sb-c)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),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*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*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 r;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 fk.identity()}static get shared(){return dk.identity()}},dk=new U,fk=new U});var be,dh=y(()=>{"use strict";be=class r{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new r(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 lt(r="default"){return Ep[r]===void 0&&(Ep[r]=-1),++Ep[r]}var Ep,ve=y(()=>{"use strict";Ep={default:-1}});function X(r,t,e=3){if(Ab[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1
+ var KF=Object.create;var fp=Object.defineProperty;var ZF=Object.getOwnPropertyDescriptor;var QF=Object.getOwnPropertyNames;var JF=Object.getPrototypeOf,tk=Object.prototype.hasOwnProperty;var y=(r,t)=>()=>(r&&(t=r(r=0)),t);var Z=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ab=(r,t)=>{for(var e in t)fp(r,e,{get:t[e],enumerable:!0})},ek=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of QF(t))!tk.call(r,s)&&s!==e&&fp(r,s,{get:()=>t[s],enumerable:!(i=ZF(t,s))||i.enumerable});return r};var ls=(r,t,e)=>(e=r!=null?KF(JF(r)):{},ek(t||!r||!r.__esModule?fp(e,"default",{value:r,enumerable:!0}):e,r));var E,pp,ah,D,F=y(()=>{"use strict";E=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(E||{}),pp=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},ah=(r,t)=>pp(r).priority??t,D={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(pp).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(pp).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(o=>o.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((o,n)=>ah(n.value,e)-ah(o.value,e)))},i=>{let s=t.findIndex(o=>o.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>ah(o,e)-ah(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})},mixin(r,...t){for(let e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}}});var cb=Z((Q3,mp)=>{"use strict";var ik=Object.prototype.hasOwnProperty,Be="~";function Jn(){}Object.create&&(Jn.prototype=Object.create(null),new Jn().__proto__||(Be=!1));function sk(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function lb(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new sk(e,i||r,s),n=Be?Be+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function lh(r,t){--r._eventsCount===0?r._events=new Jn:delete r._events[t]}function Ee(){this._events=new Jn,this._eventsCount=0}Ee.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)ik.call(e,i)&&t.push(Be?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Ee.prototype.listeners=function(t){var e=Be?Be+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Ee.prototype.listenerCount=function(t){var e=Be?Be+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Ee.prototype.emit=function(t,e,i,s,o,n){var a=Be?Be+t:t;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,h,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,h=new Array(c-1);u<c;u++)h[u-1]=arguments[u];l.fn.apply(l.context,h)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),c){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!h)for(f=1,h=new Array(c-1);f<c;f++)h[f-1]=arguments[f];l[u].fn.apply(l[u].context,h)}}return!0};Ee.prototype.on=function(t,e,i){return lb(this,t,e,i,!1)};Ee.prototype.once=function(t,e,i){return lb(this,t,e,i,!0)};Ee.prototype.removeListener=function(t,e,i,s){var o=Be?Be+t:t;if(!this._events[o])return this;if(!e)return lh(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&lh(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:lh(this,o)}return this};Ee.prototype.removeAllListeners=function(t){var e;return t?(e=Be?Be+t:t,this._events[e]&&lh(this,e)):(this._events=new Jn,this._eventsCount=0),this};Ee.prototype.off=Ee.prototype.removeListener;Ee.prototype.addListener=Ee.prototype.on;Ee.prefixed=Be;Ee.EventEmitter=Ee;typeof mp<"u"&&(mp.exports=Ee)});var hb,Pt,Ae=y(()=>{hb=ls(cb(),1),Pt=hb.default});var ok,ni,fe,lr,yb,ub,gp,nk,ch,_b,bb,db,fb,pb,ta,ak,lk,ck,hk,_p,mb,uk,xp,yp,gb,bp,Ke,xb,hh,vp=y(()=>{ok={grad:.9,turn:360,rad:360/(2*Math.PI)},ni=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},fe=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},lr=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},yb=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},ub=function(r){return{r:lr(r.r,0,255),g:lr(r.g,0,255),b:lr(r.b,0,255),a:lr(r.a)}},gp=function(r){return{r:fe(r.r),g:fe(r.g),b:fe(r.b),a:fe(r.a,3)}},nk=/^#([0-9a-f]{3,8})$/i,ch=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},_b=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=Math.max(t,e,i),n=o-Math.min(t,e,i),a=n?o===t?(e-i)/n:o===e?2+(i-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}},bb=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var o=Math.floor(t),n=i*(1-e),a=i*(1-(t-o)*e),l=i*(1-(1-t+o)*e),c=o%6;return{r:255*[i,a,n,n,l,i][c],g:255*[l,i,i,a,n,n][c],b:255*[n,n,l,i,i,a][c],a:s}},db=function(r){return{h:yb(r.h),s:lr(r.s,0,100),l:lr(r.l,0,100),a:lr(r.a)}},fb=function(r){return{h:fe(r.h),s:fe(r.s),l:fe(r.l),a:fe(r.a,3)}},pb=function(r){return bb((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},ta=function(r){return{h:(t=_b(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},ak=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lk=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ck=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hk=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_p={string:[[function(r){var t=nk.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?fe(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?fe(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=ck.exec(r)||hk.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:ub({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(r){var t=ak.exec(r)||lk.exec(r);if(!t)return null;var e,i,s=db({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(ok[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return pb(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return ni(t)&&ni(e)&&ni(i)?ub({r:Number(t),g:Number(e),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!ni(t)||!ni(e)||!ni(i))return null;var n=db({h:Number(t),s:Number(e),l:Number(i),a:Number(o)});return pb(n)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!ni(t)||!ni(e)||!ni(i))return null;var n=function(a){return{h:yb(a.h),s:lr(a.s,0,100),v:lr(a.v,0,100),a:lr(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(o)});return bb(n)},"hsv"]]},mb=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},uk=function(r){return typeof r=="string"?mb(r.trim(),_p.string):typeof r=="object"&&r!==null?mb(r,_p.object):[null,void 0]},xp=function(r,t){var e=ta(r);return{h:e.h,s:lr(e.s+100*t,0,100),l:e.l,a:e.a}},yp=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},gb=function(r,t){var e=ta(r);return{h:e.h,s:e.s,l:lr(e.l+100*t,0,100),a:e.a}},bp=function(){function r(t){this.parsed=uk(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return fe(yp(this.rgba),2)},r.prototype.isDark=function(){return yp(this.rgba)<.5},r.prototype.isLight=function(){return yp(this.rgba)>=.5},r.prototype.toHex=function(){return t=gp(this.rgba),e=t.r,i=t.g,s=t.b,n=(o=t.a)<1?ch(fe(255*o)):"","#"+ch(e)+ch(i)+ch(s)+n;var t,e,i,s,o,n},r.prototype.toRgb=function(){return gp(this.rgba)},r.prototype.toRgbString=function(){return t=gp(this.rgba),e=t.r,i=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+i+", "+s+", "+o+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,o},r.prototype.toHsl=function(){return fb(ta(this.rgba))},r.prototype.toHslString=function(){return t=fb(ta(this.rgba)),e=t.h,i=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+o+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,o},r.prototype.toHsv=function(){return t=_b(this.rgba),{h:fe(t.h),s:fe(t.s),v:fe(t.v),a:fe(t.a,3)};var t},r.prototype.invert=function(){return Ke({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Ke(xp(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ke(xp(this.rgba,-t))},r.prototype.grayscale=function(){return Ke(xp(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ke(gb(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ke(gb(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Ke({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):fe(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=ta(this.rgba);return typeof t=="number"?Ke({h:t,s:e.s,l:e.l,a:e.a}):fe(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ke(t).toHex()},r}(),Ke=function(r){return r instanceof bp?r:new bp(r)},xb=[],hh=function(r){r.forEach(function(t){xb.indexOf(t)<0&&(t(bp,_p),xb.push(t))})}});function uh(r,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"},i={};for(var s in e)i[e[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=i[this.toHex()];if(c)return c;if(n?.closest){var h=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new r(e[f]).toRgb();for(var p in e){var m=(a=h,l=o[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));m<u&&(u=m,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new r(l).toRgb():null},"name"])}var Tp=y(()=>{});var so,st,_e=y(()=>{vp();Tp();hh([uh]);so=class ea{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 ea)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 i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="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,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=ea._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,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 i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<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,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(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,i,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,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=ea.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=Ke(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,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,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof ea||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}};so.shared=new so;so._temp=new so;so.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;st=so});var vb,Tb=y(()=>{"use strict";vb={cullArea:null,cullable:!1,cullableChildren:!0}});var Sb,wb,Eb,Sp=y(()=>{"use strict";Sb=Math.PI*2,wb=180/Math.PI,Eb=Math.PI/180});var ct,wp,cr=y(()=>{"use strict";ct=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(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 wp.x=0,wp.y=0,wp}},wp=new ct});var U,dk,fk,ft=y(()=>{Sp();cr();U=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,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,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new ct;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ct;let i=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,l=this.ty,c=1/(i*n+o*-s),h=t.x,u=t.y;return e.x=n*c*h+-o*c*u+(l*o-a*n)*c,e.y=i*c*u+-s*c*h+(-l*i+a*s)*c,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),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}appendFrom(t,e){let i=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,l=t.ty,c=e.a,h=e.b,u=e.c,d=e.d;return this.a=i*c+s*u,this.b=i*h+s*d,this.c=o*c+n*u,this.d=o*h+n*d,this.tx=a*c+l*u+e.tx,this.ty=a*h+l*d+e.ty,this}setTransform(t,e,i,s,o,n,a,l,c){return this.a=Math.cos(a+c)*o,this.b=Math.sin(a+c)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*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 i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*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,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),c=Math.abs(a+l);return c<1e-5||Math.abs(Sb-c)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),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*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*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 r;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 fk.identity()}static get shared(){return dk.identity()}},dk=new U,fk=new U});var be,dh=y(()=>{"use strict";be=class r{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new r(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 lt(r="default"){return Ep[r]===void 0&&(Ep[r]=-1),++Ep[r]}var Ep,ve=y(()=>{"use strict";Ep={default:-1}});function X(r,t,e=3){if(Ab[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
2
2
  Deprecated since v${r}`):(i=i.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${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
6
- Deprecated since v${r}`),console.warn(i))),Ab[t]=!0}var Ab,tt,Pb,Ht=y(()=>{"use strict";Ab={},tt="8.0.0",Pb="8.3.4"});var cs,Ap=y(()=>{"use strict";cs=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 Pp,et,Fe=y(()=>{Ap();Pp=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 cs(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},et=new Pp});var Cb,Rb=y(()=>{Ht();Cb={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){X("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function fh(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var Cp=y(()=>{"use strict"});var Mb,Ib=y(()=>{Cp();Ht();Mb={allowChildren:!0,removeChildren(r=0,t){let e=t??this.children.length,i=e-r,s=[];if(i>0&&i<=e){for(let n=e-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}fh(this.children,r,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(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){let t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){this.allowChildren||X(tt,"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(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;let e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;let e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);let i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}}});var Bb,Fb=y(()=>{"use strict";Bb={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(r,t,e)},collectRenderablesWithEffects(r,t,e){let{renderPipes:i}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var ai,ph=y(()=>{"use strict";ai=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 Rp,mh,kb=y(()=>{F();Fe();Rp=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 i=this._tests[e];if(i.test(t))return et.get(i.maskClass,t)}return t}returnMaskEffect(t){et.return(t)}},mh=new Rp;D.handleByList(E.MaskEffect,mh._effectClasses)});var Ob,Ub=y(()=>{ph();kb();Ob={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let t=this._maskEffect;t?.mask!==r&&(t&&(this.removeEffect(t),mh.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=mh.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let t=this._filterEffect||(this._filterEffect=new ai);r=r;let e=r?.length>0,i=t.filters?.length>0,s=e!==i;r=Array.isArray(r)?r.slice(0):r,t.filters=Object.freeze(r),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new ai),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var Gb,Lb=y(()=>{Ht();Gb={label:null,get name(){return X(tt,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){X(tt,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){let e=this.children;for(let i=0;i<e.length;i++){let s=e[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(t)for(let i=0;i<e.length;i++){let o=e[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,t=!1,e=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&e.push(o)}if(t)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,e);return e}}});var gh,Q,ae=y(()=>{cr();gh=[new ct,new ct,new ct,new ct],Q=class r{constructor(t=0,e=0,i=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),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 r(0,0,0,0)}clone(){return new r(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,i,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,l=this.y,c=i*(1-s),h=i-c,u=a-c,d=a+o+c,f=l-c,p=l+n+c,m=a+h,x=a+o-h,_=l+h,T=l+n-h;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>m&&t<x&&e>_&&e<T)}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 i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=gh[0].set(t.left,t.top),l=gh[1].set(t.left,t.bottom),c=gh[2].set(t.right,t.top),h=gh[3].set(t.right,t.bottom);if(c.x<=a.x||l.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(l,l),e.apply(c,c),e.apply(h,h),Math.max(a.x,l.x,c.x,h.x)<=i||Math.min(a.x,l.x,c.x,h.x)>=s||Math.max(a.y,l.y,c.y,h.y)<=o||Math.min(a.y,l.y,c.y,h.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,x=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,x,_)<=d*a.x+f*a.y||Math.min(p,m,x,_)>=d*h.x+f*h.y)return!1;let T=u*(a.y-c.y),g=u*(c.x-a.x),w=T*i+g*o,b=T*s+g*o,S=T*i+g*n,v=T*s+g*n;return!(Math.max(w,b,S,v)<=T*a.x+g*a.y||Math.min(w,b,S,v)>=T*h.x+g*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),i=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(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=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=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=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=i-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new r),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,i=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<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 Db,Tt,Ve=y(()=>{ft();ae();Db=new U,Tt=class r{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Db,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Q);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Db,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,c=o.d,h=o.tx,u=o.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,x=n*t+l*e+h,_=a*t+c*e+u;x<d&&(d=x),_<f&&(f=_),x>p&&(p=x),_>m&&(m=_),x=n*i+l*e+h,_=a*i+c*e+u,x<d&&(d=x),_<f&&(f=_),x>p&&(p=x),_>m&&(m=_),x=n*t+l*s+h,_=a*t+c*s+u,x<d&&(d=x),_<f&&(f=_),x>p&&(p=x),_>m&&(m=_),x=n*i+l*s+h,_=a*i+c*s+u,x<d&&(d=x),_<f&&(f=_),x>p&&(p=x),_>m&&(m=_),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}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,i=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:c,tx:h,ty:u}=t,d=n*e+l*i+h,f=a*e+c*i+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+l*i+h,f=a*s+c*i+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+l*o+h,f=a*e+c*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+l*o+h,f=a*s+c*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,i,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),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 r(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,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let c=s.a,h=s.b,u=s.c,d=s.d,f=s.tx,p=s.ty;for(let m=e;m<i;m+=2){let x=t[m],_=t[m+1],T=c*x+u*_+f,g=h*x+d*_+p;o=T<o?T:o,n=g<n?g:n,a=T>a?T:a,l=g>l?g:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}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 ee,Ze,hs=y(()=>{ft();Ap();Ve();ee=new cs(U),Ze=new cs(Tt)});var pk,Nb,Hb=y(()=>{ft();Ve();hs();pk=new U,Nb={getFastGlobalBounds(r,t){t||(t=new Tt),t.clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let i=t;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=Ze.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.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(r,i,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,i.applyMatrix(n.worldTransform)),this.effects[a].addBounds(i,!0));o&&(i.applyMatrix(n.worldTransform.copyTo(pk).invert()),t.addBounds(i,this.relativeGroupTransform)),t.addBounds(i),Ze.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),Ze.return(i))}}});function oo(r,t,e){e.clear();let i,s;return r.parent?t?i=r.parent.worldTransform:(s=ee.get().identity(),i=xh(r,s)):i=U.IDENTITY,Vb(r,e,i,t),s&&ee.return(s),e.isValid||e.set(0,0,0,0),e}function Vb(r,t,e,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=ee.get(),s.appendFrom(r.localTransform,e));let o=t,n=!!r.effects.length;if(n&&(t=Ze.get().clear()),r.boundsArea)t.addRect(r.boundsArea,s);else{r.bounds&&(t.matrix=s,t.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)Vb(r.children[a],t,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(t);o.addBounds(t,U.IDENTITY),Ze.return(t)}i||ee.return(s)}function xh(r,t){let e=r.parent;return e&&(xh(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var ra=y(()=>{ft();hs()});function yh(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;let e=r>>16&255,i=r>>8&255,s=r&255,o=t>>16&255,n=t>>8&255,a=t&255,l=e*o/255|0,c=i*n/255|0,h=s*a/255|0;return(l<<16)+(c<<8)+h}var Mp=y(()=>{"use strict"});function no(r,t){return r===Wb?t:t===Wb?r:yh(r,t)}var Wb,Ip=y(()=>{Mp();Wb=16777215});function ia(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var zb,$b=y(()=>{ra();hs();Ip();zb={getGlobalAlpha(r){if(r)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(r,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let e=xh(this,ee.get().identity());return r.appendFrom(this.localTransform,e),ee.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?ia(this.renderGroup.worldColor):this.parentRenderGroup?ia(no(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=no(t,e.localColor),e=e.parent;return ia(t)}}});function N(...r){Bp!==Xb&&(Bp++,Bp===Xb?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Bp,Xb,St=y(()=>{"use strict";Bp=0,Xb=500});function ao(r,t,e){return t.clear(),e||(e=U.IDENTITY),jb(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function jb(r,t,e,i,s){let o;if(s)o=ee.get(),o=e.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=ee.get(),o.appendFrom(l,e)}let n=t,a=!!r.effects.length;if(a&&(t=Ze.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.renderPipeId&&(t.matrix=o,t.addBounds(r.bounds));let l=r.children;for(let c=0;c<l.length;c++)jb(l[c],t,o,i,!1)}if(a){for(let l=0;l<r.effects.length;l++)r.effects[l].addLocalBounds?.(t,i);n.addBounds(t,U.IDENTITY),Ze.return(t)}ee.return(o)}var _h=y(()=>{ft();hs()});function Fp(r,t){let e=r.children;for(let i=0;i<e.length;i++){let s=e[i],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&&Fp(s,t)}return t.didChange}var Yb=y(()=>{"use strict"});var mk,qb,Kb=y(()=>{ft();Ve();ra();_h();Yb();mk=new U,qb={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Tt});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),Fp(this,r),r.didChange&&ao(this,r.localBounds,mk),r.localBounds},getBounds(r,t){return oo(this,r,t||new Tt)}}});var Zb,Qb=y(()=>{"use strict";Zb={_onRender:null,set onRender(r){let t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function gk(r,t){return r._zIndex-t._zIndex}var Jb,tv=y(()=>{"use strict";Jb={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,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(gk))}}});var ev,rv=y(()=>{cr();hs();ev={getGlobalPosition(r=new ct,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){let i=this.getGlobalTransform(ee.get(),e);return t=i.apply(r,t),ee.return(i),t},toLocal(r,t,e,i){t&&(r=t.toGlobal(r,e,i));let s=this.getGlobalTransform(ee.get(),i);return e=s.applyInverse(r,e),ee.return(s),e}}});var lo,kp=y(()=>{ve();lo=class{constructor(){this.uid=lt("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 li(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Op(r){return!(r&r-1)&&!!r}var sa=y(()=>{"use strict"});function bh(r){let t={};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var Up=y(()=>{"use strict"});function xk(r){let t=iv[r];return t===void 0&&(iv[r]=lt("resource")),t}var iv,sv,vh,Gp=y(()=>{Ae();ve();Ht();iv=Object.create(null);sv=class ov extends Pt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...ov.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){X(tt,"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=xk(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};sv.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};vh=sv});var nv,vt,We=y(()=>{Ae();sa();Up();ve();Gp();nv=class av extends Pt{constructor(t={}){super(),this.options=t,this.uid=lt("textureSource"),this._resourceType="textureSource",this._resourceId=lt("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={...av.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 vh(bh(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=lt("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,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*i),o=Math.round(e*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=lt("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=Op(this.pixelWidth)&&Op(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};nv.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};vt=nv});function yk(){for(let r=0;r<16;r++){let t=[];Lp.push(t);for(let e=0;e<16;e++){let i=Th(us[r]*us[e]+fs[r]*ds[e]),s=Th(ds[r]*us[e]+ps[r]*ds[e]),o=Th(us[r]*fs[e]+fs[r]*ps[e]),n=Th(ds[r]*fs[e]+ps[r]*ps[e]);for(let a=0;a<16;a++)if(us[a]===i&&ds[a]===s&&fs[a]===o&&ps[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new U;t.set(us[r],ds[r],fs[r],ps[r],0,0),lv.push(t)}}var us,ds,fs,ps,Lp,lv,Th,Ut,cv=y(()=>{ft();us=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ds=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],fs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ps=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Lp=[],lv=[],Th=Math.sign;yk();Ut={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>us[r],uY:r=>ds[r],vX:r=>fs[r],vY:r=>ps[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Lp[r][t],sub:(r,t)=>Lp[r][Ut.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Ut.S:Ut.N:Math.abs(t)*2<=Math.abs(r)?r>0?Ut.E:Ut.W:t>0?r>0?Ut.SE:Ut.SW:r>0?Ut.NE:Ut.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=lv[Ut.inv(t)];s.tx=e,s.ty=i,r.append(s)}}});var Dp,hv=y(()=>{"use strict";Dp=()=>{}});var ms,Np=y(()=>{F();We();ms=class extends vt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),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}};ms.extension=E.TextureSource});var uv,co,Hp=y(()=>{ft();uv=new U,co=class{constructor(t,e){this.mapCoord=new U,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 i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.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 i=t.orig,s=t.trim;s&&(uv.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(uv));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+l)/o.width,n[1]=(t.frame.y+a+l)/o.height,n[2]=(t.frame.x+t.frame.width-a+l)/o.width,n[3]=(t.frame.y+t.frame.height-a+l)/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 B,_t=y(()=>{Ae();cv();ae();ve();Ht();hv();Np();We();Hp();B=class extends Pt{constructor({source:t,label:e,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=lt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Q,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new vt,this.noFrame=!i,i)this.frame.copyFrom(i);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=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=c||!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 co(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:s}=this._source,o=e.x/i,n=e.y/s,a=e.width/i,l=e.height/s,c=this.rotate;if(c){let h=a/2,u=l/2,d=o+h,f=n+u;c=Ut.add(c,Ut.NW),t.x0=d+h*Ut.uX(c),t.y0=f+u*Ut.uY(c),c=Ut.add(c,2),t.x1=d+h*Ut.uX(c),t.y1=f+u*Ut.uY(c),c=Ut.add(c,2),t.x2=d+h*Ut.uX(c),t.y2=f+u*Ut.uY(c),c=Ut.add(c,2),t.x3=d+h*Ut.uX(c),t.y3=f+u*Ut.uY(c)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+l,t.x3=o,t.y3=n+l}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 X(tt,"Texture.baseTexture is now Texture.source"),this._source}};B.EMPTY=new B({label:"EMPTY",source:new vt({label:"EMPTY"})});B.EMPTY.destroy=Dp;B.WHITE=new B({source:new ms({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});B.WHITE.destroy=Dp});var _k,Vp,Vt,Bi=y(()=>{sa();We();_t();_k=0,Vp=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){let s=new vt({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1});return new B({source:s,label:`texturePool_${_k++}`})}getOptimalTexture(t,e,i=1,s){let o=Math.ceil(t*i-1e-6),n=Math.ceil(e*i-1e-6);o=li(o),n=li(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(o,n,s)),l.source._resolution=i,l.source.width=o/i,l.source.height=n/i,l.source.pixelWidth=o,l.source.pixelHeight=n,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=!1){let i=t.source;return this.getOptimalTexture(t.width,t.height,i._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 i=this._texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},Vt=new Vp});var Sh,dv=y(()=>{ft();kp();Bi();Sh=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new U,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 lo,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 i=0;i<e.length;i++){let s=e[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Vt.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 i=0;i<e.length;i++)this.addChild(e[i])}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 i=0;i<e.length;i++)this.removeChild(e[i])}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 i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let i=t.children;for(let s=0;s<i.length;s++)this._getChildren(i[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 U),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new U),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 U),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 fv(r,t,e={}){for(let i in t)!e[i]&&t[i]!==void 0&&(r[i]=t[i])}var pv=y(()=>{"use strict"});var Wp,zp,$p,ho,oa,gs,rt,Sr=y(()=>{Ae();_e();Tb();F();ft();Sp();dh();ve();Ht();Fe();Rb();Ib();Fb();Ub();Lb();Hb();$b();Kb();Qb();tv();rv();dv();pv();Wp=new be(null),zp=new be(null),$p=new be(null,1,1),ho=1,oa=2,gs=4,rt=class r extends Pt{constructor(t={}){super(),this.uid=lt("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 U,this.relativeGroupTransform=new U,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new be(this,0,0),this._scale=$p,this._pivot=zp,this._skew=Wp,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=[],fv(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){X("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),D.mixin(r,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||X(tt,"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],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.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,i&&i.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],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,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,i),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=et.get(Sh,this),this.groupTransform=U.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),et.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 U),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*wb}set angle(t){this.rotation=t*Eb}get pivot(){return this._pivot===zp&&(this._pivot=new be(this,0,0)),this._pivot}set pivot(t){this._pivot===zp&&(this._pivot=new be(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Wp&&(this._skew=new be(this,0,0)),this._skew}set skew(t){this._skew===Wp&&(this._skew=new be(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===$p&&(this._scale=new be(this,1,1)),this._scale}set scale(t){this._scale===$p&&(this._scale=new be(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 i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.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,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,c=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-(l*e.a+c*e.c),e.ty=o._y-(l*e.b+c*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=ho,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=st.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=ho,this._onUpdate())}get tint(){return ia(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=oa,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|=gs,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|=gs,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|=gs,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}};D.mixin(rt,Mb,Nb,ev,Zb,qb,Ob,Gb,Jb,vb,Cb,zb,Bb)});var Fi,wh=y(()=>{cr();Fi=class r{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ct,this.page=new ct,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,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,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 bk(r){return function(t){return t.test(r)}}function ki(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=bk(e),o={apple:{phone:s(Xp)&&!s(ci),ipod:s(mv),tablet:!s(Xp)&&(s(gv)||Ev(t))&&!s(ci),universal:s(xv),device:(s(Xp)||s(mv)||s(gv)||s(xv)||Ev(t))&&!s(ci)},amazon:{phone:s(uo),tablet:!s(uo)&&s(Eh),device:s(uo)||s(Eh)},android:{phone:!s(ci)&&s(uo)||!s(ci)&&s(jp),tablet:!s(ci)&&!s(uo)&&!s(jp)&&(s(Eh)||s(yv)),device:!s(ci)&&(s(uo)||s(Eh)||s(jp)||s(yv))||s(/\bokhttp\b/i)},windows:{phone:s(ci),tablet:s(_v),device:s(ci)||s(_v)},other:{blackberry:s(bv),blackberry10:s(vv),opera:s(Tv),firefox:s(wv),chrome:s(Sv),device:s(bv)||s(vv)||s(Tv)||s(wv)||s(Sv)},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 Xp,mv,gv,xv,jp,yv,uo,Eh,ci,_v,bv,vv,Tv,Sv,wv,Ev,Yp=y(()=>{Xp=/iPhone/i,mv=/iPod/i,gv=/iPad/i,xv=/\biOS-universal(?:.+)Mac\b/i,jp=/\bAndroid(?:.+)Mobile\b/i,yv=/Android/i,uo=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Eh=/Silk/i,ci=/Windows Phone/i,_v=/\bWindows(?:.+)ARM\b/i,bv=/BlackBerry/i,vv=/BB10/i,Tv=/Opera Mini/i,Sv=/\b(CriOS|Chrome)(?:.+)Mobile/i,wv=/Mobile(?:.+)Firefox\b/i,Ev=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var qp=y(()=>{Yp();Yp()});var vk,Av,Pv=y(()=>{qp();vk=ki.default??ki,Av=vk(globalThis.navigator)});var Tk,Ah,Sk,wk,Cv,Rv,Ek,Ak,Pk,Kp,Iv,Bv=y(()=>{wh();F();Pv();Cp();Tk=9,Ah=100,Sk=0,wk=0,Cv=2,Rv=1,Ek=-1e3,Ak=-1e3,Pk=2,Kp=class Mv{constructor(t,e=Av){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=`${Rv}px`,t.style.height=`${Rv}px`,t.style.position="absolute",t.style.top=`${Ek}px`,t.style.left=`${Ak}px`,t.style.zIndex=Pk.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=`${Ah}px`,this._div.style.height=`${Ah}px`,this._div.style.position="absolute",this._div.style.top=`${Sk}px`,this._div.style.left=`${wk}px`,this._div.style.zIndex=Cv.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 i=0;i<e.length;i++)this._updateAccessibleObjects(e[i])}init(t){let i={accessibilityOptions:{...Mv.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.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 i of this._children)i._renderId===this._renderId&&e.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];e.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,fh(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${i}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let i=0;i<this._children.length;i++){let s=this._children[i];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,l=this._renderer.resolution,c=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*l}px`,o.style.top=`${(a.ty+n.y*a.d)*c}px`,o.style.width=`${n.width*a.a*l}px`,o.style.height=`${n.height*a.d*c}px`}else{this._capHitArea(n);let a=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*l}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*l}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:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-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${r}`),console.warn(i))),Ab[t]=!0}var Ab,tt,Pb,Ht=y(()=>{"use strict";Ab={},tt="8.0.0",Pb="8.3.4"});var cs,Ap=y(()=>{"use strict";cs=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 Pp,et,Fe=y(()=>{Ap();Pp=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 cs(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},et=new Pp});var Cb,Rb=y(()=>{Ht();Cb={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){X("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function fh(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var Cp=y(()=>{"use strict"});var Mb,Ib=y(()=>{Cp();Ht();Mb={allowChildren:!0,removeChildren(r=0,t){let e=t??this.children.length,i=e-r,s=[];if(i>0&&i<=e){for(let n=e-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}fh(this.children,r,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(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){let t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){this.allowChildren||X(tt,"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(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;let e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;let e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);let i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}}});var Bb,Fb=y(()=>{"use strict";Bb={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(r,t,e)},collectRenderablesWithEffects(r,t,e){let{renderPipes:i}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,r)}this.collectRenderablesSimple(r,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var ai,ph=y(()=>{"use strict";ai=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 Rp,mh,kb=y(()=>{F();Fe();Rp=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 i=this._tests[e];if(i.test(t))return et.get(i.maskClass,t)}return t}returnMaskEffect(t){et.return(t)}},mh=new Rp;D.handleByList(E.MaskEffect,mh._effectClasses)});var Ob,Ub=y(()=>{ph();kb();Ob={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let t=this._maskEffect;t?.mask!==r&&(t&&(this.removeEffect(t),mh.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=mh.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let t=this._filterEffect||(this._filterEffect=new ai);r=r;let e=r?.length>0,i=t.filters?.length>0,s=e!==i;r=Array.isArray(r)?r.slice(0):r,t.filters=Object.freeze(r),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new ai),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var Gb,Lb=y(()=>{Ht();Gb={label:null,get name(){return X(tt,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){X(tt,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){let e=this.children;for(let i=0;i<e.length;i++){let s=e[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(t)for(let i=0;i<e.length;i++){let o=e[i].getChildByLabel(r,!0);if(o)return o}return null},getChildrenByLabel(r,t=!1,e=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===r||r instanceof RegExp&&r.test(o.label))&&e.push(o)}if(t)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,e);return e}}});var gh,Q,ae=y(()=>{cr();gh=[new ct,new ct,new ct,new ct],Q=class r{constructor(t=0,e=0,i=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),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 r(0,0,0,0)}clone(){return new r(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,i,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,l=this.y,c=i*(1-s),h=i-c,u=a-c,d=a+o+c,f=l-c,p=l+n+c,m=a+h,x=a+o-h,_=l+h,T=l+n-h;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>m&&t<x&&e>_&&e<T)}intersects(t,e){if(!e){let P=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=P)return!1;let A=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>A}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=gh[0].set(t.left,t.top),l=gh[1].set(t.left,t.bottom),c=gh[2].set(t.right,t.top),h=gh[3].set(t.right,t.bottom);if(c.x<=a.x||l.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(l,l),e.apply(c,c),e.apply(h,h),Math.max(a.x,l.x,c.x,h.x)<=i||Math.min(a.x,l.x,c.x,h.x)>=s||Math.max(a.y,l.y,c.y,h.y)<=o||Math.min(a.y,l.y,c.y,h.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,x=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,x,_)<=d*a.x+f*a.y||Math.min(p,m,x,_)>=d*h.x+f*h.y)return!1;let T=u*(a.y-c.y),g=u*(c.x-a.x),w=T*i+g*o,b=T*s+g*o,S=T*i+g*n,v=T*s+g*n;return!(Math.max(w,b,S,v)<=T*a.x+g*a.y||Math.min(w,b,S,v)>=T*h.x+g*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),i=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(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=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=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=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=i-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new r),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,i=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<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 Db,Tt,Ve=y(()=>{ft();ae();Db=new U,Tt=class r{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Db,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Q);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Db,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,c=o.d,h=o.tx,u=o.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,x=n*t+l*e+h,_=a*t+c*e+u;x<d&&(d=x),_<f&&(f=_),x>p&&(p=x),_>m&&(m=_),x=n*i+l*e+h,_=a*i+c*e+u,x<d&&(d=x),_<f&&(f=_),x>p&&(p=x),_>m&&(m=_),x=n*t+l*s+h,_=a*t+c*s+u,x<d&&(d=x),_<f&&(f=_),x>p&&(p=x),_>m&&(m=_),x=n*i+l*s+h,_=a*i+c*s+u,x<d&&(d=x),_<f&&(f=_),x>p&&(p=x),_>m&&(m=_),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}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,i=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:c,tx:h,ty:u}=t,d=n*e+l*i+h,f=a*e+c*i+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+l*i+h,f=a*s+c*i+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+l*o+h,f=a*e+c*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+l*o+h,f=a*s+c*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,i,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),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 r(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,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let c=s.a,h=s.b,u=s.c,d=s.d,f=s.tx,p=s.ty;for(let m=e;m<i;m+=2){let x=t[m],_=t[m+1],T=c*x+u*_+f,g=h*x+d*_+p;o=T<o?T:o,n=g<n?g:n,a=T>a?T:a,l=g>l?g:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}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 ee,Ze,hs=y(()=>{ft();Ap();Ve();ee=new cs(U),Ze=new cs(Tt)});var pk,Nb,Hb=y(()=>{ft();Ve();hs();pk=new U,Nb={getFastGlobalBounds(r,t){t||(t=new Tt),t.clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let i=t;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=Ze.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.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(r,i,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,i.applyMatrix(n.worldTransform)),this.effects[a].addBounds(i,!0));o&&(i.applyMatrix(n.worldTransform.copyTo(pk).invert()),t.addBounds(i,this.relativeGroupTransform)),t.addBounds(i),Ze.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),Ze.return(i))}}});function oo(r,t,e){e.clear();let i,s;return r.parent?t?i=r.parent.worldTransform:(s=ee.get().identity(),i=xh(r,s)):i=U.IDENTITY,Vb(r,e,i,t),s&&ee.return(s),e.isValid||e.set(0,0,0,0),e}function Vb(r,t,e,i){if(!r.visible||!r.measurable)return;let s;i?s=r.worldTransform:(r.updateLocalTransform(),s=ee.get(),s.appendFrom(r.localTransform,e));let o=t,n=!!r.effects.length;if(n&&(t=Ze.get().clear()),r.boundsArea)t.addRect(r.boundsArea,s);else{r.bounds&&(t.matrix=s,t.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)Vb(r.children[a],t,s,i)}if(n){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(t);o.addBounds(t,U.IDENTITY),Ze.return(t)}i||ee.return(s)}function xh(r,t){let e=r.parent;return e&&(xh(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var ra=y(()=>{ft();hs()});function yh(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;let e=r>>16&255,i=r>>8&255,s=r&255,o=t>>16&255,n=t>>8&255,a=t&255,l=e*o/255|0,c=i*n/255|0,h=s*a/255|0;return(l<<16)+(c<<8)+h}var Mp=y(()=>{"use strict"});function no(r,t){return r===Wb?t:t===Wb?r:yh(r,t)}var Wb,Ip=y(()=>{Mp();Wb=16777215});function ia(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var zb,$b=y(()=>{ra();hs();Ip();zb={getGlobalAlpha(r){if(r)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(r,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let e=xh(this,ee.get().identity());return r.appendFrom(this.localTransform,e),ee.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?ia(this.renderGroup.worldColor):this.parentRenderGroup?ia(no(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=no(t,e.localColor),e=e.parent;return ia(t)}}});function N(...r){Bp!==Xb&&(Bp++,Bp===Xb?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Bp,Xb,St=y(()=>{"use strict";Bp=0,Xb=500});function ao(r,t,e){return t.clear(),e||(e=U.IDENTITY),jb(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function jb(r,t,e,i,s){let o;if(s)o=ee.get(),o=e.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=ee.get(),o.appendFrom(l,e)}let n=t,a=!!r.effects.length;if(a&&(t=Ze.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.renderPipeId&&(t.matrix=o,t.addBounds(r.bounds));let l=r.children;for(let c=0;c<l.length;c++)jb(l[c],t,o,i,!1)}if(a){for(let l=0;l<r.effects.length;l++)r.effects[l].addLocalBounds?.(t,i);n.addBounds(t,U.IDENTITY),Ze.return(t)}ee.return(o)}var _h=y(()=>{ft();hs()});function Fp(r,t){let e=r.children;for(let i=0;i<e.length;i++){let s=e[i],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&&Fp(s,t)}return t.didChange}var Yb=y(()=>{"use strict"});var mk,qb,Kb=y(()=>{ft();Ve();ra();_h();Yb();mk=new U,qb={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Tt});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),Fp(this,r),r.didChange&&ao(this,r.localBounds,mk),r.localBounds},getBounds(r,t){return oo(this,r,t||new Tt)}}});var Zb,Qb=y(()=>{"use strict";Zb={_onRender:null,set onRender(r){let t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function gk(r,t){return r._zIndex-t._zIndex}var Jb,tv=y(()=>{"use strict";Jb={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,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(gk))}}});var ev,rv=y(()=>{cr();hs();ev={getGlobalPosition(r=new ct,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){let i=this.getGlobalTransform(ee.get(),e);return t=i.apply(r,t),ee.return(i),t},toLocal(r,t,e,i){t&&(r=t.toGlobal(r,e,i));let s=this.getGlobalTransform(ee.get(),i);return e=s.applyInverse(r,e),ee.return(s),e}}});var lo,kp=y(()=>{ve();lo=class{constructor(){this.uid=lt("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 li(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Op(r){return!(r&r-1)&&!!r}var sa=y(()=>{"use strict"});function bh(r){let t={};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var Up=y(()=>{"use strict"});function xk(r){let t=iv[r];return t===void 0&&(iv[r]=lt("resource")),t}var iv,sv,vh,Gp=y(()=>{Ae();ve();Ht();iv=Object.create(null);sv=class ov extends Pt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...ov.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){X(tt,"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=xk(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};sv.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};vh=sv});var nv,vt,We=y(()=>{Ae();sa();Up();ve();Gp();nv=class av extends Pt{constructor(t={}){super(),this.options=t,this.uid=lt("textureSource"),this._resourceType="textureSource",this._resourceId=lt("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={...av.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 vh(bh(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=lt("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,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*i),o=Math.round(e*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=lt("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=Op(this.pixelWidth)&&Op(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};nv.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};vt=nv});function yk(){for(let r=0;r<16;r++){let t=[];Lp.push(t);for(let e=0;e<16;e++){let i=Th(us[r]*us[e]+fs[r]*ds[e]),s=Th(ds[r]*us[e]+ps[r]*ds[e]),o=Th(us[r]*fs[e]+fs[r]*ps[e]),n=Th(ds[r]*fs[e]+ps[r]*ps[e]);for(let a=0;a<16;a++)if(us[a]===i&&ds[a]===s&&fs[a]===o&&ps[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new U;t.set(us[r],ds[r],fs[r],ps[r],0,0),lv.push(t)}}var us,ds,fs,ps,Lp,lv,Th,Gt,cv=y(()=>{ft();us=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ds=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],fs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ps=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Lp=[],lv=[],Th=Math.sign;yk();Gt={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:r=>us[r],uY:r=>ds[r],vX:r=>fs[r],vY:r=>ps[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Lp[r][t],sub:(r,t)=>Lp[r][Gt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Gt.S:Gt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Gt.E:Gt.W:t>0?r>0?Gt.SE:Gt.SW:r>0?Gt.NE:Gt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=lv[Gt.inv(t)];s.tx=e,s.ty=i,r.append(s)}}});var Dp,hv=y(()=>{"use strict";Dp=()=>{}});var ms,Np=y(()=>{F();We();ms=class extends vt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),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}};ms.extension=E.TextureSource});var uv,co,Hp=y(()=>{ft();uv=new U,co=class{constructor(t,e){this.mapCoord=new U,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 i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.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 i=t.orig,s=t.trim;s&&(uv.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(uv));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+l)/o.width,n[1]=(t.frame.y+a+l)/o.height,n[2]=(t.frame.x+t.frame.width-a+l)/o.width,n[3]=(t.frame.y+t.frame.height-a+l)/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 B,_t=y(()=>{Ae();cv();ae();ve();Ht();hv();Np();We();Hp();B=class extends Pt{constructor({source:t,label:e,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=lt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Q,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new vt,this.noFrame=!i,i)this.frame.copyFrom(i);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=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=c||!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 co(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:s}=this._source,o=e.x/i,n=e.y/s,a=e.width/i,l=e.height/s,c=this.rotate;if(c){let h=a/2,u=l/2,d=o+h,f=n+u;c=Gt.add(c,Gt.NW),t.x0=d+h*Gt.uX(c),t.y0=f+u*Gt.uY(c),c=Gt.add(c,2),t.x1=d+h*Gt.uX(c),t.y1=f+u*Gt.uY(c),c=Gt.add(c,2),t.x2=d+h*Gt.uX(c),t.y2=f+u*Gt.uY(c),c=Gt.add(c,2),t.x3=d+h*Gt.uX(c),t.y3=f+u*Gt.uY(c)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+l,t.x3=o,t.y3=n+l}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 X(tt,"Texture.baseTexture is now Texture.source"),this._source}};B.EMPTY=new B({label:"EMPTY",source:new vt({label:"EMPTY"})});B.EMPTY.destroy=Dp;B.WHITE=new B({source:new ms({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});B.WHITE.destroy=Dp});var _k,Vp,Vt,Bi=y(()=>{sa();We();_t();_k=0,Vp=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){let s=new vt({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1});return new B({source:s,label:`texturePool_${_k++}`})}getOptimalTexture(t,e,i=1,s){let o=Math.ceil(t*i-1e-6),n=Math.ceil(e*i-1e-6);o=li(o),n=li(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(o,n,s)),l.source._resolution=i,l.source.width=o/i,l.source.height=n/i,l.source.pixelWidth=o,l.source.pixelHeight=n,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=!1){let i=t.source;return this.getOptimalTexture(t.width,t.height,i._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 i=this._texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},Vt=new Vp});var Sh,dv=y(()=>{ft();kp();Bi();Sh=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new U,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 lo,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 i=0;i<e.length;i++){let s=e[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Vt.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 i=0;i<e.length;i++)this.addChild(e[i])}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 i=0;i<e.length;i++)this.removeChild(e[i])}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 i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let i=t.children;for(let s=0;s<i.length;s++)this._getChildren(i[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 U),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new U),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 U),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 fv(r,t,e={}){for(let i in t)!e[i]&&t[i]!==void 0&&(r[i]=t[i])}var pv=y(()=>{"use strict"});var Wp,zp,$p,ho,oa,gs,rt,Sr=y(()=>{Ae();_e();Tb();F();ft();Sp();dh();ve();Ht();Fe();Rb();Ib();Fb();Ub();Lb();Hb();$b();Kb();Qb();tv();rv();dv();pv();Wp=new be(null),zp=new be(null),$p=new be(null,1,1),ho=1,oa=2,gs=4,rt=class r extends Pt{constructor(t={}){super(),this.uid=lt("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 U,this.relativeGroupTransform=new U,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new be(this,0,0),this._scale=$p,this._pivot=zp,this._skew=Wp,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=[],fv(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){X("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),D.mixin(r,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||X(tt,"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],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.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,i&&i.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],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,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,i),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=et.get(Sh,this),this.groupTransform=U.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),et.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 U),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*wb}set angle(t){this.rotation=t*Eb}get pivot(){return this._pivot===zp&&(this._pivot=new be(this,0,0)),this._pivot}set pivot(t){this._pivot===zp&&(this._pivot=new be(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Wp&&(this._skew=new be(this,0,0)),this._skew}set skew(t){this._skew===Wp&&(this._skew=new be(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===$p&&(this._scale=new be(this,1,1)),this._scale}set scale(t){this._scale===$p&&(this._scale=new be(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 i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.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,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,c=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-(l*e.a+c*e.c),e.ty=o._y-(l*e.b+c*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=ho,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=st.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=ho,this._onUpdate())}get tint(){return ia(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=oa,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|=gs,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|=gs,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|=gs,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}};D.mixin(rt,Mb,Nb,ev,Zb,qb,Ob,Gb,Jb,vb,Cb,zb,Bb)});var Fi,wh=y(()=>{cr();Fi=class r{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ct,this.page=new ct,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,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,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 bk(r){return function(t){return t.test(r)}}function ki(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=bk(e),o={apple:{phone:s(Xp)&&!s(ci),ipod:s(mv),tablet:!s(Xp)&&(s(gv)||Ev(t))&&!s(ci),universal:s(xv),device:(s(Xp)||s(mv)||s(gv)||s(xv)||Ev(t))&&!s(ci)},amazon:{phone:s(uo),tablet:!s(uo)&&s(Eh),device:s(uo)||s(Eh)},android:{phone:!s(ci)&&s(uo)||!s(ci)&&s(jp),tablet:!s(ci)&&!s(uo)&&!s(jp)&&(s(Eh)||s(yv)),device:!s(ci)&&(s(uo)||s(Eh)||s(jp)||s(yv))||s(/\bokhttp\b/i)},windows:{phone:s(ci),tablet:s(_v),device:s(ci)||s(_v)},other:{blackberry:s(bv),blackberry10:s(vv),opera:s(Tv),firefox:s(wv),chrome:s(Sv),device:s(bv)||s(vv)||s(Tv)||s(wv)||s(Sv)},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 Xp,mv,gv,xv,jp,yv,uo,Eh,ci,_v,bv,vv,Tv,Sv,wv,Ev,Yp=y(()=>{Xp=/iPhone/i,mv=/iPod/i,gv=/iPad/i,xv=/\biOS-universal(?:.+)Mac\b/i,jp=/\bAndroid(?:.+)Mobile\b/i,yv=/Android/i,uo=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Eh=/Silk/i,ci=/Windows Phone/i,_v=/\bWindows(?:.+)ARM\b/i,bv=/BlackBerry/i,vv=/BB10/i,Tv=/Opera Mini/i,Sv=/\b(CriOS|Chrome)(?:.+)Mobile/i,wv=/Mobile(?:.+)Firefox\b/i,Ev=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var qp=y(()=>{Yp();Yp()});var vk,Av,Pv=y(()=>{qp();vk=ki.default??ki,Av=vk(globalThis.navigator)});var Tk,Ah,Sk,wk,Cv,Rv,Ek,Ak,Pk,Kp,Iv,Bv=y(()=>{wh();F();Pv();Cp();Tk=9,Ah=100,Sk=0,wk=0,Cv=2,Rv=1,Ek=-1e3,Ak=-1e3,Pk=2,Kp=class Mv{constructor(t,e=Av){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=`${Rv}px`,t.style.height=`${Rv}px`,t.style.position="absolute",t.style.top=`${Ek}px`,t.style.left=`${Ak}px`,t.style.zIndex=Pk.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=`${Ah}px`,this._div.style.height=`${Ah}px`,this._div.style.position="absolute",this._div.style.top=`${Sk}px`,this._div.style.left=`${wk}px`,this._div.style.zIndex=Cv.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 i=0;i<e.length;i++)this._updateAccessibleObjects(e[i])}init(t){let i={accessibilityOptions:{...Mv.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.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 i of this._children)i._renderId===this._renderId&&e.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];e.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,fh(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${i}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let i=0;i<this._children.length;i++){let s=this._children[i];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,l=this._renderer.resolution,c=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*l}px`,o.style.top=`${(a.ty+n.y*a.d)*c}px`,o.style.width=`${n.width*a.a*l}px`,o.style.height=`${n.height*a.d*c}px`}else{this._capHitArea(n);let a=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*l}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*l}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:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-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;
@@ -250,7 +250,7 @@ ${s.join(`
250
250
  {
251
251
  return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
252
252
  }
253
- `}}});var Om,xT,yT=y(()=>{"use strict";Om=["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>"],xT=Om.reduce((r,t)=>(r[t]=!0,r),{})});function _T(r,t){switch(r){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 bT=y(()=>{"use strict"});var vT,Et,Ge=y(()=>{ve();Ta();yT();bT();vT=class TT{constructor(t,e){this._touched=0,this.uid=lt("uniform"),this._resourceType="uniformGroup",this._resourceId=lt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...TT.defaultOptions,...e},this.uniformStructures=t;let i={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!xT[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${Om.join(", ")}`);o.value??(o.value=_T(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=fi(Object.keys(i).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};vT.defaultOptions={ubo:!1,isStatic:!1};Et=vT});function Co(r){let t=ST[r];if(t)return t;let e=new Int32Array(r);for(let i=0;i<r;i++)e[i]=i;return t=ST[r]=new Et({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var ST,jh=y(()=>{Ge();ST={}});var re,Wr=y(()=>{"use strict";re=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(re||{})});var Yt,Er=y(()=>{Ae();ve();vs();Di();So();Wr();Ge();Yt=class r extends Pt{constructor(t){super(),this.uid=lt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,n===void 0&&(n=0,e&&(n|=re.WEBGPU),i&&(n|=re.WEBGL)),this.compatibleRenderers=n;let l={};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 c in a)for(let h in a[c]){let u=a[c][h];l[u]={group:c,binding:h,name:u}}else if(e&&s&&!a){let c=e.structsAndGroups.groups;a={},c.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[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,l[u.name]=u});let c=0;for(let h in o)l[h]||(s[99]||(s[99]=new pe,this._ownedBindGroups.push(s[99])),l[h]={group:99,binding:c,name:h},a[99]=a[99]||{},a[99][c]=h,c++);for(let h in o){let u=h,d=o[h];!d.source&&!d._resourceType&&(d=new Et(d));let f=l[u];f&&(s[f.group]||(s[f.group]=new pe,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(t,e,i){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[i]||(o[i]=t),this.groups[e]||(this.groups[e]=new pe,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let i={};for(let s in e){let o=e[s];Object.defineProperty(i,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return i}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:i,...s}=t,o,n;return e&&(o=fr.from(e)),i&&(n=dr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var Yh,wT=y(()=>{Vi();Sa();wa();Wi();jh();Er();Yh=class extends Yt{constructor(t){let e=Nr({name:"batch",bits:[Eo,Po(t),Vr]}),i=Dr({name:"batch",bits:[wo,Ao(t),Hr]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:Co(t)}})}}});var ET,AT,Ea,Um=y(()=>{F();b0();w0();wT();ET=null,AT=class PT extends _0{constructor(){super(...arguments),this.geometry=new zh,this.shader=ET||(ET=new Yh(this.maxTextures)),this.name=PT.extension.name,this.vertexSize=6}packAttributes(t,e,i,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,c=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,{positions:p,uvs:m}=t,x=t.color,_=t.attributeOffset,T=_+t.attributeSize;for(let g=_;g<T;g++){let w=g*2,b=p[w],S=p[w+1];e[s++]=l*b+h*S+d,e[s++]=u*S+c*b+f,e[s++]=m[w],e[s++]=m[w+1],i[s++]=x,i[s++]=n}}packQuadAttributes(t,e,i,s,o){let n=t.texture,a=t.transform,l=a.a,c=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,p=t.bounds,m=p.maxX,x=p.minX,_=p.maxY,T=p.minY,g=n.uvs,w=t.color,b=o<<16|t.roundPixels&65535;e[s+0]=l*x+h*T+d,e[s+1]=u*T+c*x+f,e[s+2]=g.x0,e[s+3]=g.y0,i[s+4]=w,i[s+5]=b,e[s+6]=l*m+h*T+d,e[s+7]=u*T+c*m+f,e[s+8]=g.x1,e[s+9]=g.y1,i[s+10]=w,i[s+11]=b,e[s+12]=l*m+h*_+d,e[s+13]=u*_+c*m+f,e[s+14]=g.x2,e[s+15]=g.y2,i[s+16]=w,i[s+17]=b,e[s+18]=l*x+h*_+d,e[s+19]=u*_+c*x+f,e[s+20]=g.x3,e[s+21]=g.y3,i[s+22]=w,i[s+23]=b}};AT.extension={type:[E.Batcher],name:"default"};Ea=AT});function CT(r,t,e,i,s,o,n,a=null){let l=0;e*=t,s*=o;let c=a.a,h=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;l<n;){let m=r[e],x=r[e+1];i[s]=c*m+u*x+f,i[s+1]=h*m+d*x+p,s+=o,e+=t,l++}}function RT(r,t,e,i){let s=0;for(t*=e;s<i;)r[t]=0,r[t+1]=0,t+=e,s++}var MT=y(()=>{"use strict"});function Gm(r,t,e,i,s){let o=t.a,n=t.b,a=t.c,l=t.d,c=t.tx,h=t.ty;e||(e=0),i||(i=2),s||(s=r.length/i-e);let u=e*i;for(let d=0;d<s;d++){let f=r[u],p=r[u+1];r[u]=o*f+a*p+c,r[u+1]=n*f+l*p+h,u+=i}}var IT=y(()=>{"use strict"});var e2,Ss,Lm=y(()=>{ft();Mp();e2=new U,Ss=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,i=this.renderable;return i?yh(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||e2}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 Ro,BT,FT,kT=y(()=>{F();Ro={extension:{type:E.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,o,n,a;if(r.type==="circle"){let w=r;e=w.x,i=w.y,n=a=w.radius,s=o=0}else if(r.type==="ellipse"){let w=r;e=w.x,i=w.y,n=w.halfWidth,a=w.halfHeight,s=o=0}else{let w=r,b=w.width/2,S=w.height/2;e=w.x+b,i=w.y+S,n=a=Math.max(0,Math.min(w.radius,Math.min(b,S))),s=b-n,o=S-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let l=Math.ceil(2.3*Math.sqrt(n+a)),c=l*8+(s?4:0)+(o?4:0);if(c===0)return t;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=i+o,t[2]=t[4]=e-s,t[5]=t[7]=i-o,t;let h=0,u=l*4+(s?2:0)+2,d=u,f=c,p=s+n,m=o,x=e+p,_=e-p,T=i+m;if(t[h++]=x,t[h++]=T,t[--u]=T,t[--u]=_,o){let w=i-m;t[d++]=_,t[d++]=w,t[--f]=w,t[--f]=x}for(let w=1;w<l;w++){let b=Math.PI/2*(w/l),S=s+Math.cos(b)*n,v=o+Math.sin(b)*a,A=e+S,P=e-S,C=i+v,R=i-v;t[h++]=A,t[h++]=C,t[--u]=C,t[--u]=P,t[d++]=P,t[d++]=R,t[--f]=R,t[--f]=A}p=s,m=o+a,x=e+p,_=e-p,T=i+m;let g=i-m;return t[h++]=x,t[h++]=T,t[--f]=g,t[--f]=x,s&&(t[h++]=_,t[h++]=T,t[--f]=g,t[--f]=_),t},triangulate(r,t,e,i,s,o){if(r.length===0)return;let n=0,a=0;for(let h=0;h<r.length;h+=2)n+=r[h],a+=r[h+1];n/=r.length/2,a/=r.length/2;let l=i;t[l*e]=n,t[l*e+1]=a;let c=l++;for(let h=0;h<r.length;h+=2)t[l*e]=r[h],t[l*e+1]=r[h+1],h>0&&(s[o++]=l,s[o++]=c,s[o++]=l-1),l++;s[o++]=c+1,s[o++]=c,s[o++]=l-1}},BT={...Ro,extension:{...Ro.extension,name:"ellipse"}},FT={...Ro,extension:{...Ro.extension,name:"roundedRectangle"}}});function OT(r){let t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],o=r[t-1];i<t;i+=2){let n=r[i],a=r[i+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var UT=y(()=>{"use strict"});function GT(r,t,e,i,s,o,n,a){let l=r-e*s,c=t-i*s,h=r+e*o,u=t+i*o,d,f;n?(d=i,f=-e):(d=-i,f=e);let p=l+d,m=c+f,x=h+d,_=u+f;return a.push(p,m),a.push(x,_),2}function ws(r,t,e,i,s,o,n,a){let l=e-r,c=i-t,h=Math.atan2(l,c),u=Math.atan2(s-r,o-t);a&&h<u?h+=Math.PI*2:!a&&h>u&&(u+=Math.PI*2);let d=h,f=u-h,p=Math.abs(f),m=Math.sqrt(l*l+c*c),x=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/x;if(d+=_,a){n.push(r,t),n.push(e,i);for(let T=1,g=d;T<x;T++,g+=_)n.push(r,t),n.push(r+Math.sin(g)*m,t+Math.cos(g)*m);n.push(r,t),n.push(s,o)}else{n.push(e,i),n.push(r,t);for(let T=1,g=d;T<x;T++,g+=_)n.push(r+Math.sin(g)*m,t+Math.cos(g)*m),n.push(r,t);n.push(s,o),n.push(r,t)}return x*2}function LT(r,t,e,i,s,o){let n=1e-4;if(r.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let G=OT(r);e&&(G*=-1),l=(l-.5)*G+.5}let c=new ct(r[0],r[1]),h=new ct(r[r.length-2],r[r.length-1]),u=i,d=Math.abs(c.x-h.x)<n&&Math.abs(c.y-h.y)<n;if(u){r=r.slice(),d&&(r.pop(),r.pop(),h.set(r[r.length-2],r[r.length-1]));let G=(c.x+h.x)*.5,it=(h.y+c.y)*.5;r.unshift(G,it),r.push(G,it)}let f=s,p=r.length/2,m=r.length,x=f.length/2,_=a.width/2,T=_*_,g=a.miterLimit*a.miterLimit,w=r[0],b=r[1],S=r[2],v=r[3],A=0,P=0,C=-(b-v),R=w-S,M=0,I=0,k=Math.sqrt(C*C+R*R);C/=k,R/=k,C*=_,R*=_;let W=l,O=(1-W)*2,z=W*2;u||(a.cap==="round"?m+=ws(w-C*(O-z)*.5,b-R*(O-z)*.5,w-C*O,b-R*O,w+C*z,b+R*z,f,!0)+2:a.cap==="square"&&(m+=GT(w,b,C,R,O,z,!0,f))),f.push(w-C*O,b-R*O),f.push(w+C*z,b+R*z);for(let G=1;G<p-1;++G){w=r[(G-1)*2],b=r[(G-1)*2+1],S=r[G*2],v=r[G*2+1],A=r[(G+1)*2],P=r[(G+1)*2+1],C=-(b-v),R=w-S,k=Math.sqrt(C*C+R*R),C/=k,R/=k,C*=_,R*=_,M=-(v-P),I=S-A,k=Math.sqrt(M*M+I*I),M/=k,I/=k,M*=_,I*=_;let it=S-w,yt=b-v,dt=S-A,Ot=P-v,Xt=it*dt+yt*Ot,Nt=yt*dt-Ot*it,te=Nt<0;if(Math.abs(Nt)<.001*Math.abs(Xt)){f.push(S-C*O,v-R*O),f.push(S+C*z,v+R*z),Xt>=0&&(a.join==="round"?m+=ws(S,v,S-C*O,v-R*O,S-M*O,v-I*O,f,!1)+4:m+=2,f.push(S-M*z,v-I*z),f.push(S+M*O,v+I*O));continue}let de=(-C+w)*(-R+v)-(-C+S)*(-R+b),Se=(-M+A)*(-I+v)-(-M+S)*(-I+P),Ft=(it*Se-dt*de)/Nt,ye=(Ot*de-yt*Se)/Nt,Me=(Ft-S)*(Ft-S)+(ye-v)*(ye-v),we=S+(Ft-S)*O,Ie=v+(ye-v)*O,Tr=S-(Ft-S)*z,as=v-(ye-v)*z,YF=Math.min(it*it+yt*yt,dt*dt+Ot*Ot),nb=te?O:z,qF=YF+nb*nb*T;Me<=qF?a.join==="bevel"||Me/T>g?(te?(f.push(we,Ie),f.push(S+C*z,v+R*z),f.push(we,Ie),f.push(S+M*z,v+I*z)):(f.push(S-C*O,v-R*O),f.push(Tr,as),f.push(S-M*O,v-I*O),f.push(Tr,as)),m+=2):a.join==="round"?te?(f.push(we,Ie),f.push(S+C*z,v+R*z),m+=ws(S,v,S+C*z,v+R*z,S+M*z,v+I*z,f,!0)+4,f.push(we,Ie),f.push(S+M*z,v+I*z)):(f.push(S-C*O,v-R*O),f.push(Tr,as),m+=ws(S,v,S-C*O,v-R*O,S-M*O,v-I*O,f,!1)+4,f.push(S-M*O,v-I*O),f.push(Tr,as)):(f.push(we,Ie),f.push(Tr,as)):(f.push(S-C*O,v-R*O),f.push(S+C*z,v+R*z),a.join==="round"?te?m+=ws(S,v,S+C*z,v+R*z,S+M*z,v+I*z,f,!0)+2:m+=ws(S,v,S-C*O,v-R*O,S-M*O,v-I*O,f,!1)+2:a.join==="miter"&&Me/T<=g&&(te?(f.push(Tr,as),f.push(Tr,as)):(f.push(we,Ie),f.push(we,Ie)),m+=2),f.push(S-M*O,v-I*O),f.push(S+M*z,v+I*z),m+=2)}w=r[(p-2)*2],b=r[(p-2)*2+1],S=r[(p-1)*2],v=r[(p-1)*2+1],C=-(b-v),R=w-S,k=Math.sqrt(C*C+R*R),C/=k,R/=k,C*=_,R*=_,f.push(S-C*O,v-R*O),f.push(S+C*z,v+R*z),u||(a.cap==="round"?m+=ws(S-C*(O-z)*.5,v-R*(O-z)*.5,S-C*O,v-R*O,S+C*z,v+R*z,f,!1)+2:a.cap==="square"&&(m+=GT(S,v,C,R,O,z,!1,f)));let V=1e-4*1e-4;for(let G=x;G<m+x-2;++G)w=f[G*2],b=f[G*2+1],S=f[(G+1)*2],v=f[(G+1)*2+1],A=f[(G+2)*2],P=f[(G+2)*2+1],!(Math.abs(w*(v-P)+S*(P-b)+A*(b-v))<V)&&o.push(G,G+1,G+2)}var DT=y(()=>{cr();UT()});function NT(r,t,e,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],c=t||Math.abs(o-a)<s&&Math.abs(n-l)<s,h=e,u=r.length/2,d=h.length/2;for(let f=0;f<u;f++)h.push(r[f*2]),h.push(r[f*2+1]);for(let f=0;f<u-1;f++)i.push(d+f,d+f+1);c&&i.push(d+u-1,d)}var HT=y(()=>{});var Jh=Z((e6,Vm)=>{"use strict";Vm.exports=Zh;Vm.exports.default=Zh;function Zh(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,o=WT(r,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,c,h,u,d,f;if(i&&(o=l2(r,t,o,e)),r.length>80*e){a=c=r[0],l=h=r[1];for(var p=e;p<s;p+=e)u=r[p],d=r[p+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);f=Math.max(c-a,h-l),f=f!==0?32767/f:0}return Aa(o,n,e,a,l,f,0),n}function WT(r,t,e,i,s){var o,n;if(s===Hm(r,t,e,i)>0)for(o=t;o<e;o+=i)n=VT(o,r[o],r[o+1],n);else for(o=e-i;o>=t;o-=i)n=VT(o,r[o],r[o+1],n);return n&&Qh(n,n.next)&&(Ca(n),n=n.next),n}function Es(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Qh(e,e.next)||Wt(e.prev,e,e.next)===0)){if(Ca(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Aa(r,t,e,i,s,o,n){if(r){!n&&o&&f2(r,i,s,o);for(var a=r,l,c;r.prev!==r.next;){if(l=r.prev,c=r.next,o?o2(r,i,s,o):s2(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(c.i/e|0),Ca(r),r=c.next,a=c.next;continue}if(r=c,r===a){n?n===1?(r=n2(Es(r),t,e),Aa(r,t,e,i,s,o,2)):n===2&&a2(r,t,e,i,s,o):Aa(Es(r),t,e,i,s,o,1);break}}}}function s2(r){var t=r.prev,e=r,i=r.next;if(Wt(t,e,i)>=0)return!1;for(var s=t.x,o=e.x,n=i.x,a=t.y,l=e.y,c=i.y,h=s<o?s<n?s:n:o<n?o:n,u=a<l?a<c?a:c:l<c?l:c,d=s>o?s>n?s:n:o>n?o:n,f=a>l?a>c?a:c:l>c?l:c,p=i.next;p!==t;){if(p.x>=h&&p.x<=d&&p.y>=u&&p.y<=f&&Mo(s,a,o,l,n,c,p.x,p.y)&&Wt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o2(r,t,e,i){var s=r.prev,o=r,n=r.next;if(Wt(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,c=n.x,h=s.y,u=o.y,d=n.y,f=a<l?a<c?a:c:l<c?l:c,p=h<u?h<d?h:d:u<d?u:d,m=a>l?a>c?a:c:l>c?l:c,x=h>u?h>d?h:d:u>d?u:d,_=Dm(f,p,t,e,i),T=Dm(m,x,t,e,i),g=r.prevZ,w=r.nextZ;g&&g.z>=_&&w&&w.z<=T;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=x&&g!==s&&g!==n&&Mo(a,h,l,u,c,d,g.x,g.y)&&Wt(g.prev,g,g.next)>=0||(g=g.prevZ,w.x>=f&&w.x<=m&&w.y>=p&&w.y<=x&&w!==s&&w!==n&&Mo(a,h,l,u,c,d,w.x,w.y)&&Wt(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;g&&g.z>=_;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=x&&g!==s&&g!==n&&Mo(a,h,l,u,c,d,g.x,g.y)&&Wt(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;w&&w.z<=T;){if(w.x>=f&&w.x<=m&&w.y>=p&&w.y<=x&&w!==s&&w!==n&&Mo(a,h,l,u,c,d,w.x,w.y)&&Wt(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function n2(r,t,e){var i=r;do{var s=i.prev,o=i.next.next;!Qh(s,o)&&zT(s,i,i.next,o)&&Pa(s,o)&&Pa(o,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(o.i/e|0),Ca(i),Ca(i.next),i=r=o),i=i.next}while(i!==r);return Es(i)}function a2(r,t,e,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&g2(n,a)){var l=$T(n,a);n=Es(n,n.next),l=Es(l,l.next),Aa(n,t,e,i,s,o,0),Aa(l,t,e,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function l2(r,t,e,i){var s=[],o,n,a,l,c;for(o=0,n=t.length;o<n;o++)a=t[o]*i,l=o<n-1?t[o+1]*i:r.length,c=WT(r,a,l,i,!1),c===c.next&&(c.steiner=!0),s.push(m2(c));for(s.sort(c2),o=0;o<s.length;o++)e=h2(s[o],e);return e}function c2(r,t){return r.x-t.x}function h2(r,t){var e=u2(r,t);if(!e)return t;var i=$T(e,r);return Es(i,i.next),Es(e,e.next)}function u2(r,t){var e=t,i=r.x,s=r.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<=i&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===i))return n}e=e.next}while(e!==t);if(!n)return null;var l=n,c=n.x,h=n.y,u=1/0,d;e=n;do i>=e.x&&e.x>=c&&i!==e.x&&Mo(s<h?i:o,s,c,h,s<h?o:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),Pa(e,r)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&d2(n,e)))&&(n=e,u=d)),e=e.next;while(e!==l);return n}function d2(r,t){return Wt(r.prev,r,t.prev)<0&&Wt(t.next,r,r.next)<0}function f2(r,t,e,i){var s=r;do s.z===0&&(s.z=Dm(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,p2(s)}function p2(r){var t,e,i,s,o,n,a,l,c=1;do{for(e=r,r=null,o=null,n=0;e;){for(n++,i=e,a=0,t=0;t<c&&(a++,i=i.nextZ,!!i);t++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;e=i}o.nextZ=null,c*=2}while(n>1);return r}function Dm(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function m2(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Mo(r,t,e,i,s,o,n,a){return(s-n)*(t-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(i-a)}function g2(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!x2(r,t)&&(Pa(r,t)&&Pa(t,r)&&y2(r,t)&&(Wt(r.prev,r,t.prev)||Wt(r,t.prev,t))||Qh(r,t)&&Wt(r.prev,r,r.next)>0&&Wt(t.prev,t,t.next)>0)}function Wt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Qh(r,t){return r.x===t.x&&r.y===t.y}function zT(r,t,e,i){var s=Kh(Wt(r,t,e)),o=Kh(Wt(r,t,i)),n=Kh(Wt(e,i,r)),a=Kh(Wt(e,i,t));return!!(s!==o&&n!==a||s===0&&qh(r,e,t)||o===0&&qh(r,i,t)||n===0&&qh(e,r,i)||a===0&&qh(e,t,i))}function qh(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Kh(r){return r>0?1:r<0?-1:0}function x2(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&zT(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Pa(r,t){return Wt(r.prev,r,r.next)<0?Wt(r,t,r.next)>=0&&Wt(r,r.prev,t)>=0:Wt(r,t,r.prev)<0||Wt(r,r.next,t)<0}function y2(r,t){var e=r,i=!1,s=(r.x+t.x)/2,o=(r.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&&(i=!i),e=e.next;while(e!==r);return i}function $T(r,t){var e=new Nm(r.i,r.x,r.y),i=new Nm(t.i,t.x,t.y),s=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function VT(r,t,e,i){var s=new Nm(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Ca(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Nm(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Zh.deviation=function(r,t,e,i){var s=t&&t.length,o=s?t[0]*e:r.length,n=Math.abs(Hm(r,0,o,e));if(s)for(var a=0,l=t.length;a<l;a++){var c=t[a]*e,h=a<l-1?t[a+1]*e:r.length;n-=Math.abs(Hm(r,c,h,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,p=i[a+2]*e;u+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function Hm(r,t,e,i){for(var s=0,o=t,n=e-i;o<e;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}Zh.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e}});function tu(r,t,e,i,s,o,n){let a=(0,XT.default)(r,t,2);if(!a)return;for(let c=0;c<a.length;c+=3)o[n++]=a[c]+s,o[n++]=a[c+1]+s,o[n++]=a[c+2]+s;let l=s*i;for(let c=0;c<r.length;c+=2)e[l]=r[c],e[l+1]=r[c+1],l+=i}var XT,Wm=y(()=>{XT=ls(Jh(),1)});var _2,jT,YT=y(()=>{F();Wm();_2=[],jT={extension:{type:E.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return t},triangulate(r,t,e,i,s,o){tu(r,_2,t,e,i,s,o)}}});var qT,KT=y(()=>{F();qT={extension:{type:E.ShapeBuilder,name:"rectangle"},build(r,t){let e=r,i=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=i,t[1]=s,t[2]=i+o,t[3]=s,t[4]=i+o,t[5]=s+n,t[6]=i,t[7]=s+n),t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[6],t[i+n+1]=r[7],n+=e,t[i+n]=r[4],t[i+n+1]=r[5],n+=e;let a=i/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 ZT,QT=y(()=>{F();ZT={extension:{type:E.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[4],t[i+n+1]=r[5];let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function tS(r,t){for(let e=0;e<t.length;e++){let i=t[e];r.addColorStop(i.offset,i.color)}}function eS(r,t){let e=j.get().createCanvas(r,t),i=e.getContext("2d");return{canvas:e,context:i}}function b2(r){let t=r[0]??{};return(typeof t=="number"||r[1])&&(X("8.5.2","use options object instead"),t={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??Xe.defaultLinearOptions.textureSize}),t}var JT,$m,Xe,Io=y(()=>{_e();Ct();ft();xo();_t();ve();Ht();Up();JT=[{offset:0,color:"white"},{offset:1,color:"black"}],$m=class zm{constructor(...t){this.uid=lt("fillGradient"),this.type="linear",this.colorStops=[];let e=b2(t);e={...e.type==="radial"?zm.defaultRadialOptions:zm.defaultLinearOptions,...bh(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:st.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:s}=this.end,o=i-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let x=t;t=i,i=x,o*=-1}if(n<0){let x=e;e=s,s=x,n*=-1}}let l=this.colorStops.length?this.colorStops:JT,c=this._textureSize,{canvas:h,context:u}=eS(c,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);tS(d,l),u.fillStyle=d,u.fillRect(0,0,c,1),this.texture=new B({source:new ze({resource:h,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new U;m.scale(f/c,1),m.rotate(p),m.translate(t,e),this.textureSpace==="local"&&m.scale(c,c),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:JT,e=this._textureSize,{canvas:i,context:s}=eS(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,h=this.outerRadius,u=a-h,d=l-h,f=e/(h*2),p=(o-u)*f,m=(n-d)*f,x=s.createRadialGradient(p,m,c*f,(a-u)*f,(l-d)*f,h*f);tS(x,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=x,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,e,e),this.texture=new B({source:new ze({resource:i,addressMode:this._wrapMode})});let _=new U;_.scale(1/f,1/f),_.translate(u,d),this.textureSpace==="local"&&_.scale(e,e),this.transform=_}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};$m.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};$m.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Xe=$m});function rS(r,t,e,i){let s=t.matrix?r.copyFrom(t.matrix).invert():r.identity();if(t.textureSpace==="local"){let n=e.getBounds(T2);t.width&&n.pad(t.width);let{x:a,y:l}=n,c=1/n.width,h=1/n.height,u=-a*c,d=-l*h,f=s.a,p=s.b,m=s.c,x=s.d;s.a*=c,s.b*=c,s.c*=h,s.d*=h,s.tx=u*f+d*m+s.tx,s.ty=u*p+d*x+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof Xe)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(v2.copyFrom(i).invert()),s}var v2,T2,iS=y(()=>{ft();ae();Io();v2=new U,T2=new Q});function oS(r,t){let{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")E2(o.data,i,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,l=o.data.style,c=o.data.hole;n&&c&&sS(c.shapePath,l,!0,i,e),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),sS(a,l,n,i,e)}}}function E2(r,t,e){let{vertices:i,uvs:s,indices:o}=e,n=o.length,a=i.length/2,l=[],c=eu.rectangle,h=S2,u=r.image;h.x=r.dx,h.y=r.dy,h.width=r.dw,h.height=r.dh;let d=r.transform;c.build(h,l),d&&Gm(l,d),c.triangulate(l,i,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 p=et.get(Ss);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=i.length/2-a,p.baseColor=r.style,p.alpha=r.alpha,p.texture=u,p.geometryData=e,t.push(p)}function sS(r,t,e,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:l,transform:c,holes:h})=>{let u=a.length,d=o.length/2,f=[],p=eu[l.type],m="triangle-list";if(p.build(l,f),c&&Gm(f,c),e){let g=l.closePath??!0,w=t;w.pixelLine?(NT(f,g,o,a),m="line-list"):LT(f,w,!1,g,o,a)}else if(h){let g=[],w=f.slice();A2(h).forEach(S=>{g.push(w.length/2),w.push(...S)}),tu(w,g,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let x=n.length/2,_=t.texture;if(_!==B.WHITE){let g=rS(w2,t,l,c);CT(o,2,d,n,x,2,o.length/2-d,g)}else RT(n,x,2,o.length/2-d);let T=et.get(Ss);T.indexOffset=u,T.indexSize=a.length-u,T.attributeOffset=d,T.attributeSize=o.length/2-d,T.baseColor=t.color,T.alpha=t.alpha,T.texture=_,T.geometryData=s,T.topology=m,i.push(T)})}function A2(r){let t=[];for(let e=0;e<r.length;e++){let i=r[e].shape,s=[];eu[i.type].build(i,s),t.push(s)}return t}var eu,S2,w2,nS=y(()=>{F();ft();ae();MT();IT();_t();Fe();Lm();kT();DT();HT();YT();KT();QT();iS();Wm();eu={};D.handleByMap(E.ShapeBuilder,eu);D.add(qT,jT,ZT,Ro,BT,FT);S2=new Q,w2=new U});var Xm,jm,qm,Bo,ru=y(()=>{F();Hh();Um();kp();Ht();Fe();nS();Xm=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},jm=class{constructor(){this.batcher=new Ea,this.instructions=new lo}init(){this.instructions.reset()}get geometry(){return X(Pb,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},qm=class Ym{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Ym.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Ym.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),oS(t,e);let i=t.batchMode;t.customShader||i==="no-batch"?e.isBatchable=!1:i==="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=et.get(jm),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let h=0;h<i.length;h++)i[h].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let h=0;h<i.length;h++){let u=i[h];a.add(u)}a.finish(e.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let c=a.batches;for(let h=0;h<c.length;h++){let u=c[h];u.bindGroup=bo(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new Xm;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]&&(et.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(i=>{et.return(i)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};qm.extension={type:[E.WebGLSystem,E.WebGPUSystem,E.CanvasSystem],name:"graphicsContext"};qm.defaultOptions={bezierSmoothness:.5};Bo=qm});var P2,Km,Zm,Qm,Jm,tg,eg,rg,Kt,Ar=y(()=>{"use strict";P2={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},Km=0,Zm=1,Qm=2,Jm=3,tg=4,eg=5,rg=class aS{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Km)}set blend(t){!!(this.data&1<<Km)!==t&&(this.data^=1<<Km)}get offsets(){return!!(this.data&1<<Zm)}set offsets(t){!!(this.data&1<<Zm)!==t&&(this.data^=1<<Zm)}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<<Qm)}set culling(t){!!(this.data&1<<Qm)!==t&&(this.data^=1<<Qm)}get depthTest(){return!!(this.data&1<<Jm)}set depthTest(t){!!(this.data&1<<Jm)!==t&&(this.data^=1<<Jm)}get depthMask(){return!!(this.data&1<<eg)}set depthMask(t){!!(this.data&1<<eg)!==t&&(this.data^=1<<eg)}get clockwiseFrontFace(){return!!(this.data&1<<tg)}set clockwiseFrontFace(t){!!(this.data&1<<tg)!==t&&(this.data^=1<<tg)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=P2[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 aS;return t.depthTest=!1,t.blend=!0,t}};rg.default2d=rg.for2d();Kt=rg});function zr(r,t,e){let i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}var Fo=y(()=>{"use strict"});var Ra,lS=y(()=>{F();Ar();Fe();Fo();Lm();Ra=class{constructor(t,e){this.state=Kt.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,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){let i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.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 i=0;i<e.length;i++){let s=e[i];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,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;let o=i.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,zr(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),i.isBatchable&&this._initBatchesForRenderable(t),t.batched=i.isBatchable}_addToBatcher(t,e){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,i=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=i.batches.map(n=>{let a=et.get(Ss);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=>{et.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}};Ra.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"graphics"}});var ig=y(()=>{F();ru();lS();D.add(Ra);D.add(Bo)});var zi,iu=y(()=>{"use strict";zi=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"),i=e.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(i,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 Ma,cS=y(()=>{F();ft();Di();Ge();ba();Fe();Fo();iu();Ma=class{constructor(t,e){this.localUniforms=new Et({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new pe({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),i=e.batched,s=t.batched;if(e.batched=s,i!==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 i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,i.addToBatch(o,e)}else i.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&&(et.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=ui(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),zr(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=et.get(zi);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]&&et.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}};Ma.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"mesh"}});var sg=y(()=>{F();cS();D.add(Ma)});var su,hS=y(()=>{"use strict";su=class{execute(t,e){let i=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(i),s.geometry.bind(a.geometry,o.glProgram);let c=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,c,0)}}});function og(r,t=null){let e=r*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 i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}var uS=y(()=>{"use strict"});function fS(r){return{dynamicUpdate:dS(r,!0),staticUpdate:dS(r,!1)}}function dS(r,t){let e=[];e.push(`
253
+ `}}});var Om,xT,yT=y(()=>{"use strict";Om=["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>"],xT=Om.reduce((r,t)=>(r[t]=!0,r),{})});function _T(r,t){switch(r){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 bT=y(()=>{"use strict"});var vT,Et,Ge=y(()=>{ve();Ta();yT();bT();vT=class TT{constructor(t,e){this._touched=0,this.uid=lt("uniform"),this._resourceType="uniformGroup",this._resourceId=lt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...TT.defaultOptions,...e},this.uniformStructures=t;let i={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!xT[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${Om.join(", ")}`);o.value??(o.value=_T(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=fi(Object.keys(i).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};vT.defaultOptions={ubo:!1,isStatic:!1};Et=vT});function Co(r){let t=ST[r];if(t)return t;let e=new Int32Array(r);for(let i=0;i<r;i++)e[i]=i;return t=ST[r]=new Et({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var ST,jh=y(()=>{Ge();ST={}});var re,Wr=y(()=>{"use strict";re=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(re||{})});var Yt,Er=y(()=>{Ae();ve();vs();Di();So();Wr();Ge();Yt=class r extends Pt{constructor(t){super(),this.uid=lt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,n===void 0&&(n=0,e&&(n|=re.WEBGPU),i&&(n|=re.WEBGL)),this.compatibleRenderers=n;let l={};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 c in a)for(let h in a[c]){let u=a[c][h];l[u]={group:c,binding:h,name:u}}else if(e&&s&&!a){let c=e.structsAndGroups.groups;a={},c.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[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,l[u.name]=u});let c=0;for(let h in o)l[h]||(s[99]||(s[99]=new pe,this._ownedBindGroups.push(s[99])),l[h]={group:99,binding:c,name:h},a[99]=a[99]||{},a[99][c]=h,c++);for(let h in o){let u=h,d=o[h];!d.source&&!d._resourceType&&(d=new Et(d));let f=l[u];f&&(s[f.group]||(s[f.group]=new pe,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(t,e,i){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[i]||(o[i]=t),this.groups[e]||(this.groups[e]=new pe,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let i={};for(let s in e){let o=e[s];Object.defineProperty(i,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return i}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:i,...s}=t,o,n;return e&&(o=fr.from(e)),i&&(n=dr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var Yh,wT=y(()=>{Vi();Sa();wa();Wi();jh();Er();Yh=class extends Yt{constructor(t){let e=Nr({name:"batch",bits:[Eo,Po(t),Vr]}),i=Dr({name:"batch",bits:[wo,Ao(t),Hr]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:Co(t)}})}}});var ET,AT,Ea,Um=y(()=>{F();b0();w0();wT();ET=null,AT=class PT extends _0{constructor(){super(...arguments),this.geometry=new zh,this.shader=ET||(ET=new Yh(this.maxTextures)),this.name=PT.extension.name,this.vertexSize=6}packAttributes(t,e,i,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,c=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,{positions:p,uvs:m}=t,x=t.color,_=t.attributeOffset,T=_+t.attributeSize;for(let g=_;g<T;g++){let w=g*2,b=p[w],S=p[w+1];e[s++]=l*b+h*S+d,e[s++]=u*S+c*b+f,e[s++]=m[w],e[s++]=m[w+1],i[s++]=x,i[s++]=n}}packQuadAttributes(t,e,i,s,o){let n=t.texture,a=t.transform,l=a.a,c=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,p=t.bounds,m=p.maxX,x=p.minX,_=p.maxY,T=p.minY,g=n.uvs,w=t.color,b=o<<16|t.roundPixels&65535;e[s+0]=l*x+h*T+d,e[s+1]=u*T+c*x+f,e[s+2]=g.x0,e[s+3]=g.y0,i[s+4]=w,i[s+5]=b,e[s+6]=l*m+h*T+d,e[s+7]=u*T+c*m+f,e[s+8]=g.x1,e[s+9]=g.y1,i[s+10]=w,i[s+11]=b,e[s+12]=l*m+h*_+d,e[s+13]=u*_+c*m+f,e[s+14]=g.x2,e[s+15]=g.y2,i[s+16]=w,i[s+17]=b,e[s+18]=l*x+h*_+d,e[s+19]=u*_+c*x+f,e[s+20]=g.x3,e[s+21]=g.y3,i[s+22]=w,i[s+23]=b}};AT.extension={type:[E.Batcher],name:"default"};Ea=AT});function CT(r,t,e,i,s,o,n,a=null){let l=0;e*=t,s*=o;let c=a.a,h=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;l<n;){let m=r[e],x=r[e+1];i[s]=c*m+u*x+f,i[s+1]=h*m+d*x+p,s+=o,e+=t,l++}}function RT(r,t,e,i){let s=0;for(t*=e;s<i;)r[t]=0,r[t+1]=0,t+=e,s++}var MT=y(()=>{"use strict"});function Gm(r,t,e,i,s){let o=t.a,n=t.b,a=t.c,l=t.d,c=t.tx,h=t.ty;e||(e=0),i||(i=2),s||(s=r.length/i-e);let u=e*i;for(let d=0;d<s;d++){let f=r[u],p=r[u+1];r[u]=o*f+a*p+c,r[u+1]=n*f+l*p+h,u+=i}}var IT=y(()=>{"use strict"});var e2,Ss,Lm=y(()=>{ft();Mp();e2=new U,Ss=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,i=this.renderable;return i?yh(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||e2}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 Ro,BT,FT,kT=y(()=>{F();Ro={extension:{type:E.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,o,n,a;if(r.type==="circle"){let w=r;e=w.x,i=w.y,n=a=w.radius,s=o=0}else if(r.type==="ellipse"){let w=r;e=w.x,i=w.y,n=w.halfWidth,a=w.halfHeight,s=o=0}else{let w=r,b=w.width/2,S=w.height/2;e=w.x+b,i=w.y+S,n=a=Math.max(0,Math.min(w.radius,Math.min(b,S))),s=b-n,o=S-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let l=Math.ceil(2.3*Math.sqrt(n+a)),c=l*8+(s?4:0)+(o?4:0);if(c===0)return t;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=i+o,t[2]=t[4]=e-s,t[5]=t[7]=i-o,t;let h=0,u=l*4+(s?2:0)+2,d=u,f=c,p=s+n,m=o,x=e+p,_=e-p,T=i+m;if(t[h++]=x,t[h++]=T,t[--u]=T,t[--u]=_,o){let w=i-m;t[d++]=_,t[d++]=w,t[--f]=w,t[--f]=x}for(let w=1;w<l;w++){let b=Math.PI/2*(w/l),S=s+Math.cos(b)*n,v=o+Math.sin(b)*a,P=e+S,C=e-S,A=i+v,R=i-v;t[h++]=P,t[h++]=A,t[--u]=A,t[--u]=C,t[d++]=C,t[d++]=R,t[--f]=R,t[--f]=P}p=s,m=o+a,x=e+p,_=e-p,T=i+m;let g=i-m;return t[h++]=x,t[h++]=T,t[--f]=g,t[--f]=x,s&&(t[h++]=_,t[h++]=T,t[--f]=g,t[--f]=_),t},triangulate(r,t,e,i,s,o){if(r.length===0)return;let n=0,a=0;for(let h=0;h<r.length;h+=2)n+=r[h],a+=r[h+1];n/=r.length/2,a/=r.length/2;let l=i;t[l*e]=n,t[l*e+1]=a;let c=l++;for(let h=0;h<r.length;h+=2)t[l*e]=r[h],t[l*e+1]=r[h+1],h>0&&(s[o++]=l,s[o++]=c,s[o++]=l-1),l++;s[o++]=c+1,s[o++]=c,s[o++]=l-1}},BT={...Ro,extension:{...Ro.extension,name:"ellipse"}},FT={...Ro,extension:{...Ro.extension,name:"roundedRectangle"}}});function OT(r){let t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],o=r[t-1];i<t;i+=2){let n=r[i],a=r[i+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var UT=y(()=>{"use strict"});function GT(r,t,e,i,s,o,n,a){let l=r-e*s,c=t-i*s,h=r+e*o,u=t+i*o,d,f;n?(d=i,f=-e):(d=-i,f=e);let p=l+d,m=c+f,x=h+d,_=u+f;return a.push(p,m),a.push(x,_),2}function ws(r,t,e,i,s,o,n,a){let l=e-r,c=i-t,h=Math.atan2(l,c),u=Math.atan2(s-r,o-t);a&&h<u?h+=Math.PI*2:!a&&h>u&&(u+=Math.PI*2);let d=h,f=u-h,p=Math.abs(f),m=Math.sqrt(l*l+c*c),x=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/x;if(d+=_,a){n.push(r,t),n.push(e,i);for(let T=1,g=d;T<x;T++,g+=_)n.push(r,t),n.push(r+Math.sin(g)*m,t+Math.cos(g)*m);n.push(r,t),n.push(s,o)}else{n.push(e,i),n.push(r,t);for(let T=1,g=d;T<x;T++,g+=_)n.push(r+Math.sin(g)*m,t+Math.cos(g)*m),n.push(r,t);n.push(s,o),n.push(r,t)}return x*2}function LT(r,t,e,i,s,o){let n=1e-4;if(r.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let G=OT(r);e&&(G*=-1),l=(l-.5)*G+.5}let c=new ct(r[0],r[1]),h=new ct(r[r.length-2],r[r.length-1]),u=i,d=Math.abs(c.x-h.x)<n&&Math.abs(c.y-h.y)<n;if(u){r=r.slice(),d&&(r.pop(),r.pop(),h.set(r[r.length-2],r[r.length-1]));let G=(c.x+h.x)*.5,it=(h.y+c.y)*.5;r.unshift(G,it),r.push(G,it)}let f=s,p=r.length/2,m=r.length,x=f.length/2,_=a.width/2,T=_*_,g=a.miterLimit*a.miterLimit,w=r[0],b=r[1],S=r[2],v=r[3],P=0,C=0,A=-(b-v),R=w-S,M=0,I=0,k=Math.sqrt(A*A+R*R);A/=k,R/=k,A*=_,R*=_;let W=l,O=(1-W)*2,z=W*2;u||(a.cap==="round"?m+=ws(w-A*(O-z)*.5,b-R*(O-z)*.5,w-A*O,b-R*O,w+A*z,b+R*z,f,!0)+2:a.cap==="square"&&(m+=GT(w,b,A,R,O,z,!0,f))),f.push(w-A*O,b-R*O),f.push(w+A*z,b+R*z);for(let G=1;G<p-1;++G){w=r[(G-1)*2],b=r[(G-1)*2+1],S=r[G*2],v=r[G*2+1],P=r[(G+1)*2],C=r[(G+1)*2+1],A=-(b-v),R=w-S,k=Math.sqrt(A*A+R*R),A/=k,R/=k,A*=_,R*=_,M=-(v-C),I=S-P,k=Math.sqrt(M*M+I*I),M/=k,I/=k,M*=_,I*=_;let it=S-w,yt=b-v,dt=S-P,Ut=C-v,Xt=it*dt+yt*Ut,Nt=yt*dt-Ut*it,te=Nt<0;if(Math.abs(Nt)<.001*Math.abs(Xt)){f.push(S-A*O,v-R*O),f.push(S+A*z,v+R*z),Xt>=0&&(a.join==="round"?m+=ws(S,v,S-A*O,v-R*O,S-M*O,v-I*O,f,!1)+4:m+=2,f.push(S-M*z,v-I*z),f.push(S+M*O,v+I*O));continue}let de=(-A+w)*(-R+v)-(-A+S)*(-R+b),Se=(-M+P)*(-I+v)-(-M+S)*(-I+C),Ft=(it*Se-dt*de)/Nt,ye=(Ut*de-yt*Se)/Nt,Me=(Ft-S)*(Ft-S)+(ye-v)*(ye-v),we=S+(Ft-S)*O,Ie=v+(ye-v)*O,Tr=S-(Ft-S)*z,as=v-(ye-v)*z,YF=Math.min(it*it+yt*yt,dt*dt+Ut*Ut),nb=te?O:z,qF=YF+nb*nb*T;Me<=qF?a.join==="bevel"||Me/T>g?(te?(f.push(we,Ie),f.push(S+A*z,v+R*z),f.push(we,Ie),f.push(S+M*z,v+I*z)):(f.push(S-A*O,v-R*O),f.push(Tr,as),f.push(S-M*O,v-I*O),f.push(Tr,as)),m+=2):a.join==="round"?te?(f.push(we,Ie),f.push(S+A*z,v+R*z),m+=ws(S,v,S+A*z,v+R*z,S+M*z,v+I*z,f,!0)+4,f.push(we,Ie),f.push(S+M*z,v+I*z)):(f.push(S-A*O,v-R*O),f.push(Tr,as),m+=ws(S,v,S-A*O,v-R*O,S-M*O,v-I*O,f,!1)+4,f.push(S-M*O,v-I*O),f.push(Tr,as)):(f.push(we,Ie),f.push(Tr,as)):(f.push(S-A*O,v-R*O),f.push(S+A*z,v+R*z),a.join==="round"?te?m+=ws(S,v,S+A*z,v+R*z,S+M*z,v+I*z,f,!0)+2:m+=ws(S,v,S-A*O,v-R*O,S-M*O,v-I*O,f,!1)+2:a.join==="miter"&&Me/T<=g&&(te?(f.push(Tr,as),f.push(Tr,as)):(f.push(we,Ie),f.push(we,Ie)),m+=2),f.push(S-M*O,v-I*O),f.push(S+M*z,v+I*z),m+=2)}w=r[(p-2)*2],b=r[(p-2)*2+1],S=r[(p-1)*2],v=r[(p-1)*2+1],A=-(b-v),R=w-S,k=Math.sqrt(A*A+R*R),A/=k,R/=k,A*=_,R*=_,f.push(S-A*O,v-R*O),f.push(S+A*z,v+R*z),u||(a.cap==="round"?m+=ws(S-A*(O-z)*.5,v-R*(O-z)*.5,S-A*O,v-R*O,S+A*z,v+R*z,f,!1)+2:a.cap==="square"&&(m+=GT(S,v,A,R,O,z,!1,f)));let V=1e-4*1e-4;for(let G=x;G<m+x-2;++G)w=f[G*2],b=f[G*2+1],S=f[(G+1)*2],v=f[(G+1)*2+1],P=f[(G+2)*2],C=f[(G+2)*2+1],!(Math.abs(w*(v-C)+S*(C-b)+P*(b-v))<V)&&o.push(G,G+1,G+2)}var DT=y(()=>{cr();UT()});function NT(r,t,e,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],c=t||Math.abs(o-a)<s&&Math.abs(n-l)<s,h=e,u=r.length/2,d=h.length/2;for(let f=0;f<u;f++)h.push(r[f*2]),h.push(r[f*2+1]);for(let f=0;f<u-1;f++)i.push(d+f,d+f+1);c&&i.push(d+u-1,d)}var HT=y(()=>{});var Jh=Z((s6,Vm)=>{"use strict";Vm.exports=Zh;Vm.exports.default=Zh;function Zh(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,o=WT(r,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,c,h,u,d,f;if(i&&(o=l2(r,t,o,e)),r.length>80*e){a=c=r[0],l=h=r[1];for(var p=e;p<s;p+=e)u=r[p],d=r[p+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);f=Math.max(c-a,h-l),f=f!==0?32767/f:0}return Aa(o,n,e,a,l,f,0),n}function WT(r,t,e,i,s){var o,n;if(s===Hm(r,t,e,i)>0)for(o=t;o<e;o+=i)n=VT(o,r[o],r[o+1],n);else for(o=e-i;o>=t;o-=i)n=VT(o,r[o],r[o+1],n);return n&&Qh(n,n.next)&&(Ca(n),n=n.next),n}function Es(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Qh(e,e.next)||Wt(e.prev,e,e.next)===0)){if(Ca(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Aa(r,t,e,i,s,o,n){if(r){!n&&o&&f2(r,i,s,o);for(var a=r,l,c;r.prev!==r.next;){if(l=r.prev,c=r.next,o?o2(r,i,s,o):s2(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(c.i/e|0),Ca(r),r=c.next,a=c.next;continue}if(r=c,r===a){n?n===1?(r=n2(Es(r),t,e),Aa(r,t,e,i,s,o,2)):n===2&&a2(r,t,e,i,s,o):Aa(Es(r),t,e,i,s,o,1);break}}}}function s2(r){var t=r.prev,e=r,i=r.next;if(Wt(t,e,i)>=0)return!1;for(var s=t.x,o=e.x,n=i.x,a=t.y,l=e.y,c=i.y,h=s<o?s<n?s:n:o<n?o:n,u=a<l?a<c?a:c:l<c?l:c,d=s>o?s>n?s:n:o>n?o:n,f=a>l?a>c?a:c:l>c?l:c,p=i.next;p!==t;){if(p.x>=h&&p.x<=d&&p.y>=u&&p.y<=f&&Mo(s,a,o,l,n,c,p.x,p.y)&&Wt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o2(r,t,e,i){var s=r.prev,o=r,n=r.next;if(Wt(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,c=n.x,h=s.y,u=o.y,d=n.y,f=a<l?a<c?a:c:l<c?l:c,p=h<u?h<d?h:d:u<d?u:d,m=a>l?a>c?a:c:l>c?l:c,x=h>u?h>d?h:d:u>d?u:d,_=Dm(f,p,t,e,i),T=Dm(m,x,t,e,i),g=r.prevZ,w=r.nextZ;g&&g.z>=_&&w&&w.z<=T;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=x&&g!==s&&g!==n&&Mo(a,h,l,u,c,d,g.x,g.y)&&Wt(g.prev,g,g.next)>=0||(g=g.prevZ,w.x>=f&&w.x<=m&&w.y>=p&&w.y<=x&&w!==s&&w!==n&&Mo(a,h,l,u,c,d,w.x,w.y)&&Wt(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;g&&g.z>=_;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=x&&g!==s&&g!==n&&Mo(a,h,l,u,c,d,g.x,g.y)&&Wt(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;w&&w.z<=T;){if(w.x>=f&&w.x<=m&&w.y>=p&&w.y<=x&&w!==s&&w!==n&&Mo(a,h,l,u,c,d,w.x,w.y)&&Wt(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function n2(r,t,e){var i=r;do{var s=i.prev,o=i.next.next;!Qh(s,o)&&zT(s,i,i.next,o)&&Pa(s,o)&&Pa(o,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(o.i/e|0),Ca(i),Ca(i.next),i=r=o),i=i.next}while(i!==r);return Es(i)}function a2(r,t,e,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&g2(n,a)){var l=$T(n,a);n=Es(n,n.next),l=Es(l,l.next),Aa(n,t,e,i,s,o,0),Aa(l,t,e,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function l2(r,t,e,i){var s=[],o,n,a,l,c;for(o=0,n=t.length;o<n;o++)a=t[o]*i,l=o<n-1?t[o+1]*i:r.length,c=WT(r,a,l,i,!1),c===c.next&&(c.steiner=!0),s.push(m2(c));for(s.sort(c2),o=0;o<s.length;o++)e=h2(s[o],e);return e}function c2(r,t){return r.x-t.x}function h2(r,t){var e=u2(r,t);if(!e)return t;var i=$T(e,r);return Es(i,i.next),Es(e,e.next)}function u2(r,t){var e=t,i=r.x,s=r.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<=i&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===i))return n}e=e.next}while(e!==t);if(!n)return null;var l=n,c=n.x,h=n.y,u=1/0,d;e=n;do i>=e.x&&e.x>=c&&i!==e.x&&Mo(s<h?i:o,s,c,h,s<h?o:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),Pa(e,r)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&d2(n,e)))&&(n=e,u=d)),e=e.next;while(e!==l);return n}function d2(r,t){return Wt(r.prev,r,t.prev)<0&&Wt(t.next,r,r.next)<0}function f2(r,t,e,i){var s=r;do s.z===0&&(s.z=Dm(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,p2(s)}function p2(r){var t,e,i,s,o,n,a,l,c=1;do{for(e=r,r=null,o=null,n=0;e;){for(n++,i=e,a=0,t=0;t<c&&(a++,i=i.nextZ,!!i);t++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;e=i}o.nextZ=null,c*=2}while(n>1);return r}function Dm(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function m2(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Mo(r,t,e,i,s,o,n,a){return(s-n)*(t-a)>=(r-n)*(o-a)&&(r-n)*(i-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(i-a)}function g2(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!x2(r,t)&&(Pa(r,t)&&Pa(t,r)&&y2(r,t)&&(Wt(r.prev,r,t.prev)||Wt(r,t.prev,t))||Qh(r,t)&&Wt(r.prev,r,r.next)>0&&Wt(t.prev,t,t.next)>0)}function Wt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Qh(r,t){return r.x===t.x&&r.y===t.y}function zT(r,t,e,i){var s=Kh(Wt(r,t,e)),o=Kh(Wt(r,t,i)),n=Kh(Wt(e,i,r)),a=Kh(Wt(e,i,t));return!!(s!==o&&n!==a||s===0&&qh(r,e,t)||o===0&&qh(r,i,t)||n===0&&qh(e,r,i)||a===0&&qh(e,t,i))}function qh(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Kh(r){return r>0?1:r<0?-1:0}function x2(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&zT(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Pa(r,t){return Wt(r.prev,r,r.next)<0?Wt(r,t,r.next)>=0&&Wt(r,r.prev,t)>=0:Wt(r,t,r.prev)<0||Wt(r,r.next,t)<0}function y2(r,t){var e=r,i=!1,s=(r.x+t.x)/2,o=(r.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&&(i=!i),e=e.next;while(e!==r);return i}function $T(r,t){var e=new Nm(r.i,r.x,r.y),i=new Nm(t.i,t.x,t.y),s=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function VT(r,t,e,i){var s=new Nm(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Ca(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Nm(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Zh.deviation=function(r,t,e,i){var s=t&&t.length,o=s?t[0]*e:r.length,n=Math.abs(Hm(r,0,o,e));if(s)for(var a=0,l=t.length;a<l;a++){var c=t[a]*e,h=a<l-1?t[a+1]*e:r.length;n-=Math.abs(Hm(r,c,h,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,p=i[a+2]*e;u+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function Hm(r,t,e,i){for(var s=0,o=t,n=e-i;o<e;o+=i)s+=(r[n]-r[o])*(r[o+1]+r[n+1]),n=o;return s}Zh.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var o=0;o<r[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(r[s][o][n]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e}});function tu(r,t,e,i,s,o,n){let a=(0,XT.default)(r,t,2);if(!a)return;for(let c=0;c<a.length;c+=3)o[n++]=a[c]+s,o[n++]=a[c+1]+s,o[n++]=a[c+2]+s;let l=s*i;for(let c=0;c<r.length;c+=2)e[l]=r[c],e[l+1]=r[c+1],l+=i}var XT,Wm=y(()=>{XT=ls(Jh(),1)});var _2,jT,YT=y(()=>{F();Wm();_2=[],jT={extension:{type:E.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return t},triangulate(r,t,e,i,s,o){tu(r,_2,t,e,i,s,o)}}});var qT,KT=y(()=>{F();qT={extension:{type:E.ShapeBuilder,name:"rectangle"},build(r,t){let e=r,i=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=i,t[1]=s,t[2]=i+o,t[3]=s,t[4]=i+o,t[5]=s+n,t[6]=i,t[7]=s+n),t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[6],t[i+n+1]=r[7],n+=e,t[i+n]=r[4],t[i+n+1]=r[5],n+=e;let a=i/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 ZT,QT=y(()=>{F();ZT={extension:{type:E.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[4],t[i+n+1]=r[5];let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function tS(r,t){for(let e=0;e<t.length;e++){let i=t[e];r.addColorStop(i.offset,i.color)}}function eS(r,t){let e=j.get().createCanvas(r,t),i=e.getContext("2d");return{canvas:e,context:i}}function b2(r){let t=r[0]??{};return(typeof t=="number"||r[1])&&(X("8.5.2","use options object instead"),t={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:r[5]??Xe.defaultLinearOptions.textureSize}),t}var JT,$m,Xe,Io=y(()=>{_e();Ct();ft();xo();_t();ve();Ht();Up();JT=[{offset:0,color:"white"},{offset:1,color:"black"}],$m=class zm{constructor(...t){this.uid=lt("fillGradient"),this.type="linear",this.colorStops=[];let e=b2(t);e={...e.type==="radial"?zm.defaultRadialOptions:zm.defaultLinearOptions,...bh(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:st.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:s}=this.end,o=i-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let x=t;t=i,i=x,o*=-1}if(n<0){let x=e;e=s,s=x,n*=-1}}let l=this.colorStops.length?this.colorStops:JT,c=this._textureSize,{canvas:h,context:u}=eS(c,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);tS(d,l),u.fillStyle=d,u.fillRect(0,0,c,1),this.texture=new B({source:new ze({resource:h,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new U;m.scale(f/c,1),m.rotate(p),m.translate(t,e),this.textureSpace==="local"&&m.scale(c,c),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:JT,e=this._textureSize,{canvas:i,context:s}=eS(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,h=this.outerRadius,u=a-h,d=l-h,f=e/(h*2),p=(o-u)*f,m=(n-d)*f,x=s.createRadialGradient(p,m,c*f,(a-u)*f,(l-d)*f,h*f);tS(x,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=x,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,e,e),this.texture=new B({source:new ze({resource:i,addressMode:this._wrapMode})});let _=new U;_.scale(1/f,1/f),_.translate(u,d),this.textureSpace==="local"&&_.scale(e,e),this.transform=_}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};$m.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};$m.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Xe=$m});function rS(r,t,e,i){let s=t.matrix?r.copyFrom(t.matrix).invert():r.identity();if(t.textureSpace==="local"){let n=e.getBounds(T2);t.width&&n.pad(t.width);let{x:a,y:l}=n,c=1/n.width,h=1/n.height,u=-a*c,d=-l*h,f=s.a,p=s.b,m=s.c,x=s.d;s.a*=c,s.b*=c,s.c*=h,s.d*=h,s.tx=u*f+d*m+s.tx,s.ty=u*p+d*x+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof Xe)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(v2.copyFrom(i).invert()),s}var v2,T2,iS=y(()=>{ft();ae();Io();v2=new U,T2=new Q});function oS(r,t){let{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<r.instructions.length;s++){let o=r.instructions[s];if(o.action==="texture")E2(o.data,i,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,l=o.data.style,c=o.data.hole;n&&c&&sS(c.shapePath,l,!0,i,e),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),sS(a,l,n,i,e)}}}function E2(r,t,e){let{vertices:i,uvs:s,indices:o}=e,n=o.length,a=i.length/2,l=[],c=eu.rectangle,h=S2,u=r.image;h.x=r.dx,h.y=r.dy,h.width=r.dw,h.height=r.dh;let d=r.transform;c.build(h,l),d&&Gm(l,d),c.triangulate(l,i,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 p=et.get(Ss);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=i.length/2-a,p.baseColor=r.style,p.alpha=r.alpha,p.texture=u,p.geometryData=e,t.push(p)}function sS(r,t,e,i,s){let{vertices:o,uvs:n,indices:a}=s;r.shapePrimitives.forEach(({shape:l,transform:c,holes:h})=>{let u=a.length,d=o.length/2,f=[],p=eu[l.type],m="triangle-list";if(p.build(l,f),c&&Gm(f,c),e){let g=l.closePath??!0,w=t;w.pixelLine?(NT(f,g,o,a),m="line-list"):LT(f,w,!1,g,o,a)}else if(h){let g=[],w=f.slice();A2(h).forEach(S=>{g.push(w.length/2),w.push(...S)}),tu(w,g,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let x=n.length/2,_=t.texture;if(_!==B.WHITE){let g=rS(w2,t,l,c);CT(o,2,d,n,x,2,o.length/2-d,g)}else RT(n,x,2,o.length/2-d);let T=et.get(Ss);T.indexOffset=u,T.indexSize=a.length-u,T.attributeOffset=d,T.attributeSize=o.length/2-d,T.baseColor=t.color,T.alpha=t.alpha,T.texture=_,T.geometryData=s,T.topology=m,i.push(T)})}function A2(r){let t=[];for(let e=0;e<r.length;e++){let i=r[e].shape,s=[];eu[i.type].build(i,s),t.push(s)}return t}var eu,S2,w2,nS=y(()=>{F();ft();ae();MT();IT();_t();Fe();Lm();kT();DT();HT();YT();KT();QT();iS();Wm();eu={};D.handleByMap(E.ShapeBuilder,eu);D.add(qT,jT,ZT,Ro,BT,FT);S2=new Q,w2=new U});var Xm,jm,qm,Bo,ru=y(()=>{F();Hh();Um();kp();Ht();Fe();nS();Xm=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},jm=class{constructor(){this.batcher=new Ea,this.instructions=new lo}init(){this.instructions.reset()}get geometry(){return X(Pb,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},qm=class Ym{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Ym.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Ym.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),oS(t,e);let i=t.batchMode;t.customShader||i==="no-batch"?e.isBatchable=!1:i==="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=et.get(jm),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let h=0;h<i.length;h++)i[h].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let h=0;h<i.length;h++){let u=i[h];a.add(u)}a.finish(e.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let c=a.batches;for(let h=0;h<c.length;h++){let u=c[h];u.bindGroup=bo(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new Xm;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]&&(et.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(i=>{et.return(i)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};qm.extension={type:[E.WebGLSystem,E.WebGPUSystem,E.CanvasSystem],name:"graphicsContext"};qm.defaultOptions={bezierSmoothness:.5};Bo=qm});var P2,Km,Zm,Qm,Jm,tg,eg,rg,Kt,Ar=y(()=>{"use strict";P2={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},Km=0,Zm=1,Qm=2,Jm=3,tg=4,eg=5,rg=class aS{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Km)}set blend(t){!!(this.data&1<<Km)!==t&&(this.data^=1<<Km)}get offsets(){return!!(this.data&1<<Zm)}set offsets(t){!!(this.data&1<<Zm)!==t&&(this.data^=1<<Zm)}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<<Qm)}set culling(t){!!(this.data&1<<Qm)!==t&&(this.data^=1<<Qm)}get depthTest(){return!!(this.data&1<<Jm)}set depthTest(t){!!(this.data&1<<Jm)!==t&&(this.data^=1<<Jm)}get depthMask(){return!!(this.data&1<<eg)}set depthMask(t){!!(this.data&1<<eg)!==t&&(this.data^=1<<eg)}get clockwiseFrontFace(){return!!(this.data&1<<tg)}set clockwiseFrontFace(t){!!(this.data&1<<tg)!==t&&(this.data^=1<<tg)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=P2[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 aS;return t.depthTest=!1,t.blend=!0,t}};rg.default2d=rg.for2d();Kt=rg});function zr(r,t,e){let i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}var Fo=y(()=>{"use strict"});var Ra,lS=y(()=>{F();Ar();Fe();Fo();Lm();Ra=class{constructor(t,e){this.state=Kt.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,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){let i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.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 i=0;i<e.length;i++){let s=e[i];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,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;let o=i.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,zr(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),i.isBatchable&&this._initBatchesForRenderable(t),t.batched=i.isBatchable}_addToBatcher(t,e){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,i=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=i.batches.map(n=>{let a=et.get(Ss);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=>{et.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}};Ra.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"graphics"}});var ig=y(()=>{F();ru();lS();D.add(Ra);D.add(Bo)});var zi,iu=y(()=>{"use strict";zi=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"),i=e.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(i,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 Ma,cS=y(()=>{F();ft();Di();Ge();ba();Fe();Fo();iu();Ma=class{constructor(t,e){this.localUniforms=new Et({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new pe({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),i=e.batched,s=t.batched;if(e.batched=s,i!==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 i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,i.addToBatch(o,e)}else i.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&&(et.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=ui(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),zr(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=et.get(zi);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]&&et.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}};Ma.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"mesh"}});var sg=y(()=>{F();cS();D.add(Ma)});var su,hS=y(()=>{"use strict";su=class{execute(t,e){let i=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(i),s.geometry.bind(a.geometry,o.glProgram);let c=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,c,0)}}});function og(r,t=null){let e=r*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 i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}var uS=y(()=>{"use strict"});function fS(r){return{dynamicUpdate:dS(r,!0),staticUpdate:dS(r,!1)}}function dS(r,t){let e=[];e.push(`
254
254
 
255
255
  var index = 0;
256
256
 
@@ -364,8 +364,8 @@ fn mainFragment(
364
364
  var sample = textureSample(uTexture, uSampler, uv) * color;
365
365
 
366
366
  return sample;
367
- }`});var nu,vS=y(()=>{_e();ft();vs();So();Er();_t();Gp();xS();_S();bS();nu=class extends Yt{constructor(){let t=dr.from({vertex:yS,fragment:gS}),e=fr.from({fragment:{source:ng,entryPoint:"mainFragment"},vertex:{source:ng,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:B.WHITE.source,uSampler:new vh({}),uniforms:{uTranslationMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new st(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var ko,ag=y(()=>{ft();Ge();ba();Ar();Fo();mS();vS();ko=class{constructor(t,e){this.state=Kt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Et({uTranslationMatrix:{value:new U,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 nu,this.state=Kt.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 ou({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 i=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=ui(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|t._roundPixels,zr(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Ia,TS=y(()=>{F();hS();ag();Ia=class extends ko{constructor(t){super(t,new su)}};Ia.extension={type:[E.WebGLPipes],name:"particle"}});var au,SS=y(()=>{"use strict";au=class{execute(t,e){let i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);i.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var Ba,wS=y(()=>{F();SS();ag();Ba=class extends ko{constructor(t){super(t,new au)}};Ba.extension={type:[E.WebGPUPipes],name:"particle"}});var lg=y(()=>{F();TS();wS();D.add(Ia);D.add(Ba)});var $r,Fa=y(()=>{"use strict";$r=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 ka(r,t){let{texture:e,bounds:i}=r;Fh(i,t._anchor,e);let s=t._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var cg=y(()=>{am()});var Oa,ES=y(()=>{F();Fe();Fa();cg();Oa=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 i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),et.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,ka(s,t)}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:et.get($r)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};Oa.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"text"}});var hg,je,Oo=y(()=>{Ct();sa();hg=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let i=j.get().createCanvas();i.width=t,i.height=e;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=li(t),e=li(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:i,height:s}=e,o=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},je=new hg});function AS(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function PS(r,t,e,i,s){let o=4*t;for(let n=i,a=i*o+4*e;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function CS(r,t=1){let{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,i).data,a=0,l=0,c=e-1,h=i-1;for(;l<i&&AS(n,e,l);)++l;if(l===i)return Q.EMPTY;for(;AS(n,e,h);)--h;for(;PS(n,e,a,l,h);)++a;for(;PS(n,e,c,l,h);)--c;return++c,++h,new Q(a/t,l/t,(c-a)/t,(h-l)/t)}var RS=y(()=>{ae()});var MS,pi,lu=y(()=>{ft();ve();MS={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"}},pi=class{constructor(t,e){this.uid=lt("fillPattern"),this.transform=new U,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=MS[e].addressModeU,t.source.style.addressModeV=MS[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 BS=Z((Ej,IS)=>{IS.exports=M2;var ug={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},R2=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function M2(r){var t=[];return r.replace(R2,function(e,i,s){var o=i.toLowerCase();for(s=B2(s),o=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==ug[o])return s.unshift(i),t.push(s);if(s.length<ug[o])throw new Error("malformed path data");t.push([i].concat(s.splice(0,ug[o])))}}),t}var I2=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function B2(r){var t=r.match(I2);return t?t.map(Number):[]}});function kS(r,t){let e=(0,FS.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let l=e[a],c=l[0],h=l;switch(c){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(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:N(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return t}var FS,OS=y(()=>{FS=ls(BS(),1);St()});var cu,US=y(()=>{ae();cu=class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}strokeContains(t,e,i,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,l=(1-s)*i,c=Math.sqrt(o*o+n*n);return c<=a+l&&c>a-(i-l)}getBounds(t){return t||(t=new Q),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var hu,GS=y(()=>{ae();hu=class r{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),l=i-a,c=o-l,h=n-l,u=o+a,d=n+a,f=t-this.x,p=e-this.y,m=f*f/(c*c)+p*p/(h*h),x=f*f/(u*u)+p*p/(d*d);return m>1&&x<=1}getBounds(t){return t||(t=new Q),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function LS(r,t,e,i,s,o){let n=r-e,a=t-i,l=s-e,c=o-i,h=n*l+a*c,u=l*l+c*c,d=-1;u!==0&&(d=h/u);let f,p;d<0?(f=e,p=i):d>1?(f=s,p=o):(f=e+d*l,p=i+d*c);let m=r-f,x=t-p;return m*m+x*x}var DS=y(()=>{"use strict"});var F2,k2,Uo,NS=y(()=>{DS();ae();Uo=class r{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,i=e.length;for(let s=0;s<i;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%i],l=e[(s+3)%i];t+=(a-o)*(l+n)}return t<0}containsPolygon(t){let e=this.getBounds(F2),i=t.getBounds(k2);if(!e.containsRect(i))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 r(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],c=this.points[n*2],h=this.points[n*2+1];l>e!=h>e&&t<(c-a)*((e-l)/(h-l))+a&&(i=!i)}return i}strokeContains(t,e,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:l}=this,c=l.length-(this.closePath?0:2);for(let h=0;h<c;h+=2){let u=l[h],d=l[h+1],f=l[(h+2)%l.length],p=l[(h+3)%l.length],m=LS(t,e,u,d,f,p),x=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(m<=(x<0?a:n))return!0}return!1}getBounds(t){t||(t=new Q);let e=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=e.length;a<l;a+=2){let c=e[a],h=e[a+1];i=c<i?c:i,s=c>s?c:s,o=h<o?h:o,n=h>n?h:n}return t.x=i,t.width=s-i,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 uu,du,HS=y(()=>{ae();uu=(r,t,e,i,s,o,n)=>{let a=r-e,l=t-i,c=Math.sqrt(a*a+l*l);return c>=s-o&&c<=s+n},du=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o}getBounds(t){return t||(t=new Q),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new r(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,i,s=.5){let{x:o,y:n,width:a,height:l,radius:c}=this,h=i*(1-s),u=i-h,d=o+c,f=n+c,p=a-c*2,m=l-c*2,x=o+a,_=n+l;return(t>=o-h&&t<=o+u||t>=x-u&&t<=x+h)&&e>=f&&e<=f+m||(e>=n-h&&e<=n+u||e>=_-u&&e<=_+h)&&t>=d&&t<=d+p?!0:t<d&&e<f&&uu(t,e,d,f,c,u,h)||t>x-c&&e<f&&uu(t,e,x-c,f,c,u,h)||t>x-c&&e>_-c&&uu(t,e,x-c,_-c,c,u,h)||t<d&&e>_-c&&uu(t,e,d,_-c,c,u,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function pu(r,t,e,i,s,o,n,a,l,c){let u=Math.min(.99,Math.max(0,c??Bo.defaultOptions.bezierSmoothness)),d=(U2-u)/1;return d*=d,G2(t,e,i,s,o,n,a,l,r,d),r}function G2(r,t,e,i,s,o,n,a,l,c){fg(r,t,e,i,s,o,n,a,l,c,0),l.push(n,a)}function fg(r,t,e,i,s,o,n,a,l,c,h){if(h>O2)return;let u=Math.PI,d=(r+e)/2,f=(t+i)/2,p=(e+s)/2,m=(i+o)/2,x=(s+n)/2,_=(o+a)/2,T=(d+p)/2,g=(f+m)/2,w=(p+x)/2,b=(m+_)/2,S=(T+w)/2,v=(g+b)/2;if(h>0){let A=n-r,P=a-t,C=Math.abs((e-n)*P-(i-a)*A),R=Math.abs((s-n)*P-(o-a)*A),M,I;if(C>fu&&R>fu){if((C+R)*(C+R)<=c*(A*A+P*P)){if(Go<dg){l.push(S,v);return}let k=Math.atan2(o-i,s-e);if(M=Math.abs(k-Math.atan2(i-t,e-r)),I=Math.abs(Math.atan2(a-o,n-s)-k),M>=u&&(M=2*u-M),I>=u&&(I=2*u-I),M+I<Go){l.push(S,v);return}if(As!==0){if(M>As){l.push(e,i);return}if(I>As){l.push(s,o);return}}}}else if(C>fu){if(C*C<=c*(A*A+P*P)){if(Go<dg){l.push(S,v);return}if(M=Math.abs(Math.atan2(o-i,s-e)-Math.atan2(i-t,e-r)),M>=u&&(M=2*u-M),M<Go){l.push(e,i),l.push(s,o);return}if(As!==0&&M>As){l.push(e,i);return}}}else if(R>fu){if(R*R<=c*(A*A+P*P)){if(Go<dg){l.push(S,v);return}if(M=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-e)),M>=u&&(M=2*u-M),M<Go){l.push(e,i),l.push(s,o);return}if(As!==0&&M>As){l.push(s,o);return}}}else if(A=S-(r+n)/2,P=v-(t+a)/2,A*A+P*P<=c){l.push(S,v);return}}fg(r,t,d,f,T,g,S,v,l,c,h+1),fg(S,v,w,b,x,_,n,a,l,c,h+1)}var O2,fu,U2,dg,Go,As,pg=y(()=>{ru();O2=8,fu=11920929e-14,U2=1,dg=.01,Go=0,As=0});function WS(r,t,e,i,s,o,n,a){let c=Math.min(.99,Math.max(0,a??Bo.defaultOptions.bezierSmoothness)),h=(N2-c)/1;return h*=h,V2(t,e,i,s,o,n,r,h),r}function V2(r,t,e,i,s,o,n,a){mg(n,r,t,e,i,s,o,a,0),n.push(s,o)}function mg(r,t,e,i,s,o,n,a,l){if(l>L2)return;let c=Math.PI,h=(t+i)/2,u=(e+s)/2,d=(i+o)/2,f=(s+n)/2,p=(h+d)/2,m=(u+f)/2,x=o-t,_=n-e,T=Math.abs((i-o)*_-(s-n)*x);if(T>D2){if(T*T<=a*(x*x+_*_)){if(VS<H2){r.push(p,m);return}let g=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-e,i-t));if(g>=c&&(g=2*c-g),g<VS){r.push(p,m);return}}}else if(x=p-(t+o)/2,_=m-(e+n)/2,x*x+_*_<=a){r.push(p,m);return}mg(r,t,e,h,u,p,m,a,l+1),mg(r,p,m,d,f,o,n,a,l+1)}var L2,D2,N2,H2,VS,zS=y(()=>{ru();L2=8,D2=11920929e-14,N2=1,H2=.01,VS=0});function mu(r,t,e,i,s,o,n,a){let l=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(l/Math.PI)))),a=Math.max(a,3);let c=l/a,h=s;c*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(h),f=Math.sin(h),p=t+d*i,m=e+f*i;r.push(p,m),h+=c}}var gg=y(()=>{"use strict"});function $S(r,t,e,i,s,o){let n=r[r.length-2],l=r[r.length-1]-e,c=n-t,h=s-e,u=i-t,d=Math.abs(l*u-c*h);if(d<1e-8||o===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}let f=l*l+c*c,p=h*h+u*u,m=l*h+c*u,x=o*Math.sqrt(f)/d,_=o*Math.sqrt(p)/d,T=x*m/f,g=_*m/p,w=x*u+_*c,b=x*h+_*l,S=c*(_+T),v=l*(_+T),A=u*(x+g),P=h*(x+g),C=Math.atan2(v-b,S-w),R=Math.atan2(P-b,A-w);mu(r,w+t,b+e,o,C,R,c*h>u*l)}var XS=y(()=>{gg()});function W2(r,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+t),a=Math.sin(r+t);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function YS(r,t,e,i,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let h=Math.sin(a*Ua/360),u=Math.cos(a*Ua/360),d=u*(t-i)/2+h*(e-s)/2,f=-h*(t-i)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),z2(t,e,i,s,o,n,l,c,h,u,d,f,xg);let{ang1:m,ang2:x}=xg,{centerX:_,centerY:T}=xg,g=Math.abs(x)/(Ua/4);Math.abs(1-g)<1e-7&&(g=1);let w=Math.max(Math.ceil(g),1);x/=w;let b=r[r.length-2],S=r[r.length-1],v={x:0,y:0};for(let A=0;A<w;A++){let P=W2(m,x),{x:C,y:R}=yg(P[0],o,n,u,h,_,T,v),{x:M,y:I}=yg(P[1],o,n,u,h,_,T,v),{x:k,y:W}=yg(P[2],o,n,u,h,_,T,v);pu(r,b,S,C,R,M,I,k,W),b=k,S=W,m+=x}}var Ua,xg,yg,jS,z2,qS=y(()=>{pg();Ua=Math.PI*2,xg={centerX:0,centerY:0,ang1:0,ang2:0},yg=({x:r,y:t},e,i,s,o,n,a,l)=>{r*=e,t*=i;let c=s*r-o*t,h=o*r+s*t;return l.x=c+n,l.y=h+a,l};jS=(r,t,e,i)=>{let s=r*i-t*e<0?-1:1,o=r*e+t*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},z2=(r,t,e,i,s,o,n,a,l,c,h,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(h,2),x=Math.pow(u,2),_=f*p-f*x-p*m;_<0&&(_=0),_/=f*x+p*m,_=Math.sqrt(_)*(n===a?-1:1);let T=_*s/o*u,g=_*-o/s*h,w=c*T-l*g+(r+e)/2,b=l*T+c*g+(t+i)/2,S=(h-T)/s,v=(u-g)/o,A=(-h-T)/s,P=(-u-g)/o,C=jS(1,0,S,v),R=jS(S,v,A,P);a===0&&R>0&&(R-=Ua),a===1&&R<0&&(R+=Ua),d.centerX=w,d.centerY=b,d.ang1=C,d.ang2=R}});function KS(r,t,e){let i=(n,a)=>{let l=a.x-n.x,c=a.y-n.y,h=Math.sqrt(l*l+c*c),u=l/h,d=c/h;return{len:h,nx:u,ny:d}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],l=a.radius??e;if(l<=0){s(n,a),o=a;continue}let c=t[(n+1)%t.length],h=i(a,o),u=i(a,c);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,p=!1;h.nx*u.nx-h.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);let m=d/2,x,_=Math.abs(Math.cos(m)*l/Math.sin(m));_>Math.min(h.len/2,u.len/2)?(_=Math.min(h.len/2,u.len/2),x=Math.abs(_*Math.sin(m)/Math.cos(m))):x=l;let T=a.x+u.nx*_+-u.ny*x*f,g=a.y+u.ny*_+u.nx*x*f,w=Math.atan2(h.ny,h.nx)+Math.PI/2*f,b=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&r.moveTo(T+Math.cos(w)*x,g+Math.sin(w)*x),r.arc(T,g,x,w,b,p),o=a}}function ZS(r,t,e,i){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),o=(a,l,c)=>({x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c}),n=t.length;for(let a=0;a<n;a++){let l=t[(a+1)%n],c=l.radius??e;if(c<=0){a===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}let h=t[a],u=t[(a+2)%n],d=s(h,l),f;if(d<1e-4)f=l;else{let x=Math.min(d/2,c);f=o(l,h,x/d)}let p=s(u,l),m;if(p<1e-4)m=l;else{let x=Math.min(p/2,c);m=o(l,u,x/p)}a===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(l.x,l.y,m.x,m.y,i)}}var QS=y(()=>{"use strict"});var $2,gu,JS=y(()=>{US();GS();NS();ae();HS();Ve();pg();zS();gg();XS();qS();QS();$2=new Q,gu=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Tt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==t||o!==e)&&i.push(t,e),this}arc(t,e,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return mu(a,t,e,i,s,o,n),this}arcTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return $S(n,t,e,i,s,o),this}arcToSvg(t,e,i,s,o,n,a){let l=this._currentPoly.points;return YS(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,i,s,o),this}bezierCurveTo(t,e,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return pu(this._currentPoly.points,l.lastX,l.lastY,t,e,i,s,o,n,a),this}quadraticCurveTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly;return WS(this._currentPoly.points,n.lastX,n.lastY,t,e,i,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 i=this.shapePrimitives,s=i.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[n];if(a.shape.type==="polygon"){let l=a.shape,c=o?.shape;c&&c.containsPolygon(l)?(o.holes||(o.holes=[]),o.holes.push(a),i.copyWithin(n,n+1),i.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,s,o){return this.drawShape(new Q(t,e,i,s),o),this}circle(t,e,i,s){return this.drawShape(new cu(t,e,i),s),this}poly(t,e,i){let s=new Uo(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,l=Math.PI*2/s,c=[];for(let h=0;h<s;h++){let u=a-h*l;c.push(t+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(c,!0,n),this}roundPoly(t,e,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,i,s,n);let l=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let c=-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+c,p=t+i*Math.cos(f),m=e+i*Math.sin(f),x=f+Math.PI+u,_=f-Math.PI-u,T=p+o*Math.cos(x),g=m+o*Math.sin(x),w=p+o*Math.cos(_),b=m+o*Math.sin(_);d===0?this.moveTo(T,g):this.lineTo(T,g),this.quadraticCurveTo(p,m,w,b,a)}return this.closePath()}roundShape(t,e,i=!1,s){return t.length<3?this:(i?ZS(this,t,e,s):KS(this,t,e),this.closePath())}filletRect(t,e,i,s,o){if(o===0)return this.rect(t,e,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=t+i,c=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(l-u,e).arcTo(l-h,e+h,l,e+u,u).lineTo(l,c-u).arcTo(l-h,c-h,t+i-u,c,u).lineTo(t+u,c).arcTo(t+h,c-h,t,c-u,u).closePath()}chamferRect(t,e,i,s,o,n){if(o<=0)return this.rect(t,e,i,s);let a=Math.min(o,Math.min(i,s)/2),l=t+i,c=e+s,h=[t+a,e,l-a,e,l,e+a,l,c-a,l-a,c,t+a,c,t,c-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,i,s,o){return this.drawShape(new hu(t,e,i,s),o),this}roundRect(t,e,i,s,o,n){return this.drawShape(new du(t,e,i,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Uo,i.points.push(t,e),this._currentPoly=i,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 Uo,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,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 i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let i=0;i<e.length;i++){let s=e[i],o=s.shape.getBounds($2);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function Ga(r,t){return r?r.prepend(t):t.clone()}var $i,_g=y(()=>{cr();ve();St();OS();JS();$i=class r{constructor(t,e=!1){this.instructions=[],this.uid=lt("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?kS(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new gu(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,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(ct.shared),l=0,c=0;if(!n||n.action!=="bezierCurveTo")l=a.x,c=a.y;else{l=n.data[2],c=n.data[3];let h=a.x,u=a.y;l=h+(h-l),c=u+(u-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,t,e,i,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,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(ct.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 l=o.x,c=o.y;n=l+(l-n),a=c+(c-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,i]}),this._dirty=!0,this}rect(t,e,i,s,o){return this.instructions.push({action:"rect",data:[t,e,i,s,o]}),this._dirty=!0,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,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,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,c=i*2,h=Math.PI*2/c,u=[];for(let d=0;d<c;d++){let f=d%2?o:s,p=d*h+l;u.push(t+f*Math.cos(p),e+f*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){let e=new r;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];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,i=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,l=0,c=0,h=0,u=0,d=0,f=0,p=0,m=0;for(let x=0;x<this.instructions.length;x++){let _=this.instructions[x],T=_.data;switch(_.action){case"moveTo":case"lineTo":l=T[0],c=T[1],T[0]=e*l+s*c+n,T[1]=i*l+o*c+a;break;case"bezierCurveTo":h=T[0],u=T[1],d=T[2],f=T[3],l=T[4],c=T[5],T[0]=e*h+s*u+n,T[1]=i*h+o*u+a,T[2]=e*d+s*f+n,T[3]=i*d+o*f+a,T[4]=e*l+s*c+n,T[5]=i*l+o*c+a;break;case"quadraticCurveTo":h=T[0],u=T[1],l=T[2],c=T[3],T[0]=e*h+s*u+n,T[1]=i*h+o*u+a,T[2]=e*l+s*c+n,T[3]=i*l+o*c+a;break;case"arcToSvg":l=T[5],c=T[6],p=T[0],m=T[1],T[0]=e*p+s*m,T[1]=i*p+o*m,T[5]=e*l+s*c+n,T[6]=i*l+o*c+a;break;case"circle":T[4]=Ga(T[3],t);break;case"rect":T[4]=Ga(T[4],t);break;case"ellipse":T[8]=Ga(T[8],t);break;case"roundRect":T[5]=Ga(T[5],t);break;case"addPath":T[0].transform(t);break;case"poly":T[2]=Ga(T[2],t);break;default:N("unknown transform action",_.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}});function Gt(r,t,e){let i=r.getAttribute(t);return i?Number(i):e}var bg=y(()=>{"use strict"});function tw(r,t){let e=r.querySelectorAll("defs");for(let i=0;i<e.length;i++){let s=e[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=X2(n);break;case"radialgradient":t.defs[n.id]=j2(n);break;default:break}}}}function X2(r){let t=Gt(r,"x1",0),e=Gt(r,"y1",0),i=Gt(r,"x2",1),s=Gt(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new Xe(t,e,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let l=r.children[a],c=Gt(l,"offset",0),h=st.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(c,h)}return n}function j2(r){return N("[SVG Parser] Radial gradients are not yet supported"),new Xe(0,0,1,0)}var ew=y(()=>{_e();St();Io();bg()});function vg(r){let t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var rw=y(()=>{"use strict"});function Tg(r,t){let e=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in iw){let a=r.getAttribute(n);a&&sw(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[c,h]=l.split(":");iw[c]&&sw(t,o,c,h.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function sw(r,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=vg(i);t.strokeStyle.fill=r.defs[s]}else t.strokeStyle.color=st.shared.setValue(i).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=vg(i);t.fillStyle.fill=r.defs[s]}else t.fillStyle.color=st.shared.setValue(i).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(i);break;case"stroke-opacity":t.strokeStyle.alpha=Number(i);break;case"opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}var iw,ow=y(()=>{_e();rw();iw={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 nw(r,t){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let e={context:t,defs:{},path:new $i};tw(r,e);let i=r.children,{fillStyle:s,strokeStyle:o}=Tg(r,e);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&aw(a,e,s,o)}return t}function aw(r,t,e,i){let s=r.children,{fillStyle:o,strokeStyle:n}=Tg(r,t);o&&e?e={...e,...o}:o&&(e=o),n&&i?i={...i,...n}:n&&(i=n);let a=!e&&!i;a&&(e={color:0});let l,c,h,u,d,f,p,m,x,_,T,g,w,b,S,v,A;switch(r.nodeName.toLowerCase()){case"path":b=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&N("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new $i(b,!0),t.context.path(S),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"circle":p=Gt(r,"cx",0),m=Gt(r,"cy",0),x=Gt(r,"r",0),t.context.ellipse(p,m,x,x),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":l=Gt(r,"x",0),c=Gt(r,"y",0),v=Gt(r,"width",0),A=Gt(r,"height",0),_=Gt(r,"rx",0),T=Gt(r,"ry",0),_||T?t.context.roundRect(l,c,v,A,_||T):t.context.rect(l,c,v,A),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":p=Gt(r,"cx",0),m=Gt(r,"cy",0),_=Gt(r,"rx",0),T=Gt(r,"ry",0),t.context.beginPath(),t.context.ellipse(p,m,_,T),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":h=Gt(r,"x1",0),u=Gt(r,"y1",0),d=Gt(r,"x2",0),f=Gt(r,"y2",0),t.context.beginPath(),t.context.moveTo(h,u),t.context.lineTo(d,f),i&&t.context.stroke(i);break;case"polygon":w=r.getAttribute("points"),g=w.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(g,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":w=r.getAttribute("points"),g=w.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(g,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{N(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let P=0;P<s.length;P++)aw(s[P],t,e,i)}var lw=y(()=>{St();_g();ew();bg();ow()});function Y2(r){return st.isColorLike(r)}function cw(r){return r instanceof pi}function hw(r){return r instanceof Xe}function q2(r){return r instanceof B}function K2(r,t,e){let i=st.shared.setValue(t??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=B.WHITE,{...e,...r}}function Z2(r,t,e){return r.texture=t,{...e,...r}}function uw(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function dw(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,{...e,...r}}function Q2(r,t){let e={...t,...r},i=st.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function mi(r,t){if(r==null)return null;let e={},i=r;return Y2(r)?K2(e,r,t):q2(r)?Z2(e,r,t):cw(r)?uw(e,r,t):hw(r)?dw(e,r,t):i.fill&&cw(i.fill)?uw(i,i.fill,t):i.fill&&hw(i.fill)?dw(i,i.fill,t):Q2(i,t)}function Lo(r,t){let{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=t,c=mi(r,l);return c?{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var Sg=y(()=>{_e();_t();Io();lu()});var J2,fw,wg,Le,xu=y(()=>{Ae();_e();ft();cr();_t();ve();Ht();Ve();_g();lw();Sg();J2=new ct,fw=new U,wg=class Xr extends Pt{constructor(){super(...arguments),this.uid=lt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new $i,this._transform=new U,this._fillStyle={...Xr.defaultFillStyle},this._strokeStyle={...Xr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Tt,this._boundsDirty=!0}clone(){let t=new Xr;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=mi(t,Xr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Lo(t,Xr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=mi(t,Xr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=mi(t,Xr.defaultStrokeStyle),this}texture(t,e,i,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?st.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new $i,this}fill(t,e){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(X(tt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=mi(t,Xr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(ct.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Lo(t,Xr.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],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,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,i,s,o,n),this}arcTo(t,e,i,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*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,e,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*i+l.c*s+l.tx,l.b*i+l.d*s+l.ty,l.a*o+l.c*n+l.tx,l.b*o+l.d*n+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*t+i.c*e+i.tx,n=i.b*t+i.d*e+i.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,i,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*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,o){return this._tick++,this._activePath.roundRect(t,e,i,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,i,s,o,n),this}roundPoly(t,e,i,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,i,s,o,n),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,o){return this._tick++,this._activePath.filletRect(t,e,i,s,o),this}chamferRect(t,e,i,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,i,s,o,n),this}star(t,e,i,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,i,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,nw(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,i,s,o,n){return t instanceof U?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,o,n),this)}transform(t,e,i,s,o,n){return t instanceof U?(this._transform.append(t),this):(fw.set(t,e,i,s,o,n),this._transform.append(fw),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 i=this.instructions[e],s=i.action;if(s==="fill"){let o=i.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=i.data,n=o.style.alignment,a=o.style.width*(1-n),l=o.path.bounds;t.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,i=!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 l=n.style,c=a.shapePath.shapePrimitives;for(let h=0;h<c.length;h++){let u=c[h].shape;if(!l||!u)continue;let d=c[h].transform,f=d?d.applyInverse(t,J2):t;if(o.action==="fill")i=u.contains(f.x,f.y);else{let m=l;i=u.strokeContains(f.x,f.y,m.width,m.alignment)}let p=n.hole;if(p){let m=p.shapePath?.shapePrimitives;if(m)for(let x=0;x<m.length;x++)m[x].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};wg.defaultFillStyle={color:16777215,alpha:1,texture:B.WHITE,matrix:null,fill:null,textureSpace:"local"};wg.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:B.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Le=wg});function yu(r){let t=[],e=0;for(let i=0;i<pw.length;i++){let s=`_${pw[i]}`;t[e++]=r[s]}return e=mw(r._fill,t,e),e=tO(r._stroke,t,e),e=eO(r.dropShadow,t,e),t.join("-")}function mw(r,t,e){return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=r.fill?.styleKey),e}function tO(r,t,e){return r&&(e=mw(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function eO(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=st.shared.setValue(r.color).toNumber()),e}var pw,Eg=y(()=>{_e();pw=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function rO(r){let t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=It.defaultDropShadow;r.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){X(tt,"strokeThickness is now a part of stroke");let e=t.stroke,i={};if(st.isColorLike(e))i.color=e;else if(e instanceof Xe||e instanceof pi)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){X(tt,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;r.fontSize==null?r.fontSize=It.defaultTextStyle.fontSize:typeof r.fontSize=="string"?e=parseInt(r.fontSize,10):e=r.fontSize;let i=new Xe({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>st.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var Ag,It,Ps=y(()=>{Ae();_e();Ht();Io();lu();xu();Sg();Eg();Ag=class Do extends Pt{constructor(t={}){super(),rO(t);let e={...Do.defaultTextStyle,...t};for(let i in e){let s=i;this[s]=e[i]}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({...Do.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Do.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({...Le.defaultFillStyle,...t},()=>{this._fill=mi({...this._originalFill},Le.defaultFillStyle)})),this._fill=mi(t===0?"black":t,Le.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Le.defaultStrokeStyle,...t},()=>{this._stroke=Lo({...this._originalStroke},Le.defaultStrokeStyle)})),this._stroke=Lo(t,Le.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=yu(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Do.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Do({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 i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,o)=>(i[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(st.isColorLike(t)||t instanceof Xe||t instanceof pi)}};Ag.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Ag.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};It=Ag});function _u(r,t,e,i){let s=iO;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=Vt.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}var iO,Pg=y(()=>{Bi();Ve();iO=new Tt});function Cs(r){let t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!sO.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}var sO,bu=y(()=>{"use strict";sO=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Cg,Pr,Lt,La=y(()=>{Ct();bu();Cg={willReadFrequently:!0},Pr=class Y{static get experimentalLetterSpacingSupported(){let t=Y._experimentalLetterSpacingSupported;if(t!==void 0){let e=j.get().getCanvasRenderingContext2D().prototype;t=Y._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,o,n,a,l,c){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=c}static measureText(t=" ",e,i=Y._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(Y._measurementCache[o])return Y._measurementCache[o];let n=Cs(e),a=Y.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let l=Y.__context;l.font=n;let h=(s?Y._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let T=0;T<h.length;T++){let g=Y._measureText(h[T],e.letterSpacing,l);u[T]=g,d=Math.max(d,g)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let m=e.lineHeight||a.fontSize,x=Math.max(m,a.fontSize+f)+(h.length-1)*(m+e.leading);return e.dropShadow&&(x+=e.dropShadow.distance),new Y(t,e,p,x,h,u,m+e.leading,d,a)}static _measureText(t,e,i){let s=!1;Y.experimentalLetterSpacingSupported&&(Y.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,c=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,c-=e;else{let h=(Y.graphemeSegmenter(t).length-1)*e;n+=h,c+=h}return Math.max(n,c)}static _wordWrap(t,e,i=Y._canvas){let s=i.getContext("2d",Cg),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:h}=e,u=Y._collapseSpaces(h),d=Y._collapseNewlines(h),f=!u,p=e.wordWrapWidth+c,m=Y._tokenize(t);for(let x=0;x<m.length;x++){let _=m[x];if(Y._isNewline(_)){if(!d){a+=Y._addLine(n),f=!u,n="",o=0;continue}_=" "}if(u){let g=Y.isBreakingSpace(_),w=Y.isBreakingSpace(n[n.length-1]);if(g&&w)continue}let T=Y._getFromCache(_,c,l,s);if(T>p)if(n!==""&&(a+=Y._addLine(n),n="",o=0),Y.canBreakWords(_,e.breakWords)){let g=Y.wordWrapSplit(_);for(let w=0;w<g.length;w++){let b=g[w],S=b,v=1;for(;g[w+v];){let P=g[w+v];if(!Y.canBreakChars(S,P,_,w,e.breakWords))b+=P;else break;S=P,v++}w+=v-1;let A=Y._getFromCache(b,c,l,s);A+o>p&&(a+=Y._addLine(n),f=!1,n="",o=0),n+=b,o+=A}}else{n.length>0&&(a+=Y._addLine(n),n="",o=0);let g=x===m.length-1;a+=Y._addLine(_,!g),f=!1,n="",o=0}else T+o>p&&(f=!1,a+=Y._addLine(n),n="",o=0),(n.length>0||!Y.isBreakingSpace(_)||f)&&(n+=_,o+=T)}return a+=Y._addLine(n,!1),a}static _addLine(t,e=!0){return t=Y._trimRight(t),t=e?`${t}
368
- `:t,t}static _getFromCache(t,e,i,s){let o=i[t];return typeof o!="number"&&(o=Y._measureText(t,e,s)+e,i[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 i=t[e];if(!Y.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:Y._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:Y._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(Y.isBreakingSpace(o,n)||Y._isNewline(o)){i!==""&&(e.push(i),i=""),e.push(o);continue}i+=o}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,o){return!0}static wordWrapSplit(t){return Y.graphemeSegmenter(t)}static measureFont(t){if(Y._fonts[t])return Y._fonts[t];let e=Y._context;e.font=t;let i=e.measureText(Y.METRICS_STRING+Y.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return Y._fonts[t]=s,s}static clearMetrics(t=""){t?delete Y._fonts[t]:Y._fonts={}}static get _canvas(){if(!Y.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",Cg)?.measureText)return Y.__canvas=e,e;t=j.get().createCanvas()}catch{t=j.get().createCanvas()}t.width=t.height=10,Y.__canvas=t}return Y.__canvas}static get _context(){return Y.__context||(Y.__context=Y._canvas.getContext("2d",Cg)),Y.__context}};Pr.METRICS_STRING="|\xC9q\xC5";Pr.BASELINE_SYMBOL="M";Pr.BASELINE_MULTIPLIER=1.4;Pr.HEIGHT_MULTIPLIER=2;Pr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})();Pr.experimentalLetterSpacing=!1;Pr._fonts={};Pr._newlines=[10,13];Pr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Pr._measurementCache={};Lt=Pr});function No(r,t,e,i=0){if(r.texture===B.WHITE&&!r.fill)return st.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof pi){let s=r.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(U.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof Xe){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&e&&(a=e.width+i,l=e.height+i);let c,h=!1;if(o){let{start:u,end:d}=s;c=t.createLinearGradient(u.x*a,u.y*l,d.x*a,d.y*l),h=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:p}=s;c=t.createRadialGradient(u.x*a,u.y*l,d*a,f.x*a,f.y*l,p*a)}if(h&&n&&e){let u=e.lineHeight/l;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+i/2)/l;s.colorStops.forEach(p=>{let m=f+p.offset*u;c.addColorStop(Math.floor(m*gw)/gw,st.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{c.addColorStop(u.offset,st.shared.setValue(u.color).toHex())});return c}}else{let s=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(U.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return N("FillStyle not recognised",r),"red"}var gw,Rg=y(()=>{_e();ft();_t();St();Io();lu();gw=1e5});var Da,xw=y(()=>{_e();F();sa();Oo();Bi();RS();Ht();Ps();Pg();La();bu();Rg();Da=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){let s=Lt.measureText(t||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=li(o),n=li(n),{width:o,height:n}}getTexture(t,e,i,s){typeof t=="string"&&(X("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof It||(t.style=new It(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),je.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:i}=t,s=t.resolution??this._renderer.resolution,o=Lt.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),l=je.getOptimalCanvasAndContext(n,a),{canvas:c}=l;this.renderTextToCanvas(e,i,s,l);let h=_u(c,n,a,s);if(i.trim){let u=CS(c,s);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:l}}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:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Vt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(je.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){let{canvas:o,context:n}=s,a=Cs(e),l=Lt.measureText(t||" ",e),c=l.lines,h=l.lineHeight,u=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,p=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=e.textBaseline,e._stroke?.width){let T=e._stroke;n.lineWidth=T.width,n.miterLimit=T.miterLimit,n.lineJoin=T.join,n.lineCap=T.cap}n.font=a;let m,x,_=e.dropShadow?2:1;for(let T=0;T<_;++T){let g=e.dropShadow&&T===0,w=g?Math.ceil(Math.max(1,p)+e.padding*2):0,b=w*i;if(g){n.fillStyle="black",n.strokeStyle="black";let A=e.dropShadow,P=A.color,C=A.alpha;n.shadowColor=st.shared.setValue(P).setAlpha(C).toRgbaString();let R=A.blur*i,M=A.distance*i;n.shadowBlur=R,n.shadowOffsetX=Math.cos(A.angle)*M,n.shadowOffsetY=Math.sin(A.angle)*M+b}else{if(n.fillStyle=e._fill?No(e._fill,n,l):null,e._stroke?.width){let A=e._stroke.width*e._stroke.alignment;n.strokeStyle=No(e._stroke,n,l,A)}n.shadowColor="black"}let S=(h-f.fontSize)/2;h-f.fontSize<0&&(S=0);let v=e._stroke?.width??0;for(let A=0;A<c.length;A++)m=v/2,x=v/2+A*h+f.ascent+S,e.align==="right"?m+=d-u[A]:e.align==="center"&&(m+=(d-u[A])/2),e._stroke?.width&&this._drawLetterSpacing(c[A],e,s,m+e.padding,x+e.padding-w,!0),e._fill!==void 0&&this._drawLetterSpacing(c[A],e,s,m+e.padding,x+e.padding-w)}}_drawLetterSpacing(t,e,i,s,o,n=!1){let{context:a}=i,l=e.letterSpacing,c=!1;if(Lt.experimentalLetterSpacingSupported&&(Lt.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,c=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||c){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let h=s,u=Lt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let m=u[p];n?a.strokeText(m,h,o):a.fillText(m,h,o);let x="";for(let _=p+1;_<u.length;++_)x+=u[_];f=a.measureText(x).width,h+=d-f+l,d=f}}destroy(){this._activeTextures=null}};Da.extension={type:[E.WebGLSystem,E.WebGPUSystem,E.CanvasSystem],name:"canvasText"}});var Mg=y(()=>{F();ES();xw();D.add(Da);D.add(Oa)});var Bt,Ig=y(()=>{Ht();Mh();xu();Bt=class r extends Oi{constructor(t){t instanceof Le&&(t={context:t});let{context:e,roundPixels:i,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Le,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!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 r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(t,e,i){X(tt,"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),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){X(tt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){X(tt,"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!==Le.defaultStrokeStyle.width||t.color!==Le.defaultStrokeStyle.color||t.alpha!==Le.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return X(tt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return X(tt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return X(tt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return X(tt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return X(tt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return X(tt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var yw,_w,bw=y(()=>{"use strict";yw={name:"local-uniform-msdf-bit",vertex:{header:`
367
+ }`});var nu,vS=y(()=>{_e();ft();vs();So();Er();_t();Gp();xS();_S();bS();nu=class extends Yt{constructor(){let t=dr.from({vertex:yS,fragment:gS}),e=fr.from({fragment:{source:ng,entryPoint:"mainFragment"},vertex:{source:ng,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:B.WHITE.source,uSampler:new vh({}),uniforms:{uTranslationMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new st(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var ko,ag=y(()=>{ft();Ge();ba();Ar();Fo();mS();vS();ko=class{constructor(t,e){this.state=Kt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Et({uTranslationMatrix:{value:new U,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 nu,this.state=Kt.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 ou({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 i=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=ui(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|t._roundPixels,zr(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Ia,TS=y(()=>{F();hS();ag();Ia=class extends ko{constructor(t){super(t,new su)}};Ia.extension={type:[E.WebGLPipes],name:"particle"}});var au,SS=y(()=>{"use strict";au=class{execute(t,e){let i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);i.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var Ba,wS=y(()=>{F();SS();ag();Ba=class extends ko{constructor(t){super(t,new au)}};Ba.extension={type:[E.WebGPUPipes],name:"particle"}});var lg=y(()=>{F();TS();wS();D.add(Ia);D.add(Ba)});var $r,Fa=y(()=>{"use strict";$r=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 ka(r,t){let{texture:e,bounds:i}=r;Fh(i,t._anchor,e);let s=t._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var cg=y(()=>{am()});var Oa,ES=y(()=>{F();Fe();Fa();cg();Oa=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 i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),et.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,ka(s,t)}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:et.get($r)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};Oa.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"text"}});var hg,je,Oo=y(()=>{Ct();sa();hg=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let i=j.get().createCanvas();i.width=t,i.height=e;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=li(t),e=li(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:i,height:s}=e,o=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},je=new hg});function AS(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function PS(r,t,e,i,s){let o=4*t;for(let n=i,a=i*o+4*e;n<=s;++n,a+=o)if(r[a+3]!==0)return!1;return!0}function CS(r,t=1){let{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,i).data,a=0,l=0,c=e-1,h=i-1;for(;l<i&&AS(n,e,l);)++l;if(l===i)return Q.EMPTY;for(;AS(n,e,h);)--h;for(;PS(n,e,a,l,h);)++a;for(;PS(n,e,c,l,h);)--c;return++c,++h,new Q(a/t,l/t,(c-a)/t,(h-l)/t)}var RS=y(()=>{ae()});var MS,pi,lu=y(()=>{ft();ve();MS={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"}},pi=class{constructor(t,e){this.uid=lt("fillPattern"),this.transform=new U,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=MS[e].addressModeU,t.source.style.addressModeV=MS[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 BS=Z((Cj,IS)=>{IS.exports=M2;var ug={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},R2=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function M2(r){var t=[];return r.replace(R2,function(e,i,s){var o=i.toLowerCase();for(s=B2(s),o=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==ug[o])return s.unshift(i),t.push(s);if(s.length<ug[o])throw new Error("malformed path data");t.push([i].concat(s.splice(0,ug[o])))}}),t}var I2=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function B2(r){var t=r.match(I2);return t?t.map(Number):[]}});function kS(r,t){let e=(0,FS.default)(r),i=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let l=e[a],c=l[0],h=l;switch(c){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(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:N(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return t}var FS,OS=y(()=>{FS=ls(BS(),1);St()});var cu,US=y(()=>{ae();cu=class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}strokeContains(t,e,i,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,l=(1-s)*i,c=Math.sqrt(o*o+n*n);return c<=a+l&&c>a-(i-l)}getBounds(t){return t||(t=new Q),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var hu,GS=y(()=>{ae();hu=class r{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),l=i-a,c=o-l,h=n-l,u=o+a,d=n+a,f=t-this.x,p=e-this.y,m=f*f/(c*c)+p*p/(h*h),x=f*f/(u*u)+p*p/(d*d);return m>1&&x<=1}getBounds(t){return t||(t=new Q),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function LS(r,t,e,i,s,o){let n=r-e,a=t-i,l=s-e,c=o-i,h=n*l+a*c,u=l*l+c*c,d=-1;u!==0&&(d=h/u);let f,p;d<0?(f=e,p=i):d>1?(f=s,p=o):(f=e+d*l,p=i+d*c);let m=r-f,x=t-p;return m*m+x*x}var DS=y(()=>{"use strict"});var F2,k2,Uo,NS=y(()=>{DS();ae();Uo=class r{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,i=e.length;for(let s=0;s<i;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%i],l=e[(s+3)%i];t+=(a-o)*(l+n)}return t<0}containsPolygon(t){let e=this.getBounds(F2),i=t.getBounds(k2);if(!e.containsRect(i))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 r(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],c=this.points[n*2],h=this.points[n*2+1];l>e!=h>e&&t<(c-a)*((e-l)/(h-l))+a&&(i=!i)}return i}strokeContains(t,e,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:l}=this,c=l.length-(this.closePath?0:2);for(let h=0;h<c;h+=2){let u=l[h],d=l[h+1],f=l[(h+2)%l.length],p=l[(h+3)%l.length],m=LS(t,e,u,d,f,p),x=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(m<=(x<0?a:n))return!0}return!1}getBounds(t){t||(t=new Q);let e=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=e.length;a<l;a+=2){let c=e[a],h=e[a+1];i=c<i?c:i,s=c>s?c:s,o=h<o?h:o,n=h>n?h:n}return t.x=i,t.width=s-i,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 uu,du,HS=y(()=>{ae();uu=(r,t,e,i,s,o,n)=>{let a=r-e,l=t-i,c=Math.sqrt(a*a+l*l);return c>=s-o&&c<=s+n},du=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o}getBounds(t){return t||(t=new Q),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new r(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,i,s=.5){let{x:o,y:n,width:a,height:l,radius:c}=this,h=i*(1-s),u=i-h,d=o+c,f=n+c,p=a-c*2,m=l-c*2,x=o+a,_=n+l;return(t>=o-h&&t<=o+u||t>=x-u&&t<=x+h)&&e>=f&&e<=f+m||(e>=n-h&&e<=n+u||e>=_-u&&e<=_+h)&&t>=d&&t<=d+p?!0:t<d&&e<f&&uu(t,e,d,f,c,u,h)||t>x-c&&e<f&&uu(t,e,x-c,f,c,u,h)||t>x-c&&e>_-c&&uu(t,e,x-c,_-c,c,u,h)||t<d&&e>_-c&&uu(t,e,d,_-c,c,u,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function pu(r,t,e,i,s,o,n,a,l,c){let u=Math.min(.99,Math.max(0,c??Bo.defaultOptions.bezierSmoothness)),d=(U2-u)/1;return d*=d,G2(t,e,i,s,o,n,a,l,r,d),r}function G2(r,t,e,i,s,o,n,a,l,c){fg(r,t,e,i,s,o,n,a,l,c,0),l.push(n,a)}function fg(r,t,e,i,s,o,n,a,l,c,h){if(h>O2)return;let u=Math.PI,d=(r+e)/2,f=(t+i)/2,p=(e+s)/2,m=(i+o)/2,x=(s+n)/2,_=(o+a)/2,T=(d+p)/2,g=(f+m)/2,w=(p+x)/2,b=(m+_)/2,S=(T+w)/2,v=(g+b)/2;if(h>0){let P=n-r,C=a-t,A=Math.abs((e-n)*C-(i-a)*P),R=Math.abs((s-n)*C-(o-a)*P),M,I;if(A>fu&&R>fu){if((A+R)*(A+R)<=c*(P*P+C*C)){if(Go<dg){l.push(S,v);return}let k=Math.atan2(o-i,s-e);if(M=Math.abs(k-Math.atan2(i-t,e-r)),I=Math.abs(Math.atan2(a-o,n-s)-k),M>=u&&(M=2*u-M),I>=u&&(I=2*u-I),M+I<Go){l.push(S,v);return}if(As!==0){if(M>As){l.push(e,i);return}if(I>As){l.push(s,o);return}}}}else if(A>fu){if(A*A<=c*(P*P+C*C)){if(Go<dg){l.push(S,v);return}if(M=Math.abs(Math.atan2(o-i,s-e)-Math.atan2(i-t,e-r)),M>=u&&(M=2*u-M),M<Go){l.push(e,i),l.push(s,o);return}if(As!==0&&M>As){l.push(e,i);return}}}else if(R>fu){if(R*R<=c*(P*P+C*C)){if(Go<dg){l.push(S,v);return}if(M=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-e)),M>=u&&(M=2*u-M),M<Go){l.push(e,i),l.push(s,o);return}if(As!==0&&M>As){l.push(s,o);return}}}else if(P=S-(r+n)/2,C=v-(t+a)/2,P*P+C*C<=c){l.push(S,v);return}}fg(r,t,d,f,T,g,S,v,l,c,h+1),fg(S,v,w,b,x,_,n,a,l,c,h+1)}var O2,fu,U2,dg,Go,As,pg=y(()=>{ru();O2=8,fu=11920929e-14,U2=1,dg=.01,Go=0,As=0});function WS(r,t,e,i,s,o,n,a){let c=Math.min(.99,Math.max(0,a??Bo.defaultOptions.bezierSmoothness)),h=(N2-c)/1;return h*=h,V2(t,e,i,s,o,n,r,h),r}function V2(r,t,e,i,s,o,n,a){mg(n,r,t,e,i,s,o,a,0),n.push(s,o)}function mg(r,t,e,i,s,o,n,a,l){if(l>L2)return;let c=Math.PI,h=(t+i)/2,u=(e+s)/2,d=(i+o)/2,f=(s+n)/2,p=(h+d)/2,m=(u+f)/2,x=o-t,_=n-e,T=Math.abs((i-o)*_-(s-n)*x);if(T>D2){if(T*T<=a*(x*x+_*_)){if(VS<H2){r.push(p,m);return}let g=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-e,i-t));if(g>=c&&(g=2*c-g),g<VS){r.push(p,m);return}}}else if(x=p-(t+o)/2,_=m-(e+n)/2,x*x+_*_<=a){r.push(p,m);return}mg(r,t,e,h,u,p,m,a,l+1),mg(r,p,m,d,f,o,n,a,l+1)}var L2,D2,N2,H2,VS,zS=y(()=>{ru();L2=8,D2=11920929e-14,N2=1,H2=.01,VS=0});function mu(r,t,e,i,s,o,n,a){let l=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(l/Math.PI)))),a=Math.max(a,3);let c=l/a,h=s;c*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(h),f=Math.sin(h),p=t+d*i,m=e+f*i;r.push(p,m),h+=c}}var gg=y(()=>{"use strict"});function $S(r,t,e,i,s,o){let n=r[r.length-2],l=r[r.length-1]-e,c=n-t,h=s-e,u=i-t,d=Math.abs(l*u-c*h);if(d<1e-8||o===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}let f=l*l+c*c,p=h*h+u*u,m=l*h+c*u,x=o*Math.sqrt(f)/d,_=o*Math.sqrt(p)/d,T=x*m/f,g=_*m/p,w=x*u+_*c,b=x*h+_*l,S=c*(_+T),v=l*(_+T),P=u*(x+g),C=h*(x+g),A=Math.atan2(v-b,S-w),R=Math.atan2(C-b,P-w);mu(r,w+t,b+e,o,A,R,c*h>u*l)}var XS=y(()=>{gg()});function W2(r,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+t),a=Math.sin(r+t);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function YS(r,t,e,i,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let h=Math.sin(a*Ua/360),u=Math.cos(a*Ua/360),d=u*(t-i)/2+h*(e-s)/2,f=-h*(t-i)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),z2(t,e,i,s,o,n,l,c,h,u,d,f,xg);let{ang1:m,ang2:x}=xg,{centerX:_,centerY:T}=xg,g=Math.abs(x)/(Ua/4);Math.abs(1-g)<1e-7&&(g=1);let w=Math.max(Math.ceil(g),1);x/=w;let b=r[r.length-2],S=r[r.length-1],v={x:0,y:0};for(let P=0;P<w;P++){let C=W2(m,x),{x:A,y:R}=yg(C[0],o,n,u,h,_,T,v),{x:M,y:I}=yg(C[1],o,n,u,h,_,T,v),{x:k,y:W}=yg(C[2],o,n,u,h,_,T,v);pu(r,b,S,A,R,M,I,k,W),b=k,S=W,m+=x}}var Ua,xg,yg,jS,z2,qS=y(()=>{pg();Ua=Math.PI*2,xg={centerX:0,centerY:0,ang1:0,ang2:0},yg=({x:r,y:t},e,i,s,o,n,a,l)=>{r*=e,t*=i;let c=s*r-o*t,h=o*r+s*t;return l.x=c+n,l.y=h+a,l};jS=(r,t,e,i)=>{let s=r*i-t*e<0?-1:1,o=r*e+t*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},z2=(r,t,e,i,s,o,n,a,l,c,h,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(h,2),x=Math.pow(u,2),_=f*p-f*x-p*m;_<0&&(_=0),_/=f*x+p*m,_=Math.sqrt(_)*(n===a?-1:1);let T=_*s/o*u,g=_*-o/s*h,w=c*T-l*g+(r+e)/2,b=l*T+c*g+(t+i)/2,S=(h-T)/s,v=(u-g)/o,P=(-h-T)/s,C=(-u-g)/o,A=jS(1,0,S,v),R=jS(S,v,P,C);a===0&&R>0&&(R-=Ua),a===1&&R<0&&(R+=Ua),d.centerX=w,d.centerY=b,d.ang1=A,d.ang2=R}});function KS(r,t,e){let i=(n,a)=>{let l=a.x-n.x,c=a.y-n.y,h=Math.sqrt(l*l+c*c),u=l/h,d=c/h;return{len:h,nx:u,ny:d}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],l=a.radius??e;if(l<=0){s(n,a),o=a;continue}let c=t[(n+1)%t.length],h=i(a,o),u=i(a,c);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,p=!1;h.nx*u.nx-h.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);let m=d/2,x,_=Math.abs(Math.cos(m)*l/Math.sin(m));_>Math.min(h.len/2,u.len/2)?(_=Math.min(h.len/2,u.len/2),x=Math.abs(_*Math.sin(m)/Math.cos(m))):x=l;let T=a.x+u.nx*_+-u.ny*x*f,g=a.y+u.ny*_+u.nx*x*f,w=Math.atan2(h.ny,h.nx)+Math.PI/2*f,b=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&r.moveTo(T+Math.cos(w)*x,g+Math.sin(w)*x),r.arc(T,g,x,w,b,p),o=a}}function ZS(r,t,e,i){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),o=(a,l,c)=>({x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c}),n=t.length;for(let a=0;a<n;a++){let l=t[(a+1)%n],c=l.radius??e;if(c<=0){a===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}let h=t[a],u=t[(a+2)%n],d=s(h,l),f;if(d<1e-4)f=l;else{let x=Math.min(d/2,c);f=o(l,h,x/d)}let p=s(u,l),m;if(p<1e-4)m=l;else{let x=Math.min(p/2,c);m=o(l,u,x/p)}a===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(l.x,l.y,m.x,m.y,i)}}var QS=y(()=>{"use strict"});var $2,gu,JS=y(()=>{US();GS();NS();ae();HS();Ve();pg();zS();gg();XS();qS();QS();$2=new Q,gu=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Tt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==t||o!==e)&&i.push(t,e),this}arc(t,e,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return mu(a,t,e,i,s,o,n),this}arcTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return $S(n,t,e,i,s,o),this}arcToSvg(t,e,i,s,o,n,a){let l=this._currentPoly.points;return YS(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,i,s,o),this}bezierCurveTo(t,e,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return pu(this._currentPoly.points,l.lastX,l.lastY,t,e,i,s,o,n,a),this}quadraticCurveTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly;return WS(this._currentPoly.points,n.lastX,n.lastY,t,e,i,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 i=this.shapePrimitives,s=i.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&i.length-s>1){let o=null;for(let n=s;n<i.length;n++){let a=i[n];if(a.shape.type==="polygon"){let l=a.shape,c=o?.shape;c&&c.containsPolygon(l)?(o.holes||(o.holes=[]),o.holes.push(a),i.copyWithin(n,n+1),i.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,s,o){return this.drawShape(new Q(t,e,i,s),o),this}circle(t,e,i,s){return this.drawShape(new cu(t,e,i),s),this}poly(t,e,i){let s=new Uo(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,l=Math.PI*2/s,c=[];for(let h=0;h<s;h++){let u=a-h*l;c.push(t+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(c,!0,n),this}roundPoly(t,e,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,i,s,n);let l=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let c=-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+c,p=t+i*Math.cos(f),m=e+i*Math.sin(f),x=f+Math.PI+u,_=f-Math.PI-u,T=p+o*Math.cos(x),g=m+o*Math.sin(x),w=p+o*Math.cos(_),b=m+o*Math.sin(_);d===0?this.moveTo(T,g):this.lineTo(T,g),this.quadraticCurveTo(p,m,w,b,a)}return this.closePath()}roundShape(t,e,i=!1,s){return t.length<3?this:(i?ZS(this,t,e,s):KS(this,t,e),this.closePath())}filletRect(t,e,i,s,o){if(o===0)return this.rect(t,e,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=t+i,c=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(l-u,e).arcTo(l-h,e+h,l,e+u,u).lineTo(l,c-u).arcTo(l-h,c-h,t+i-u,c,u).lineTo(t+u,c).arcTo(t+h,c-h,t,c-u,u).closePath()}chamferRect(t,e,i,s,o,n){if(o<=0)return this.rect(t,e,i,s);let a=Math.min(o,Math.min(i,s)/2),l=t+i,c=e+s,h=[t+a,e,l-a,e,l,e+a,l,c-a,l-a,c,t+a,c,t,c-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,i,s,o){return this.drawShape(new hu(t,e,i,s),o),this}roundRect(t,e,i,s,o,n){return this.drawShape(new du(t,e,i,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Uo,i.points.push(t,e),this._currentPoly=i,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 Uo,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,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 i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let i=0;i<e.length;i++){let s=e[i],o=s.shape.getBounds($2);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function Ga(r,t){return r?r.prepend(t):t.clone()}var $i,_g=y(()=>{cr();ve();St();OS();JS();$i=class r{constructor(t,e=!1){this.instructions=[],this.uid=lt("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?kS(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new gu(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,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(ct.shared),l=0,c=0;if(!n||n.action!=="bezierCurveTo")l=a.x,c=a.y;else{l=n.data[2],c=n.data[3];let h=a.x,u=a.y;l=h+(h-l),c=u+(u-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,t,e,i,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,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(ct.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 l=o.x,c=o.y;n=l+(l-n),a=c+(c-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,i]}),this._dirty=!0,this}rect(t,e,i,s,o){return this.instructions.push({action:"rect",data:[t,e,i,s,o]}),this._dirty=!0,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,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,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,c=i*2,h=Math.PI*2/c,u=[];for(let d=0;d<c;d++){let f=d%2?o:s,p=d*h+l;u.push(t+f*Math.cos(p),e+f*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){let e=new r;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];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,i=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,l=0,c=0,h=0,u=0,d=0,f=0,p=0,m=0;for(let x=0;x<this.instructions.length;x++){let _=this.instructions[x],T=_.data;switch(_.action){case"moveTo":case"lineTo":l=T[0],c=T[1],T[0]=e*l+s*c+n,T[1]=i*l+o*c+a;break;case"bezierCurveTo":h=T[0],u=T[1],d=T[2],f=T[3],l=T[4],c=T[5],T[0]=e*h+s*u+n,T[1]=i*h+o*u+a,T[2]=e*d+s*f+n,T[3]=i*d+o*f+a,T[4]=e*l+s*c+n,T[5]=i*l+o*c+a;break;case"quadraticCurveTo":h=T[0],u=T[1],l=T[2],c=T[3],T[0]=e*h+s*u+n,T[1]=i*h+o*u+a,T[2]=e*l+s*c+n,T[3]=i*l+o*c+a;break;case"arcToSvg":l=T[5],c=T[6],p=T[0],m=T[1],T[0]=e*p+s*m,T[1]=i*p+o*m,T[5]=e*l+s*c+n,T[6]=i*l+o*c+a;break;case"circle":T[4]=Ga(T[3],t);break;case"rect":T[4]=Ga(T[4],t);break;case"ellipse":T[8]=Ga(T[8],t);break;case"roundRect":T[5]=Ga(T[5],t);break;case"addPath":T[0].transform(t);break;case"poly":T[2]=Ga(T[2],t);break;default:N("unknown transform action",_.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}});function Lt(r,t,e){let i=r.getAttribute(t);return i?Number(i):e}var bg=y(()=>{"use strict"});function tw(r,t){let e=r.querySelectorAll("defs");for(let i=0;i<e.length;i++){let s=e[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=X2(n);break;case"radialgradient":t.defs[n.id]=j2(n);break;default:break}}}}function X2(r){let t=Lt(r,"x1",0),e=Lt(r,"y1",0),i=Lt(r,"x2",1),s=Lt(r,"y2",0),o=r.getAttribute("gradientUnits")||"objectBoundingBox",n=new Xe(t,e,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<r.children.length;a++){let l=r.children[a],c=Lt(l,"offset",0),h=st.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(c,h)}return n}function j2(r){return N("[SVG Parser] Radial gradients are not yet supported"),new Xe(0,0,1,0)}var ew=y(()=>{_e();St();Io();bg()});function vg(r){let t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var rw=y(()=>{"use strict"});function Tg(r,t){let e=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in iw){let a=r.getAttribute(n);a&&sw(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[c,h]=l.split(":");iw[c]&&sw(t,o,c,h.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function sw(r,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=vg(i);t.strokeStyle.fill=r.defs[s]}else t.strokeStyle.color=st.shared.setValue(i).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=vg(i);t.fillStyle.fill=r.defs[s]}else t.fillStyle.color=st.shared.setValue(i).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(i);break;case"stroke-opacity":t.strokeStyle.alpha=Number(i);break;case"opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}var iw,ow=y(()=>{_e();rw();iw={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 nw(r,t){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let e={context:t,defs:{},path:new $i};tw(r,e);let i=r.children,{fillStyle:s,strokeStyle:o}=Tg(r,e);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&aw(a,e,s,o)}return t}function aw(r,t,e,i){let s=r.children,{fillStyle:o,strokeStyle:n}=Tg(r,t);o&&e?e={...e,...o}:o&&(e=o),n&&i?i={...i,...n}:n&&(i=n);let a=!e&&!i;a&&(e={color:0});let l,c,h,u,d,f,p,m,x,_,T,g,w,b,S,v,P;switch(r.nodeName.toLowerCase()){case"path":b=r.getAttribute("d"),r.getAttribute("fill-rule")==="evenodd"&&N("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new $i(b,!0),t.context.path(S),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"circle":p=Lt(r,"cx",0),m=Lt(r,"cy",0),x=Lt(r,"r",0),t.context.ellipse(p,m,x,x),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":l=Lt(r,"x",0),c=Lt(r,"y",0),v=Lt(r,"width",0),P=Lt(r,"height",0),_=Lt(r,"rx",0),T=Lt(r,"ry",0),_||T?t.context.roundRect(l,c,v,P,_||T):t.context.rect(l,c,v,P),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":p=Lt(r,"cx",0),m=Lt(r,"cy",0),_=Lt(r,"rx",0),T=Lt(r,"ry",0),t.context.beginPath(),t.context.ellipse(p,m,_,T),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":h=Lt(r,"x1",0),u=Lt(r,"y1",0),d=Lt(r,"x2",0),f=Lt(r,"y2",0),t.context.beginPath(),t.context.moveTo(h,u),t.context.lineTo(d,f),i&&t.context.stroke(i);break;case"polygon":w=r.getAttribute("points"),g=w.match(/\d+/g).map(C=>parseInt(C,10)),t.context.poly(g,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":w=r.getAttribute("points"),g=w.match(/\d+/g).map(C=>parseInt(C,10)),t.context.poly(g,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{N(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let C=0;C<s.length;C++)aw(s[C],t,e,i)}var lw=y(()=>{St();_g();ew();bg();ow()});function Y2(r){return st.isColorLike(r)}function cw(r){return r instanceof pi}function hw(r){return r instanceof Xe}function q2(r){return r instanceof B}function K2(r,t,e){let i=st.shared.setValue(t??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=B.WHITE,{...e,...r}}function Z2(r,t,e){return r.texture=t,{...e,...r}}function uw(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function dw(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,{...e,...r}}function Q2(r,t){let e={...t,...r},i=st.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function mi(r,t){if(r==null)return null;let e={},i=r;return Y2(r)?K2(e,r,t):q2(r)?Z2(e,r,t):cw(r)?uw(e,r,t):hw(r)?dw(e,r,t):i.fill&&cw(i.fill)?uw(i,i.fill,t):i.fill&&hw(i.fill)?dw(i,i.fill,t):Q2(i,t)}function Lo(r,t){let{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=t,c=mi(r,l);return c?{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var Sg=y(()=>{_e();_t();Io();lu()});var J2,fw,wg,Le,xu=y(()=>{Ae();_e();ft();cr();_t();ve();Ht();Ve();_g();lw();Sg();J2=new ct,fw=new U,wg=class Xr extends Pt{constructor(){super(...arguments),this.uid=lt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new $i,this._transform=new U,this._fillStyle={...Xr.defaultFillStyle},this._strokeStyle={...Xr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Tt,this._boundsDirty=!0}clone(){let t=new Xr;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=mi(t,Xr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Lo(t,Xr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=mi(t,Xr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=mi(t,Xr.defaultStrokeStyle),this}texture(t,e,i,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?st.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new $i,this}fill(t,e){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(X(tt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=mi(t,Xr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(ct.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Lo(t,Xr.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],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,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,i,s,o,n),this}arcTo(t,e,i,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*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,e,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*i+l.c*s+l.tx,l.b*i+l.d*s+l.ty,l.a*o+l.c*n+l.tx,l.b*o+l.d*n+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*t+i.c*e+i.tx,n=i.b*t+i.d*e+i.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,i,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*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,o){return this._tick++,this._activePath.roundRect(t,e,i,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,i,s,o,n),this}roundPoly(t,e,i,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,i,s,o,n),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,o){return this._tick++,this._activePath.filletRect(t,e,i,s,o),this}chamferRect(t,e,i,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,i,s,o,n),this}star(t,e,i,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,i,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,nw(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,i,s,o,n){return t instanceof U?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,o,n),this)}transform(t,e,i,s,o,n){return t instanceof U?(this._transform.append(t),this):(fw.set(t,e,i,s,o,n),this._transform.append(fw),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 i=this.instructions[e],s=i.action;if(s==="fill"){let o=i.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=i.data,n=o.style.alignment,a=o.style.width*(1-n),l=o.path.bounds;t.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,i=!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 l=n.style,c=a.shapePath.shapePrimitives;for(let h=0;h<c.length;h++){let u=c[h].shape;if(!l||!u)continue;let d=c[h].transform,f=d?d.applyInverse(t,J2):t;if(o.action==="fill")i=u.contains(f.x,f.y);else{let m=l;i=u.strokeContains(f.x,f.y,m.width,m.alignment)}let p=n.hole;if(p){let m=p.shapePath?.shapePrimitives;if(m)for(let x=0;x<m.length;x++)m[x].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};wg.defaultFillStyle={color:16777215,alpha:1,texture:B.WHITE,matrix:null,fill:null,textureSpace:"local"};wg.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:B.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Le=wg});function yu(r){let t=[],e=0;for(let i=0;i<pw.length;i++){let s=`_${pw[i]}`;t[e++]=r[s]}return e=mw(r._fill,t,e),e=tO(r._stroke,t,e),e=eO(r.dropShadow,t,e),t.join("-")}function mw(r,t,e){return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=r.fill?.styleKey),e}function tO(r,t,e){return r&&(e=mw(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function eO(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=st.shared.setValue(r.color).toNumber()),e}var pw,Eg=y(()=>{_e();pw=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function rO(r){let t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=It.defaultDropShadow;r.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){X(tt,"strokeThickness is now a part of stroke");let e=t.stroke,i={};if(st.isColorLike(e))i.color=e;else if(e instanceof Xe||e instanceof pi)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){X(tt,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;r.fontSize==null?r.fontSize=It.defaultTextStyle.fontSize:typeof r.fontSize=="string"?e=parseInt(r.fontSize,10):e=r.fontSize;let i=new Xe({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>st.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var Ag,It,Ps=y(()=>{Ae();_e();Ht();Io();lu();xu();Sg();Eg();Ag=class Do extends Pt{constructor(t={}){super(),rO(t);let e={...Do.defaultTextStyle,...t};for(let i in e){let s=i;this[s]=e[i]}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({...Do.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Do.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({...Le.defaultFillStyle,...t},()=>{this._fill=mi({...this._originalFill},Le.defaultFillStyle)})),this._fill=mi(t===0?"black":t,Le.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Le.defaultStrokeStyle,...t},()=>{this._stroke=Lo({...this._originalStroke},Le.defaultStrokeStyle)})),this._stroke=Lo(t,Le.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=yu(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Do.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Do({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 i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,o)=>(i[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(st.isColorLike(t)||t instanceof Xe||t instanceof pi)}};Ag.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Ag.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};It=Ag});function _u(r,t,e,i){let s=iO;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=Vt.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}var iO,Pg=y(()=>{Bi();Ve();iO=new Tt});function Cs(r){let t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!sO.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}var sO,bu=y(()=>{"use strict";sO=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Cg,Pr,kt,La=y(()=>{Ct();bu();Cg={willReadFrequently:!0},Pr=class Y{static get experimentalLetterSpacingSupported(){let t=Y._experimentalLetterSpacingSupported;if(t!==void 0){let e=j.get().getCanvasRenderingContext2D().prototype;t=Y._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,o,n,a,l,c){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=c}static measureText(t=" ",e,i=Y._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(Y._measurementCache[o])return Y._measurementCache[o];let n=Cs(e),a=Y.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let l=Y.__context;l.font=n;let h=(s?Y._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let T=0;T<h.length;T++){let g=Y._measureText(h[T],e.letterSpacing,l);u[T]=g,d=Math.max(d,g)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let m=e.lineHeight||a.fontSize,x=Math.max(m,a.fontSize+f)+(h.length-1)*(m+e.leading);return e.dropShadow&&(x+=e.dropShadow.distance),new Y(t,e,p,x,h,u,m+e.leading,d,a)}static _measureText(t,e,i){let s=!1;Y.experimentalLetterSpacingSupported&&(Y.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,c=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,c-=e;else{let h=(Y.graphemeSegmenter(t).length-1)*e;n+=h,c+=h}return Math.max(n,c)}static _wordWrap(t,e,i=Y._canvas){let s=i.getContext("2d",Cg),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:h}=e,u=Y._collapseSpaces(h),d=Y._collapseNewlines(h),f=!u,p=e.wordWrapWidth+c,m=Y._tokenize(t);for(let x=0;x<m.length;x++){let _=m[x];if(Y._isNewline(_)){if(!d){a+=Y._addLine(n),f=!u,n="",o=0;continue}_=" "}if(u){let g=Y.isBreakingSpace(_),w=Y.isBreakingSpace(n[n.length-1]);if(g&&w)continue}let T=Y._getFromCache(_,c,l,s);if(T>p)if(n!==""&&(a+=Y._addLine(n),n="",o=0),Y.canBreakWords(_,e.breakWords)){let g=Y.wordWrapSplit(_);for(let w=0;w<g.length;w++){let b=g[w],S=b,v=1;for(;g[w+v];){let C=g[w+v];if(!Y.canBreakChars(S,C,_,w,e.breakWords))b+=C;else break;S=C,v++}w+=v-1;let P=Y._getFromCache(b,c,l,s);P+o>p&&(a+=Y._addLine(n),f=!1,n="",o=0),n+=b,o+=P}}else{n.length>0&&(a+=Y._addLine(n),n="",o=0);let g=x===m.length-1;a+=Y._addLine(_,!g),f=!1,n="",o=0}else T+o>p&&(f=!1,a+=Y._addLine(n),n="",o=0),(n.length>0||!Y.isBreakingSpace(_)||f)&&(n+=_,o+=T)}return a+=Y._addLine(n,!1),a}static _addLine(t,e=!0){return t=Y._trimRight(t),t=e?`${t}
368
+ `:t,t}static _getFromCache(t,e,i,s){let o=i[t];return typeof o!="number"&&(o=Y._measureText(t,e,s)+e,i[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 i=t[e];if(!Y.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:Y._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:Y._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(Y.isBreakingSpace(o,n)||Y._isNewline(o)){i!==""&&(e.push(i),i=""),e.push(o);continue}i+=o}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,o){return!0}static wordWrapSplit(t){return Y.graphemeSegmenter(t)}static measureFont(t){if(Y._fonts[t])return Y._fonts[t];let e=Y._context;e.font=t;let i=e.measureText(Y.METRICS_STRING+Y.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return Y._fonts[t]=s,s}static clearMetrics(t=""){t?delete Y._fonts[t]:Y._fonts={}}static get _canvas(){if(!Y.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",Cg)?.measureText)return Y.__canvas=e,e;t=j.get().createCanvas()}catch{t=j.get().createCanvas()}t.width=t.height=10,Y.__canvas=t}return Y.__canvas}static get _context(){return Y.__context||(Y.__context=Y._canvas.getContext("2d",Cg)),Y.__context}};Pr.METRICS_STRING="|\xC9q\xC5";Pr.BASELINE_SYMBOL="M";Pr.BASELINE_MULTIPLIER=1.4;Pr.HEIGHT_MULTIPLIER=2;Pr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})();Pr.experimentalLetterSpacing=!1;Pr._fonts={};Pr._newlines=[10,13];Pr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Pr._measurementCache={};kt=Pr});function No(r,t,e,i=0){if(r.texture===B.WHITE&&!r.fill)return st.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof pi){let s=r.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(U.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof Xe){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&e&&(a=e.width+i,l=e.height+i);let c,h=!1;if(o){let{start:u,end:d}=s;c=t.createLinearGradient(u.x*a,u.y*l,d.x*a,d.y*l),h=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:p}=s;c=t.createRadialGradient(u.x*a,u.y*l,d*a,f.x*a,f.y*l,p*a)}if(h&&n&&e){let u=e.lineHeight/l;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+i/2)/l;s.colorStops.forEach(p=>{let m=f+p.offset*u;c.addColorStop(Math.floor(m*gw)/gw,st.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{c.addColorStop(u.offset,st.shared.setValue(u.color).toHex())});return c}}else{let s=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(U.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return N("FillStyle not recognised",r),"red"}var gw,Rg=y(()=>{_e();ft();_t();St();Io();lu();gw=1e5});var Da,xw=y(()=>{_e();F();sa();Oo();Bi();RS();Ht();Ps();Pg();La();bu();Rg();Da=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){let s=kt.measureText(t||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=li(o),n=li(n),{width:o,height:n}}getTexture(t,e,i,s){typeof t=="string"&&(X("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof It||(t.style=new It(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),je.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:i}=t,s=t.resolution??this._renderer.resolution,o=kt.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),l=je.getOptimalCanvasAndContext(n,a),{canvas:c}=l;this.renderTextToCanvas(e,i,s,l);let h=_u(c,n,a,s);if(i.trim){let u=CS(c,s);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:l}}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:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Vt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(je.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){let{canvas:o,context:n}=s,a=Cs(e),l=kt.measureText(t||" ",e),c=l.lines,h=l.lineHeight,u=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,p=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=e.textBaseline,e._stroke?.width){let T=e._stroke;n.lineWidth=T.width,n.miterLimit=T.miterLimit,n.lineJoin=T.join,n.lineCap=T.cap}n.font=a;let m,x,_=e.dropShadow?2:1;for(let T=0;T<_;++T){let g=e.dropShadow&&T===0,w=g?Math.ceil(Math.max(1,p)+e.padding*2):0,b=w*i;if(g){n.fillStyle="black",n.strokeStyle="black";let P=e.dropShadow,C=P.color,A=P.alpha;n.shadowColor=st.shared.setValue(C).setAlpha(A).toRgbaString();let R=P.blur*i,M=P.distance*i;n.shadowBlur=R,n.shadowOffsetX=Math.cos(P.angle)*M,n.shadowOffsetY=Math.sin(P.angle)*M+b}else{if(n.fillStyle=e._fill?No(e._fill,n,l):null,e._stroke?.width){let P=e._stroke.width*e._stroke.alignment;n.strokeStyle=No(e._stroke,n,l,P)}n.shadowColor="black"}let S=(h-f.fontSize)/2;h-f.fontSize<0&&(S=0);let v=e._stroke?.width??0;for(let P=0;P<c.length;P++)m=v/2,x=v/2+P*h+f.ascent+S,e.align==="right"?m+=d-u[P]:e.align==="center"&&(m+=(d-u[P])/2),e._stroke?.width&&this._drawLetterSpacing(c[P],e,s,m+e.padding,x+e.padding-w,!0),e._fill!==void 0&&this._drawLetterSpacing(c[P],e,s,m+e.padding,x+e.padding-w)}}_drawLetterSpacing(t,e,i,s,o,n=!1){let{context:a}=i,l=e.letterSpacing,c=!1;if(kt.experimentalLetterSpacingSupported&&(kt.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,c=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||c){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let h=s,u=kt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let m=u[p];n?a.strokeText(m,h,o):a.fillText(m,h,o);let x="";for(let _=p+1;_<u.length;++_)x+=u[_];f=a.measureText(x).width,h+=d-f+l,d=f}}destroy(){this._activeTextures=null}};Da.extension={type:[E.WebGLSystem,E.WebGPUSystem,E.CanvasSystem],name:"canvasText"}});var Mg=y(()=>{F();ES();xw();D.add(Da);D.add(Oa)});var Bt,Ig=y(()=>{Ht();Mh();xu();Bt=class r extends Oi{constructor(t){t instanceof Le&&(t={context:t});let{context:e,roundPixels:i,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Le,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!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 r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(t,e,i){X(tt,"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),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){X(tt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){X(tt,"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!==Le.defaultStrokeStyle.width||t.color!==Le.defaultStrokeStyle.color||t.alpha!==Le.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return X(tt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return X(tt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return X(tt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return X(tt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return X(tt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return X(tt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var yw,_w,bw=y(()=>{"use strict";yw={name:"local-uniform-msdf-bit",vertex:{header:`
369
369
  struct LocalUniforms {
370
370
  uColor:vec4<f32>,
371
371
  uTransformMatrix:mat3x3<f32>,
@@ -462,8 +462,8 @@ fn mainFragment(
462
462
 
463
463
  return coverage;
464
464
  }
465
- `}}});var Bg,Fg,vu,ww=y(()=>{ft();_s();Vi();Sa();wa();Wi();jh();Er();Ge();bw();Sw();vu=class extends Yt{constructor(){let t=new Et({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=hr();Bg??(Bg=Dr({name:"sdf-shader",bits:[wo,Ao(e),yw,vw,Hr]})),Fg??(Fg=Nr({name:"sdf-shader",bits:[Eo,Po(e),_w,Tw,Vr]})),super({glProgram:Fg,gpuProgram:Bg,resources:{localUniforms:t,batchSamplers:Co(e)}})}}});var Ho,kg=y(()=>{Ae();Ht();Ho=class extends Pt{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 X(tt,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return X(tt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return X(tt,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return X(tt,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return X(tt,"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 Tu(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let t=[];for(let e=0,i=r.length;e<i;e++){let s=r[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,l=n;a<=l;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 Og=y(()=>{"use strict"});var Ew,Ug,Pw=y(()=>{_e();ae();Oo();xo();_t();Ht();La();bu();Rg();Ps();kg();Og();Ew=class Aw extends Ho{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={...Aw.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=B.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=Cs(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=Lt.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){let e=Tu(t).filter(x=>!this._currentChars.includes(x)).filter((x,_,T)=>T.indexOf(x)===_);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:o}=i.canvasAndContext,n=i.texture.source,a=this._style,l=this._currentX,c=this._currentY,h=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*h,d=0,f=!1,p=s.width/this.resolution,m=s.height/this.resolution;for(let x=0;x<e.length;x++){let _=e[x],T=Lt.measureText(_,a,s,!1);T.lineHeight=T.height;let g=T.width*h,w=Math.ceil((a.fontStyle==="italic"?2:1)*g),b=T.height*h,S=w+u*2,v=b+u*2;if(f=!1,_!==`
466
- `&&_!=="\r"&&_!==" "&&_!==" "&&(f=!0,d=Math.ceil(Math.max(v,d))),l+S>p&&(c+=d,d=v,l=0,c+d>m)){n.update();let P=this._nextPage();s=P.canvasAndContext.canvas,o=P.canvasAndContext.context,n=P.texture.source,c=0}let A=g/h-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:A,kerning:{}},f){this._drawGlyph(o,T,l+u,c+u,h,a);let P=n.width*h,C=n.height*h,R=new Q(l/P*n.width,c/C*n.height,S/P*n.width,v/C*n.height);this.chars[_].texture=new B({source:n,frame:R}),l+=Math.ceil(S)}}n.update(),this._currentX=l,this._currentY=c,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return X(tt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let i=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],l=i[o];l||(l=i[o]=e.measureText(o).width);let c=i[a];c||(c=i[a]=e.measureText(a).width);let h=e.measureText(o+a).width,u=h-(l+c);u&&(this.chars[o].kerning[a]=u),h=e.measureText(o+a).width,u=h-(l+c),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=je.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new B({source:new ze({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,i){e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=Cs(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=No(s,t)),e._fill&&(t.fillStyle=No(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=st.shared.setValue(n.color).toArray(),l=n.blur*i,c=n.distance*i;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=l,t.shadowOffsetX=Math.cos(n.angle)*c,t.shadowOffsetY=Math.sin(n.angle)*c}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,i,s,o,n){let a=e.text,l=e.fontProperties,h=(n._stroke?.width??0)*o,u=i+h/2,d=s-h/2,f=l.descent*o,p=e.lineHeight*o;n.stroke&&h&&t.strokeText(a,u,d+p-f),n._fill&&t.fillText(a,u,d+p-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:i}=this.pages[t];je.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};Ew.defaultOptions={textureSize:512,style:new It,mipmap:!0};Ug=Ew});function Su(r,t,e,i){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,l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},c=p=>{let m=o.width;for(let x=0;x<l.index;x++){let _=p.positions[x];o.chars.push(p.chars[x]),o.charPositions.push(_+m)}o.width+=p.width,a=!1,l.width=0,l.index=0,l.chars.length=0},h=()=>{let p=o.chars.length-1;if(i){let m=o.chars[p];for(;m===" ";)o.width-=e.chars[m].xAdvance,m=o.chars[--p]}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 p=0;p<r.length+1;p++){let m,x=p===r.length;x||(m=r[p]);let _=e.chars[m]||e.chars[" "];if(/(?:\s)/.test(m)||m==="\r"||m===`
465
+ `}}});var Bg,Fg,vu,ww=y(()=>{ft();_s();Vi();Sa();wa();Wi();jh();Er();Ge();bw();Sw();vu=class extends Yt{constructor(){let t=new Et({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=hr();Bg??(Bg=Dr({name:"sdf-shader",bits:[wo,Ao(e),yw,vw,Hr]})),Fg??(Fg=Nr({name:"sdf-shader",bits:[Eo,Po(e),_w,Tw,Vr]})),super({glProgram:Fg,gpuProgram:Bg,resources:{localUniforms:t,batchSamplers:Co(e)}})}}});var Ho,kg=y(()=>{Ae();Ht();Ho=class extends Pt{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 X(tt,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return X(tt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return X(tt,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return X(tt,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return X(tt,"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 Tu(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let t=[];for(let e=0,i=r.length;e<i;e++){let s=r[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,l=n;a<=l;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 Og=y(()=>{"use strict"});var Ew,Ug,Pw=y(()=>{_e();ae();Oo();xo();_t();Ht();La();bu();Rg();Ps();kg();Og();Ew=class Aw extends Ho{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={...Aw.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=B.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=Cs(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=kt.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){let e=Tu(t).filter(x=>!this._currentChars.includes(x)).filter((x,_,T)=>T.indexOf(x)===_);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:o}=i.canvasAndContext,n=i.texture.source,a=this._style,l=this._currentX,c=this._currentY,h=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*h,d=0,f=!1,p=s.width/this.resolution,m=s.height/this.resolution;for(let x=0;x<e.length;x++){let _=e[x],T=kt.measureText(_,a,s,!1);T.lineHeight=T.height;let g=T.width*h,w=Math.ceil((a.fontStyle==="italic"?2:1)*g),b=T.height*h,S=w+u*2,v=b+u*2;if(f=!1,_!==`
466
+ `&&_!=="\r"&&_!==" "&&_!==" "&&(f=!0,d=Math.ceil(Math.max(v,d))),l+S>p&&(c+=d,d=v,l=0,c+d>m)){n.update();let C=this._nextPage();s=C.canvasAndContext.canvas,o=C.canvasAndContext.context,n=C.texture.source,c=0}let P=g/h-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:P,kerning:{}},f){this._drawGlyph(o,T,l+u,c+u,h,a);let C=n.width*h,A=n.height*h,R=new Q(l/C*n.width,c/A*n.height,S/C*n.width,v/A*n.height);this.chars[_].texture=new B({source:n,frame:R}),l+=Math.ceil(S)}}n.update(),this._currentX=l,this._currentY=c,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return X(tt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let i=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],l=i[o];l||(l=i[o]=e.measureText(o).width);let c=i[a];c||(c=i[a]=e.measureText(a).width);let h=e.measureText(o+a).width,u=h-(l+c);u&&(this.chars[o].kerning[a]=u),h=e.measureText(o+a).width,u=h-(l+c),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=je.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new B({source:new ze({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,i){e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=Cs(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=No(s,t)),e._fill&&(t.fillStyle=No(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=st.shared.setValue(n.color).toArray(),l=n.blur*i,c=n.distance*i;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=l,t.shadowOffsetX=Math.cos(n.angle)*c,t.shadowOffsetY=Math.sin(n.angle)*c}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,i,s,o,n){let a=e.text,l=e.fontProperties,h=(n._stroke?.width??0)*o,u=i+h/2,d=s-h/2,f=l.descent*o,p=e.lineHeight*o;n.stroke&&h&&t.strokeText(a,u,d+p-f),n._fill&&t.fillText(a,u,d+p-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:i}=this.pages[t];je.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};Ew.defaultOptions={textureSize:512,style:new It,mipmap:!0};Ug=Ew});function Su(r,t,e,i){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,l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},c=p=>{let m=o.width;for(let x=0;x<l.index;x++){let _=p.positions[x];o.chars.push(p.chars[x]),o.charPositions.push(_+m)}o.width+=p.width,a=!1,l.width=0,l.index=0,l.chars.length=0},h=()=>{let p=o.chars.length-1;if(i){let m=o.chars[p];for(;m===" ";)o.width-=e.chars[m].xAdvance,m=o.chars[--p]}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 p=0;p<r.length+1;p++){let m,x=p===r.length;x||(m=r[p]);let _=e.chars[m]||e.chars[" "];if(/(?:\s)/.test(m)||m==="\r"||m===`
467
467
  `||x){if(!a&&t.wordWrap&&o.width+l.width-d>f?(h(),c(l),x||o.charPositions.push(0)):(l.start=o.width,c(l),x||o.charPositions.push(0)),m==="\r"||m===`
468
468
  `)o.width!==0&&h();else if(!x){let b=_.xAdvance+(_.kerning[n]||0)+d;o.width+=b,o.spaceWidth=b,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let w=_.kerning[n]||0,b=_.xAdvance+w+d;l.positions[l.index++]=l.width+w,l.chars.push(m),l.width+=b}n=m}return h(),t.align==="center"?oO(s):t.align==="right"?nO(s):t.align==="justify"&&aO(s),s}function oO(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function nO(r){for(let t=0;t<r.lines.length;t++){let e=r.lines[t],i=r.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function aO(r){let t=r.width;for(let e=0;e<r.lines.length;e++){let i=r.lines[e],s=0,o=i.spacesIndex[s++],n=0,a=i.spacesIndex.length,c=(t-i.width)/a;for(let h=0;h<i.charPositions.length;h++)h===o&&(o=i.spacesIndex[s++],n+=c),i.charPositions[h]+=n}}var Gg=y(()=>{"use strict"});var wu,Lg,Na,Dg=y(()=>{Li();Ht();St();Ps();Pw();Gg();Og();wu=0,Lg=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 i=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!bt.has(i)){let n=new Ug({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});wu++,wu>50&&N("BitmapText",`You have dynamically created ${wu} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{wu--,bt.remove(i)}),bt.set(i,n)}let o=bt.get(i);return o.ensureCharacters?.(t),o}getLayout(t,e,i=!0){let s=this.getFont(t,e);return Su([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}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},X(tt,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof It?s:new It(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Ug({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),l=Tu(e.chars);return a.ensureCharacters(l.join("")),bt.set(`${i}-bitmap`,a),a.once("destroy",()=>bt.remove(`${i}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,i=bt.get(e);i&&i.destroy()}},Na=new Lg});function Cw(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}var Ha,Rw=y(()=>{Li();F();Fe();Ig();ww();Dg();Gg();Ha=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 i=this._getGpuBitmapText(t);Cw(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.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&&(et.return(e.customShader),e.customShader=null),et.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);Cw(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:i}=e,s=Na.getFont(t.text,t._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=et.get(vu)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,l=Su(o,n,s,!0),c=0,h=n.padding,u=l.scale,d=l.width,f=l.height+l.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),i.translate(-t._anchor._x*d-h,-t._anchor._y*f-h).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let m=0;m<l.lines.length;m++){let x=l.lines[m];for(let _=0;_<x.charPositions.length;_++){let T=o[c++],g=s.chars[T];g?.texture&&i.texture(g.texture,p||"black",Math.round(x.charPositions[_]+g.xOffset),Math.round(a+g.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=et.get(Bt);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,i=t._style.fontFamily,s=bt.get(`${i}-bitmap`),{a:o,b:n,c:a,d:l}=t.groupTransform,c=Math.sqrt(o*o+n*n),h=Math.sqrt(a*a+l*l),u=(Math.abs(c)+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}};Ha.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"bitmapText"}});var Ng=y(()=>{F();Rw();D.add(Ha)});var Va,Mw=y(()=>{F();_t();Fe();Fa();cg();Va=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 i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),et.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,ka(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let i=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=i;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(),ka(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:B.EMPTY,currentKey:"--",batchableSprite:et.get($r),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=B.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.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}};Va.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"htmlText"}});function Iw(){let{userAgent:r}=j.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var Bw=y(()=>{Ct()});var Fw,kw,Vo,Hg=y(()=>{"use strict";Fw="http://www.w3.org/2000/svg",kw="http://www.w3.org/1999/xhtml",Vo=class{constructor(){this.svgRoot=document.createElementNS(Fw,"svg"),this.foreignObject=document.createElementNS(Fw,"foreignObject"),this.domElement=document.createElementNS(kw,"div"),this.styleElement=document.createElementNS(kw,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}});function Gw(r){let t=r._stroke,e=r._fill,s=[`div { ${[`color: ${st.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[Dw(t)]:[],...r.dropShadow?[Lw(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return lO(r.tagStyles,s),s.join(" ")}function Lw(r){let t=st.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${e}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${t}`:`text-shadow: ${s} ${t}`}function Dw(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${st.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${st.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function lO(r,t){for(let e in r){let i=r[e],s=[];for(let o in i)Uw[o]?s.push(Uw[o](i[o])):Ow[o]&&s.push(Ow[o].replace("{{VALUE}}",i[o]));t.push(`${e} { ${s.join(";")} }`)}}var Ow,Uw,Nw=y(()=>{_e();Ow={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"},Uw={fill:r=>`color: ${st.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:Dw,dropShadow:Lw}});var Eu,Hw=y(()=>{St();Ps();Eg();Nw();Eu=class r extends It{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=yu(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new r({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=Gw(this)),this._cssStyle}addOverride(...t){let e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&N("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&N("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function Vw(r,t){let e=t.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=r.match(o);function a(l){s[l]||(i.push(l),s[l]=!0)}if(Array.isArray(e))for(let l=0;l<e.length;l++)a(e[l]);else a(e);n&&n.forEach(l=>{let c=l.split(":")[1].trim();a(c)});for(let l in t.tagStyles){let c=t.tagStyles[l].fontFamily;a(c)}return i}var Ww=y(()=>{"use strict"});async function zw(r){let e=await(await j.get().fetch(r)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(e)})}var $w=y(()=>{Ct()});async function Vg(r,t){let e=await zw(t);return`@font-face {
469
469
  font-family: "${r.fontFamily}";
@@ -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 zg,$g,Cu,uE=y(()=>{ft();Vi();Xo();Wi();Er();Ge();_t();hE();Cu=class extends Yt{constructor(){zg??(zg=Dr({name:"tiling-sprite-shader",bits:[Rs,lE,Hr]})),$g??($g=Nr({name:"tiling-sprite-shader",bits:[$o,cE,Vr]}));let t=new Et({uMapCoord:{value:new U,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 U,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:$g,gpuProgram:zg,resources:{localUniforms:new Et({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:B.EMPTY.source,uSampler:B.EMPTY.source.style}})}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,c=n.height,h=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*l/t,i.b*l/e,i.c*c/t,i.d*c/e,i.tx/t,i.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 Ru,dE=y(()=>{Pu();Ru=class extends zo{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 fE(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}var pE=y(()=>{"use strict"});function mE(r,t,e,i){let s=0,o=r.length/(t||2),n=i.a,a=i.b,l=i.c,c=i.d,h=i.tx,u=i.ty;for(e*=t;s<o;){let d=r[e],f=r[e+1];r[e]=n*d+l*f+h,r[e+1]=a*d+c*f+u,e+=t,s++}}var gE=y(()=>{"use strict"});function xE(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.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=U.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),mE(t,2,0,a)}var yE=y(()=>{ft();gE()});var Mu,Wa,_E=y(()=>{F();ba();Ar();Wr();Fo();iu();Pu();uE();dE();pE();yE();Mu=new Ru,Wa=class{constructor(t){this._state=Kt.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),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new zi);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,i.addToBatch(a,e)}else i.break(e),s.shader||(s.shader=new Cu),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,zr(t.groupColorAlpha,i.uColor,0),this._state.blendMode=ui(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Mu,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){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 zo({indices:Mu.indices,positions:Mu.positions.slice(),uvs:Mu.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:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),xE(t,i.uvs),fE(t,i.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),i=t.texture,s=!0;return this._renderer.type===re.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};Wa.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"tilingSprite"}});var Xg=y(()=>{F();_E();D.add(Wa)});var bE,TE,SE=y(()=>{Ht();Pu();bE=class vE extends zo{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(X(tt,"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={...vE.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,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,c=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;i.push(d*l,f*c),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,p=f*this.verticesX+d,m=f*this.verticesX+d+1,x=(f+1)*this.verticesX+d,_=(f+1)*this.verticesX+d+1;o.push(p,m,x,m,_,x)}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};bE.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};TE=bE});var wE,AE,PE=y(()=>{SE();wE=class EE extends TE{constructor(t={}){t={...EE.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:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:c}=this,h=s+o,u=e>h?1:e/h,d=n+a,f=i>d?1:i/d,p=Math.min(u,f),m=l*e,x=c*i;t[0]=t[8]=t[16]=t[24]=-m,t[2]=t[10]=t[18]=t[26]=s*p-m,t[4]=t[12]=t[20]=t[28]=e-o*p-m,t[6]=t[14]=t[22]=t[30]=e-m,t[1]=t[3]=t[5]=t[7]=-x,t[9]=t[11]=t[13]=t[15]=n*p-x,t[17]=t[19]=t[21]=t[23]=i-a*p-x,t[25]=t[27]=t[29]=t[31]=i-x,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};wE.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};AE=wE});var za,CE=y(()=>{F();Fe();iu();PE();za=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 i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,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];et.return(e.geometry),et.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=et.get(zi);return e.geometry=et.get(AE),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}};za.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"nineSliceSprite"}});var jg=y(()=>{F();CE();D.add(za)});var $a,RE=y(()=>{F();$a=class{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.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}};$a.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"filter"}});function ME(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var IE=y(()=>{"use strict"});var cO,Xa,BE=y(()=>{F();ft();cr();Di();vo();Ge();_t();Bi();Wr();Ve();IE();St();cO=new ur({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])}),Xa=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Et({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 pe({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?ME(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 p=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,l=0,c=!0,h=!1,u=!1,d=!0;for(let f=0;f<i.length;f++){let p=i[f];if(a=Math.min(a,p.resolution==="inherit"?n._resolution:p.resolution),l+=p.padding,p.antialias==="off"?c=!1:p.antialias==="inherit"&&c&&(c=n.antialias),p.clipToViewport||(d=!1),!!!(p.compatibleRenderers&e.type)){u=!1;break}if(p.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){N("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=p.enabled||u,h||(h=p.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,p=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/p,0,f.height/p)}if(o.scale(a).ceil().scale(1/a).pad(l|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=Vt.getOptimalTexture(o.width,o.height,a,c),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 i=e.inputTexture,s=e.bounds,o=B.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,l=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(l,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,!1),Vt.returnTexture(i);else{let a=e.inputTexture,l=Vt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),c=0;for(c=0;c<n.length-1;++c){n[c].apply(this,a,l,!0);let u=a;a=l,l=u}n[c].apply(this,a,e.previousRenderSurface,!1),Vt.returnTexture(a),Vt.returnTexture(l)}e.blendRequired&&Vt.returnTexture(o)}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=Vt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(e.width*s),c=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:l,height:c},{x:0,y:0}),o}applyFilter(t,e,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,l=ct.shared,h=n.previousRenderSurface===i,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,p=f.uniforms,m=p.uOutputFrame,x=p.uInputSize,_=p.uInputPixel,T=p.uInputClamp,g=p.uGlobalFrame,w=p.uOutputTexture;if(h){let v=this._filterStackIndex;for(;v>0;){v--;let A=this._filterStack[this._filterStackIndex-1];if(!A.skip){l.x=A.bounds.minX,l.y=A.bounds.minY;break}}m[0]=a.minX-l.x,m[1]=a.minY-l.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,x[0]=e.source.width,x[1]=e.source.height,x[2]=1/x[0],x[3]=1/x[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],T[0]=.5*_[2],T[1]=.5*_[3],T[2]=e.frame.width*x[2]-.5*_[2],T[3]=e.frame.height*x[3]-.5*_[3];let b=this.renderer.renderTarget.rootRenderTarget.colorTexture;g[0]=l.x*u,g[1]=l.y*u,g[2]=b.source.width*u,g[3]=b.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof B?(w[0]=i.frame.width,w[1]=i.frame.height):(w[0]=S.width,w[1]=S.height),w[2]=S.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let v=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(v,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:cO,shader:t,state:t._state,topology:"triangle-list"}),o.type===re.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Tt,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(U.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}};Xa.extension={type:[E.WebGLSystem,E.WebGPUSystem],name:"filter"}});var Yg=y(()=>{F();RE();BE();D.add(Xa);D.add($a)});var hO={};var FE=y(()=>{Ov();Zp();Wv();$v();Bh();Lh();ig();sg();lg();Mg();Ng();Wg();Xg();jg();Yg()});var uO={};var OE=y(()=>{Zp();Bh();Lh();ig();sg();lg();Mg();Ng();Wg();Xg();jg();Yg()});var GE,LE,DE=y(()=>{vs();So();Er();Ar();GE=class qg extends Yt{constructor(t){t={...qg.defaultOptions,...t},super(t),this.enabled=!0,this._state=Kt.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,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=fr.from(e)),i&&(n=dr.from(i)),new qg({gpuProgram:o,glProgram:n,...s})}};GE.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};LE=GE});async function NE(r){if(!r)for(let t=0;t<Kg.length;t++){let e=Kg[t];if(e.value.test()){await e.value.load();return}}}var Kg,HE=y(()=>{F();Kg=[];D.handleByNamedList(E.Environment,Kg)});function Iu(){if(typeof ja=="boolean")return ja;try{ja=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ja=!1}return ja}var ja,Zg=y(()=>{"use strict"});var me,jo=y(()=>{"use strict";me=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(me||{})});var Yo,Qg=y(()=>{"use strict";Yo=class{constructor(t){this.items=[],this._name=t}emit(t,e,i,s,o,n,a,l){let{name:c,items:h}=this;for(let u=0,d=h.length;u<d;u++)h[u][c](t,e,i,s,o,n,a,l);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 dO,VE,Xi,Ya=y(()=>{_e();HE();Sr();Zg();Ht();jo();Qg();Ae();dO=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],VE=class WE extends Pt{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=[...dO,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await NE(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...WE.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){let i=t;if(i instanceof rt&&(i={container:i},e&&(X(tt,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){let s=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=s?i.clearColor:st.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i)}resize(t,e,i){let s=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==s&&this.runners.resolutionChange.emit(i)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=me.ALL);let{clear:i,clearColor:s,target:o}=t;st.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,i,st.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 Yo(e)})}_addSystems(t){let e;for(e in t){let i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){let i=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=i[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(!Iu())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()}};VE.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Xi=VE});var qa,XE=y(()=>{F();ft();_s();Hh();Vi();Sa();wa();Xo();Wi();Er();Ge();qa=class{init(){let t=new Et({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Dr({name:"graphics",bits:[wo,Ao(hr()),aE,Hr]});this.shader=new Yt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),c=o.encoder;c.setGeometry(a.geometry,s.gpuProgram);let h=o.globalUniforms.bindGroup;c.setBindGroup(0,h,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,u,s.gpuProgram);let d=l.instructions,f=null;for(let p=0;p<l.instructionSize;p++){let m=d[p];if(m.topology!==f&&(f=m.topology,c.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){let x=m.textures;m.bindGroup=bo(x.textures,x.count),m.gpuBindGroup=o.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}c.setBindGroup(1,m.bindGroup,s.gpuProgram),c.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};qa.extension={type:[E.WebGPUPipesAdaptor],name:"graphics"}});var jE,YE,Jg=y(()=>{"use strict";jE={name:"texture-bit",vertex:{header:`
569
+ `}}});var zg,$g,Cu,uE=y(()=>{ft();Vi();Xo();Wi();Er();Ge();_t();hE();Cu=class extends Yt{constructor(){zg??(zg=Dr({name:"tiling-sprite-shader",bits:[Rs,lE,Hr]})),$g??($g=Nr({name:"tiling-sprite-shader",bits:[$o,cE,Vr]}));let t=new Et({uMapCoord:{value:new U,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 U,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:$g,gpuProgram:zg,resources:{localUniforms:new Et({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:B.EMPTY.source,uSampler:B.EMPTY.source.style}})}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,c=n.height,h=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*l/t,i.b*l/e,i.c*c/t,i.d*c/e,i.tx/t,i.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 Ru,dE=y(()=>{Pu();Ru=class extends zo{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 fE(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}var pE=y(()=>{"use strict"});function mE(r,t,e,i){let s=0,o=r.length/(t||2),n=i.a,a=i.b,l=i.c,c=i.d,h=i.tx,u=i.ty;for(e*=t;s<o;){let d=r[e],f=r[e+1];r[e]=n*d+l*f+h,r[e+1]=a*d+c*f+u,e+=t,s++}}var gE=y(()=>{"use strict"});function xE(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.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=U.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),mE(t,2,0,a)}var yE=y(()=>{ft();gE()});var Mu,Wa,_E=y(()=>{F();ba();Ar();Wr();Fo();iu();Pu();uE();dE();pE();yE();Mu=new Ru,Wa=class{constructor(t){this._state=Kt.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),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new zi);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,i.addToBatch(a,e)}else i.break(e),s.shader||(s.shader=new Cu),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,zr(t.groupColorAlpha,i.uColor,0),this._state.blendMode=ui(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Mu,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){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 zo({indices:Mu.indices,positions:Mu.positions.slice(),uvs:Mu.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:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),xE(t,i.uvs),fE(t,i.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),i=t.texture,s=!0;return this._renderer.type===re.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};Wa.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"tilingSprite"}});var Xg=y(()=>{F();_E();D.add(Wa)});var bE,TE,SE=y(()=>{Ht();Pu();bE=class vE extends zo{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(X(tt,"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={...vE.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,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,c=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;i.push(d*l,f*c),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,p=f*this.verticesX+d,m=f*this.verticesX+d+1,x=(f+1)*this.verticesX+d,_=(f+1)*this.verticesX+d+1;o.push(p,m,x,m,_,x)}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};bE.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};TE=bE});var wE,AE,PE=y(()=>{SE();wE=class EE extends TE{constructor(t={}){t={...EE.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:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:c}=this,h=s+o,u=e>h?1:e/h,d=n+a,f=i>d?1:i/d,p=Math.min(u,f),m=l*e,x=c*i;t[0]=t[8]=t[16]=t[24]=-m,t[2]=t[10]=t[18]=t[26]=s*p-m,t[4]=t[12]=t[20]=t[28]=e-o*p-m,t[6]=t[14]=t[22]=t[30]=e-m,t[1]=t[3]=t[5]=t[7]=-x,t[9]=t[11]=t[13]=t[15]=n*p-x,t[17]=t[19]=t[21]=t[23]=i-a*p-x,t[25]=t[27]=t[29]=t[31]=i-x,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};wE.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};AE=wE});var za,CE=y(()=>{F();Fe();iu();PE();za=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 i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,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];et.return(e.geometry),et.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=et.get(zi);return e.geometry=et.get(AE),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}};za.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"nineSliceSprite"}});var jg=y(()=>{F();CE();D.add(za)});var $a,RE=y(()=>{F();$a=class{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.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}};$a.extension={type:[E.WebGLPipes,E.WebGPUPipes,E.CanvasPipes],name:"filter"}});function ME(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var IE=y(()=>{"use strict"});var cO,Xa,BE=y(()=>{F();ft();cr();Di();vo();Ge();_t();Bi();Wr();Ve();IE();St();cO=new ur({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])}),Xa=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Et({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 pe({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?ME(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 p=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,l=0,c=!0,h=!1,u=!1,d=!0;for(let f=0;f<i.length;f++){let p=i[f];if(a=Math.min(a,p.resolution==="inherit"?n._resolution:p.resolution),l+=p.padding,p.antialias==="off"?c=!1:p.antialias==="inherit"&&c&&(c=n.antialias),p.clipToViewport||(d=!1),!!!(p.compatibleRenderers&e.type)){u=!1;break}if(p.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){N("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=p.enabled||u,h||(h=p.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,p=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/p,0,f.height/p)}if(o.scale(a).ceil().scale(1/a).pad(l|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=Vt.getOptimalTexture(o.width,o.height,a,c),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 i=e.inputTexture,s=e.bounds,o=B.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,l=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(l,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,!1),Vt.returnTexture(i);else{let a=e.inputTexture,l=Vt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),c=0;for(c=0;c<n.length-1;++c){n[c].apply(this,a,l,!0);let u=a;a=l,l=u}n[c].apply(this,a,e.previousRenderSurface,!1),Vt.returnTexture(a),Vt.returnTexture(l)}e.blendRequired&&Vt.returnTexture(o)}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=Vt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(e.width*s),c=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:l,height:c},{x:0,y:0}),o}applyFilter(t,e,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,l=ct.shared,h=n.previousRenderSurface===i,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,p=f.uniforms,m=p.uOutputFrame,x=p.uInputSize,_=p.uInputPixel,T=p.uInputClamp,g=p.uGlobalFrame,w=p.uOutputTexture;if(h){let v=this._filterStackIndex;for(;v>0;){v--;let P=this._filterStack[this._filterStackIndex-1];if(!P.skip){l.x=P.bounds.minX,l.y=P.bounds.minY;break}}m[0]=a.minX-l.x,m[1]=a.minY-l.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,x[0]=e.source.width,x[1]=e.source.height,x[2]=1/x[0],x[3]=1/x[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],T[0]=.5*_[2],T[1]=.5*_[3],T[2]=e.frame.width*x[2]-.5*_[2],T[3]=e.frame.height*x[3]-.5*_[3];let b=this.renderer.renderTarget.rootRenderTarget.colorTexture;g[0]=l.x*u,g[1]=l.y*u,g[2]=b.source.width*u,g[3]=b.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof B?(w[0]=i.frame.width,w[1]=i.frame.height):(w[0]=S.width,w[1]=S.height),w[2]=S.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let v=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(v,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:cO,shader:t,state:t._state,topology:"triangle-list"}),o.type===re.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Tt,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(U.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}};Xa.extension={type:[E.WebGLSystem,E.WebGPUSystem],name:"filter"}});var Yg=y(()=>{F();RE();BE();D.add(Xa);D.add($a)});var hO={};var FE=y(()=>{Ov();Zp();Wv();$v();Bh();Lh();ig();sg();lg();Mg();Ng();Wg();Xg();jg();Yg()});var uO={};var OE=y(()=>{Zp();Bh();Lh();ig();sg();lg();Mg();Ng();Wg();Xg();jg();Yg()});var GE,LE,DE=y(()=>{vs();So();Er();Ar();GE=class qg extends Yt{constructor(t){t={...qg.defaultOptions,...t},super(t),this.enabled=!0,this._state=Kt.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,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=fr.from(e)),i&&(n=dr.from(i)),new qg({gpuProgram:o,glProgram:n,...s})}};GE.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};LE=GE});async function NE(r){if(!r)for(let t=0;t<Kg.length;t++){let e=Kg[t];if(e.value.test()){await e.value.load();return}}}var Kg,HE=y(()=>{F();Kg=[];D.handleByNamedList(E.Environment,Kg)});function Iu(){if(typeof ja=="boolean")return ja;try{ja=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ja=!1}return ja}var ja,Zg=y(()=>{"use strict"});var me,jo=y(()=>{"use strict";me=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(me||{})});var Yo,Qg=y(()=>{"use strict";Yo=class{constructor(t){this.items=[],this._name=t}emit(t,e,i,s,o,n,a,l){let{name:c,items:h}=this;for(let u=0,d=h.length;u<d;u++)h[u][c](t,e,i,s,o,n,a,l);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 dO,VE,Xi,Ya=y(()=>{_e();HE();Sr();Zg();Ht();jo();Qg();Ae();dO=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],VE=class WE extends Pt{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=[...dO,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await NE(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...WE.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){let i=t;if(i instanceof rt&&(i={container:i},e&&(X(tt,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){let s=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=s?i.clearColor:st.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i)}resize(t,e,i){let s=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==s&&this.runners.resolutionChange.emit(i)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=me.ALL);let{clear:i,clearColor:s,target:o}=t;st.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,i,st.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 Yo(e)})}_addSystems(t){let e;for(e in t){let i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){let i=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=i[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(!Iu())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()}};VE.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Xi=VE});var qa,XE=y(()=>{F();ft();_s();Hh();Vi();Sa();wa();Xo();Wi();Er();Ge();qa=class{init(){let t=new Et({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Dr({name:"graphics",bits:[wo,Ao(hr()),aE,Hr]});this.shader=new Yt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),c=o.encoder;c.setGeometry(a.geometry,s.gpuProgram);let h=o.globalUniforms.bindGroup;c.setBindGroup(0,h,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,u,s.gpuProgram);let d=l.instructions,f=null;for(let p=0;p<l.instructionSize;p++){let m=d[p];if(m.topology!==f&&(f=m.topology,c.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){let x=m.textures;m.bindGroup=bo(x.textures,x.count),m.gpuBindGroup=o.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}c.setBindGroup(1,m.bindGroup,s.gpuProgram),c.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};qa.extension={type:[E.WebGPUPipesAdaptor],name:"graphics"}});var jE,YE,Jg=y(()=>{"use strict";jE={name:"texture-bit",vertex:{header:`
570
570
 
571
571
  struct TextureUniforms {
572
572
  uTextureMatrix:mat3x3<f32>,
@@ -1086,11 +1086,11 @@ fn mainFragment(
1086
1086
  cv = cu.value;
1087
1087
  v = uv["${i}"];
1088
1088
  ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
1089
- `))}var PP=y(()=>{Nu();Ge();bx();EP()});var Hl,CP=y(()=>{F();PP();Hl=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){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,i))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let i=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)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return AP(t,e)}_getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];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}};Hl.extension={type:[E.WebGLSystem],name:"uniformGroup"}});function RP(r){let t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof j.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return t}var MP=y(()=>{Ct()});var kO,OO,UO,GO,LO,DO,IP,BP,FP=y(()=>{F();Ar();MP();kO=0,OO=1,UO=2,GO=3,LO=4,DO=5,IP=class Hx{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[kO]=this.setBlend,this.map[OO]=this.setOffset,this.map[UO]=this.setCullFace,this.map[GO]=this.setDepthTest,this.map[LO]=this.setFrontFace,this.map[DO]=this.setDepthMask,this.checks=[],this.defaultState=Kt.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=RP(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;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(Hx._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Hx._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],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.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 i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,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}};IP.extension={type:[E.WebGLSystem],name:"state"};BP=IP});var ed,kP=y(()=>{Bx();ed=class{constructor(t){this.target=Ix.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=mt.UNSIGNED_BYTE,this.internalFormat=Yu.RGBA,this.format=Yu.RGBA,this.samplerType=0}}});var OP,UP=y(()=>{"use strict";OP={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}}});var NO,GP,LP=y(()=>{"use strict";NO={"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},GP={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!NO[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,t.format,t.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var rd,Vx=y(()=>{"use strict";rd={id:"image",upload(r,t,e,i){let s=t.width,o=t.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l<n||c<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,c,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=n,t.height=a}}});var DP,NP=y(()=>{Vx();DP={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}rd.upload(r,t,e,i)}}});var Wx,HP,id,VP,WP=y(()=>{"use strict";Wx={linear:9729,nearest:9728},HP={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},id={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},VP={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function zx(r,t,e,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let c=id[n?"clamp-to-edge":r.addressModeU],h=id[n?"clamp-to-edge":r.addressModeV],u=id[n?"clamp-to-edge":r.addressModeW];t[s](l,t.TEXTURE_WRAP_S,c),t[s](l,t.TEXTURE_WRAP_T,h),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,u)}if((!a||r.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,Wx[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){let c=HP[r.minFilter][r.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,c)}}else t[s](l,t.TEXTURE_MIN_FILTER,Wx[r.minFilter]);if(i&&r.maxAnisotropy>1){let c=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,c)}r.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,VP[r.compare])}var zP=y(()=>{WP()});function $P(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var XP=y(()=>{"use strict"});function jP(r,t){let e={},i=r.RGBA;return r instanceof j.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...e,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.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 YP=y(()=>{Ct()});function qP(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var KP=y(()=>{"use strict"});var HO,Vl,ZP=y(()=>{Ct();F();_t();kP();UP();LP();Vx();NP();zP();XP();YP();KP();HO=4,Vl=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:rd,buffer:OP,video:DP,compressed:GP},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=jP(t,this._renderer.context.extensions),this._mapFormatToType=qP(t),this._mapFormatToFormat=$P(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(B.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=B.EMPTY.source);let s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){let e=t.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,i=new ed(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.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]=i,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),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,zx(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.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,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.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,i,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 i=this.getGlSource(t);this._gl.generateMipmap(i.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,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,zx(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!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:i,height:s}=this.getPixels(t),o=j.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),o=Math.max(Math.round(i.height*e),1),n=new Uint8Array(HO*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(t),c=a.renderTarget.getGpuRenderTarget(l),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,c.resolveTargetFramebuffer),h.readPixels(Math.round(i.x*e),Math.round(i.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(B.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Vl.extension={type:[E.WebGLSystem],name:"texture"}});var eC={};ab(eC,{WebGLRenderer:()=>$x});var VO,WO,zO,QP,JP,tC,$x,rC=y(()=>{F();I1();B1();F1();Ya();xx();Wr();U1();D1();W1();X1();j1();Y1();q1();eP();sP();TP();CP();FP();ZP();VO=[...Gu,Ll,$1,L1,Fl,Vl,Dl,kl,Hl,Nl,Ul,BP,Gl,Ol],WO=[...Lu],zO=[Il,Ml,Rl],QP=[],JP=[],tC=[];D.handleByNamedList(E.WebGLSystem,QP);D.handleByNamedList(E.WebGLPipes,JP);D.handleByNamedList(E.WebGLPipesAdaptor,tC);D.add(...VO,...WO,...zO);$x=class extends Xi{constructor(){let t={name:"webgl",type:re.WEBGL,systems:QP,renderPipes:JP,renderPipeAdaptors:tC};super(t)}}});var vM=Z((Bgt,Oy)=>{"use strict";var qG=Object.prototype.hasOwnProperty,He="~";function cc(){}Object.create&&(cc.prototype=Object.create(null),new cc().__proto__||(He=!1));function KG(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function bM(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new KG(e,i||r,s),n=He?He+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function _f(r,t){--r._eventsCount===0?r._events=new cc:delete r._events[t]}function Re(){this._events=new cc,this._eventsCount=0}Re.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)qG.call(e,i)&&t.push(He?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Re.prototype.listeners=function(t){var e=He?He+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Re.prototype.listenerCount=function(t){var e=He?He+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Re.prototype.emit=function(t,e,i,s,o,n){var a=He?He+t:t;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,h,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,h=new Array(c-1);u<c;u++)h[u-1]=arguments[u];l.fn.apply(l.context,h)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),c){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!h)for(f=1,h=new Array(c-1);f<c;f++)h[f-1]=arguments[f];l[u].fn.apply(l[u].context,h)}}return!0};Re.prototype.on=function(t,e,i){return bM(this,t,e,i,!1)};Re.prototype.once=function(t,e,i){return bM(this,t,e,i,!0)};Re.prototype.removeListener=function(t,e,i,s){var o=He?He+t:t;if(!this._events[o])return this;if(!e)return _f(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&_f(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:_f(this,o)}return this};Re.prototype.removeAllListeners=function(t){var e;return t?(e=He?He+t:t,this._events[e]&&_f(this,e)):(this._events=new cc,this._eventsCount=0),this};Re.prototype.off=Re.prototype.removeListener;Re.prototype.addListener=Re.prototype.on;Re.prefixed=He;Re.EventEmitter=Re;typeof Oy<"u"&&(Oy.exports=Re)});var TM=Z((_n,bn)=>{(function(r){var t=typeof _n=="object"&&_n&&!_n.nodeType&&_n,e=typeof bn=="object"&&bn&&!bn.nodeType&&bn,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,l=26,c=38,h=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=n-a,g=Math.floor,w=String.fromCharCode,b;function S(V){throw new RangeError(_[V])}function v(V,G){for(var it=V.length,yt=[];it--;)yt[it]=G(V[it]);return yt}function A(V,G){var it=V.split("@"),yt="";it.length>1&&(yt=it[0]+"@",V=it[1]),V=V.replace(x,".");var dt=V.split("."),Ot=v(dt,G).join(".");return yt+Ot}function P(V){for(var G=[],it=0,yt=V.length,dt,Ot;it<yt;)dt=V.charCodeAt(it++),dt>=55296&&dt<=56319&&it<yt?(Ot=V.charCodeAt(it++),(Ot&64512)==56320?G.push(((dt&1023)<<10)+(Ot&1023)+65536):(G.push(dt),it--)):G.push(dt);return G}function C(V){return v(V,function(G){var it="";return G>65535&&(G-=65536,it+=w(G>>>10&1023|55296),G=56320|G&1023),it+=w(G),it}).join("")}function R(V){return V-48<10?V-22:V-65<26?V-65:V-97<26?V-97:n}function M(V,G){return V+22+75*(V<26)-((G!=0)<<5)}function I(V,G,it){var yt=0;for(V=it?g(V/h):V>>1,V+=g(V/G);V>T*l>>1;yt+=n)V=g(V/T);return g(yt+(T+1)*V/(V+c))}function k(V){var G=[],it=V.length,yt,dt=0,Ot=d,Xt=u,Nt,te,de,Se,Ft,ye,Me,we,Ie;for(Nt=V.lastIndexOf(f),Nt<0&&(Nt=0),te=0;te<Nt;++te)V.charCodeAt(te)>=128&&S("not-basic"),G.push(V.charCodeAt(te));for(de=Nt>0?Nt+1:0;de<it;){for(Se=dt,Ft=1,ye=n;de>=it&&S("invalid-input"),Me=R(V.charCodeAt(de++)),(Me>=n||Me>g((o-dt)/Ft))&&S("overflow"),dt+=Me*Ft,we=ye<=Xt?a:ye>=Xt+l?l:ye-Xt,!(Me<we);ye+=n)Ie=n-we,Ft>g(o/Ie)&&S("overflow"),Ft*=Ie;yt=G.length+1,Xt=I(dt-Se,yt,Se==0),g(dt/yt)>o-Ot&&S("overflow"),Ot+=g(dt/yt),dt%=yt,G.splice(dt++,0,Ot)}return C(G)}function W(V){var G,it,yt,dt,Ot,Xt,Nt,te,de,Se,Ft,ye=[],Me,we,Ie,Tr;for(V=P(V),Me=V.length,G=d,it=0,Ot=u,Xt=0;Xt<Me;++Xt)Ft=V[Xt],Ft<128&&ye.push(w(Ft));for(yt=dt=ye.length,dt&&ye.push(f);yt<Me;){for(Nt=o,Xt=0;Xt<Me;++Xt)Ft=V[Xt],Ft>=G&&Ft<Nt&&(Nt=Ft);for(we=yt+1,Nt-G>g((o-it)/we)&&S("overflow"),it+=(Nt-G)*we,G=Nt,Xt=0;Xt<Me;++Xt)if(Ft=V[Xt],Ft<G&&++it>o&&S("overflow"),Ft==G){for(te=it,de=n;Se=de<=Ot?a:de>=Ot+l?l:de-Ot,!(te<Se);de+=n)Tr=te-Se,Ie=n-Se,ye.push(w(M(Se+Tr%Ie,0))),te=g(Tr/Ie);ye.push(w(M(te,0))),Ot=I(it,we,yt==dt),it=0,++yt}++it,++G}return ye.join("")}function O(V){return A(V,function(G){return p.test(G)?k(G.slice(4).toLowerCase()):G})}function z(V){return A(V,function(G){return m.test(G)?"xn--"+W(G):G})}if(s={version:"1.4.1",ucs2:{decode:P,encode:C},decode:k,encode:W,toASCII:z,toUnicode:O},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(bn.exports==t)e.exports=s;else for(b in s)s.hasOwnProperty(b)&&(t[b]=s[b]);else r.punycode=s})(_n)});var Us=Z((Fgt,SM)=>{"use strict";SM.exports=TypeError});var wM=Z(()=>{});var pc=Z((Ugt,zM)=>{var $y=typeof Map=="function"&&Map.prototype,Uy=Object.getOwnPropertyDescriptor&&$y?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,vf=$y&&Uy&&typeof Uy.get=="function"?Uy.get:null,EM=$y&&Map.prototype.forEach,Xy=typeof Set=="function"&&Set.prototype,Gy=Object.getOwnPropertyDescriptor&&Xy?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Tf=Xy&&Gy&&typeof Gy.get=="function"?Gy.get:null,AM=Xy&&Set.prototype.forEach,ZG=typeof WeakMap=="function"&&WeakMap.prototype,uc=ZG?WeakMap.prototype.has:null,QG=typeof WeakSet=="function"&&WeakSet.prototype,dc=QG?WeakSet.prototype.has:null,JG=typeof WeakRef=="function"&&WeakRef.prototype,PM=JG?WeakRef.prototype.deref:null,tL=Boolean.prototype.valueOf,eL=Object.prototype.toString,rL=Function.prototype.toString,iL=String.prototype.match,jy=String.prototype.slice,rs=String.prototype.replace,sL=String.prototype.toUpperCase,CM=String.prototype.toLowerCase,GM=RegExp.prototype.test,RM=Array.prototype.concat,Zr=Array.prototype.join,oL=Array.prototype.slice,MM=Math.floor,Ny=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ly=Object.getOwnPropertySymbols,Hy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,vn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",fc=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===vn||!0)?Symbol.toStringTag:null,LM=Object.prototype.propertyIsEnumerable,IM=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function BM(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||GM.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-MM(-r):MM(r);if(i!==r){var s=String(i),o=jy.call(t,s.length+1);return rs.call(s,e,"$&_")+"."+rs.call(rs.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return rs.call(t,e,"$&_")}var Vy=wM(),FM=Vy.custom,kM=HM(FM)?FM:null,DM={__proto__:null,double:'"',single:"'"},nL={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};zM.exports=function r(t,e,i,s){var o=e||{};if(Ti(o,"quoteStyle")&&!Ti(DM,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ti(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=Ti(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ti(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ti(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return WM(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?BM(t,l):l}if(typeof t=="bigint"){var c=String(t)+"n";return a?BM(t,c):c}var h=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=h&&h>0&&typeof t=="object")return Wy(t)?"[Array]":"[Object]";var u=wL(o,i);if(typeof s>"u")s=[];else if(VM(s,t)>=0)return"[Circular]";function d(I,k,W){if(k&&(s=oL.call(s),s.push(k)),W){var O={depth:o.depth};return Ti(o,"quoteStyle")&&(O.quoteStyle=o.quoteStyle),r(I,O,i+1,s)}return r(I,o,i+1,s)}if(typeof t=="function"&&!OM(t)){var f=mL(t),p=bf(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Zr.call(p,", ")+" }":"")}if(HM(t)){var m=vn?rs.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Hy.call(t);return typeof t=="object"&&!vn?hc(m):m}if(vL(t)){for(var x="<"+CM.call(String(t.nodeName)),_=t.attributes||[],T=0;T<_.length;T++)x+=" "+_[T].name+"="+NM(aL(_[T].value),"double",o);return x+=">",t.childNodes&&t.childNodes.length&&(x+="..."),x+="</"+CM.call(String(t.nodeName))+">",x}if(Wy(t)){if(t.length===0)return"[]";var g=bf(t,d);return u&&!SL(g)?"["+zy(g,u)+"]":"[ "+Zr.call(g,", ")+" ]"}if(cL(t)){var w=bf(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!LM.call(t,"cause")?"{ ["+String(t)+"] "+Zr.call(RM.call("[cause]: "+d(t.cause),w),", ")+" }":w.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Zr.call(w,", ")+" }"}if(typeof t=="object"&&n){if(kM&&typeof t[kM]=="function"&&Vy)return Vy(t,{depth:h-i});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(gL(t)){var b=[];return EM&&EM.call(t,function(I,k){b.push(d(k,t,!0)+" => "+d(I,t))}),UM("Map",vf.call(t),b,u)}if(_L(t)){var S=[];return AM&&AM.call(t,function(I){S.push(d(I,t))}),UM("Set",Tf.call(t),S,u)}if(xL(t))return Dy("WeakMap");if(bL(t))return Dy("WeakSet");if(yL(t))return Dy("WeakRef");if(uL(t))return hc(d(Number(t)));if(fL(t))return hc(d(Ny.call(t)));if(dL(t))return hc(tL.call(t));if(hL(t))return hc(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!lL(t)&&!OM(t)){var v=bf(t,d),A=IM?IM(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",C=!A&&fc&&Object(t)===t&&fc in t?jy.call(is(t),8,-1):P?"Object":"",R=A||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",M=R+(C||P?"["+Zr.call(RM.call([],C||[],P||[]),": ")+"] ":"");return v.length===0?M+"{}":u?M+"{"+zy(v,u)+"}":M+"{ "+Zr.call(v,", ")+" }"}return String(t)};function NM(r,t,e){var i=e.quoteStyle||t,s=DM[i];return s+r+s}function aL(r){return rs.call(String(r),/"/g,"&quot;")}function Gs(r){return!fc||!(typeof r=="object"&&(fc in r||typeof r[fc]<"u"))}function Wy(r){return is(r)==="[object Array]"&&Gs(r)}function lL(r){return is(r)==="[object Date]"&&Gs(r)}function OM(r){return is(r)==="[object RegExp]"&&Gs(r)}function cL(r){return is(r)==="[object Error]"&&Gs(r)}function hL(r){return is(r)==="[object String]"&&Gs(r)}function uL(r){return is(r)==="[object Number]"&&Gs(r)}function dL(r){return is(r)==="[object Boolean]"&&Gs(r)}function HM(r){if(vn)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Hy)return!1;try{return Hy.call(r),!0}catch{}return!1}function fL(r){if(!r||typeof r!="object"||!Ny)return!1;try{return Ny.call(r),!0}catch{}return!1}var pL=Object.prototype.hasOwnProperty||function(r){return r in this};function Ti(r,t){return pL.call(r,t)}function is(r){return eL.call(r)}function mL(r){if(r.name)return r.name;var t=iL.call(rL.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function VM(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function gL(r){if(!vf||!r||typeof r!="object")return!1;try{vf.call(r);try{Tf.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function xL(r){if(!uc||!r||typeof r!="object")return!1;try{uc.call(r,uc);try{dc.call(r,dc)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function yL(r){if(!PM||!r||typeof r!="object")return!1;try{return PM.call(r),!0}catch{}return!1}function _L(r){if(!Tf||!r||typeof r!="object")return!1;try{Tf.call(r);try{vf.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function bL(r){if(!dc||!r||typeof r!="object")return!1;try{dc.call(r,dc);try{uc.call(r,uc)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function vL(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function WM(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return WM(jy.call(r,0,t.maxStringLength),t)+i}var s=nL[t.quoteStyle||"single"];s.lastIndex=0;var o=rs.call(rs.call(r,s,"\\$1"),/[\x00-\x1f]/g,TL);return NM(o,"single",t)}function TL(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+sL.call(t.toString(16))}function hc(r){return"Object("+r+")"}function Dy(r){return r+" { ? }"}function UM(r,t,e,i){var s=i?zy(e,i):Zr.call(e,", ");return r+" ("+t+") {"+s+"}"}function SL(r){for(var t=0;t<r.length;t++)if(VM(r[t],`
1090
- `)>=0)return!1;return!0}function wL(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Zr.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Zr.call(Array(t+1),e)}}function zy(r,t){if(r.length===0)return"";var e=`
1089
+ `))}var PP=y(()=>{Nu();Ge();bx();EP()});var Hl,CP=y(()=>{F();PP();Hl=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){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,i))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let i=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)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return AP(t,e)}_getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];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}};Hl.extension={type:[E.WebGLSystem],name:"uniformGroup"}});function RP(r){let t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof j.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return t}var MP=y(()=>{Ct()});var kO,OO,UO,GO,LO,DO,IP,BP,FP=y(()=>{F();Ar();MP();kO=0,OO=1,UO=2,GO=3,LO=4,DO=5,IP=class Hx{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[kO]=this.setBlend,this.map[OO]=this.setOffset,this.map[UO]=this.setCullFace,this.map[GO]=this.setDepthTest,this.map[LO]=this.setFrontFace,this.map[DO]=this.setDepthMask,this.checks=[],this.defaultState=Kt.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=RP(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;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(Hx._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Hx._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],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.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 i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,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}};IP.extension={type:[E.WebGLSystem],name:"state"};BP=IP});var ed,kP=y(()=>{Bx();ed=class{constructor(t){this.target=Ix.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=mt.UNSIGNED_BYTE,this.internalFormat=Yu.RGBA,this.format=Yu.RGBA,this.samplerType=0}}});var OP,UP=y(()=>{"use strict";OP={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}}});var NO,GP,LP=y(()=>{"use strict";NO={"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},GP={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!NO[r.format];for(let n=0;n<r.resource.length;n++){let a=r.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,i,s,0,t.format,t.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var rd,Vx=y(()=>{"use strict";rd={id:"image",upload(r,t,e,i){let s=t.width,o=t.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l<n||c<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,c,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=n,t.height=a}}});var DP,NP=y(()=>{Vx();DP={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}rd.upload(r,t,e,i)}}});var Wx,HP,id,VP,WP=y(()=>{"use strict";Wx={linear:9729,nearest:9728},HP={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},id={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},VP={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function zx(r,t,e,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let c=id[n?"clamp-to-edge":r.addressModeU],h=id[n?"clamp-to-edge":r.addressModeV],u=id[n?"clamp-to-edge":r.addressModeW];t[s](l,t.TEXTURE_WRAP_S,c),t[s](l,t.TEXTURE_WRAP_T,h),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,u)}if((!a||r.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,Wx[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){let c=HP[r.minFilter][r.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,c)}}else t[s](l,t.TEXTURE_MIN_FILTER,Wx[r.minFilter]);if(i&&r.maxAnisotropy>1){let c=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,c)}r.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,VP[r.compare])}var zP=y(()=>{WP()});function $P(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var XP=y(()=>{"use strict"});function jP(r,t){let e={},i=r.RGBA;return r instanceof j.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...e,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.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 YP=y(()=>{Ct()});function qP(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var KP=y(()=>{"use strict"});var HO,Vl,ZP=y(()=>{Ct();F();_t();kP();UP();LP();Vx();NP();zP();XP();YP();KP();HO=4,Vl=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:rd,buffer:OP,video:DP,compressed:GP},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=jP(t,this._renderer.context.extensions),this._mapFormatToType=qP(t),this._mapFormatToFormat=$P(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(B.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=B.EMPTY.source);let s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){let e=t.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,i=new ed(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.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]=i,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),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,zx(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.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,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.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,i,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 i=this.getGlSource(t);this._gl.generateMipmap(i.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,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,zx(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!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:i,height:s}=this.getPixels(t),o=j.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),o=Math.max(Math.round(i.height*e),1),n=new Uint8Array(HO*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(t),c=a.renderTarget.getGpuRenderTarget(l),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,c.resolveTargetFramebuffer),h.readPixels(Math.round(i.x*e),Math.round(i.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(B.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Vl.extension={type:[E.WebGLSystem],name:"texture"}});var eC={};ab(eC,{WebGLRenderer:()=>$x});var VO,WO,zO,QP,JP,tC,$x,rC=y(()=>{F();I1();B1();F1();Ya();xx();Wr();U1();D1();W1();X1();j1();Y1();q1();eP();sP();TP();CP();FP();ZP();VO=[...Gu,Ll,$1,L1,Fl,Vl,Dl,kl,Hl,Nl,Ul,BP,Gl,Ol],WO=[...Lu],zO=[Il,Ml,Rl],QP=[],JP=[],tC=[];D.handleByNamedList(E.WebGLSystem,QP);D.handleByNamedList(E.WebGLPipes,JP);D.handleByNamedList(E.WebGLPipesAdaptor,tC);D.add(...VO,...WO,...zO);$x=class extends Xi{constructor(){let t={name:"webgl",type:re.WEBGL,systems:QP,renderPipes:JP,renderPipeAdaptors:tC};super(t)}}});var vM=Z((Ogt,Oy)=>{"use strict";var QG=Object.prototype.hasOwnProperty,He="~";function cc(){}Object.create&&(cc.prototype=Object.create(null),new cc().__proto__||(He=!1));function JG(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function bM(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new JG(e,i||r,s),n=He?He+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function _f(r,t){--r._eventsCount===0?r._events=new cc:delete r._events[t]}function Re(){this._events=new cc,this._eventsCount=0}Re.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)QG.call(e,i)&&t.push(He?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Re.prototype.listeners=function(t){var e=He?He+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s<o;s++)n[s]=i[s].fn;return n};Re.prototype.listenerCount=function(t){var e=He?He+t:t,i=this._events[e];return i?i.fn?1:i.length:0};Re.prototype.emit=function(t,e,i,s,o,n){var a=He?He+t:t;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,h,u;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,i),!0;case 4:return l.fn.call(l.context,e,i,s),!0;case 5:return l.fn.call(l.context,e,i,s,o),!0;case 6:return l.fn.call(l.context,e,i,s,o,n),!0}for(u=1,h=new Array(c-1);u<c;u++)h[u-1]=arguments[u];l.fn.apply(l.context,h)}else{var d=l.length,f;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),c){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,i);break;case 4:l[u].fn.call(l[u].context,e,i,s);break;default:if(!h)for(f=1,h=new Array(c-1);f<c;f++)h[f-1]=arguments[f];l[u].fn.apply(l[u].context,h)}}return!0};Re.prototype.on=function(t,e,i){return bM(this,t,e,i,!1)};Re.prototype.once=function(t,e,i){return bM(this,t,e,i,!0)};Re.prototype.removeListener=function(t,e,i,s){var o=He?He+t:t;if(!this._events[o])return this;if(!e)return _f(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!i||n.context===i)&&_f(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==e||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:_f(this,o)}return this};Re.prototype.removeAllListeners=function(t){var e;return t?(e=He?He+t:t,this._events[e]&&_f(this,e)):(this._events=new cc,this._eventsCount=0),this};Re.prototype.off=Re.prototype.removeListener;Re.prototype.addListener=Re.prototype.on;Re.prefixed=He;Re.EventEmitter=Re;typeof Oy<"u"&&(Oy.exports=Re)});var TM=Z((_n,bn)=>{(function(r){var t=typeof _n=="object"&&_n&&!_n.nodeType&&_n,e=typeof bn=="object"&&bn&&!bn.nodeType&&bn,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,l=26,c=38,h=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=n-a,g=Math.floor,w=String.fromCharCode,b;function S(V){throw new RangeError(_[V])}function v(V,G){for(var it=V.length,yt=[];it--;)yt[it]=G(V[it]);return yt}function P(V,G){var it=V.split("@"),yt="";it.length>1&&(yt=it[0]+"@",V=it[1]),V=V.replace(x,".");var dt=V.split("."),Ut=v(dt,G).join(".");return yt+Ut}function C(V){for(var G=[],it=0,yt=V.length,dt,Ut;it<yt;)dt=V.charCodeAt(it++),dt>=55296&&dt<=56319&&it<yt?(Ut=V.charCodeAt(it++),(Ut&64512)==56320?G.push(((dt&1023)<<10)+(Ut&1023)+65536):(G.push(dt),it--)):G.push(dt);return G}function A(V){return v(V,function(G){var it="";return G>65535&&(G-=65536,it+=w(G>>>10&1023|55296),G=56320|G&1023),it+=w(G),it}).join("")}function R(V){return V-48<10?V-22:V-65<26?V-65:V-97<26?V-97:n}function M(V,G){return V+22+75*(V<26)-((G!=0)<<5)}function I(V,G,it){var yt=0;for(V=it?g(V/h):V>>1,V+=g(V/G);V>T*l>>1;yt+=n)V=g(V/T);return g(yt+(T+1)*V/(V+c))}function k(V){var G=[],it=V.length,yt,dt=0,Ut=d,Xt=u,Nt,te,de,Se,Ft,ye,Me,we,Ie;for(Nt=V.lastIndexOf(f),Nt<0&&(Nt=0),te=0;te<Nt;++te)V.charCodeAt(te)>=128&&S("not-basic"),G.push(V.charCodeAt(te));for(de=Nt>0?Nt+1:0;de<it;){for(Se=dt,Ft=1,ye=n;de>=it&&S("invalid-input"),Me=R(V.charCodeAt(de++)),(Me>=n||Me>g((o-dt)/Ft))&&S("overflow"),dt+=Me*Ft,we=ye<=Xt?a:ye>=Xt+l?l:ye-Xt,!(Me<we);ye+=n)Ie=n-we,Ft>g(o/Ie)&&S("overflow"),Ft*=Ie;yt=G.length+1,Xt=I(dt-Se,yt,Se==0),g(dt/yt)>o-Ut&&S("overflow"),Ut+=g(dt/yt),dt%=yt,G.splice(dt++,0,Ut)}return A(G)}function W(V){var G,it,yt,dt,Ut,Xt,Nt,te,de,Se,Ft,ye=[],Me,we,Ie,Tr;for(V=C(V),Me=V.length,G=d,it=0,Ut=u,Xt=0;Xt<Me;++Xt)Ft=V[Xt],Ft<128&&ye.push(w(Ft));for(yt=dt=ye.length,dt&&ye.push(f);yt<Me;){for(Nt=o,Xt=0;Xt<Me;++Xt)Ft=V[Xt],Ft>=G&&Ft<Nt&&(Nt=Ft);for(we=yt+1,Nt-G>g((o-it)/we)&&S("overflow"),it+=(Nt-G)*we,G=Nt,Xt=0;Xt<Me;++Xt)if(Ft=V[Xt],Ft<G&&++it>o&&S("overflow"),Ft==G){for(te=it,de=n;Se=de<=Ut?a:de>=Ut+l?l:de-Ut,!(te<Se);de+=n)Tr=te-Se,Ie=n-Se,ye.push(w(M(Se+Tr%Ie,0))),te=g(Tr/Ie);ye.push(w(M(te,0))),Ut=I(it,we,yt==dt),it=0,++yt}++it,++G}return ye.join("")}function O(V){return P(V,function(G){return p.test(G)?k(G.slice(4).toLowerCase()):G})}function z(V){return P(V,function(G){return m.test(G)?"xn--"+W(G):G})}if(s={version:"1.4.1",ucs2:{decode:C,encode:A},decode:k,encode:W,toASCII:z,toUnicode:O},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(bn.exports==t)e.exports=s;else for(b in s)s.hasOwnProperty(b)&&(t[b]=s[b]);else r.punycode=s})(_n)});var Us=Z((Ugt,SM)=>{"use strict";SM.exports=TypeError});var wM=Z(()=>{});var pc=Z((Dgt,zM)=>{var $y=typeof Map=="function"&&Map.prototype,Uy=Object.getOwnPropertyDescriptor&&$y?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,vf=$y&&Uy&&typeof Uy.get=="function"?Uy.get:null,EM=$y&&Map.prototype.forEach,Xy=typeof Set=="function"&&Set.prototype,Gy=Object.getOwnPropertyDescriptor&&Xy?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Tf=Xy&&Gy&&typeof Gy.get=="function"?Gy.get:null,AM=Xy&&Set.prototype.forEach,tL=typeof WeakMap=="function"&&WeakMap.prototype,uc=tL?WeakMap.prototype.has:null,eL=typeof WeakSet=="function"&&WeakSet.prototype,dc=eL?WeakSet.prototype.has:null,rL=typeof WeakRef=="function"&&WeakRef.prototype,PM=rL?WeakRef.prototype.deref:null,iL=Boolean.prototype.valueOf,sL=Object.prototype.toString,oL=Function.prototype.toString,nL=String.prototype.match,jy=String.prototype.slice,rs=String.prototype.replace,aL=String.prototype.toUpperCase,CM=String.prototype.toLowerCase,GM=RegExp.prototype.test,RM=Array.prototype.concat,Zr=Array.prototype.join,lL=Array.prototype.slice,MM=Math.floor,Ny=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ly=Object.getOwnPropertySymbols,Hy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,vn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",fc=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===vn||!0)?Symbol.toStringTag:null,LM=Object.prototype.propertyIsEnumerable,IM=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function BM(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||GM.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-MM(-r):MM(r);if(i!==r){var s=String(i),o=jy.call(t,s.length+1);return rs.call(s,e,"$&_")+"."+rs.call(rs.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return rs.call(t,e,"$&_")}var Vy=wM(),FM=Vy.custom,kM=HM(FM)?FM:null,DM={__proto__:null,double:'"',single:"'"},cL={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};zM.exports=function r(t,e,i,s){var o=e||{};if(Ti(o,"quoteStyle")&&!Ti(DM,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ti(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=Ti(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ti(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ti(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return WM(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?BM(t,l):l}if(typeof t=="bigint"){var c=String(t)+"n";return a?BM(t,c):c}var h=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=h&&h>0&&typeof t=="object")return Wy(t)?"[Array]":"[Object]";var u=PL(o,i);if(typeof s>"u")s=[];else if(VM(s,t)>=0)return"[Circular]";function d(I,k,W){if(k&&(s=lL.call(s),s.push(k)),W){var O={depth:o.depth};return Ti(o,"quoteStyle")&&(O.quoteStyle=o.quoteStyle),r(I,O,i+1,s)}return r(I,o,i+1,s)}if(typeof t=="function"&&!OM(t)){var f=yL(t),p=bf(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Zr.call(p,", ")+" }":"")}if(HM(t)){var m=vn?rs.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Hy.call(t);return typeof t=="object"&&!vn?hc(m):m}if(wL(t)){for(var x="<"+CM.call(String(t.nodeName)),_=t.attributes||[],T=0;T<_.length;T++)x+=" "+_[T].name+"="+NM(hL(_[T].value),"double",o);return x+=">",t.childNodes&&t.childNodes.length&&(x+="..."),x+="</"+CM.call(String(t.nodeName))+">",x}if(Wy(t)){if(t.length===0)return"[]";var g=bf(t,d);return u&&!AL(g)?"["+zy(g,u)+"]":"[ "+Zr.call(g,", ")+" ]"}if(dL(t)){var w=bf(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!LM.call(t,"cause")?"{ ["+String(t)+"] "+Zr.call(RM.call("[cause]: "+d(t.cause),w),", ")+" }":w.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Zr.call(w,", ")+" }"}if(typeof t=="object"&&n){if(kM&&typeof t[kM]=="function"&&Vy)return Vy(t,{depth:h-i});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(_L(t)){var b=[];return EM&&EM.call(t,function(I,k){b.push(d(k,t,!0)+" => "+d(I,t))}),UM("Map",vf.call(t),b,u)}if(TL(t)){var S=[];return AM&&AM.call(t,function(I){S.push(d(I,t))}),UM("Set",Tf.call(t),S,u)}if(bL(t))return Dy("WeakMap");if(SL(t))return Dy("WeakSet");if(vL(t))return Dy("WeakRef");if(pL(t))return hc(d(Number(t)));if(gL(t))return hc(d(Ny.call(t)));if(mL(t))return hc(iL.call(t));if(fL(t))return hc(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!uL(t)&&!OM(t)){var v=bf(t,d),P=IM?IM(t)===Object.prototype:t instanceof Object||t.constructor===Object,C=t instanceof Object?"":"null prototype",A=!P&&fc&&Object(t)===t&&fc in t?jy.call(is(t),8,-1):C?"Object":"",R=P||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",M=R+(A||C?"["+Zr.call(RM.call([],A||[],C||[]),": ")+"] ":"");return v.length===0?M+"{}":u?M+"{"+zy(v,u)+"}":M+"{ "+Zr.call(v,", ")+" }"}return String(t)};function NM(r,t,e){var i=e.quoteStyle||t,s=DM[i];return s+r+s}function hL(r){return rs.call(String(r),/"/g,"&quot;")}function Gs(r){return!fc||!(typeof r=="object"&&(fc in r||typeof r[fc]<"u"))}function Wy(r){return is(r)==="[object Array]"&&Gs(r)}function uL(r){return is(r)==="[object Date]"&&Gs(r)}function OM(r){return is(r)==="[object RegExp]"&&Gs(r)}function dL(r){return is(r)==="[object Error]"&&Gs(r)}function fL(r){return is(r)==="[object String]"&&Gs(r)}function pL(r){return is(r)==="[object Number]"&&Gs(r)}function mL(r){return is(r)==="[object Boolean]"&&Gs(r)}function HM(r){if(vn)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Hy)return!1;try{return Hy.call(r),!0}catch{}return!1}function gL(r){if(!r||typeof r!="object"||!Ny)return!1;try{return Ny.call(r),!0}catch{}return!1}var xL=Object.prototype.hasOwnProperty||function(r){return r in this};function Ti(r,t){return xL.call(r,t)}function is(r){return sL.call(r)}function yL(r){if(r.name)return r.name;var t=nL.call(oL.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function VM(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function _L(r){if(!vf||!r||typeof r!="object")return!1;try{vf.call(r);try{Tf.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function bL(r){if(!uc||!r||typeof r!="object")return!1;try{uc.call(r,uc);try{dc.call(r,dc)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function vL(r){if(!PM||!r||typeof r!="object")return!1;try{return PM.call(r),!0}catch{}return!1}function TL(r){if(!Tf||!r||typeof r!="object")return!1;try{Tf.call(r);try{vf.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function SL(r){if(!dc||!r||typeof r!="object")return!1;try{dc.call(r,dc);try{uc.call(r,uc)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function wL(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function WM(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return WM(jy.call(r,0,t.maxStringLength),t)+i}var s=cL[t.quoteStyle||"single"];s.lastIndex=0;var o=rs.call(rs.call(r,s,"\\$1"),/[\x00-\x1f]/g,EL);return NM(o,"single",t)}function EL(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+aL.call(t.toString(16))}function hc(r){return"Object("+r+")"}function Dy(r){return r+" { ? }"}function UM(r,t,e,i){var s=i?zy(e,i):Zr.call(e,", ");return r+" ("+t+") {"+s+"}"}function AL(r){for(var t=0;t<r.length;t++)if(VM(r[t],`
1090
+ `)>=0)return!1;return!0}function PL(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Zr.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Zr.call(Array(t+1),e)}}function zy(r,t){if(r.length===0)return"";var e=`
1091
1091
  `+t.prev+t.base;return e+Zr.call(r,","+e)+`
1092
- `+t.prev}function bf(r,t){var e=Wy(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=Ti(r,s)?t(r[s],r):""}var o=typeof Ly=="function"?Ly(r):[],n;if(vn){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in r)Ti(r,l)&&(e&&String(Number(l))===l&&l<r.length||vn&&n["$"+l]instanceof Symbol||(GM.call(/[^\w$]/,l)?i.push(t(l,r)+": "+t(r[l],r)):i.push(l+": "+t(r[l],r))));if(typeof Ly=="function")for(var c=0;c<o.length;c++)LM.call(r,o[c])&&i.push("["+t(o[c])+"]: "+t(r[o[c]],r));return i}});var XM=Z((Ggt,$M)=>{"use strict";var EL=pc(),AL=Us(),Sf=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},PL=function(r,t){if(r){var e=Sf(r,t);return e&&e.value}},CL=function(r,t,e){var i=Sf(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},RL=function(r,t){return r?!!Sf(r,t):!1},ML=function(r,t){if(r)return Sf(r,t,!0)};$M.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new AL("Side channel does not contain "+EL(i))},delete:function(i){var s=t&&t.next,o=ML(t,i);return o&&s&&s===o&&(t=void 0),!!o},get:function(i){return PL(t,i)},has:function(i){return RL(t,i)},set:function(i,s){t||(t={next:void 0}),CL(t,i,s)}};return e}});var Yy=Z((Lgt,jM)=>{"use strict";jM.exports=Object});var qM=Z((Dgt,YM)=>{"use strict";YM.exports=Error});var ZM=Z((Ngt,KM)=>{"use strict";KM.exports=EvalError});var JM=Z((Hgt,QM)=>{"use strict";QM.exports=RangeError});var eI=Z((Vgt,tI)=>{"use strict";tI.exports=ReferenceError});var iI=Z((Wgt,rI)=>{"use strict";rI.exports=SyntaxError});var oI=Z((zgt,sI)=>{"use strict";sI.exports=URIError});var aI=Z(($gt,nI)=>{"use strict";nI.exports=Math.abs});var cI=Z((Xgt,lI)=>{"use strict";lI.exports=Math.floor});var uI=Z((jgt,hI)=>{"use strict";hI.exports=Math.max});var fI=Z((Ygt,dI)=>{"use strict";dI.exports=Math.min});var mI=Z((qgt,pI)=>{"use strict";pI.exports=Math.pow});var xI=Z((Kgt,gI)=>{"use strict";gI.exports=Math.round});var _I=Z((Zgt,yI)=>{"use strict";yI.exports=Number.isNaN||function(t){return t!==t}});var vI=Z((Qgt,bI)=>{"use strict";var IL=_I();bI.exports=function(t){return IL(t)||t===0?t:t<0?-1:1}});var SI=Z((Jgt,TI)=>{"use strict";TI.exports=Object.getOwnPropertyDescriptor});var qy=Z((txt,wI)=>{"use strict";var wf=SI();if(wf)try{wf([],"length")}catch{wf=null}wI.exports=wf});var AI=Z((ext,EI)=>{"use strict";var Ef=Object.defineProperty||!1;if(Ef)try{Ef({},"a",{value:1})}catch{Ef=!1}EI.exports=Ef});var CI=Z((rxt,PI)=>{"use strict";PI.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var II=Z((ixt,MI)=>{"use strict";var RI=typeof Symbol<"u"&&Symbol,BL=CI();MI.exports=function(){return typeof RI!="function"||typeof Symbol!="function"||typeof RI("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:BL()}});var Ky=Z((sxt,BI)=>{"use strict";BI.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Zy=Z((oxt,FI)=>{"use strict";var FL=Yy();FI.exports=FL.getPrototypeOf||null});var UI=Z((nxt,OI)=>{"use strict";var kL="Function.prototype.bind called on incompatible ",OL=Object.prototype.toString,UL=Math.max,GL="[object Function]",kI=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var o=0;o<e.length;o+=1)i[o+t.length]=e[o];return i},LL=function(t,e){for(var i=[],s=e||0,o=0;s<t.length;s+=1,o+=1)i[o]=t[s];return i},DL=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e};OI.exports=function(t){var e=this;if(typeof e!="function"||OL.apply(e)!==GL)throw new TypeError(kL+e);for(var i=LL(arguments,1),s,o=function(){if(this instanceof s){var h=e.apply(this,kI(i,arguments));return Object(h)===h?h:this}return e.apply(t,kI(i,arguments))},n=UL(0,e.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+DL(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var c=function(){};c.prototype=e.prototype,s.prototype=new c,c.prototype=null}return s}});var mc=Z((axt,GI)=>{"use strict";var NL=UI();GI.exports=Function.prototype.bind||NL});var Af=Z((lxt,LI)=>{"use strict";LI.exports=Function.prototype.call});var Qy=Z((cxt,DI)=>{"use strict";DI.exports=Function.prototype.apply});var HI=Z((hxt,NI)=>{"use strict";NI.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var WI=Z((uxt,VI)=>{"use strict";var HL=mc(),VL=Qy(),WL=Af(),zL=HI();VI.exports=zL||HL.call(WL,VL)});var Jy=Z((dxt,zI)=>{"use strict";var $L=mc(),XL=Us(),jL=Af(),YL=WI();zI.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new XL("a function is required");return YL($L,jL,t)}});var KI=Z((fxt,qI)=>{"use strict";var qL=Jy(),$I=qy(),jI;try{jI=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var t_=!!jI&&$I&&$I(Object.prototype,"__proto__"),YI=Object,XI=YI.getPrototypeOf;qI.exports=t_&&typeof t_.get=="function"?qL([t_.get]):typeof XI=="function"?function(t){return XI(t==null?t:YI(t))}:!1});var eB=Z((pxt,tB)=>{"use strict";var ZI=Ky(),QI=Zy(),JI=KI();tB.exports=ZI?function(t){return ZI(t)}:QI?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return QI(t)}:JI?function(t){return JI(t)}:null});var iB=Z((mxt,rB)=>{"use strict";var KL=Function.prototype.call,ZL=Object.prototype.hasOwnProperty,QL=mc();rB.exports=QL.call(KL,ZL)});var Rf=Z((gxt,cB)=>{"use strict";var ut,JL=Yy(),tD=qM(),eD=ZM(),rD=JM(),iD=eI(),En=iI(),wn=Us(),sD=oI(),oD=aI(),nD=cI(),aD=uI(),lD=fI(),cD=mI(),hD=xI(),uD=vI(),aB=Function,e_=function(r){try{return aB('"use strict"; return ('+r+").constructor;")()}catch{}},gc=qy(),dD=AI(),r_=function(){throw new wn},fD=gc?function(){try{return arguments.callee,r_}catch{try{return gc(arguments,"callee").get}catch{return r_}}}():r_,Tn=II()(),xe=eB(),pD=Zy(),mD=Ky(),lB=Qy(),xc=Af(),Sn={},gD=typeof Uint8Array>"u"||!xe?ut:xe(Uint8Array),Ls={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ut:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ut:ArrayBuffer,"%ArrayIteratorPrototype%":Tn&&xe?xe([][Symbol.iterator]()):ut,"%AsyncFromSyncIteratorPrototype%":ut,"%AsyncFunction%":Sn,"%AsyncGenerator%":Sn,"%AsyncGeneratorFunction%":Sn,"%AsyncIteratorPrototype%":Sn,"%Atomics%":typeof Atomics>"u"?ut:Atomics,"%BigInt%":typeof BigInt>"u"?ut:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ut:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ut:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ut:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":tD,"%eval%":eval,"%EvalError%":eD,"%Float16Array%":typeof Float16Array>"u"?ut:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ut:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ut:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ut:FinalizationRegistry,"%Function%":aB,"%GeneratorFunction%":Sn,"%Int8Array%":typeof Int8Array>"u"?ut:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ut:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ut:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Tn&&xe?xe(xe([][Symbol.iterator]())):ut,"%JSON%":typeof JSON=="object"?JSON:ut,"%Map%":typeof Map>"u"?ut:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Tn||!xe?ut:xe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":JL,"%Object.getOwnPropertyDescriptor%":gc,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ut:Promise,"%Proxy%":typeof Proxy>"u"?ut:Proxy,"%RangeError%":rD,"%ReferenceError%":iD,"%Reflect%":typeof Reflect>"u"?ut:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ut:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Tn||!xe?ut:xe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ut:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Tn&&xe?xe(""[Symbol.iterator]()):ut,"%Symbol%":Tn?Symbol:ut,"%SyntaxError%":En,"%ThrowTypeError%":fD,"%TypedArray%":gD,"%TypeError%":wn,"%Uint8Array%":typeof Uint8Array>"u"?ut:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ut:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ut:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ut:Uint32Array,"%URIError%":sD,"%WeakMap%":typeof WeakMap>"u"?ut:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ut:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ut:WeakSet,"%Function.prototype.call%":xc,"%Function.prototype.apply%":lB,"%Object.defineProperty%":dD,"%Object.getPrototypeOf%":pD,"%Math.abs%":oD,"%Math.floor%":nD,"%Math.max%":aD,"%Math.min%":lD,"%Math.pow%":cD,"%Math.round%":hD,"%Math.sign%":uD,"%Reflect.getPrototypeOf%":mD};if(xe)try{null.error}catch(r){sB=xe(xe(r)),Ls["%Error.prototype%"]=sB}var sB,xD=function r(t){var e;if(t==="%AsyncFunction%")e=e_("async function () {}");else if(t==="%GeneratorFunction%")e=e_("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=e_("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&xe&&(e=xe(s.prototype))}return Ls[t]=e,e},oB={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},yc=mc(),Pf=iB(),yD=yc.call(xc,Array.prototype.concat),_D=yc.call(lB,Array.prototype.splice),nB=yc.call(xc,String.prototype.replace),Cf=yc.call(xc,String.prototype.slice),bD=yc.call(xc,RegExp.prototype.exec),vD=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,TD=/\\(\\)?/g,SD=function(t){var e=Cf(t,0,1),i=Cf(t,-1);if(e==="%"&&i!=="%")throw new En("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new En("invalid intrinsic syntax, expected opening `%`");var s=[];return nB(t,vD,function(o,n,a,l){s[s.length]=a?nB(l,TD,"$1"):n||o}),s},wD=function(t,e){var i=t,s;if(Pf(oB,i)&&(s=oB[i],i="%"+s[0]+"%"),Pf(Ls,i)){var o=Ls[i];if(o===Sn&&(o=xD(i)),typeof o>"u"&&!e)throw new wn("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new En("intrinsic "+t+" does not exist!")};cB.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new wn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new wn('"allowMissing" argument must be a boolean');if(bD(/^%?[^%]*%?$/,t)===null)throw new En("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=SD(t),s=i.length>0?i[0]:"",o=wD("%"+s+"%",e),n=o.name,a=o.value,l=!1,c=o.alias;c&&(s=c[0],_D(i,yD([0,1],c)));for(var h=1,u=!0;h<i.length;h+=1){var d=i[h],f=Cf(d,0,1),p=Cf(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new En("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(l=!0),s+="."+d,n="%"+s+"%",Pf(Ls,n))a=Ls[n];else if(a!=null){if(!(d in a)){if(!e)throw new wn("base intrinsic for "+t+" exists, but the property is not available.");return}if(gc&&h+1>=i.length){var m=gc(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=Pf(a,d),a=a[d];u&&!l&&(Ls[n]=a)}}return a}});var i_=Z((xxt,dB)=>{"use strict";var hB=Rf(),uB=Jy(),ED=uB([hB("%String.prototype.indexOf%")]);dB.exports=function(t,e){var i=hB(t,!!e);return typeof i=="function"&&ED(t,".prototype.")>-1?uB([i]):i}});var s_=Z((yxt,pB)=>{"use strict";var AD=Rf(),_c=i_(),PD=pc(),CD=Us(),fB=AD("%Map%",!0),RD=_c("Map.prototype.get",!0),MD=_c("Map.prototype.set",!0),ID=_c("Map.prototype.has",!0),BD=_c("Map.prototype.delete",!0),FD=_c("Map.prototype.size",!0);pB.exports=!!fB&&function(){var t,e={assert:function(i){if(!e.has(i))throw new CD("Side channel does not contain "+PD(i))},delete:function(i){if(t){var s=BD(t,i);return FD(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return RD(t,i)},has:function(i){return t?ID(t,i):!1},set:function(i,s){t||(t=new fB),MD(t,i,s)}};return e}});var gB=Z((_xt,mB)=>{"use strict";var kD=Rf(),If=i_(),OD=pc(),Mf=s_(),UD=Us(),An=kD("%WeakMap%",!0),GD=If("WeakMap.prototype.get",!0),LD=If("WeakMap.prototype.set",!0),DD=If("WeakMap.prototype.has",!0),ND=If("WeakMap.prototype.delete",!0);mB.exports=An?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new UD("Side channel does not contain "+OD(s))},delete:function(s){if(An&&s&&(typeof s=="object"||typeof s=="function")){if(t)return ND(t,s)}else if(Mf&&e)return e.delete(s);return!1},get:function(s){return An&&s&&(typeof s=="object"||typeof s=="function")&&t?GD(t,s):e&&e.get(s)},has:function(s){return An&&s&&(typeof s=="object"||typeof s=="function")&&t?DD(t,s):!!e&&e.has(s)},set:function(s,o){An&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new An),LD(t,s,o)):Mf&&(e||(e=Mf()),e.set(s,o))}};return i}:Mf});var yB=Z((bxt,xB)=>{"use strict";var HD=Us(),VD=pc(),WD=XM(),zD=s_(),$D=gB(),XD=$D||zD||WD;xB.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new HD("Side channel does not contain "+VD(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,s){t||(t=XD()),t.set(i,s)}};return e}});var Bf=Z((vxt,_B)=>{"use strict";var jD=String.prototype.replace,YD=/%20/g,o_={RFC1738:"RFC1738",RFC3986:"RFC3986"};_B.exports={default:o_.RFC3986,formatters:{RFC1738:function(r){return jD.call(r,YD,"+")},RFC3986:function(r){return String(r)}},RFC1738:o_.RFC1738,RFC3986:o_.RFC3986}});var l_=Z((Txt,vB)=>{"use strict";var qD=Bf(),n_=Object.prototype.hasOwnProperty,Ds=Array.isArray,Qr=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),KD=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Ds(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);e.obj[e.prop]=s}}},bB=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},ZD=function r(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(Ds(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!n_.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return Ds(t)&&!Ds(e)&&(s=bB(t,i)),Ds(t)&&Ds(e)?(e.forEach(function(o,n){if(n_.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=r(a,o,i):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return n_.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},QD=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},JD=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},a_=1024,tN=function(t,e,i,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),i==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",l=0;l<n.length;l+=a_){for(var c=n.length>=a_?n.slice(l,l+a_):n,h=[],u=0;u<c.length;++u){var d=c.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===qD.RFC1738&&(d===40||d===41)){h[h.length]=c.charAt(u);continue}if(d<128){h[h.length]=Qr[d];continue}if(d<2048){h[h.length]=Qr[192|d>>6]+Qr[128|d&63];continue}if(d<55296||d>=57344){h[h.length]=Qr[224|d>>12]+Qr[128|d>>6&63]+Qr[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|c.charCodeAt(u)&1023),h[h.length]=Qr[240|d>>18]+Qr[128|d>>12&63]+Qr[128|d>>6&63]+Qr[128|d&63]}a+=h.join("")}return a},eN=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),l=0;l<a.length;++l){var c=a[l],h=n[c];typeof h=="object"&&h!==null&&i.indexOf(h)===-1&&(e.push({obj:n,prop:c}),i.push(h))}return KD(e),t},rN=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},iN=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},sN=function(t,e){return[].concat(t,e)},oN=function(t,e){if(Ds(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)};vB.exports={arrayToObject:bB,assign:QD,combine:sN,compact:eN,decode:JD,encode:tN,isBuffer:iN,isRegExp:rN,maybeMap:oN,merge:ZD}});var PB=Z((Sxt,AB)=>{"use strict";var SB=yB(),Ff=l_(),bc=Bf(),nN=Object.prototype.hasOwnProperty,wB={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Jr=Array.isArray,aN=Array.prototype.push,EB=function(r,t){aN.apply(r,Jr(t)?t:[t])},lN=Date.prototype.toISOString,TB=bc.default,he={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Ff.encode,encodeValuesOnly:!1,filter:void 0,format:TB,formatter:bc.formatters[TB],indices:!1,serializeDate:function(t){return lN.call(t)},skipNulls:!1,strictNullHandling:!1},cN=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},c_={},hN=function r(t,e,i,s,o,n,a,l,c,h,u,d,f,p,m,x,_,T){for(var g=t,w=T,b=0,S=!1;(w=w.get(c_))!==void 0&&!S;){var v=w.get(t);if(b+=1,typeof v<"u"){if(v===b)throw new RangeError("Cyclic object value");S=!0}typeof w.get(c_)>"u"&&(b=0)}if(typeof h=="function"?g=h(e,g):g instanceof Date?g=f(g):i==="comma"&&Jr(g)&&(g=Ff.maybeMap(g,function(it){return it instanceof Date?f(it):it})),g===null){if(n)return c&&!x?c(e,he.encoder,_,"key",p):e;g=""}if(cN(g)||Ff.isBuffer(g)){if(c){var A=x?e:c(e,he.encoder,_,"key",p);return[m(A)+"="+m(c(g,he.encoder,_,"value",p))]}return[m(e)+"="+m(String(g))]}var P=[];if(typeof g>"u")return P;var C;if(i==="comma"&&Jr(g))x&&c&&(g=Ff.maybeMap(g,c)),C=[{value:g.length>0?g.join(",")||null:void 0}];else if(Jr(h))C=h;else{var R=Object.keys(g);C=u?R.sort(u):R}var M=l?String(e).replace(/\./g,"%2E"):String(e),I=s&&Jr(g)&&g.length===1?M+"[]":M;if(o&&Jr(g)&&g.length===0)return I+"[]";for(var k=0;k<C.length;++k){var W=C[k],O=typeof W=="object"&&W&&typeof W.value<"u"?W.value:g[W];if(!(a&&O===null)){var z=d&&l?String(W).replace(/\./g,"%2E"):String(W),V=Jr(g)?typeof i=="function"?i(I,z):I:I+(d?"."+z:"["+z+"]");T.set(t,b);var G=SB();G.set(c_,T),EB(P,r(O,V,i,s,o,n,a,l,i==="comma"&&x&&Jr(g)?null:c,h,u,d,f,p,m,x,_,G))}}return P},uN=function(t){if(!t)return he;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||he.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=bc.default;if(typeof t.format<"u"){if(!nN.call(bc.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=bc.formatters[i],o=he.filter;(typeof t.filter=="function"||Jr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in wB?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=he.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:he.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:he.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:he.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:he.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?he.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:he.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:he.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:he.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:he.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:he.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:he.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:he.strictNullHandling}};AB.exports=function(r,t){var e=r,i=uN(t),s,o;typeof i.filter=="function"?(o=i.filter,e=o("",e)):Jr(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=wB[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var c=SB(),h=0;h<s.length;++h){var u=s[h],d=e[u];i.skipNulls&&d===null||EB(n,hN(d,u,a,l,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,c))}var f=n.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var IB=Z((wxt,MB)=>{"use strict";var Ns=l_(),h_=Object.prototype.hasOwnProperty,CB=Array.isArray,qt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Ns.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},dN=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},RB=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},fN="utf8=%26%2310003%3B",pN="utf8=%E2%9C%93",mN=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,c=e.charset;if(e.charsetSentinel)for(l=0;l<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===pN?c="utf-8":n[l]===fN&&(c="iso-8859-1"),a=l,l=n.length);for(l=0;l<n.length;++l)if(l!==a){var h=n[l],u=h.indexOf("]="),d=u===-1?h.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(h,qt.decoder,c,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(h.slice(0,d),qt.decoder,c,"key"),p=Ns.maybeMap(RB(h.slice(d+1),e,CB(i[f])?i[f].length:0),function(x){return e.decoder(x,qt.decoder,c,"value")})),p&&e.interpretNumericEntities&&c==="iso-8859-1"&&(p=dN(String(p))),h.indexOf("[]=")>-1&&(p=CB(p)?[p]:p);var m=h_.call(i,f);m&&e.duplicates==="combine"?i[f]=Ns.combine(i[f],p):(!m||e.duplicates==="last")&&(i[f]=p)}return i},gN=function(r,t,e,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=i?t:RB(t,e,s),a=r.length-1;a>=0;--a){var l,c=r[a];if(c==="[]"&&e.parseArrays)l=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:Ns.combine([],n);else{l=e.plainObjects?{__proto__:null}:{};var h=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,u=e.decodeDotInKeys?h.replace(/%2E/g,"."):h,d=parseInt(u,10);!e.parseArrays&&u===""?l={0:n}:!isNaN(d)&&c!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(l=[],l[d]=n):u!=="__proto__"&&(l[u]=n)}n=l}return n},xN=function(t,e,i,s){if(t){var o=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),c=l?o.slice(0,l.index):o,h=[];if(c){if(!i.plainObjects&&h_.call(Object.prototype,c)&&!i.allowPrototypes)return;h.push(c)}for(var u=0;i.depth>0&&(l=a.exec(o))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&h_.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;h.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");h.push("["+o.slice(l.index)+"]")}return gN(h,e,i,s)}},yN=function(t){if(!t)return qt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?qt.charset:t.charset,i=typeof t.duplicates>"u"?qt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:qt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:qt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:qt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:qt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:qt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:qt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:qt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:qt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:qt.decoder,delimiter:typeof t.delimiter=="string"||Ns.isRegExp(t.delimiter)?t.delimiter:qt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:qt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:qt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:qt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:qt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:qt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:qt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};MB.exports=function(r,t){var e=yN(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?mN(r,e):r,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=xN(a,i[a],e,typeof r=="string");s=Ns.merge(s,l,e)}return e.allowSparse===!0?s:Ns.compact(s)}});var FB=Z((Ext,BB)=>{"use strict";var _N=PB(),bN=IB(),vN=Bf();BB.exports={formats:vN,parse:bN,stringify:_N}});var GB=Z(Cn=>{"use strict";var TN=TM();function yr(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var SN=/^([a-z0-9.+-]+:)/i,wN=/:[0-9]*$/,EN=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,AN=["<",">",'"',"`"," ","\r",`
1093
- `," "],PN=["{","}","|","\\","^","`"].concat(AN),u_=["'"].concat(PN),kB=["%","/","?",";","#"].concat(u_),OB=["/","?","#"],CN=255,UB=/^[+a-z0-9A-Z_-]{0,63}$/,RN=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,MN={javascript:!0,"javascript:":!0},d_={javascript:!0,"javascript:":!0},Pn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},f_=FB();function vc(r,t,e){if(r&&typeof r=="object"&&r instanceof yr)return r;var i=new yr;return i.parse(r,t,e),i}yr.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var l=EN.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],t?this.query=f_.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var c=SN.exec(a);if(c){c=c[0];var h=c.toLowerCase();this.protocol=h,a=a.substr(c.length)}if(e||c||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(c&&d_[c])&&(a=a.substr(2),this.slashes=!0)}if(!d_[c]&&(u||c&&!Pn[c])){for(var d=-1,f=0;f<OB.length;f++){var p=a.indexOf(OB[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,x;d===-1?x=a.lastIndexOf("@"):x=a.lastIndexOf("@",d),x!==-1&&(m=a.slice(0,x),a=a.slice(x+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<kB.length;f++){var p=a.indexOf(kB[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var T=this.hostname.split(/\./),f=0,g=T.length;f<g;f++){var w=T[f];if(w&&!w.match(UB)){for(var b="",S=0,v=w.length;S<v;S++)w.charCodeAt(S)>127?b+="x":b+=w[S];if(!b.match(UB)){var A=T.slice(0,f),P=T.slice(f+1),C=w.match(RN);C&&(A.push(C[1]),P.unshift(C[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=A.join(".");break}}}this.hostname.length>CN?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=TN.toASCII(this.hostname));var R=this.port?":"+this.port:"",M=this.hostname||"";this.host=M+R,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!MN[h])for(var f=0,g=u_.length;f<g;f++){var I=u_[f];if(a.indexOf(I)!==-1){var k=encodeURIComponent(I);k===I&&(k=escape(I)),a=a.split(I).join(k)}}var W=a.indexOf("#");W!==-1&&(this.hash=a.substr(W),a=a.slice(0,W));var O=a.indexOf("?");if(O!==-1?(this.search=a.substr(O),this.query=a.substr(O+1),t&&(this.query=f_.parse(this.query)),a=a.slice(0,O)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Pn[h]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var R=this.pathname||"",z=this.search||"";this.path=R+z}return this.href=this.format(),this};function IN(r){return typeof r=="string"&&(r=vc(r)),r instanceof yr?r.format():yr.prototype.format.call(r)}yr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=f_.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Pn[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+i};function BN(r,t){return vc(r,!1,!0).resolve(t)}yr.prototype.resolve=function(r){return this.resolveObject(vc(r,!1,!0)).format()};function FN(r,t){return r?vc(r,!1,!0).resolveObject(t):t}yr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new yr;t.parse(r,!1,!0),r=t}for(var e=new yr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];e[o]=this[o]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(e[l]=r[l])}return Pn[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!Pn[r.protocol]){for(var c=Object.keys(r),h=0;h<c.length;h++){var u=c[h];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!d_[r.protocol]){for(var g=(r.pathname||"").split("/");g.length&&!(r.host=g.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),e.pathname=g.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",x=m||p||e.host&&r.pathname,_=x,T=e.pathname&&e.pathname.split("/")||[],g=r.pathname&&r.pathname.split("/")||[],w=e.protocol&&!Pn[e.protocol];if(w&&(e.hostname="",e.port=null,e.host&&(T[0]===""?T[0]=e.host:T.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(g[0]===""?g[0]=r.host:g.unshift(r.host)),r.host=null),x=x&&(g[0]===""||T[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,T=g;else if(g.length)T||(T=[]),T.pop(),T=T.concat(g),e.search=r.search,e.query=r.query;else if(r.search!=null){if(w){e.host=T.shift(),e.hostname=e.host;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!T.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=T.slice(-1)[0],v=(e.host||r.host||T.length>1)&&(S==="."||S==="..")||S==="",A=0,P=T.length;P>=0;P--)S=T[P],S==="."?T.splice(P,1):S===".."?(T.splice(P,1),A++):A&&(T.splice(P,1),A--);if(!x&&!_)for(;A--;A)T.unshift("..");x&&T[0]!==""&&(!T[0]||T[0].charAt(0)!=="/")&&T.unshift(""),v&&T.join("/").substr(-1)!=="/"&&T.push("");var C=T[0]===""||T[0]&&T[0].charAt(0)==="/";if(w){e.hostname=C?"":T.length?T.shift():"",e.host=e.hostname;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return x=x||e.host&&T.length,x&&!C&&T.unshift(""),T.length>0?e.pathname=T.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e};yr.prototype.parseHost=function(){var r=this.host,t=wN.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};Cn.parse=vc;Cn.resolve=BN;Cn.resolveObject=FN;Cn.format=IN;Cn.Url=yr});var rk=()=>{let r=new Map,t=l=>typeof l=="string"&&l.startsWith("blob:"),e=l=>typeof l?.type=="string"&&(l.type.startsWith("image/")||l.type.startsWith("video/"))&&typeof l?.url=="string"&&!t(l.url);return{load:async l=>{let c=[];for(let[h,u]of Object.entries(l))r.has(h)||c.push([h,u]);c.length>0&&await Promise.all(c.map(async([h,u])=>{if(e(u)){r.set(h,{url:u.url,type:u.type,source:"url"});return}let p={buffer:await(await fetch(u.url)).arrayBuffer(),type:u.type,source:"buffer"};r.set(h,p)}))},getBufferMap:()=>{let l={};for(let[c,h]of r.entries())l[c]=h;return l},clear:()=>r.clear(),size:()=>r.size,has:l=>r.has(l)}};F();var kE={extension:{type:E.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(FE(),hO))}};F();var UE={extension:{type:E.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(OE(),uO))}};F();Lh();Bh();F();Ct();Ya();var Bu;function zE(r){return Bu!==void 0||(Bu=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:r??Xi.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let i=j.get().createCanvas().getContext("webgl",t),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),Bu}Ct();var Fu;async function $E(r={}){return Fu!==void 0||(Fu=await(async()=>{let t=j.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),Fu}Ya();var iC=["webgl","webgpu","canvas"];async function sC(r){let t=[];r.preference?(t.push(r.preference),iC.forEach(o=>{o!==r.preference&&t.push(o)})):t=iC.slice();let e,i={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await $E()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(M1(),R1));e=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&zE(r.failIfMajorPerformanceCaveat??Xi.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(rC(),eC));e=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(i),s}Sr();sx();Ht();var oC=class Xx{constructor(...t){this.stage=new rt,t[0]!==void 0&&X(tt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await sC(t),Xx._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return X(tt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let i=Xx._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};oC._plugins=[];var Wl=oC;D.handleByList(E.Application,Wl._plugins);D.add(sl);F();Ui();om();Ct();F();xs();ae();_t();kg();Dg();var zl=class extends Ho{constructor(t,e){super();let{textures:i,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:l}=i[n.page],c=new Q(n.x+a.x,n.y+a.y,n.width,n.height),h=new B({source:l,frame:c});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){Na.install(t)}static uninstall(t){Na.uninstall(t)}};var sd={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let t=r.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),p={};for(let m in f){let x=f[m].split("="),_=x[0],T=x[1].replace(/"/gm,""),g=parseFloat(T),w=isNaN(g)?T:g;p[_]=w}e[d].push(p)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(i.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),i.fontSize=parseInt(s.size,10),i.fontFamily=s.face,i.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)i.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let l={};i.baseLineOffset=i.lineHeight-parseInt(o.base,10);let c=e.char;for(let u=0;u<c.length;u++){let d=c[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),l[f]=p,i.chars[p]={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),p=parseInt(h[u].amount,10);i.chars[l[f]].kerning[l[d]]=p}return i}};Ct();var jx={test(r){let t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let c=0;c<o.length;c++)t.pages.push({id:parseInt(o[c].getAttribute("id"),10)||0,file:o[c].getAttribute("file")});let l={};t.baseLineOffset=t.lineHeight-parseInt(i.getAttribute("base"),10);for(let c=0;c<n.length;c++){let h=n[c],u=parseInt(h.getAttribute("id"),10),d=h.getAttribute("letter")??h.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),l[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 c=0;c<a.length;c++){let h=parseInt(a[c].getAttribute("first"),10),u=parseInt(a[c].getAttribute("second"),10),d=parseInt(a[c].getAttribute("amount"),10);t.chars[l[u]].kerning[l[h]]=d}return t}};var Yx={test(r){return typeof r=="string"&&r.includes("<font>")?jx.test(j.get().parseXML(r)):!1},parse(r){return jx.parse(j.get().parseXML(r))}};var $O=[".xml",".fnt"],nC={extension:{type:E.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof zl,getCacheableAssets(r,t){let e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},aC={extension:{type:E.LoadParser,priority:Oe.Normal},name:"loadBitmapFont",test(r){return $O.includes(ce.extname(r).toLowerCase())},async testParse(r){return sd.test(r)||Yx.test(r)},async parse(r,t,e){let i=sd.test(r)?sd.parse(r):Yx.parse(r),{src:s}=t,{pages:o}=i,n=[],a=i.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=ce.join(ce.dirname(s),d);f=fa(f,s),n.push({src:f,data:a})}let l=await e.load(n),c=n.map(u=>l[u.src]);return new zl({data:i,textures:c},s)},async load(r,t){return await(await j.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};St();var od=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 i=0;i<e;i++)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())}};Li();F();_t();var lC={extension:{type:E.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof B),getCacheableAssets:(r,t)=>{let e={};return r.forEach(i=>{t.forEach((s,o)=>{e[i+(o===0?"":o+1)]=s})}),e}};F();async function nd(r){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var cC={extension:{type:E.DetectionParser,priority:1},test:async()=>nd("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};F();var hC=["png","jpg","jpeg"],uC={extension:{type:E.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...hC],remove:async r=>r.filter(t=>!hC.includes(t))};F();var XO="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function en(r){return XO?!1:document.createElement("video").canPlayType(r)!==""}var dC={extension:{type:E.DetectionParser,priority:0},test:async()=>en("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};F();var fC={extension:{type:E.DetectionParser,priority:0},test:async()=>en("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};F();var pC={extension:{type:E.DetectionParser,priority:0},test:async()=>en("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};F();var mC={extension:{type:E.DetectionParser,priority:0},test:async()=>nd("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};St();xs();da();Ih();var ad=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||N(`[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 N(`[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),i.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,i.parser=a)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0,s={},o=ys(t),n=Ue(t,c=>({alias:[c],src:c,data:{}})),a=n.length,l=n.map(async c=>{let h=ce.toAbsolute(c.src);if(!s[c.src])try{this.promiseCache[h]||(this.promiseCache[h]=this._getLoadPromiseAndParser(h,c)),s[c.src]=await this.promiseCache[h].promise,e&&e(++i/a)}catch(u){throw delete this.promiseCache[h],delete s[c.src],new Error(`[Loader.load] Failed to load ${h}.
1092
+ `+t.prev}function bf(r,t){var e=Wy(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=Ti(r,s)?t(r[s],r):""}var o=typeof Ly=="function"?Ly(r):[],n;if(vn){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in r)Ti(r,l)&&(e&&String(Number(l))===l&&l<r.length||vn&&n["$"+l]instanceof Symbol||(GM.call(/[^\w$]/,l)?i.push(t(l,r)+": "+t(r[l],r)):i.push(l+": "+t(r[l],r))));if(typeof Ly=="function")for(var c=0;c<o.length;c++)LM.call(r,o[c])&&i.push("["+t(o[c])+"]: "+t(r[o[c]],r));return i}});var XM=Z((Ngt,$M)=>{"use strict";var CL=pc(),RL=Us(),Sf=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},ML=function(r,t){if(r){var e=Sf(r,t);return e&&e.value}},IL=function(r,t,e){var i=Sf(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},BL=function(r,t){return r?!!Sf(r,t):!1},FL=function(r,t){if(r)return Sf(r,t,!0)};$M.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new RL("Side channel does not contain "+CL(i))},delete:function(i){var s=t&&t.next,o=FL(t,i);return o&&s&&s===o&&(t=void 0),!!o},get:function(i){return ML(t,i)},has:function(i){return BL(t,i)},set:function(i,s){t||(t={next:void 0}),IL(t,i,s)}};return e}});var Yy=Z((Hgt,jM)=>{"use strict";jM.exports=Object});var qM=Z((Vgt,YM)=>{"use strict";YM.exports=Error});var ZM=Z((Wgt,KM)=>{"use strict";KM.exports=EvalError});var JM=Z((zgt,QM)=>{"use strict";QM.exports=RangeError});var eI=Z(($gt,tI)=>{"use strict";tI.exports=ReferenceError});var iI=Z((Xgt,rI)=>{"use strict";rI.exports=SyntaxError});var oI=Z((jgt,sI)=>{"use strict";sI.exports=URIError});var aI=Z((Ygt,nI)=>{"use strict";nI.exports=Math.abs});var cI=Z((qgt,lI)=>{"use strict";lI.exports=Math.floor});var uI=Z((Kgt,hI)=>{"use strict";hI.exports=Math.max});var fI=Z((Zgt,dI)=>{"use strict";dI.exports=Math.min});var mI=Z((Qgt,pI)=>{"use strict";pI.exports=Math.pow});var xI=Z((Jgt,gI)=>{"use strict";gI.exports=Math.round});var _I=Z((txt,yI)=>{"use strict";yI.exports=Number.isNaN||function(t){return t!==t}});var vI=Z((ext,bI)=>{"use strict";var kL=_I();bI.exports=function(t){return kL(t)||t===0?t:t<0?-1:1}});var SI=Z((rxt,TI)=>{"use strict";TI.exports=Object.getOwnPropertyDescriptor});var qy=Z((ixt,wI)=>{"use strict";var wf=SI();if(wf)try{wf([],"length")}catch{wf=null}wI.exports=wf});var AI=Z((sxt,EI)=>{"use strict";var Ef=Object.defineProperty||!1;if(Ef)try{Ef({},"a",{value:1})}catch{Ef=!1}EI.exports=Ef});var CI=Z((oxt,PI)=>{"use strict";PI.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var II=Z((nxt,MI)=>{"use strict";var RI=typeof Symbol<"u"&&Symbol,OL=CI();MI.exports=function(){return typeof RI!="function"||typeof Symbol!="function"||typeof RI("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:OL()}});var Ky=Z((axt,BI)=>{"use strict";BI.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Zy=Z((lxt,FI)=>{"use strict";var UL=Yy();FI.exports=UL.getPrototypeOf||null});var UI=Z((cxt,OI)=>{"use strict";var GL="Function.prototype.bind called on incompatible ",LL=Object.prototype.toString,DL=Math.max,NL="[object Function]",kI=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var o=0;o<e.length;o+=1)i[o+t.length]=e[o];return i},HL=function(t,e){for(var i=[],s=e||0,o=0;s<t.length;s+=1,o+=1)i[o]=t[s];return i},VL=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e};OI.exports=function(t){var e=this;if(typeof e!="function"||LL.apply(e)!==NL)throw new TypeError(GL+e);for(var i=HL(arguments,1),s,o=function(){if(this instanceof s){var h=e.apply(this,kI(i,arguments));return Object(h)===h?h:this}return e.apply(t,kI(i,arguments))},n=DL(0,e.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+VL(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var c=function(){};c.prototype=e.prototype,s.prototype=new c,c.prototype=null}return s}});var mc=Z((hxt,GI)=>{"use strict";var WL=UI();GI.exports=Function.prototype.bind||WL});var Af=Z((uxt,LI)=>{"use strict";LI.exports=Function.prototype.call});var Qy=Z((dxt,DI)=>{"use strict";DI.exports=Function.prototype.apply});var HI=Z((fxt,NI)=>{"use strict";NI.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var WI=Z((pxt,VI)=>{"use strict";var zL=mc(),$L=Qy(),XL=Af(),jL=HI();VI.exports=jL||zL.call(XL,$L)});var Jy=Z((mxt,zI)=>{"use strict";var YL=mc(),qL=Us(),KL=Af(),ZL=WI();zI.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new qL("a function is required");return ZL(YL,KL,t)}});var KI=Z((gxt,qI)=>{"use strict";var QL=Jy(),$I=qy(),jI;try{jI=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var t_=!!jI&&$I&&$I(Object.prototype,"__proto__"),YI=Object,XI=YI.getPrototypeOf;qI.exports=t_&&typeof t_.get=="function"?QL([t_.get]):typeof XI=="function"?function(t){return XI(t==null?t:YI(t))}:!1});var eB=Z((xxt,tB)=>{"use strict";var ZI=Ky(),QI=Zy(),JI=KI();tB.exports=ZI?function(t){return ZI(t)}:QI?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return QI(t)}:JI?function(t){return JI(t)}:null});var iB=Z((yxt,rB)=>{"use strict";var JL=Function.prototype.call,tD=Object.prototype.hasOwnProperty,eD=mc();rB.exports=eD.call(JL,tD)});var Rf=Z((_xt,cB)=>{"use strict";var ut,rD=Yy(),iD=qM(),sD=ZM(),oD=JM(),nD=eI(),En=iI(),wn=Us(),aD=oI(),lD=aI(),cD=cI(),hD=uI(),uD=fI(),dD=mI(),fD=xI(),pD=vI(),aB=Function,e_=function(r){try{return aB('"use strict"; return ('+r+").constructor;")()}catch{}},gc=qy(),mD=AI(),r_=function(){throw new wn},gD=gc?function(){try{return arguments.callee,r_}catch{try{return gc(arguments,"callee").get}catch{return r_}}}():r_,Tn=II()(),xe=eB(),xD=Zy(),yD=Ky(),lB=Qy(),xc=Af(),Sn={},_D=typeof Uint8Array>"u"||!xe?ut:xe(Uint8Array),Ls={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ut:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ut:ArrayBuffer,"%ArrayIteratorPrototype%":Tn&&xe?xe([][Symbol.iterator]()):ut,"%AsyncFromSyncIteratorPrototype%":ut,"%AsyncFunction%":Sn,"%AsyncGenerator%":Sn,"%AsyncGeneratorFunction%":Sn,"%AsyncIteratorPrototype%":Sn,"%Atomics%":typeof Atomics>"u"?ut:Atomics,"%BigInt%":typeof BigInt>"u"?ut:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ut:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ut:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ut:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":iD,"%eval%":eval,"%EvalError%":sD,"%Float16Array%":typeof Float16Array>"u"?ut:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ut:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ut:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ut:FinalizationRegistry,"%Function%":aB,"%GeneratorFunction%":Sn,"%Int8Array%":typeof Int8Array>"u"?ut:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ut:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ut:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Tn&&xe?xe(xe([][Symbol.iterator]())):ut,"%JSON%":typeof JSON=="object"?JSON:ut,"%Map%":typeof Map>"u"?ut:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Tn||!xe?ut:xe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":rD,"%Object.getOwnPropertyDescriptor%":gc,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ut:Promise,"%Proxy%":typeof Proxy>"u"?ut:Proxy,"%RangeError%":oD,"%ReferenceError%":nD,"%Reflect%":typeof Reflect>"u"?ut:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ut:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Tn||!xe?ut:xe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ut:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Tn&&xe?xe(""[Symbol.iterator]()):ut,"%Symbol%":Tn?Symbol:ut,"%SyntaxError%":En,"%ThrowTypeError%":gD,"%TypedArray%":_D,"%TypeError%":wn,"%Uint8Array%":typeof Uint8Array>"u"?ut:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ut:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ut:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ut:Uint32Array,"%URIError%":aD,"%WeakMap%":typeof WeakMap>"u"?ut:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ut:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ut:WeakSet,"%Function.prototype.call%":xc,"%Function.prototype.apply%":lB,"%Object.defineProperty%":mD,"%Object.getPrototypeOf%":xD,"%Math.abs%":lD,"%Math.floor%":cD,"%Math.max%":hD,"%Math.min%":uD,"%Math.pow%":dD,"%Math.round%":fD,"%Math.sign%":pD,"%Reflect.getPrototypeOf%":yD};if(xe)try{null.error}catch(r){sB=xe(xe(r)),Ls["%Error.prototype%"]=sB}var sB,bD=function r(t){var e;if(t==="%AsyncFunction%")e=e_("async function () {}");else if(t==="%GeneratorFunction%")e=e_("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=e_("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&xe&&(e=xe(s.prototype))}return Ls[t]=e,e},oB={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},yc=mc(),Pf=iB(),vD=yc.call(xc,Array.prototype.concat),TD=yc.call(lB,Array.prototype.splice),nB=yc.call(xc,String.prototype.replace),Cf=yc.call(xc,String.prototype.slice),SD=yc.call(xc,RegExp.prototype.exec),wD=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ED=/\\(\\)?/g,AD=function(t){var e=Cf(t,0,1),i=Cf(t,-1);if(e==="%"&&i!=="%")throw new En("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new En("invalid intrinsic syntax, expected opening `%`");var s=[];return nB(t,wD,function(o,n,a,l){s[s.length]=a?nB(l,ED,"$1"):n||o}),s},PD=function(t,e){var i=t,s;if(Pf(oB,i)&&(s=oB[i],i="%"+s[0]+"%"),Pf(Ls,i)){var o=Ls[i];if(o===Sn&&(o=bD(i)),typeof o>"u"&&!e)throw new wn("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new En("intrinsic "+t+" does not exist!")};cB.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new wn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new wn('"allowMissing" argument must be a boolean');if(SD(/^%?[^%]*%?$/,t)===null)throw new En("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=AD(t),s=i.length>0?i[0]:"",o=PD("%"+s+"%",e),n=o.name,a=o.value,l=!1,c=o.alias;c&&(s=c[0],TD(i,vD([0,1],c)));for(var h=1,u=!0;h<i.length;h+=1){var d=i[h],f=Cf(d,0,1),p=Cf(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new En("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(l=!0),s+="."+d,n="%"+s+"%",Pf(Ls,n))a=Ls[n];else if(a!=null){if(!(d in a)){if(!e)throw new wn("base intrinsic for "+t+" exists, but the property is not available.");return}if(gc&&h+1>=i.length){var m=gc(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=Pf(a,d),a=a[d];u&&!l&&(Ls[n]=a)}}return a}});var i_=Z((bxt,dB)=>{"use strict";var hB=Rf(),uB=Jy(),CD=uB([hB("%String.prototype.indexOf%")]);dB.exports=function(t,e){var i=hB(t,!!e);return typeof i=="function"&&CD(t,".prototype.")>-1?uB([i]):i}});var s_=Z((vxt,pB)=>{"use strict";var RD=Rf(),_c=i_(),MD=pc(),ID=Us(),fB=RD("%Map%",!0),BD=_c("Map.prototype.get",!0),FD=_c("Map.prototype.set",!0),kD=_c("Map.prototype.has",!0),OD=_c("Map.prototype.delete",!0),UD=_c("Map.prototype.size",!0);pB.exports=!!fB&&function(){var t,e={assert:function(i){if(!e.has(i))throw new ID("Side channel does not contain "+MD(i))},delete:function(i){if(t){var s=OD(t,i);return UD(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return BD(t,i)},has:function(i){return t?kD(t,i):!1},set:function(i,s){t||(t=new fB),FD(t,i,s)}};return e}});var gB=Z((Txt,mB)=>{"use strict";var GD=Rf(),If=i_(),LD=pc(),Mf=s_(),DD=Us(),An=GD("%WeakMap%",!0),ND=If("WeakMap.prototype.get",!0),HD=If("WeakMap.prototype.set",!0),VD=If("WeakMap.prototype.has",!0),WD=If("WeakMap.prototype.delete",!0);mB.exports=An?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new DD("Side channel does not contain "+LD(s))},delete:function(s){if(An&&s&&(typeof s=="object"||typeof s=="function")){if(t)return WD(t,s)}else if(Mf&&e)return e.delete(s);return!1},get:function(s){return An&&s&&(typeof s=="object"||typeof s=="function")&&t?ND(t,s):e&&e.get(s)},has:function(s){return An&&s&&(typeof s=="object"||typeof s=="function")&&t?VD(t,s):!!e&&e.has(s)},set:function(s,o){An&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new An),HD(t,s,o)):Mf&&(e||(e=Mf()),e.set(s,o))}};return i}:Mf});var yB=Z((Sxt,xB)=>{"use strict";var zD=Us(),$D=pc(),XD=XM(),jD=s_(),YD=gB(),qD=YD||jD||XD;xB.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new zD("Side channel does not contain "+$D(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,s){t||(t=qD()),t.set(i,s)}};return e}});var Bf=Z((wxt,_B)=>{"use strict";var KD=String.prototype.replace,ZD=/%20/g,o_={RFC1738:"RFC1738",RFC3986:"RFC3986"};_B.exports={default:o_.RFC3986,formatters:{RFC1738:function(r){return KD.call(r,ZD,"+")},RFC3986:function(r){return String(r)}},RFC1738:o_.RFC1738,RFC3986:o_.RFC3986}});var l_=Z((Ext,vB)=>{"use strict";var QD=Bf(),n_=Object.prototype.hasOwnProperty,Ds=Array.isArray,Qr=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),JD=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Ds(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);e.obj[e.prop]=s}}},bB=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},tN=function r(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(Ds(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!n_.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return Ds(t)&&!Ds(e)&&(s=bB(t,i)),Ds(t)&&Ds(e)?(e.forEach(function(o,n){if(n_.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=r(a,o,i):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return n_.call(o,n)?o[n]=r(o[n],a,i):o[n]=a,o},s)},eN=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},rN=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},a_=1024,iN=function(t,e,i,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),i==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",l=0;l<n.length;l+=a_){for(var c=n.length>=a_?n.slice(l,l+a_):n,h=[],u=0;u<c.length;++u){var d=c.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===QD.RFC1738&&(d===40||d===41)){h[h.length]=c.charAt(u);continue}if(d<128){h[h.length]=Qr[d];continue}if(d<2048){h[h.length]=Qr[192|d>>6]+Qr[128|d&63];continue}if(d<55296||d>=57344){h[h.length]=Qr[224|d>>12]+Qr[128|d>>6&63]+Qr[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|c.charCodeAt(u)&1023),h[h.length]=Qr[240|d>>18]+Qr[128|d>>12&63]+Qr[128|d>>6&63]+Qr[128|d&63]}a+=h.join("")}return a},sN=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),l=0;l<a.length;++l){var c=a[l],h=n[c];typeof h=="object"&&h!==null&&i.indexOf(h)===-1&&(e.push({obj:n,prop:c}),i.push(h))}return JD(e),t},oN=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},nN=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},aN=function(t,e){return[].concat(t,e)},lN=function(t,e){if(Ds(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)};vB.exports={arrayToObject:bB,assign:eN,combine:aN,compact:sN,decode:rN,encode:iN,isBuffer:nN,isRegExp:oN,maybeMap:lN,merge:tN}});var PB=Z((Axt,AB)=>{"use strict";var SB=yB(),Ff=l_(),bc=Bf(),cN=Object.prototype.hasOwnProperty,wB={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Jr=Array.isArray,hN=Array.prototype.push,EB=function(r,t){hN.apply(r,Jr(t)?t:[t])},uN=Date.prototype.toISOString,TB=bc.default,he={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Ff.encode,encodeValuesOnly:!1,filter:void 0,format:TB,formatter:bc.formatters[TB],indices:!1,serializeDate:function(t){return uN.call(t)},skipNulls:!1,strictNullHandling:!1},dN=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},c_={},fN=function r(t,e,i,s,o,n,a,l,c,h,u,d,f,p,m,x,_,T){for(var g=t,w=T,b=0,S=!1;(w=w.get(c_))!==void 0&&!S;){var v=w.get(t);if(b+=1,typeof v<"u"){if(v===b)throw new RangeError("Cyclic object value");S=!0}typeof w.get(c_)>"u"&&(b=0)}if(typeof h=="function"?g=h(e,g):g instanceof Date?g=f(g):i==="comma"&&Jr(g)&&(g=Ff.maybeMap(g,function(it){return it instanceof Date?f(it):it})),g===null){if(n)return c&&!x?c(e,he.encoder,_,"key",p):e;g=""}if(dN(g)||Ff.isBuffer(g)){if(c){var P=x?e:c(e,he.encoder,_,"key",p);return[m(P)+"="+m(c(g,he.encoder,_,"value",p))]}return[m(e)+"="+m(String(g))]}var C=[];if(typeof g>"u")return C;var A;if(i==="comma"&&Jr(g))x&&c&&(g=Ff.maybeMap(g,c)),A=[{value:g.length>0?g.join(",")||null:void 0}];else if(Jr(h))A=h;else{var R=Object.keys(g);A=u?R.sort(u):R}var M=l?String(e).replace(/\./g,"%2E"):String(e),I=s&&Jr(g)&&g.length===1?M+"[]":M;if(o&&Jr(g)&&g.length===0)return I+"[]";for(var k=0;k<A.length;++k){var W=A[k],O=typeof W=="object"&&W&&typeof W.value<"u"?W.value:g[W];if(!(a&&O===null)){var z=d&&l?String(W).replace(/\./g,"%2E"):String(W),V=Jr(g)?typeof i=="function"?i(I,z):I:I+(d?"."+z:"["+z+"]");T.set(t,b);var G=SB();G.set(c_,T),EB(C,r(O,V,i,s,o,n,a,l,i==="comma"&&x&&Jr(g)?null:c,h,u,d,f,p,m,x,_,G))}}return C},pN=function(t){if(!t)return he;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||he.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=bc.default;if(typeof t.format<"u"){if(!cN.call(bc.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=bc.formatters[i],o=he.filter;(typeof t.filter=="function"||Jr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in wB?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=he.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:he.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:he.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:he.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:he.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?he.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:he.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:he.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:he.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:he.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:he.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:he.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:he.strictNullHandling}};AB.exports=function(r,t){var e=r,i=pN(t),s,o;typeof i.filter=="function"?(o=i.filter,e=o("",e)):Jr(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=wB[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var c=SB(),h=0;h<s.length;++h){var u=s[h],d=e[u];i.skipNulls&&d===null||EB(n,fN(d,u,a,l,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,c))}var f=n.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var IB=Z((Pxt,MB)=>{"use strict";var Ns=l_(),h_=Object.prototype.hasOwnProperty,CB=Array.isArray,qt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Ns.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},mN=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},RB=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},gN="utf8=%26%2310003%3B",xN="utf8=%E2%9C%93",yN=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,c=e.charset;if(e.charsetSentinel)for(l=0;l<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===xN?c="utf-8":n[l]===gN&&(c="iso-8859-1"),a=l,l=n.length);for(l=0;l<n.length;++l)if(l!==a){var h=n[l],u=h.indexOf("]="),d=u===-1?h.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(h,qt.decoder,c,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(h.slice(0,d),qt.decoder,c,"key"),p=Ns.maybeMap(RB(h.slice(d+1),e,CB(i[f])?i[f].length:0),function(x){return e.decoder(x,qt.decoder,c,"value")})),p&&e.interpretNumericEntities&&c==="iso-8859-1"&&(p=mN(String(p))),h.indexOf("[]=")>-1&&(p=CB(p)?[p]:p);var m=h_.call(i,f);m&&e.duplicates==="combine"?i[f]=Ns.combine(i[f],p):(!m||e.duplicates==="last")&&(i[f]=p)}return i},_N=function(r,t,e,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=i?t:RB(t,e,s),a=r.length-1;a>=0;--a){var l,c=r[a];if(c==="[]"&&e.parseArrays)l=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:Ns.combine([],n);else{l=e.plainObjects?{__proto__:null}:{};var h=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,u=e.decodeDotInKeys?h.replace(/%2E/g,"."):h,d=parseInt(u,10);!e.parseArrays&&u===""?l={0:n}:!isNaN(d)&&c!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(l=[],l[d]=n):u!=="__proto__"&&(l[u]=n)}n=l}return n},bN=function(t,e,i,s){if(t){var o=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),c=l?o.slice(0,l.index):o,h=[];if(c){if(!i.plainObjects&&h_.call(Object.prototype,c)&&!i.allowPrototypes)return;h.push(c)}for(var u=0;i.depth>0&&(l=a.exec(o))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&h_.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;h.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");h.push("["+o.slice(l.index)+"]")}return _N(h,e,i,s)}},vN=function(t){if(!t)return qt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?qt.charset:t.charset,i=typeof t.duplicates>"u"?qt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:qt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:qt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:qt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:qt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:qt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:qt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:qt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:qt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:qt.decoder,delimiter:typeof t.delimiter=="string"||Ns.isRegExp(t.delimiter)?t.delimiter:qt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:qt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:qt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:qt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:qt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:qt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:qt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};MB.exports=function(r,t){var e=vN(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?yN(r,e):r,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=bN(a,i[a],e,typeof r=="string");s=Ns.merge(s,l,e)}return e.allowSparse===!0?s:Ns.compact(s)}});var FB=Z((Cxt,BB)=>{"use strict";var TN=PB(),SN=IB(),wN=Bf();BB.exports={formats:wN,parse:SN,stringify:TN}});var GB=Z(Cn=>{"use strict";var EN=TM();function yr(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var AN=/^([a-z0-9.+-]+:)/i,PN=/:[0-9]*$/,CN=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,RN=["<",">",'"',"`"," ","\r",`
1093
+ `," "],MN=["{","}","|","\\","^","`"].concat(RN),u_=["'"].concat(MN),kB=["%","/","?",";","#"].concat(u_),OB=["/","?","#"],IN=255,UB=/^[+a-z0-9A-Z_-]{0,63}$/,BN=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,FN={javascript:!0,"javascript:":!0},d_={javascript:!0,"javascript:":!0},Pn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},f_=FB();function vc(r,t,e){if(r&&typeof r=="object"&&r instanceof yr)return r;var i=new yr;return i.parse(r,t,e),i}yr.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",o=r.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),r=o.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var l=CN.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],t?this.query=f_.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var c=AN.exec(a);if(c){c=c[0];var h=c.toLowerCase();this.protocol=h,a=a.substr(c.length)}if(e||c||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(c&&d_[c])&&(a=a.substr(2),this.slashes=!0)}if(!d_[c]&&(u||c&&!Pn[c])){for(var d=-1,f=0;f<OB.length;f++){var p=a.indexOf(OB[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,x;d===-1?x=a.lastIndexOf("@"):x=a.lastIndexOf("@",d),x!==-1&&(m=a.slice(0,x),a=a.slice(x+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<kB.length;f++){var p=a.indexOf(kB[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var T=this.hostname.split(/\./),f=0,g=T.length;f<g;f++){var w=T[f];if(w&&!w.match(UB)){for(var b="",S=0,v=w.length;S<v;S++)w.charCodeAt(S)>127?b+="x":b+=w[S];if(!b.match(UB)){var P=T.slice(0,f),C=T.slice(f+1),A=w.match(BN);A&&(P.push(A[1]),C.unshift(A[2])),C.length&&(a="/"+C.join(".")+a),this.hostname=P.join(".");break}}}this.hostname.length>IN?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=EN.toASCII(this.hostname));var R=this.port?":"+this.port:"",M=this.hostname||"";this.host=M+R,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!FN[h])for(var f=0,g=u_.length;f<g;f++){var I=u_[f];if(a.indexOf(I)!==-1){var k=encodeURIComponent(I);k===I&&(k=escape(I)),a=a.split(I).join(k)}}var W=a.indexOf("#");W!==-1&&(this.hash=a.substr(W),a=a.slice(0,W));var O=a.indexOf("?");if(O!==-1?(this.search=a.substr(O),this.query=a.substr(O+1),t&&(this.query=f_.parse(this.query)),a=a.slice(0,O)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Pn[h]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var R=this.pathname||"",z=this.search||"";this.path=R+z}return this.href=this.format(),this};function kN(r){return typeof r=="string"&&(r=vc(r)),r instanceof yr?r.format():yr.prototype.format.call(r)}yr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=f_.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Pn[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+i};function ON(r,t){return vc(r,!1,!0).resolve(t)}yr.prototype.resolve=function(r){return this.resolveObject(vc(r,!1,!0)).format()};function UN(r,t){return r?vc(r,!1,!0).resolveObject(t):t}yr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new yr;t.parse(r,!1,!0),r=t}for(var e=new yr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];e[o]=this[o]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var n=Object.keys(r),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(e[l]=r[l])}return Pn[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!Pn[r.protocol]){for(var c=Object.keys(r),h=0;h<c.length;h++){var u=c[h];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!d_[r.protocol]){for(var g=(r.pathname||"").split("/");g.length&&!(r.host=g.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),e.pathname=g.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",x=m||p||e.host&&r.pathname,_=x,T=e.pathname&&e.pathname.split("/")||[],g=r.pathname&&r.pathname.split("/")||[],w=e.protocol&&!Pn[e.protocol];if(w&&(e.hostname="",e.port=null,e.host&&(T[0]===""?T[0]=e.host:T.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(g[0]===""?g[0]=r.host:g.unshift(r.host)),r.host=null),x=x&&(g[0]===""||T[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,T=g;else if(g.length)T||(T=[]),T.pop(),T=T.concat(g),e.search=r.search,e.query=r.query;else if(r.search!=null){if(w){e.host=T.shift(),e.hostname=e.host;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!T.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=T.slice(-1)[0],v=(e.host||r.host||T.length>1)&&(S==="."||S==="..")||S==="",P=0,C=T.length;C>=0;C--)S=T[C],S==="."?T.splice(C,1):S===".."?(T.splice(C,1),P++):P&&(T.splice(C,1),P--);if(!x&&!_)for(;P--;P)T.unshift("..");x&&T[0]!==""&&(!T[0]||T[0].charAt(0)!=="/")&&T.unshift(""),v&&T.join("/").substr(-1)!=="/"&&T.push("");var A=T[0]===""||T[0]&&T[0].charAt(0)==="/";if(w){e.hostname=A?"":T.length?T.shift():"",e.host=e.hostname;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return x=x||e.host&&T.length,x&&!A&&T.unshift(""),T.length>0?e.pathname=T.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e};yr.prototype.parseHost=function(){var r=this.host,t=PN.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};Cn.parse=vc;Cn.resolve=ON;Cn.resolveObject=UN;Cn.format=kN;Cn.Url=yr});var rk=()=>{let r=new Map,t=l=>typeof l=="string"&&l.startsWith("blob:"),e=l=>typeof l?.type=="string"&&(l.type.startsWith("image/")||l.type.startsWith("video/"))&&typeof l?.url=="string"&&!t(l.url);return{load:async l=>{let c=[];for(let[h,u]of Object.entries(l))r.has(h)||c.push([h,u]);c.length>0&&await Promise.all(c.map(async([h,u])=>{if(e(u)){r.set(h,{url:u.url,type:u.type,source:"url"});return}let p={buffer:await(await fetch(u.url)).arrayBuffer(),type:u.type,source:"buffer"};r.set(h,p)}))},getBufferMap:()=>{let l={};for(let[c,h]of r.entries())l[c]=h;return l},clear:()=>r.clear(),size:()=>r.size,has:l=>r.has(l)}};F();var kE={extension:{type:E.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(FE(),hO))}};F();var UE={extension:{type:E.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(OE(),uO))}};F();Lh();Bh();F();Ct();Ya();var Bu;function zE(r){return Bu!==void 0||(Bu=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:r??Xi.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let i=j.get().createCanvas().getContext("webgl",t),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),Bu}Ct();var Fu;async function $E(r={}){return Fu!==void 0||(Fu=await(async()=>{let t=j.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),Fu}Ya();var iC=["webgl","webgpu","canvas"];async function sC(r){let t=[];r.preference?(t.push(r.preference),iC.forEach(o=>{o!==r.preference&&t.push(o)})):t=iC.slice();let e,i={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await $E()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(M1(),R1));e=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&zE(r.failIfMajorPerformanceCaveat??Xi.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(rC(),eC));e=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(i),s}Sr();sx();Ht();var oC=class Xx{constructor(...t){this.stage=new rt,t[0]!==void 0&&X(tt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await sC(t),Xx._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return X(tt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let i=Xx._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};oC._plugins=[];var Wl=oC;D.handleByList(E.Application,Wl._plugins);D.add(sl);F();Ui();om();Ct();F();xs();ae();_t();kg();Dg();var zl=class extends Ho{constructor(t,e){super();let{textures:i,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:l}=i[n.page],c=new Q(n.x+a.x,n.y+a.y,n.width,n.height),h=new B({source:l,frame:c});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){Na.install(t)}static uninstall(t){Na.uninstall(t)}};var sd={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){let t=r.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),p={};for(let m in f){let x=f[m].split("="),_=x[0],T=x[1].replace(/"/gm,""),g=parseFloat(T),w=isNaN(g)?T:g;p[_]=w}e[d].push(p)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(i.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),i.fontSize=parseInt(s.size,10),i.fontFamily=s.face,i.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)i.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let l={};i.baseLineOffset=i.lineHeight-parseInt(o.base,10);let c=e.char;for(let u=0;u<c.length;u++){let d=c[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),l[f]=p,i.chars[p]={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),p=parseInt(h[u].amount,10);i.chars[l[f]].kerning[l[d]]=p}return i}};Ct();var jx={test(r){let t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=r.getElementsByTagName("info")[0],i=r.getElementsByTagName("common")[0],s=r.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=r.getElementsByTagName("page"),n=r.getElementsByTagName("char"),a=r.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let c=0;c<o.length;c++)t.pages.push({id:parseInt(o[c].getAttribute("id"),10)||0,file:o[c].getAttribute("file")});let l={};t.baseLineOffset=t.lineHeight-parseInt(i.getAttribute("base"),10);for(let c=0;c<n.length;c++){let h=n[c],u=parseInt(h.getAttribute("id"),10),d=h.getAttribute("letter")??h.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),l[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 c=0;c<a.length;c++){let h=parseInt(a[c].getAttribute("first"),10),u=parseInt(a[c].getAttribute("second"),10),d=parseInt(a[c].getAttribute("amount"),10);t.chars[l[u]].kerning[l[h]]=d}return t}};var Yx={test(r){return typeof r=="string"&&r.includes("<font>")?jx.test(j.get().parseXML(r)):!1},parse(r){return jx.parse(j.get().parseXML(r))}};var $O=[".xml",".fnt"],nC={extension:{type:E.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof zl,getCacheableAssets(r,t){let e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},aC={extension:{type:E.LoadParser,priority:Oe.Normal},name:"loadBitmapFont",test(r){return $O.includes(ce.extname(r).toLowerCase())},async testParse(r){return sd.test(r)||Yx.test(r)},async parse(r,t,e){let i=sd.test(r)?sd.parse(r):Yx.parse(r),{src:s}=t,{pages:o}=i,n=[],a=i.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=ce.join(ce.dirname(s),d);f=fa(f,s),n.push({src:f,data:a})}let l=await e.load(n),c=n.map(u=>l[u.src]);return new zl({data:i,textures:c},s)},async load(r,t){return await(await j.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};St();var od=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 i=0;i<e;i++)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())}};Li();F();_t();var lC={extension:{type:E.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof B),getCacheableAssets:(r,t)=>{let e={};return r.forEach(i=>{t.forEach((s,o)=>{e[i+(o===0?"":o+1)]=s})}),e}};F();async function nd(r){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var cC={extension:{type:E.DetectionParser,priority:1},test:async()=>nd("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};F();var hC=["png","jpg","jpeg"],uC={extension:{type:E.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...hC],remove:async r=>r.filter(t=>!hC.includes(t))};F();var XO="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function en(r){return XO?!1:document.createElement("video").canPlayType(r)!==""}var dC={extension:{type:E.DetectionParser,priority:0},test:async()=>en("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};F();var fC={extension:{type:E.DetectionParser,priority:0},test:async()=>en("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};F();var pC={extension:{type:E.DetectionParser,priority:0},test:async()=>en("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};F();var mC={extension:{type:E.DetectionParser,priority:0},test:async()=>nd("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};St();xs();da();Ih();var ad=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||N(`[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 N(`[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),i.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,i.parser=a)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0,s={},o=ys(t),n=Ue(t,c=>({alias:[c],src:c,data:{}})),a=n.length,l=n.map(async c=>{let h=ce.toAbsolute(c.src);if(!s[c.src])try{this.promiseCache[h]||(this.promiseCache[h]=this._getLoadPromiseAndParser(h,c)),s[c.src]=await this.promiseCache[h].promise,e&&e(++i/a)}catch(u){throw delete this.promiseCache[h],delete s[c.src],new Error(`[Loader.load] Failed to load ${h}.
1094
1094
  ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=Ue(t,s=>({alias:[s],src:s})).map(async s=>{let o=ce.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(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&N(`[Assets] loadParser name conflict "${e.name}"`):N("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Ct();F();function pr(r,t){if(Array.isArray(t)){for(let e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}xs();function mr(r,t){let e=r.split("?")[0],i=ce.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}Ui();var jO=".json",YO="application/json",gC={extension:{type:E.LoadParser,priority:Oe.Low},name:"loadJson",test(r){return pr(r,YO)||mr(r,jO)},async load(r){return await(await j.get().fetch(r)).json()}};Ct();F();Ui();var qO=".txt",KO="text/plain",xC={name:"loadTxt",extension:{type:E.LoadParser,priority:Oe.Low,name:"loadTxt"},test(r){return pr(r,KO)||mr(r,qO)},async load(r){return await(await j.get().fetch(r)).text()}};Ct();F();St();xs();Li();Ui();var ZO=["normal","bold","100","200","300","400","500","600","700","800","900"],QO=[".ttf",".otf",".woff",".woff2"],JO=["font/ttf","font/otf","font/woff","font/woff2"],tU=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function eU(r){let t=ce.extname(r),s=ce.basename(r,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(tU)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var rU=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function iU(r){return rU.test(r)?r:encodeURI(r)}var yC={extension:{type:E.LoadParser,priority:Oe.Low},name:"loadWebFont",test(r){return pr(r,JO)||mr(r,QO)},async load(r,t){let e=j.get().getFontFaceSet();if(e){let i=[],s=t.data?.family??eU(r),o=t.data?.weights?.filter(a=>ZO.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let l=o[a],c=new FontFace(s,`url(${iU(r)})`,{...n,weight:l});await c.load(),e.add(c),i.push(c)}return bt.set(`${s}-and-url`,{url:r,fontFaces:i}),i.length===1?i[0]:i}return N("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>{bt.remove(`${t.family}-and-url`),j.get().getFontFaceSet().delete(t)})}};Ct();F();xo();xu();mo();function rn(r,t=1){let e=Je.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}Ui();_t();St();Li();function sn(r,t,e){r.label=e,r._sourceOrigin=e;let i=new B({source:r,label:e}),s=()=>{delete t.promiseCache[e],bt.has(e)&&bt.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(N("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),i.once("destroy",()=>{r.destroyed||(N("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var sU=".svg",oU="image/svg+xml",_C={extension:{type:E.LoadParser,priority:Oe.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return pr(r,oU)||mr(r,sU)},async load(r,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?aU(r):nU(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function nU(r,t,e,i){let o=await(await j.get().fetch(r)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=i,await a.decode(),URL.revokeObjectURL(n);let l=document.createElement("canvas"),c=l.getContext("2d"),h=t.data?.resolution||rn(r),u=t.data?.width??a.width,d=t.data?.height??a.height;l.width=u*h,l.height=d*h,c.drawImage(a,0,0,u*h,d*h);let{parseAsGraphicsContext:f,...p}=t.data??{},m=new ze({resource:l,alphaMode:"premultiply-alpha-on-upload",resolution:h,...p});return sn(m,e,r)}async function aU(r){let e=await(await j.get().fetch(r)).text(),i=new Le;return i.svg(e),i}Ct();F();xo();var lU=`(function () {
1095
1095
  'use strict';
1096
1096
 
@@ -1141,18 +1141,20 @@ ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=Ue(t
1141
1141
  };
1142
1142
 
1143
1143
  })();
1144
- `,an=null,$l=class{constructor(){an||(an=URL.createObjectURL(new Blob([cU],{type:"application/javascript"}))),this.worker=new Worker(an)}};$l.revokeObjectURL=function(){an&&(URL.revokeObjectURL(an),an=null)};var bC=0,qx,Kx=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 nn;e.addEventListener("message",i=>{e.terminate(),nn.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){qx===void 0&&(qx=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<qx&&(this._createdWorkers++,t=new $l().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 i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[bC]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:bC++,id:i})}},Zx=new Kx;Ui();var hU=[".jpeg",".jpg",".png",".webp",".avif"],uU=["image/jpeg","image/png","image/webp","image/avif"];async function dU(r,t){let e=await j.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var ld={name:"loadTextures",extension:{type:E.LoadParser,priority:Oe.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return pr(r,uU)||mr(r,hU)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Zx.isImageBitmapSupported()?i=await Zx.loadImageBitmap(r,t):i=await dU(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new ze({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||rn(r),...t.data});return sn(s,e,r)},unload(r){r.destroy(!0)}};F();dm();um();var vC=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],fU=vC.map(r=>`video/${r.substring(1)}`);function pU(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=gU(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function mU(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function gU(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var TC={name:"loadVideo",extension:{type:E.LoadParser,name:"loadVideo"},test(r){let t=pr(r,fU),e=mr(r,vC);return t||e},async load(r,t,e){let i={...yo.defaultOptions,resolution:t.data?.resolution||rn(r),alphaMode:t.data?.alphaMode||await Uh(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let c=o[l];c!==void 0&&s.setAttribute(l,c)}),i.muted===!0&&(s.muted=!0),pU(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=yo.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let c=async()=>{let h=new yo({...i,resource:s});s.removeEventListener("canplay",c),t.data.preload&&await mU(s),l(sn(h,e,r))};s.addEventListener("canplay",c),s.appendChild(n)})},unload(r){r.destroy(!0)}};F();mo();F();mo();var cd={extension:{type:E.ResolveParser,name:"resolveTexture"},test:ld.test,parse:r=>({resolution:parseFloat(Je.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var SC={extension:{type:E.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Je.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:cd.parse};mo();da();Ih();var hd=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Je,this.loader=new ad,this.cache=bt,this._backgroundLoader=new od(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){N("[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,i=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:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=ys(t),s=Ue(t).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(c=>!this.resolver.hasKey(c))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,l=0,c=()=>{e?.(++a/l)},h=n.map(u=>{let d=s[u];return l+=Object.keys(d).length,this._mapLoadToResolve(d,c).then(f=>{o[u]=f})});return await Promise.all(h),i?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(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return bt.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=bt.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(c=>{o[c]=a}),bt.set(l,a)}),o}async unload(t){this._initialized||await this.init();let e=Ue(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Ue(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{bt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},gr=new hd;D.handleByList(E.LoadParser,gr.loader.parsers).handleByList(E.ResolveParser,gr.resolver.parsers).handleByList(E.CacheParser,gr.cache.parsers).handleByList(E.DetectionParser,gr.detections);D.add(lC,uC,cC,mC,dC,fC,pC,gC,xC,yC,_C,ld,TC,aC,nC,cd,SC);var wC={loader:E.LoadParser,resolver:E.ResolveParser,cache:E.CacheParser,detection:E.DetectionParser};D.handle(E.Asset,r=>{let t=r.ref;Object.entries(wC).filter(([e])=>!!t[e]).forEach(([e,i])=>D.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(wC).filter(e=>!!t[e]).forEach(e=>D.remove(t[e]))});_t();aa();po();ma();var Xl=class r extends wt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:c=null,textures:h,updateAnchor:u=!1,...d}=e,[f]=h;super({...d,texture:f instanceof B?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=l,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=h,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(le.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(le.shared.add(this.update,this,Or.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(B.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(B.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof B)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(le.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(le.shared.add(this.update,this),this._isConnectedToTicker=!0))}};dh();Ht();Mh();var ud=class extends Oi{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:c,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new be({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=c??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}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,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}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 EC(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&(X(tt,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}La();Ps();var Cr=class extends ud{constructor(...t){let e=EC(t,"Text");super(e,It),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=Lt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ft();ae();dx();_t();Uu();mm();Sr();Ig();ma();La();Ps();nm();Ae();var xU=ls(Jh(),1);D.add(kE,UE);var yU=new(window.AudioContext||window.webkitAudioContext),Qx={},_U=async(r,t)=>{if(!Qx[r]&&t.byteLength!==0)try{let e=await yU.decodeAudioData(t);Qx[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},bU=r=>Qx[r],ln={load:_U,getAsset:bU};var Zt=({type:r,add:t,update:e,delete:i,parse:s,shouldUpdateUnchanged:o})=>({type:r,add:t,update:e,delete:i,parse:s,shouldUpdateUnchanged:o});var Jx=({type:r})=>({type:r});var ty=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var dd={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"};var fd={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var Is={RECT:"rect",TEXT:"text",INPUT:"input",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var zt={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var Yr=(r,t)=>{let e={fill:t?.fill??zt.fill,fontFamily:t?.fontFamily??zt.fontFamily,fontSize:t?.fontSize??zt.fontSize,align:t?.align??zt.align,lineHeight:t?.lineHeight??zt.lineHeight,wordWrap:t?.wordWrap??zt.wordWrap,breakWords:t?.breakWords??zt.breakWords,strokeColor:t?.strokeColor??zt.strokeColor,strokeWidth:t?.strokeWidth??zt.strokeWidth,wordWrapWidth:t?.wordWrapWidth??zt.wordWrapWidth};r.style=e};var vU=(r,t)=>typeof t!="string"?t:r[t]??t,TU=(r,t,e,i)=>{let s=vU(e,t);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},AC=(r,t,e=fd)=>{for(let i of t)for(let[s,o]of Object.entries(i.tween)){if(!dd[s])throw new Error(`${s} is not a supported property for animation.`);o.initialValue!==void 0&&TU(r,s,e,o.initialValue)}},pd=({animations:r,animationBus:t,completionTracker:e,element:i,targetState:s,onComplete:o})=>{for(let n of r){for(let[l,c]of Object.entries(n.tween))if(c.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,l)))throw new Error(`Animation "${n.id}" cannot auto-resolve property "${l}" from targetState.`);let a=e.getVersion();e.track(a),t.dispatch({type:"START",payload:{id:n.id,element:i,properties:n.tween,targetState:s,onComplete:()=>{e.complete(a),o?.(n)}}})}};function md(r,t){let e=r.text.substring(0,t),s=Lt.measureText(e,r.style).width;return r.x+s}var SU=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&t?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),e()},r);s=()=>{clearTimeout(n),o(),i(t.reason)},t?.addEventListener("abort",s,{once:!0})}),ey=SU;var yi=Symbol("textRevealRuntime"),yd=Symbol("textRevealSnapshot"),wU=18,EU=64,AU=1.25,CC=r=>typeof r=="number"&&r>0?r:1,PU=r=>{let t=new wt(B.EMPTY);if(r?.indicator?.revealing?.src){let e=B.from(r.indicator.revealing.src);t=new wt(e),t.width=r.indicator.revealing.width??e.width,t.height=r.indicator.revealing.height??e.height}return t},jl=(r,t)=>{if(!t?.indicator?.complete?.src)return;let e=B.from(t.indicator.complete.src);r.texture=e,r.width=t.indicator.complete.width??e.width,r.height=t.indicator.complete.height??e.height},Yl=(r,t,e)=>{r.x=e,r.y=t?t.y+(t.lineMaxHeight-r.height):0},xd=(r,t,e)=>{if(!t||t.text.length===0){r.x=e;return}r.x=md(t,t.text.length-1)+e},CU=(r,t)=>{if(r[yi]){let e=r[yi];delete r[yi],e()}r[yi]=t},RU=r=>r?.[yd]??null,gd=(r,t)=>r?t?(r[yd]=t,t):(delete r[yd],null):null,RC=r=>{let t=RU(r);return!t||t.mode!=="typewriter"||t.completed===!0?null:t},MC=r=>!!RC(r),ry=r=>{if(r[yi]){let e=r[yi];delete r[yi],e()}delete r[yd],r.onRender=void 0,r.removeChildren().forEach(e=>{e.destroy({children:!0})})},IC=(r,t="",e="")=>{let i=new It(r.textStyle),s=new Cr({text:t,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new It(r.furigana.textStyle);o=new Cr({text:e,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},BC=(r,t)=>{let e=null,i=null,s=0,o=0,n=[];for(let a=0;a<t.content.length;a++){let l=t.content[a],c=new rt({label:`${t.id}-line-${a}`}),h=[],u=null,d=0;r.addChild(c),i=l,o=Math.max(o,l.lineMaxHeight??0);for(let f=0;f<l.lineParts.length;f++){let p=l.lineParts[f],{text:m,furiganaText:x}=IC(p,p.text,p.furigana?.text||"");x&&(c.addChild(x),h.push(x)),c.addChild(m),h.push(m),e=m,u=m,s+=p.text.length,d+=p.text.length}if(h.length>0){let f=c.getLocalBounds();n.push({chunk:l,container:c,lastTextObject:u,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else c.destroy()}return{lines:n,lastTextObject:e,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:r.getLocalBounds()}},PC=({contentContainer:r,indicatorSprite:t,element:e})=>{let i=e?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=BC(r,e);Yl(t,o,i),xd(t,s,i),jl(t,e)},MU=({indicatorSprite:r,element:t})=>{let e=t?.indicator?.offset??12,i=t.content[0]??null;Yl(r,i,e)},IU=async({contentContainer:r,indicatorSprite:t,element:e,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=CC(e.speed??50),a=e?.indicator?.offset??12,l=Math.max(1,Math.floor(1e3/n)),c=Math.max(1,Math.floor(4e3/n)),h=Math.max(0,Math.floor(s));o&&(o.revealedCharacters=h,o.completed=!1);for(let u=0;u<e.content.length;u++){if(i?.aborted||r.destroyed)return!1;let d=e.content[u],f=!1;Yl(t,d,a);for(let p=0;p<d.lineParts.length;p++){if(i?.aborted||r.destroyed)return!1;let m=d.lineParts[p],{text:x,furiganaText:_}=IC(m);_&&r.addChild(_),r.addChild(x);let T=m.text,g=m.furigana?.text||"",w=g.length,b=Math.min(T.length,h),S=T.length>0?Math.round(b/T.length*w):0;x.text=T.substring(0,b),_&&(_.text=g.substring(0,S)),h-=b,b>0&&(t.x=md(x,b-1)+a);for(let v=b;v<T.length;v++){if(i?.aborted||r.destroyed)return!1;if(x.text=T.substring(0,v+1),t.x=md(x,v)+a,f=!0,o&&(o.revealedCharacters+=1),_){let A=Math.round((v+1)/T.length*w);_.text=g.substring(0,A)}v<T.length-1&&await ey(l,i)}}u<e.content.length-1&&f&&await ey(c,i)}return jl(t,e),o&&(o.completed=!0),!0},BU=({container:r,contentContainer:t,indicatorSprite:e,element:i,animationBus:s,completionTracker:o})=>{let n=i?.indicator?.offset??12,a=CC(i.speed??50),{lines:l,lastTextObject:c,lastChunk:h,totalCharacters:u,maxLineHeight:d,bounds:f}=BC(t,i);if(Yl(e,h,n),l.length===0||u===0||!l.some(C=>C.bounds.width>0&&C.bounds.height>0)||!globalThis.document||!s)return xd(e,c,n),jl(e,i),!1;let p=Math.max(wU,Math.min(EU,Math.round(d*AU))),m=Math.max(1,Math.round(u/a*1e3)),x=l.map(C=>{let R=Math.max(1,C.totalCharacters),M=1+p/Math.max(1,C.bounds.width);return R*M}),_=x.reduce((C,R)=>C+R,0),T=[],g=0;for(let C=0;C<l.length;C++){let R=x[C],M=_>0?g/_:0;g+=R,T.push({...l[C],startProgress:M,endProgress:_>0?g/_:1})}let w=o.getVersion(),b=`${i.id}-soft-wipe`,S=T.map(C=>{let R=document.createElement("canvas");R.width=Math.max(1,Math.ceil(C.bounds.width+p)),R.height=Math.max(1,Math.ceil(C.bounds.height));let M=R.getContext("2d");if(!M)return null;let I=Ms(R),k=new wt(I);return k.x=Math.floor(C.bounds.x-p),k.y=Math.floor(C.bounds.y),C.container.mask=k,t.addChild(k),{canvas:R,context:M,texture:I,sprite:k,line:C}});if(S.some(C=>C===null))return S.forEach(C=>{C&&(C.line.container.mask===C.sprite&&(C.line.container.mask=null),C.sprite.parent&&C.sprite.parent.removeChild(C.sprite),C.sprite.destroy(),C.texture.destroy(!0))}),xd(e,c,n),jl(e,i),!1;let v=!1,A=C=>{v||(v=!0,r[yi]===P&&delete r[yi],S.forEach(R=>{R.line.container.mask===R.sprite&&(R.line.container.mask=null),R.sprite.parent&&R.sprite.parent.removeChild(R.sprite),R.sprite.destroy(),R.texture.destroy(!0)}),C&&(xd(e,c,n),jl(e,i)))},P=()=>{s.dispatch({type:"CANCEL",id:b}),A(!1)};return CU(r,P),o.track(w),s.dispatch({type:"START",payload:{id:b,driver:"custom",duration:m,applyFrame:C=>{let R=m>0?Math.min(C/m,1):1,M=T[0],I=0;for(let k=0;k<T.length;k++){let W=T[k],O=S[k],z=Math.max(1e-6,W.endProgress-W.startProgress),V=Math.max(0,Math.min((R-W.startProgress)/z,1)),{context:G,canvas:it,texture:yt}=O;if(G.clearRect(0,0,it.width,it.height),V<=0){yt.source.update();continue}let dt=p,Ot=0,Xt=W.bounds.width+p,Nt=dt+V*Xt,te=Math.max(dt,Nt-p);te>dt&&(G.fillStyle="#ffffff",G.fillRect(dt,Ot,Math.min(te-dt,W.bounds.width),W.bounds.height));let de=Math.max(dt,Nt-p),Se=Math.min(dt+W.bounds.width,Nt);if(Se>de){let Ft=G.createLinearGradient(de,0,Se,0);Ft.addColorStop(0,"rgba(255, 255, 255, 1)"),Ft.addColorStop(1,"rgba(255, 255, 255, 0)"),G.fillStyle=Ft,G.fillRect(de,Ot,Se-de,W.bounds.height)}yt.source.update(),(V<1||k===T.length-1)&&(M=W,I=Math.min(1,(Nt-dt)/Math.max(1,W.bounds.width)))}Yl(e,M.chunk,n),e.x=M.bounds.x+Math.min(M.bounds.width,M.bounds.width*I)+n},applyTargetState:()=>{A(!1)},onComplete:()=>{o.complete(w),A(!0)},onCancel:()=>{o.complete(w),A(!1)},isValid:()=>!!r&&!r.destroyed&&!t.destroyed&&!e.destroyed}}),!0},_i=async({container:r,element:t,completionTracker:e,animationBus:i,zIndex:s,signal:o,playback:n="autoplay"})=>{if(o?.aborted||r.destroyed)return;let a=n==="resume"?RC(r):null;if(n==="resume"&&!a)return;ry(r),r.zIndex=s;let l=new rt({label:`${t.id}-content`}),c=PU(t);r.addChild(l),r.addChild(c);try{if(n==="paused-initial"){t.revealEffect!=="none"&&gd(r,{mode:"typewriter",revealedCharacters:0,completed:!1}),t.revealEffect==="none"?PC({contentContainer:l,indicatorSprite:c,element:t}):MU({indicatorSprite:c,element:t});return}if(t.revealEffect==="softWipe"){if(gd(r,{mode:"softWipe",completed:!1}),!BU({container:r,contentContainer:l,indicatorSprite:c,element:t,animationBus:i,completionTracker:e})&&!o?.aborted&&!r.destroyed){let f=e.getVersion();e.track(f),e.complete(f)}return}let h=e.getVersion(),u=!1;if(e.track(h),t.revealEffect==="none")gd(r,{mode:"none",completed:!0}),PC({contentContainer:l,indicatorSprite:c,element:t}),u=!0;else{let d=gd(r,{mode:"typewriter",revealedCharacters:a?.revealedCharacters??0,completed:!1});u=await IU({contentContainer:l,indicatorSprite:c,element:t,signal:o,startAtCharacter:a?.revealedCharacters??0,snapshot:d})}u&&!o?.aborted&&!r.destroyed&&e.complete(h)}catch(h){if(h?.name!=="AbortError"&&!o?.aborted)throw h}};var _d=({suppressAnimations:r=!1,deferredMountOperations:t=[]}={})=>({suppressAnimations:r,deferredMountOperations:t}),FC=r=>{switch(r?.type){case"play-animated-sprite":r.animatedSprite?.destroyed||r.animatedSprite?.play();return;case"play-video":r.video?.play();return;case"start-particles":if(r.app?.debug){let t=e=>{if(r.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",t);return}e?.detail?.deltaMS&&r.emitter.update(Number(e.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",t),r.container.customTickerHandler=t;return}r.app.ticker.add(r.tickerCallback);return;case"autoplay-text-reveal":_i({container:r.container,element:r.element,completionTracker:r.completionTracker,animationBus:r.animationBus,zIndex:r.zIndex,signal:r.signal,playback:"autoplay"});return;case"start-update-animations":if(!r.element||r.element.destroyed)return;pd({animations:r.animations,animationBus:r.animationBus,completionTracker:r.completionTracker,element:r.element,targetState:r.targetState});return}},ql=(r,t)=>{if(t?.type){if(!r?.suppressAnimations){FC(t);return}r.deferredMountOperations.push(t)}},bd=r=>{r?.deferredMountOperations&&(r.deferredMountOperations.length=0)},kC=(r,t)=>ql(r,{type:"play-animated-sprite",animatedSprite:t}),OC=(r,t)=>ql(r,{type:"play-video",video:t}),UC=(r,{app:t,emitter:e,container:i,tickerCallback:s})=>ql(r,{type:"start-particles",app:t,emitter:e,container:i,tickerCallback:s}),vd=(r,{container:t,element:e,completionTracker:i,animationBus:s,zIndex:o,signal:n})=>ql(r,{type:"autoplay-text-reveal",container:t,element:e,completionTracker:i,animationBus:s,zIndex:o,signal:n}),GC=(r,{animations:t,animationBus:e,completionTracker:i,element:s,targetState:o})=>ql(r,{type:"start-update-animations",animations:t,animationBus:e,completionTracker:i,element:s,targetState:o}),LC=r=>{if(!r?.deferredMountOperations?.length)return;let t=r.deferredMountOperations.splice(0);for(let e of t)FC(e)};var DC=(r=[])=>{if(r instanceof Map)return r;let t=new Map;for(let e of r)t.has(e.targetId)||t.set(e.targetId,[]),t.get(e.targetId).push(e);return t},Td=(r,t)=>r instanceof Map?r.get(t)??[]:r.filter(e=>e.targetId===t),FU=(r,t)=>Td(r,t).filter(e=>e.type==="update"),Sd=(r,t)=>Td(r,t).find(e=>e.type==="transition")??null,kU=({animations:r,targetId:t,animationBus:e,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=FU(r,t);if(l.length===0)return!1;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");return AC(s,l),GC(a,{animations:l,animationBus:e,completionTracker:i,element:s,targetState:o}),!0}return pd({animations:l,animationBus:e,completionTracker:i,element:s,targetState:o,onComplete:n}),!0};var ot=kU;var VC=Symbol("routeGraphicsTextAnchorRatios"),WC=Symbol("routeGraphicsTextLayoutState"),NC=(r,t)=>typeof r!="number"||r===0?0:t/r,iy=r=>r?.align??zt.align,HC=r=>{let t=r[WC];return t?.fixedWidth&&typeof t.layoutWidth=="number"?t.layoutWidth:r.width},sy=(r,t,e)=>{let i=Math.max(0,r-t);return e==="center"?i/2:e==="right"?i:0},Kl=r=>{let t=r.measuredWidth??r.width,e=sy(r.width,t,iy(r.textStyle));return{x:r.x+e,y:r.y}},wd=(r,t)=>{let e=t.__fixedWidth&&typeof t.width=="number"?t.width:r.width||t.width,i=r.height||t.height,s=typeof t.__anchorXRatio=="number"?t.__anchorXRatio:NC(e,t.originX),o=typeof t.__anchorYRatio=="number"?t.__anchorYRatio:NC(i,t.originY);r[VC]={x:s,y:o},r[WC]={fixedWidth:!!t.__fixedWidth,layoutWidth:t.width}},OU=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?zt.lineHeight:r.lineHeight/r.fontSize,UU=(r,t)=>{if(!t)return r;let e={...r,...t};if(t.fontSize!==void 0||t.lineHeight!==void 0){let i=t.lineHeight??OU(r);e.lineHeight=Math.round(e.fontSize*i)}return e},qr=(r,t,e)=>{let i=r[VC],s=HC(r),o=UU(t,e);if(!i){Yr(r,o);return}let n=sy(s,r.width,iy(r.style)),l=r.x-n+s*i.x,c=r.y+r.height*i.y;Yr(r,o);let h=HC(r),u=sy(h,r.width,iy(r.style));r.x=l-h*i.x+u,r.y=c-r.height*i.y},Ed=(r,t)=>{let e=Kl({...t,measuredWidth:r.width,width:t.__fixedWidth&&typeof t.width=="number"?t.width:r.width});r.x=e.x,r.y=e.y};var zC=r=>{if(!(!r||typeof r!="object")){if(typeof r.button=="number")return r.button;if(typeof r.data?.button=="number")return r.data.button;if(typeof r.nativeEvent?.button=="number")return r.nativeEvent.button}},ie=r=>{let t=zC(r);return t===void 0||t===0},$C=r=>zC(r)===2;var oy=Symbol.for("routeGraphics.setInheritedHover"),XC=Symbol.for("routeGraphics.treeInheritedHoverActive"),ny=Symbol.for("routeGraphics.setInheritedPress"),jC=Symbol.for("routeGraphics.treeInheritedPressActive"),ay=Symbol.for("routeGraphics.setInheritedRightPress"),YC=Symbol.for("routeGraphics.treeInheritedRightPressActive"),cn=r=>Array.isArray(r?.children)?r.children:[],ly=({displayObject:r,symbol:t,source:e,isActive:i})=>{let s=r?.[t];typeof s=="function"&&s(e,i)},Ad=({displayObject:r,symbol:t})=>{r&&t in r&&delete r[t]},cy=({displayObject:r,symbol:t,onStateChange:e})=>{let i=!1,s=new Set,o=({nextDirectActive:n=i,onInheritedChange:a})=>{let l=i||s.size>0;i=n,a?.(s);let c=i||s.size>0;return l!==c&&e(c),c};return r[t]=(n,a)=>o({onInheritedChange:l=>{if(n){if(a){l.add(n);return}l.delete(n)}}}),{setDirectState:n=>o({nextDirectActive:n}),isActive:()=>i||s.size>0,destroy:()=>{Ad({displayObject:r,symbol:t})}}},hn=r=>Ad({displayObject:r,symbol:oy}),Pd=r=>Ad({displayObject:r,symbol:ny}),Cd=r=>Ad({displayObject:r,symbol:ay}),Kr=({displayObject:r,onHoverChange:t})=>{let e=cy({displayObject:r,symbol:oy,onStateChange:t});return{setDirectHover:e.setDirectState,isHovering:e.isActive,destroy:e.destroy}},qi=({displayObject:r,onPressChange:t})=>{let e=cy({displayObject:r,symbol:ny,onStateChange:t});return{setDirectPress:e.setDirectState,isPressed:e.isActive,destroy:e.destroy}},Ki=({displayObject:r,onPressChange:t})=>{let e=cy({displayObject:r,symbol:ay,onStateChange:t});return{setDirectPress:e.setDirectState,isPressed:e.isActive,destroy:e.destroy}},hy=r=>r?.[XC]===!0,uy=r=>r?.[jC]===!0,dy=r=>r?.[YC]===!0,un=({root:r,isHovered:t})=>{if(!r)return;r[XC]=t;let e=[...cn(r)];for(;e.length>0;){let i=e.pop();ly({displayObject:i,symbol:oy,source:r,isActive:t}),e.push(...cn(i))}},Bs=({root:r,isPressed:t})=>{if(!r)return;r[jC]=t;let e=[...cn(r)];for(;e.length>0;){let i=e.pop();ly({displayObject:i,symbol:ny,source:r,isActive:t}),e.push(...cn(i))}},bi=({root:r,isPressed:t})=>{if(!r)return;r[YC]=t;let e=[...cn(r)];for(;e.length>0;){let i=e.pop();ly({displayObject:i,symbol:ay,source:r,isActive:t}),e.push(...cn(i))}};var qC=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=new Cr({label:e.id});c.zIndex=l,c.text=e.content,Yr(c,e.textStyle),wd(c,e),c.alpha=e.alpha,Ed(c,e);let h=e?.hover,u=e?.click,d=e?.rightClick,f=null,p=null,m=null,x=()=>{let _=f?.isHovering()??!1,T=p?.isPressed()??!1;(m?.isPressed()??!1)&&d?.textStyle?qr(c,e.textStyle,d.textStyle):T&&u?.textStyle?qr(c,e.textStyle,u.textStyle):_&&h?.textStyle?qr(c,e.textStyle,h.textStyle):qr(c,e.textStyle)};if(h){let{cursor:_,soundSrc:T,payload:g}=h;c.eventMode="static",f=Kr({displayObject:c,onHoverChange:x});let w=()=>{f.setDirectHover(!0),g&&s&&s("hover",{_event:{id:c.label},...g}),_&&(c.cursor=_),T&&r.audioStage.add({id:`hover-${Date.now()}`,url:T,loop:!1})},b=()=>{f.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",w),c.on("pointerout",b)}if(u){let{soundSrc:_,soundVolume:T,payload:g}=u;c.eventMode="static",p=qi({displayObject:c,onPressChange:x});let w=v=>{ie(v)&&p.setDirectPress(!0)},b=v=>{ie(v)&&(p.setDirectPress(!1),g&&s&&s("click",{_event:{id:c.label},...g}),_&&r.audioStage.add({id:`click-${Date.now()}`,url:_,loop:!1,volume:(T??1e3)/1e3}))},S=()=>{p.setDirectPress(!1)};c.on("pointerdown",w),c.on("pointerup",b),c.on("pointerupoutside",S)}if(d){let{soundSrc:_,payload:T}=d;c.eventMode="static",m=Ki({displayObject:c,onPressChange:x});let g=()=>{m.setDirectPress(!0)},w=()=>{m.setDirectPress(!1)},b=()=>{m.setDirectPress(!1),T&&s&&s("rightClick",{_event:{id:c.label},...T}),_&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:_,loop:!1})},S=()=>{m.setDirectPress(!1)};c.on("rightdown",g),c.on("rightup",w),c.on("rightclick",b),c.on("rightupoutside",S)}t.addChild(c),ot({animations:i,targetId:e.id,animationBus:o,completionTracker:n,element:c,targetState:{...Kl(e),alpha:e.alpha},renderContext:a})};var GU=Object.prototype.hasOwnProperty,gt=(r,t)=>{if(Object.is(r,t))return!0;if(r===null||t===null||typeof r!="object"||typeof t!="object")return!1;let e=Array.isArray(r),i=Array.isArray(t);if(e!==i)return!1;if(e&&i){if(r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!gt(r[n],t[n]))return!1;return!0}let s=Object.keys(r),o=Object.keys(t);if(s.length!==o.length)return!1;for(let n of s)if(!GU.call(t,n)||!gt(r[n],t[n]))return!1;return!0};var KC=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let c=t.children.find(f=>f.label===e.id);if(!c)return;c.zIndex=l;let{alpha:h}=i,u=()=>{if(!gt(e,i)){c.text=i.content,Yr(c,i.textStyle),wd(c,i),Ed(c,i),c.alpha=h,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerdown"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightdown"),c.removeAllListeners("rightclick"),c.removeAllListeners("rightup"),c.removeAllListeners("rightupoutside"),hn(c),Pd(c),Cd(c);let f=i?.hover,p=i?.click,m=i?.rightClick,x=null,_=null,T=null,g=()=>{let w=x?.isHovering()??!1,b=_?.isPressed()??!1;(T?.isPressed()??!1)&&m?.textStyle?qr(c,i.textStyle,m.textStyle):b&&p?.textStyle?qr(c,i.textStyle,p.textStyle):w&&f?.textStyle?qr(c,i.textStyle,f.textStyle):qr(c,i.textStyle)};if(f){let{cursor:w,soundSrc:b,payload:S}=f;c.eventMode="static",x=Kr({displayObject:c,onHoverChange:g});let v=()=>{x.setDirectHover(!0),S&&s&&s("hover",{_event:{id:c.label},...S}),w&&(c.cursor=w),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1})},A=()=>{x.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",v),c.on("pointerout",A)}if(p){let{soundSrc:w,soundVolume:b,payload:S}=p;c.eventMode="static",_=qi({displayObject:c,onPressChange:g});let v=C=>{ie(C)&&_.setDirectPress(!0)},A=C=>{ie(C)&&(_.setDirectPress(!1),S&&s&&s("click",{_event:{id:c.label},...S}),w&&r.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1,volume:(b??1e3)/1e3}))},P=()=>{_.setDirectPress(!1)};c.on("pointerdown",v),c.on("pointerup",A),c.on("pointerupoutside",P)}if(m){let{soundSrc:w,payload:b}=m;c.eventMode="static",T=Ki({displayObject:c,onPressChange:g});let S=()=>{T.setDirectPress(!0)},v=()=>{T.setDirectPress(!1)},A=()=>{T.setDirectPress(!1),b&&s&&s("rightClick",{_event:{id:c.label},...b}),w&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:w,loop:!1})},P=()=>{T.setDirectPress(!1)};c.on("rightdown",S),c.on("rightup",v),c.on("rightclick",A),c.on("rightupoutside",P)}}};ot({animations:o,targetId:e.id,animationBus:n,completionTracker:a,element:c,targetState:{...Kl(i),alpha:h},onComplete:()=>{u()}})||u()};var ZC=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var QC=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,l=t-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var ge=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(Is).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Is).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===Is.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=QC({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var JC=({state:r})=>{let t={...zt,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),typeof r.width=="number"&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let e=String(r.content??""),{width:i,height:s}=Lt.measureText(e,new It(t)),o=Math.round(i),n=Math.round(s),a=typeof r.width=="number"?Math.round(r.width):o,c={...ge({...r,width:a,height:n}),content:e,measuredWidth:o,textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}};return Object.defineProperties(c,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),c};var LU=Zt({type:"text",add:qC,update:KC,delete:ZC,parse:JC});var tR="__rtglRectScrollHandled",Rd=({canvas:r,rect:t,width:e,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1;t.eventMode="static",t.hitArea=new Q(0,0,Math.round(e),Math.round(i));let l=(f,p)=>{p?.[tR]||(p&&(p[tR]=!0),f<0&&s?.payload&&n?n("scrollUp",{_event:{id:t.label},...s.payload}):f>0&&o?.payload&&n&&n("scrollDown",{_event:{id:t.label},...o.payload}))},c=()=>{a=!0},h=()=>{a=!1},u=f=>{f.preventDefault?.(),l(f.deltaY,f.nativeEvent)},d=f=>{a&&(f.preventDefault(),l(f.deltaY,f))};t.on("pointerover",c),t.on("pointerout",h),t.on("wheel",u),r?.addEventListener("wheel",d,{passive:!1}),t._cleanupScrollInteraction=()=>{a=!1,t.off("pointerover",c),t.off("pointerout",h),t.off("wheel",u),r?.removeEventListener("wheel",d),t.hitArea=null,delete t._cleanupScrollInteraction}};var DU=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,eR=({app:r,parent:t,element:e,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:c,x:h,y:u,width:d,height:f,fill:p,border:m,alpha:x,scaleX:_,scaleY:T}=e,g=new Bt;g.label=c,g.zIndex=n;let w={x:h,y:u,alpha:x};_!==void 0&&(w.scaleX=_),T!==void 0&&(w.scaleY=T),(()=>{g.clear(),g.rect(0,0,Math.round(d),Math.round(f)).fill(DU(p)),g.x=Math.round(h),g.y=Math.round(u),g.alpha=x,g.scale.x=1,g.scale.y=1,m&&g.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)})})();let S=e?.hover,v=e?.click,A=e?.rightClick,P=e?.scrollUp,C=e?.scrollDown,R=e?.drag;if(S){let{cursor:M,soundSrc:I,payload:k}=S;g.eventMode="static";let W=()=>{k&&o&&o("hover",{_event:{id:g.label},...k}),M&&(g.cursor=M),I&&r.audioStage.add({id:`hover-${Date.now()}`,url:I,loop:!1})},O=()=>{g.cursor="auto"};g.on("pointerover",W),g.on("pointerout",O)}if(v){let{soundSrc:M,soundVolume:I,payload:k}=v;g.eventMode="static";let W=O=>{ie(O)&&(k&&o&&o("click",{_event:{id:g.label},...k}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1,volume:(I??1e3)/1e3}))};g.on("pointerup",W)}if(A){let{soundSrc:M,payload:I}=A;g.eventMode="static";let k=()=>{I&&o&&o("rightClick",{_event:{id:g.label},...I}),M&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:M,loop:!1})};g.on("rightclick",k)}if((P||C)&&Rd({canvas:r.canvas,rect:g,width:d,height:f,scrollUpEvent:P,scrollDownEvent:C,eventHandler:o}),R){let{start:M,end:I,move:k}=R;g.eventMode="static";let W=()=>{g._isDragging=!0,M&&o&&o("dragStart",{_event:{id:g.label},...typeof M?.payload=="object"?M.payload:{}})},O=()=>{g._isDragging=!1,I&&o&&o("dragEnd",{_event:{id:g.label},...typeof I?.payload=="object"?I.payload:{}})},z=V=>{k&&o&&g._isDragging&&o("dragMove",{_event:{id:g.label,x:V.global.x,y:V.global.y},...typeof k?.payload=="object"?k.payload:{}})};g.on("pointerdown",W),g.on("pointerup",O),g.on("globalpointermove",z),g.on("pointerupoutside",O)}t.addChild(g),ot({animations:i,targetId:c,animationBus:s,completionTracker:a,element:g,targetState:w,renderContext:l})};var NU=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,rR=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=t.children.find(S=>S.label===e.id);if(!c)return;c.zIndex=a;let{x:h,y:u,width:d,height:f,fill:p,border:m,alpha:x,scaleX:_,scaleY:T}=i,g={x:h,y:u,alpha:x};_!==void 0&&(g.scaleX=_),T!==void 0&&(g.scaleY=T);let w=()=>{if(!gt(e,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(d),Math.round(f)).fill(NU(p)),c.x=Math.round(h),c.y=Math.round(u),c.alpha=x,c.scale.x=1,c.scale.y=1,m&&c.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)}),c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightclick"),c.removeAllListeners("wheel"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove"),c.removeAllListeners("pointerupoutside");let S=i?.hover,v=i?.click,A=i?.rightClick,P=i?.scrollUp,C=i?.scrollDown,R=i?.drag;if(S){let{cursor:M,soundSrc:I,payload:k}=S;c.eventMode="static";let W=()=>{k&&n&&n("hover",{_event:{id:c.label},...k}),M&&(c.cursor=M),I&&r.audioStage.add({id:`hover-${Date.now()}`,url:I,loop:!1})},O=()=>{c.cursor="auto"};c.on("pointerover",W),c.on("pointerout",O)}if(v){let{soundSrc:M,soundVolume:I,payload:k}=v;c.eventMode="static";let W=O=>{ie(O)&&(k&&n&&n("click",{_event:{id:c.label},...k}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1,volume:(I??1e3)/1e3}))};c.on("pointerup",W)}if(A){let{soundSrc:M,payload:I}=A;c.eventMode="static";let k=()=>{I&&n&&n("rightClick",{_event:{id:c.label},...I}),M&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:M,loop:!1})};c.on("rightclick",k)}if((P||C)&&Rd({canvas:r.canvas,rect:c,width:d,height:f,scrollUpEvent:P,scrollDownEvent:C,eventHandler:n}),R){let{start:M,end:I,move:k}=R;c.eventMode="static";let W=()=>{c._isDragging=!0,M&&n&&n("dragStart",{_event:{id:c.label},...typeof M?.payload=="object"?M.payload:{}})},O=()=>{c._isDragging=!1,I&&n&&n("dragEnd",{_event:{id:c.label},...typeof I?.payload=="object"?I.payload:{}})},z=V=>{k&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:V.global.x,y:V.global.y},...typeof k?.payload=="object"?k.payload:{}})};c.on("pointerdown",W),c.on("pointerup",O),c.on("globalpointermove",z),c.on("pointerupoutside",O)}}};ot({animations:s,targetId:e.id,animationBus:o,completionTracker:l,element:c,targetState:g,onComplete:()=>{w()}})||w()};var iR=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var sR=({state:r})=>{let t=ge(r),e=r.border?.width,i=t;return typeof e=="number"&&e>0&&(i={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:e}}),{...i,...r.fill!==void 0?{fill:r.fill}:{},...r.scaleX!==void 0?{scaleX:r.scaleX}:{},...r.scaleY!==void 0?{scaleY:r.scaleY}:{},rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}}};var HU=Zt({type:"rect",add:eR,update:rR,delete:iR,parse:sR});var oR=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:c,x:h,y:u,width:d,height:f,src:p,alpha:m}=e,x=p?B.from(p):B.EMPTY,_=new wt(x);_.label=c,_.zIndex=l,_.x=Math.round(h),_.y=Math.round(u),_.width=Math.round(d),_.height=Math.round(f),_.alpha=m;let T=e?.hover,g=e?.click,w=e?.rightClick,b=null,S=null,v=null,A=()=>{let P=b?.isHovering()??!1,C=S?.isPressed()??!1;if((v?.isPressed()??!1)&&w?.src){let M=B.from(w.src);_.texture=M}else if(C&&g?.src){let M=B.from(g.src);_.texture=M}else if(P&&T?.src){let M=B.from(T.src);_.texture=M}else _.texture=x};if(T){let{cursor:P,soundSrc:C,payload:R}=T;_.eventMode="static",b=Kr({displayObject:_,onHoverChange:A});let M=()=>{b.setDirectHover(!0),R&&s&&s("hover",{_event:{id:_.label},...R}),P&&(_.cursor=P),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1})},I=()=>{b.setDirectHover(!1),_.cursor="auto"};_.on("pointerover",M),_.on("pointerout",I)}if(g){let{soundSrc:P,soundVolume:C,payload:R}=g;_.eventMode="static",S=qi({displayObject:_,onPressChange:A});let M=W=>{ie(W)&&S.setDirectPress(!0)},I=W=>{ie(W)&&(S.setDirectPress(!1),R&&s&&s("click",{_event:{id:_.label},...R}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:(C??1e3)/1e3}))},k=()=>{S.setDirectPress(!1)};_.on("pointerdown",M),_.on("pointerup",I),_.on("pointerupoutside",k)}if(w){let{soundSrc:P,payload:C}=w;_.eventMode="static",v=Ki({displayObject:_,onPressChange:A});let R=()=>{v.setDirectPress(!0)},M=()=>{v.setDirectPress(!1)},I=()=>{v.setDirectPress(!1),C&&s&&s("rightClick",{_event:{id:_.label},...C}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})},k=()=>{v.setDirectPress(!1)};_.on("rightdown",R),_.on("rightup",M),_.on("rightclick",I),_.on("rightupoutside",k)}t.addChild(_),ot({animations:i,targetId:c,animationBus:o,completionTracker:n,element:_,targetState:{x:h,y:u,width:d,height:f,alpha:m},renderContext:a})};var nR=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=t.children.find(g=>g.label===e.id);if(!c)return;c.zIndex=l;let{id:h,x:u,y:d,width:f,height:p,src:m,alpha:x}=i,_=()=>{if(!gt(e,i)){let g=m?B.from(m):B.EMPTY;c.texture=g,c.x=Math.round(u),c.y=Math.round(d),c.width=Math.round(f),c.height=Math.round(p),c.alpha=x,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerdown"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightdown"),c.removeAllListeners("rightclick"),c.removeAllListeners("rightup"),c.removeAllListeners("rightupoutside"),hn(c),Pd(c),Cd(c);let w=i?.hover,b=i?.click,S=i?.rightClick,v=null,A=null,P=null,C=()=>{let R=v?.isHovering()??!1,M=A?.isPressed()??!1;if((P?.isPressed()??!1)&&S?.src){let k=B.from(S.src);c.texture=k}else if(M&&b?.src){let k=B.from(b.src);c.texture=k}else if(R&&w?.src){let k=B.from(w.src);c.texture=k}else c.texture=g};if(w){let{cursor:R,soundSrc:M,payload:I}=w;c.eventMode="static",v=Kr({displayObject:c,onHoverChange:C});let k=()=>{v.setDirectHover(!0),I&&a&&a("hover",{_event:{id:c.label},...I}),R&&(c.cursor=R),M&&r.audioStage.add({id:`hover-${Date.now()}`,url:M,loop:!1})},W=()=>{v.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",k),c.on("pointerout",W)}if(b){let{soundSrc:R,soundVolume:M,payload:I}=b;c.eventMode="static",A=qi({displayObject:c,onPressChange:C});let k=z=>{ie(z)&&A.setDirectPress(!0)},W=z=>{ie(z)&&(A.setDirectPress(!1),I&&a&&a("click",{_event:{id:c.label},...I}),R&&r.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:(M??1e3)/1e3}))},O=()=>{A.setDirectPress(!1)};c.on("pointerdown",k),c.on("pointerup",W),c.on("pointerupoutside",O)}if(S){let{soundSrc:R,payload:M}=S;c.eventMode="static",P=Ki({displayObject:c,onPressChange:C});let I=()=>{P.setDirectPress(!0)},k=()=>{P.setDirectPress(!1)},W=()=>{P.setDirectPress(!1),M&&a&&a("rightClick",{_event:{id:c.label},...M}),R&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})},O=()=>{P.setDirectPress(!1)};c.on("rightdown",I),c.on("rightup",k),c.on("rightclick",W),c.on("rightupoutside",O)}}};ot({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:c,targetState:{x:u,y:d,width:f,height:p,alpha:x},onComplete:()=>{_()}})||_()};var aR=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===t.id);if(!o)return;ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var lR=({state:r})=>({...ge(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var VU=Zt({type:"sprite",add:oR,update:nR,delete:aR,parse:lR});var WU=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,fy=({videoElement:r,video:t})=>{t&&r?._videoEndedListener&&t.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},Md=({videoElement:r,video:t,loop:e,completionTracker:i})=>{if(fy({videoElement:r,video:t}),(e??!1)||WU(t))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};t.addEventListener("ended",o),r._videoEndedListener=o,r._playbackStateVersion=s};var cR=({parent:r,element:t,renderContext:e,completionTracker:i,zIndex:s})=>{let{id:o,x:n,y:a,width:l,height:c,src:h,volume:u,loop:d,alpha:f}=t,p=B.from(h),m=p.source.resource;m.pause(),m.currentTime=0,m.loop=d??!1,m.volume=u/1e3,m.muted=!1;let x=new wt(p);x.label=o,x.zIndex=s,x._videoEndedListener=void 0,x._playbackStateVersion=null,x.x=Math.round(n),x.y=Math.round(a),x.width=Math.round(l),x.height=Math.round(c),x.alpha=f??1,Md({videoElement:x,video:m,loop:d,completionTracker:i}),OC(e,m),r.addChild(x)};var hR=({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=r.children.find(x=>x.label===t.id);if(!l)return;l.zIndex=a;let{x:c,y:h,width:u,height:d,alpha:f}=e,p=()=>{if(!gt(t,e)){l.x=Math.round(c),l.y=Math.round(h),l.width=Math.round(u),l.height=Math.round(d),l.alpha=f??1;let x=l.texture.source.resource;if(t.src!==e.src){let _=x;fy({videoElement:l,video:_}),_&&_.pause();let T=B.from(e.src);l.texture=T,x=T.source.resource,x.muted=!1,x.pause(),x.currentTime=0}Md({videoElement:l,video:x,loop:e.loop,completionTracker:n}),x.volume=e.volume/1e3,x.loop=e.loop??!1,t.src!==e.src&&x.play()}};ot({animations:i,targetId:t.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:h,width:u,height:d,alpha:f??1},onComplete:p})||p()};var uR=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(l=>l.label===t.id);if(!o)return;let n=()=>{if(o&&!o.destroyed){o._playbackStateVersion!==null&&s.complete(o._playbackStateVersion);let l=o.texture.source.resource;l&&(o._videoEndedListener&&l.removeEventListener("ended",o._videoEndedListener),l.pause()),r.removeChild(o),o.destroy()}};ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var dR=({state:r})=>({...ge(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var zU=Zt({type:"video",add:cR,update:hR,delete:uR,parse:dR});var fR=0,pR=16,$U=(r,t)=>r!==null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,t),my=r=>Math.max(0,Math.min(1,r)),Fs=r=>r?B.from(r):B.EMPTY,dn=r=>({bar:`${r}-bar`,inactiveBar:`${r}-inactive-bar`,barMask:`${r}-bar-mask`,thumb:`${r}-thumb`}),gR=({sliderContainer:r,fromId:t,toId:e})=>{if(t===e)return;let i=dn(t),s=dn(e);for(let[o,n]of Object.entries(i)){let a=r.getChildByLabel(n);a&&(a.label=s[o])}},fn=({sliderContainer:r,id:t})=>{let e=dn(t);return{bar:r.getChildByLabel(e.bar),inactiveBar:r.getChildByLabel(e.inactiveBar),barMask:r.getChildByLabel(e.barMask),thumb:r.getChildByLabel(e.thumb)}},py=({baseValue:r,override:t,key:e})=>$U(t,e)?t[e]??"":r??"",XU=(r,t=null)=>({thumbSrc:py({baseValue:r.thumbSrc,override:t,key:"thumbSrc"}),barSrc:py({baseValue:r.barSrc,override:t,key:"barSrc"}),inactiveBarSrc:py({baseValue:r.inactiveBarSrc,override:t,key:"inactiveBarSrc"})}),jU=r=>{let t=new wt(B.EMPTY);return t.label=r,t.eventMode="static",t.zIndex=0,t},YU=r=>{let t=new Bt;return t.label=r,t.zIndex=0,t},qU=({sliderContainer:r,id:t,bar:e})=>{let i=dn(t),{inactiveBar:s,barMask:o}=fn({sliderContainer:r,id:t});return s||(s=jU(i.inactiveBar),r.addChild(s)),o||(o=YU(i.barMask),r.addChild(o)),e.mask=o,{inactiveBar:s,barMask:o}},KU=({sliderContainer:r,id:t,bar:e})=>{let{inactiveBar:i,barMask:s}=fn({sliderContainer:r,id:t});e?.mask===s&&(e.mask=null),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy())},xR=({currentValue:r,min:t,max:e})=>{let i=e-t;return i<=0?0:my((r-t)/i)},ZU=({barMask:r,direction:t,width:e,height:i,currentValue:s,min:o,max:n})=>{if(!r)return;let a=xR({currentValue:s,min:o,max:n}),l=Math.round(t==="horizontal"?e*a:e),c=Math.round(t==="horizontal"?i:i*a);r.clear(),!(l<=0||c<=0)&&r.rect(0,0,l,c).fill({color:16777215,alpha:0})},QU=({thumb:r,direction:t,currentValue:e,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=xR({currentValue:e,min:i,max:s});if(t==="horizontal"){r.x=a*(o-r.width),r.y=(n-r.height)/2;return}r.x=(o-r.width)/2,r.y=a*(n-r.height)},Id=({thumb:r,thumbSrc:t,direction:e,trackWidth:i,trackHeight:s})=>{let o=e==="horizontal"?s-fR*2:i-fR*2,n=Fs(t),a=n.width||pR,l=n.height||pR,c=o/a,h=o/l,u=Math.min(c,h);r.width=a*u,r.height=l*u},Zl=({sliderContainer:r,sliderComputedNode:t,thumb:e,currentValue:i,hoverOverride:s=null})=>{let{id:o,width:n,height:a,direction:l,min:c,max:h}=t,{barSrc:u,inactiveBarSrc:d,thumbSrc:f}=XU(t,s),{bar:p}=fn({sliderContainer:r,id:o});if(p){if(p.texture=Fs(u),p.width=n,p.height=a,e.texture=Fs(f),d){let{inactiveBar:m,barMask:x}=qU({sliderContainer:r,id:o,bar:p});m.texture=Fs(d),m.width=n,m.height=a,ZU({barMask:x,direction:l,width:n,height:a,currentValue:i,min:c,max:h})}else KU({sliderContainer:r,id:o,bar:p});QU({thumb:e,direction:l,currentValue:i,min:c,max:h,trackWidth:n,trackHeight:a})}},JU=({position:r,thumb:t,direction:e,min:i,max:s,step:o,trackWidth:n,trackHeight:a})=>{let l=s-i,c;if(e==="horizontal"){let u=r.x-t.width/2,d=Math.max(n-t.width,1);c=my(u/d)}else{let u=r.y-t.height/2,d=Math.max(a-t.height,1);c=my(u/d)}let h=i+c*l;return o>0&&(h=Math.round((h-i)/o)*o+i,h=Math.max(i,Math.min(s,h))),h},mR=({sliderContainer:r,sliderComputedNode:t,cursor:e})=>{let i=e??"auto",{bar:s,inactiveBar:o,thumb:n}=fn({sliderContainer:r,id:t.id});r.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},Bd=({app:r,sliderContainer:t,sliderComputedNode:e,thumb:i,eventHandler:s})=>{hn(t);let{id:o,hover:n,change:a,min:l,max:c,step:h,direction:u,initialValue:d,width:f,height:p}=e,m=d??l,x=!1,_=null,T=()=>{Zl({sliderContainer:t,sliderComputedNode:e,thumb:i,currentValue:m,hoverOverride:_?.isHovering()?n:null})},g=P=>{let C=t.toLocal(P.global),R=JU({position:C,thumb:i,direction:u,min:l,max:c,step:h,trackWidth:f,trackHeight:p});R!==m&&(m=R,T(),a?.payload&&s&&s("change",{_event:{id:o,value:m},...a.payload}))},w=P=>{x=!0,g(P)},b=P=>{x&&g(P)},S=()=>{x&&(x=!1)};if(t.on("pointerdown",w),t.on("globalpointermove",b),t.on("pointerup",S),t.on("pointerupoutside",S),!n)return;_=Kr({displayObject:t,onHoverChange:T});let v=()=>{_.setDirectHover(!0),T(),mR({sliderContainer:t,sliderComputedNode:e,cursor:n.cursor}),n.soundSrc&&r.audioStage.add({id:`hover-${Date.now()}`,url:n.soundSrc,loop:!1})},A=()=>{x||(_.setDirectHover(!1),T(),mR({sliderContainer:t,sliderComputedNode:e,cursor:null}))};t.on("pointerover",v),t.on("pointerout",A),t.on("pointerupoutside",A)};var yR=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{let{id:c,x:h,y:u,width:d,height:f,alpha:p,thumbSrc:m,barSrc:x,initialValue:_,min:T}=e,g=new rt;g.label=c,g.zIndex=l,g.x=h,g.y=u,g.alpha=p,g.sortableChildren=!0,g.eventMode="static";let w=dn(c),b=new wt(Fs(x));b.label=w.bar,b.eventMode="static",b.zIndex=1;let S=new wt(Fs(m));S.label=w.thumb,S.eventMode="static",S.zIndex=2;let v=_??T;Id({thumb:S,thumbSrc:m,direction:e.direction,trackWidth:d,trackHeight:f}),g.addChild(b),g.addChild(S),Zl({sliderContainer:g,sliderComputedNode:e,thumb:S,currentValue:v}),Bd({app:r,sliderContainer:g,sliderComputedNode:e,thumb:S,eventHandler:n}),t.addChild(g),ot({animations:i,targetId:c,animationBus:s,completionTracker:o,element:g,targetState:{x:h,y:u,alpha:p},renderContext:a})};var _R=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=t.children.find(m=>m.label===e.id);if(!c)return;c.zIndex=l;let h=()=>{if(!gt(e,i)){c.x=i.x,c.y=i.y,c.alpha=i.alpha,c.label=i.id,c.pivot.set(i.originX,i.originY),gR({sliderContainer:c,fromId:e.id,toId:i.id});let{bar:m,thumb:x}=fn({sliderContainer:c,id:i.id}),_=!gt(e.hover,i.hover)||!gt(e.change,i.change)||e.min!==i.min||e.max!==i.max||e.step!==i.step||e.direction!==i.direction||e.initialValue!==i.initialValue||e.thumbSrc!==i.thumbSrc||e.barSrc!==i.barSrc||e.inactiveBarSrc!==i.inactiveBarSrc||e.width!==i.width||e.height!==i.height||e.id!==i.id;if(m&&x&&(Id({thumb:x,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),Zl({sliderContainer:c,sliderComputedNode:i,thumb:x,currentValue:i.initialValue})),!m||!x)return;_&&(c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove")),_&&Bd({app:r,sliderContainer:c,sliderComputedNode:i,thumb:x,eventHandler:a})}},{x:u,y:d,alpha:f}=i;ot({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:c,targetState:{x:u,y:d,alpha:f},onComplete:h})||h()};var bR=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};ot({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var vR=({state:r})=>{let t=ge(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValue<e||r.initialValue>i)throw new Error("Input error: slider initialValue must be between min and max");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",...r.inactiveBarSrc!==void 0&&{inactiveBarSrc:r.inactiveBarSrc??""},alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var tG=Zt({type:"slider",add:yR,update:_R,delete:bR,parse:vR});var gn=Symbol("routeGraphicsInputRuntime"),Fd={top:10,right:12,bottom:10,left:12},pn={fill:"#FFFFFF",fillAlpha:1,strokeColor:"#2E2E2E",strokeWidth:1,strokeAlpha:1},kd={strokeColor:"#4A89FF",strokeWidth:2,strokeAlpha:1},TR={fill:"#4A89FF",alpha:.3},gy={fill:"#111111",width:2},eG=(r={})=>{let t=r.fontSize??zt.fontSize,e=r.lineHeight??zt.lineHeight;return typeof e!="number"?Math.round(t*zt.lineHeight):e>8?Math.round(e):Math.round(t*e)},Ld=(r={},t={})=>({...zt,...r,align:r.align??"left",lineHeight:eG(r),wordWrap:!1,breakWords:!1,wordWrapWidth:t.wordWrapWidth??0,whiteSpace:"pre"}),xy=r=>typeof r=="number"?{top:r,right:r,bottom:r,left:r}:Array.isArray(r)?{top:r[0]??0,right:r[1]??r[0]??0,bottom:r[2]??r[0]??0,left:r[3]??r[1]??r[0]??0}:{top:r?.top??Fd.top,right:r?.right??Fd.right,bottom:r?.bottom??Fd.bottom,left:r?.left??Fd.left},mn=r=>String(r??"").replace(/\r\n/g,`
1144
+ `,an=null,$l=class{constructor(){an||(an=URL.createObjectURL(new Blob([cU],{type:"application/javascript"}))),this.worker=new Worker(an)}};$l.revokeObjectURL=function(){an&&(URL.revokeObjectURL(an),an=null)};var bC=0,qx,Kx=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 nn;e.addEventListener("message",i=>{e.terminate(),nn.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){qx===void 0&&(qx=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<qx&&(this._createdWorkers++,t=new $l().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 i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[bC]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:bC++,id:i})}},Zx=new Kx;Ui();var hU=[".jpeg",".jpg",".png",".webp",".avif"],uU=["image/jpeg","image/png","image/webp","image/avif"];async function dU(r,t){let e=await j.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var ld={name:"loadTextures",extension:{type:E.LoadParser,priority:Oe.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return pr(r,uU)||mr(r,hU)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Zx.isImageBitmapSupported()?i=await Zx.loadImageBitmap(r,t):i=await dU(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new ze({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||rn(r),...t.data});return sn(s,e,r)},unload(r){r.destroy(!0)}};F();dm();um();var vC=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],fU=vC.map(r=>`video/${r.substring(1)}`);function pU(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=gU(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function mU(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function gU(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var TC={name:"loadVideo",extension:{type:E.LoadParser,name:"loadVideo"},test(r){let t=pr(r,fU),e=mr(r,vC);return t||e},async load(r,t,e){let i={...yo.defaultOptions,resolution:t.data?.resolution||rn(r),alphaMode:t.data?.alphaMode||await Uh(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let c=o[l];c!==void 0&&s.setAttribute(l,c)}),i.muted===!0&&(s.muted=!0),pU(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=yo.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let c=async()=>{let h=new yo({...i,resource:s});s.removeEventListener("canplay",c),t.data.preload&&await mU(s),l(sn(h,e,r))};s.addEventListener("canplay",c),s.appendChild(n)})},unload(r){r.destroy(!0)}};F();mo();F();mo();var cd={extension:{type:E.ResolveParser,name:"resolveTexture"},test:ld.test,parse:r=>({resolution:parseFloat(Je.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var SC={extension:{type:E.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Je.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:cd.parse};mo();da();Ih();var hd=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Je,this.loader=new ad,this.cache=bt,this._backgroundLoader=new od(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){N("[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,i=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:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=ys(t),s=Ue(t).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(c=>!this.resolver.hasKey(c))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,l=0,c=()=>{e?.(++a/l)},h=n.map(u=>{let d=s[u];return l+=Object.keys(d).length,this._mapLoadToResolve(d,c).then(f=>{o[u]=f})});return await Promise.all(h),i?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(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return bt.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=bt.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(c=>{o[c]=a}),bt.set(l,a)}),o}async unload(t){this._initialized||await this.init();let e=Ue(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Ue(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{bt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},gr=new hd;D.handleByList(E.LoadParser,gr.loader.parsers).handleByList(E.ResolveParser,gr.resolver.parsers).handleByList(E.CacheParser,gr.cache.parsers).handleByList(E.DetectionParser,gr.detections);D.add(lC,uC,cC,mC,dC,fC,pC,gC,xC,yC,_C,ld,TC,aC,nC,cd,SC);var wC={loader:E.LoadParser,resolver:E.ResolveParser,cache:E.CacheParser,detection:E.DetectionParser};D.handle(E.Asset,r=>{let t=r.ref;Object.entries(wC).filter(([e])=>!!t[e]).forEach(([e,i])=>D.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(wC).filter(e=>!!t[e]).forEach(e=>D.remove(t[e]))});_t();aa();po();ma();var Xl=class r extends wt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:c=null,textures:h,updateAnchor:u=!1,...d}=e,[f]=h;super({...d,texture:f instanceof B?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=l,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=h,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(le.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(le.shared.add(this.update,this,Or.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(B.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(B.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof B)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(le.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(le.shared.add(this.update,this),this._isConnectedToTicker=!0))}};dh();Ht();Mh();var ud=class extends Oi{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:c,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new be({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=c??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}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,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}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 EC(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&(X(tt,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}La();Ps();var Cr=class extends ud{constructor(...t){let e=EC(t,"Text");super(e,It),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=kt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ft();ae();dx();_t();Uu();mm();Sr();Ig();ma();La();Ps();nm();Ae();var xU=ls(Jh(),1);D.add(kE,UE);var yU=new(window.AudioContext||window.webkitAudioContext),Qx={},_U=async(r,t)=>{if(!Qx[r]&&t.byteLength!==0)try{let e=await yU.decodeAudioData(t);Qx[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},bU=r=>Qx[r],ln={load:_U,getAsset:bU};var Zt=({type:r,add:t,update:e,delete:i,parse:s,shouldUpdateUnchanged:o})=>({type:r,add:t,update:e,delete:i,parse:s,shouldUpdateUnchanged:o});var Jx=({type:r})=>({type:r});var ty=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var dd={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"};var fd={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var Is={RECT:"rect",TEXT:"text",INPUT:"input",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var zt={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var Yr=(r,t)=>{let e={fill:t?.fill??zt.fill,fontFamily:t?.fontFamily??zt.fontFamily,fontSize:t?.fontSize??zt.fontSize,align:t?.align??zt.align,lineHeight:t?.lineHeight??zt.lineHeight,wordWrap:t?.wordWrap??zt.wordWrap,breakWords:t?.breakWords??zt.breakWords,strokeColor:t?.strokeColor??zt.strokeColor,strokeWidth:t?.strokeWidth??zt.strokeWidth,wordWrapWidth:t?.wordWrapWidth??zt.wordWrapWidth};r.style=e};var vU=(r,t)=>typeof t!="string"?t:r[t]??t,TU=(r,t,e,i)=>{let s=vU(e,t);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},AC=(r,t,e=fd)=>{for(let i of t)for(let[s,o]of Object.entries(i.tween)){if(!dd[s])throw new Error(`${s} is not a supported property for animation.`);o.initialValue!==void 0&&TU(r,s,e,o.initialValue)}},pd=({animations:r,animationBus:t,completionTracker:e,element:i,targetState:s,onComplete:o})=>{for(let n of r){for(let[l,c]of Object.entries(n.tween))if(c.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,l)))throw new Error(`Animation "${n.id}" cannot auto-resolve property "${l}" from targetState.`);let a=e.getVersion();e.track(a),t.dispatch({type:"START",payload:{id:n.id,element:i,properties:n.tween,targetState:s,onComplete:()=>{e.complete(a),o?.(n)}}})}};function md(r,t){let e=r.text.substring(0,t),s=kt.measureText(e,r.style).width;return r.x+s}var SU=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&t?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),e()},r);s=()=>{clearTimeout(n),o(),i(t.reason)},t?.addEventListener("abort",s,{once:!0})}),ey=SU;var yi=Symbol("textRevealRuntime"),yd=Symbol("textRevealSnapshot"),wU=18,EU=64,AU=1.25,CC=r=>typeof r=="number"&&r>0?r:1,PU=r=>{let t=new wt(B.EMPTY);if(r?.indicator?.revealing?.src){let e=B.from(r.indicator.revealing.src);t=new wt(e),t.width=r.indicator.revealing.width??e.width,t.height=r.indicator.revealing.height??e.height}return t},jl=(r,t)=>{if(!t?.indicator?.complete?.src)return;let e=B.from(t.indicator.complete.src);r.texture=e,r.width=t.indicator.complete.width??e.width,r.height=t.indicator.complete.height??e.height},Yl=(r,t,e)=>{r.x=e,r.y=t?t.y+(t.lineMaxHeight-r.height):0},xd=(r,t,e)=>{if(!t||t.text.length===0){r.x=e;return}r.x=md(t,t.text.length-1)+e},CU=(r,t)=>{if(r[yi]){let e=r[yi];delete r[yi],e()}r[yi]=t},RU=r=>r?.[yd]??null,gd=(r,t)=>r?t?(r[yd]=t,t):(delete r[yd],null):null,RC=r=>{let t=RU(r);return!t||t.mode!=="typewriter"||t.completed===!0?null:t},MC=r=>!!RC(r),ry=r=>{if(r[yi]){let e=r[yi];delete r[yi],e()}delete r[yd],r.onRender=void 0,r.removeChildren().forEach(e=>{e.destroy({children:!0})})},IC=(r,t="",e="")=>{let i=new It(r.textStyle),s=new Cr({text:t,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new It(r.furigana.textStyle);o=new Cr({text:e,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},BC=(r,t)=>{let e=null,i=null,s=0,o=0,n=[];for(let a=0;a<t.content.length;a++){let l=t.content[a],c=new rt({label:`${t.id}-line-${a}`}),h=[],u=null,d=0;r.addChild(c),i=l,o=Math.max(o,l.lineMaxHeight??0);for(let f=0;f<l.lineParts.length;f++){let p=l.lineParts[f],{text:m,furiganaText:x}=IC(p,p.text,p.furigana?.text||"");x&&(c.addChild(x),h.push(x)),c.addChild(m),h.push(m),e=m,u=m,s+=p.text.length,d+=p.text.length}if(h.length>0){let f=c.getLocalBounds();n.push({chunk:l,container:c,lastTextObject:u,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else c.destroy()}return{lines:n,lastTextObject:e,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:r.getLocalBounds()}},PC=({contentContainer:r,indicatorSprite:t,element:e})=>{let i=e?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=BC(r,e);Yl(t,o,i),xd(t,s,i),jl(t,e)},MU=({indicatorSprite:r,element:t})=>{let e=t?.indicator?.offset??12,i=t.content[0]??null;Yl(r,i,e)},IU=async({contentContainer:r,indicatorSprite:t,element:e,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=CC(e.speed??50),a=e?.indicator?.offset??12,l=Math.max(1,Math.floor(1e3/n)),c=Math.max(1,Math.floor(4e3/n)),h=Math.max(0,Math.floor(s));o&&(o.revealedCharacters=h,o.completed=!1);for(let u=0;u<e.content.length;u++){if(i?.aborted||r.destroyed)return!1;let d=e.content[u],f=!1;Yl(t,d,a);for(let p=0;p<d.lineParts.length;p++){if(i?.aborted||r.destroyed)return!1;let m=d.lineParts[p],{text:x,furiganaText:_}=IC(m);_&&r.addChild(_),r.addChild(x);let T=m.text,g=m.furigana?.text||"",w=g.length,b=Math.min(T.length,h),S=T.length>0?Math.round(b/T.length*w):0;x.text=T.substring(0,b),_&&(_.text=g.substring(0,S)),h-=b,b>0&&(t.x=md(x,b-1)+a);for(let v=b;v<T.length;v++){if(i?.aborted||r.destroyed)return!1;if(x.text=T.substring(0,v+1),t.x=md(x,v)+a,f=!0,o&&(o.revealedCharacters+=1),_){let P=Math.round((v+1)/T.length*w);_.text=g.substring(0,P)}v<T.length-1&&await ey(l,i)}}u<e.content.length-1&&f&&await ey(c,i)}return jl(t,e),o&&(o.completed=!0),!0},BU=({container:r,contentContainer:t,indicatorSprite:e,element:i,animationBus:s,completionTracker:o})=>{let n=i?.indicator?.offset??12,a=CC(i.speed??50),{lines:l,lastTextObject:c,lastChunk:h,totalCharacters:u,maxLineHeight:d,bounds:f}=BC(t,i);if(Yl(e,h,n),l.length===0||u===0||!l.some(A=>A.bounds.width>0&&A.bounds.height>0)||!globalThis.document||!s)return xd(e,c,n),jl(e,i),!1;let p=Math.max(wU,Math.min(EU,Math.round(d*AU))),m=Math.max(1,Math.round(u/a*1e3)),x=l.map(A=>{let R=Math.max(1,A.totalCharacters),M=1+p/Math.max(1,A.bounds.width);return R*M}),_=x.reduce((A,R)=>A+R,0),T=[],g=0;for(let A=0;A<l.length;A++){let R=x[A],M=_>0?g/_:0;g+=R,T.push({...l[A],startProgress:M,endProgress:_>0?g/_:1})}let w=o.getVersion(),b=`${i.id}-soft-wipe`,S=T.map(A=>{let R=document.createElement("canvas");R.width=Math.max(1,Math.ceil(A.bounds.width+p)),R.height=Math.max(1,Math.ceil(A.bounds.height));let M=R.getContext("2d");if(!M)return null;let I=Ms(R),k=new wt(I);return k.x=Math.floor(A.bounds.x-p),k.y=Math.floor(A.bounds.y),A.container.mask=k,t.addChild(k),{canvas:R,context:M,texture:I,sprite:k,line:A}});if(S.some(A=>A===null))return S.forEach(A=>{A&&(A.line.container.mask===A.sprite&&(A.line.container.mask=null),A.sprite.parent&&A.sprite.parent.removeChild(A.sprite),A.sprite.destroy(),A.texture.destroy(!0))}),xd(e,c,n),jl(e,i),!1;let v=!1,P=A=>{v||(v=!0,r[yi]===C&&delete r[yi],S.forEach(R=>{R.line.container.mask===R.sprite&&(R.line.container.mask=null),R.sprite.parent&&R.sprite.parent.removeChild(R.sprite),R.sprite.destroy(),R.texture.destroy(!0)}),A&&(xd(e,c,n),jl(e,i)))},C=()=>{s.dispatch({type:"CANCEL",id:b}),P(!1)};return CU(r,C),o.track(w),s.dispatch({type:"START",payload:{id:b,driver:"custom",duration:m,applyFrame:A=>{let R=m>0?Math.min(A/m,1):1,M=T[0],I=0;for(let k=0;k<T.length;k++){let W=T[k],O=S[k],z=Math.max(1e-6,W.endProgress-W.startProgress),V=Math.max(0,Math.min((R-W.startProgress)/z,1)),{context:G,canvas:it,texture:yt}=O;if(G.clearRect(0,0,it.width,it.height),V<=0){yt.source.update();continue}let dt=p,Ut=0,Xt=W.bounds.width+p,Nt=dt+V*Xt,te=Math.max(dt,Nt-p);te>dt&&(G.fillStyle="#ffffff",G.fillRect(dt,Ut,Math.min(te-dt,W.bounds.width),W.bounds.height));let de=Math.max(dt,Nt-p),Se=Math.min(dt+W.bounds.width,Nt);if(Se>de){let Ft=G.createLinearGradient(de,0,Se,0);Ft.addColorStop(0,"rgba(255, 255, 255, 1)"),Ft.addColorStop(1,"rgba(255, 255, 255, 0)"),G.fillStyle=Ft,G.fillRect(de,Ut,Se-de,W.bounds.height)}yt.source.update(),(V<1||k===T.length-1)&&(M=W,I=Math.min(1,(Nt-dt)/Math.max(1,W.bounds.width)))}Yl(e,M.chunk,n),e.x=M.bounds.x+Math.min(M.bounds.width,M.bounds.width*I)+n},applyTargetState:()=>{P(!1)},onComplete:()=>{o.complete(w),P(!0)},onCancel:()=>{o.complete(w),P(!1)},isValid:()=>!!r&&!r.destroyed&&!t.destroyed&&!e.destroyed}}),!0},_i=async({container:r,element:t,completionTracker:e,animationBus:i,zIndex:s,signal:o,playback:n="autoplay"})=>{if(o?.aborted||r.destroyed)return;let a=n==="resume"?RC(r):null;if(n==="resume"&&!a)return;ry(r),r.zIndex=s;let l=new rt({label:`${t.id}-content`}),c=PU(t);r.addChild(l),r.addChild(c);try{if(n==="paused-initial"){t.revealEffect!=="none"&&gd(r,{mode:"typewriter",revealedCharacters:0,completed:!1}),t.revealEffect==="none"?PC({contentContainer:l,indicatorSprite:c,element:t}):MU({indicatorSprite:c,element:t});return}if(t.revealEffect==="softWipe"){if(gd(r,{mode:"softWipe",completed:!1}),!BU({container:r,contentContainer:l,indicatorSprite:c,element:t,animationBus:i,completionTracker:e})&&!o?.aborted&&!r.destroyed){let f=e.getVersion();e.track(f),e.complete(f)}return}let h=e.getVersion(),u=!1;if(e.track(h),t.revealEffect==="none")gd(r,{mode:"none",completed:!0}),PC({contentContainer:l,indicatorSprite:c,element:t}),u=!0;else{let d=gd(r,{mode:"typewriter",revealedCharacters:a?.revealedCharacters??0,completed:!1});u=await IU({contentContainer:l,indicatorSprite:c,element:t,signal:o,startAtCharacter:a?.revealedCharacters??0,snapshot:d})}u&&!o?.aborted&&!r.destroyed&&e.complete(h)}catch(h){if(h?.name!=="AbortError"&&!o?.aborted)throw h}};var _d=({suppressAnimations:r=!1,deferredMountOperations:t=[]}={})=>({suppressAnimations:r,deferredMountOperations:t}),FC=r=>{switch(r?.type){case"play-animated-sprite":r.animatedSprite?.destroyed||r.animatedSprite?.play();return;case"play-video":r.video?.play();return;case"start-particles":if(r.app?.debug){let t=e=>{if(r.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",t);return}e?.detail?.deltaMS&&r.emitter.update(Number(e.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",t),r.container.customTickerHandler=t;return}r.app.ticker.add(r.tickerCallback);return;case"autoplay-text-reveal":_i({container:r.container,element:r.element,completionTracker:r.completionTracker,animationBus:r.animationBus,zIndex:r.zIndex,signal:r.signal,playback:"autoplay"});return;case"start-update-animations":if(!r.element||r.element.destroyed)return;pd({animations:r.animations,animationBus:r.animationBus,completionTracker:r.completionTracker,element:r.element,targetState:r.targetState});return}},ql=(r,t)=>{if(t?.type){if(!r?.suppressAnimations){FC(t);return}r.deferredMountOperations.push(t)}},bd=r=>{r?.deferredMountOperations&&(r.deferredMountOperations.length=0)},kC=(r,t)=>ql(r,{type:"play-animated-sprite",animatedSprite:t}),OC=(r,t)=>ql(r,{type:"play-video",video:t}),UC=(r,{app:t,emitter:e,container:i,tickerCallback:s})=>ql(r,{type:"start-particles",app:t,emitter:e,container:i,tickerCallback:s}),vd=(r,{container:t,element:e,completionTracker:i,animationBus:s,zIndex:o,signal:n})=>ql(r,{type:"autoplay-text-reveal",container:t,element:e,completionTracker:i,animationBus:s,zIndex:o,signal:n}),GC=(r,{animations:t,animationBus:e,completionTracker:i,element:s,targetState:o})=>ql(r,{type:"start-update-animations",animations:t,animationBus:e,completionTracker:i,element:s,targetState:o}),LC=r=>{if(!r?.deferredMountOperations?.length)return;let t=r.deferredMountOperations.splice(0);for(let e of t)FC(e)};var DC=(r=[])=>{if(r instanceof Map)return r;let t=new Map;for(let e of r)t.has(e.targetId)||t.set(e.targetId,[]),t.get(e.targetId).push(e);return t},Td=(r,t)=>r instanceof Map?r.get(t)??[]:r.filter(e=>e.targetId===t),FU=(r,t)=>Td(r,t).filter(e=>e.type==="update"),Sd=(r,t)=>Td(r,t).find(e=>e.type==="transition")??null,kU=({animations:r,targetId:t,animationBus:e,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=FU(r,t);if(l.length===0)return!1;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");return AC(s,l),GC(a,{animations:l,animationBus:e,completionTracker:i,element:s,targetState:o}),!0}return pd({animations:l,animationBus:e,completionTracker:i,element:s,targetState:o,onComplete:n}),!0};var ot=kU;var VC=Symbol("routeGraphicsTextAnchorRatios"),WC=Symbol("routeGraphicsTextLayoutState"),NC=(r,t)=>typeof r!="number"||r===0?0:t/r,iy=r=>r?.align??zt.align,HC=r=>{let t=r[WC];return t?.fixedWidth&&typeof t.layoutWidth=="number"?t.layoutWidth:r.width},sy=(r,t,e)=>{let i=Math.max(0,r-t);return e==="center"?i/2:e==="right"?i:0},Kl=r=>{let t=r.measuredWidth??r.width,e=sy(r.width,t,iy(r.textStyle));return{x:r.x+e,y:r.y}},wd=(r,t)=>{let e=t.__fixedWidth&&typeof t.width=="number"?t.width:r.width||t.width,i=r.height||t.height,s=typeof t.__anchorXRatio=="number"?t.__anchorXRatio:NC(e,t.originX),o=typeof t.__anchorYRatio=="number"?t.__anchorYRatio:NC(i,t.originY);r[VC]={x:s,y:o},r[WC]={fixedWidth:!!t.__fixedWidth,layoutWidth:t.width}},OU=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?zt.lineHeight:r.lineHeight/r.fontSize,UU=(r,t)=>{if(!t)return r;let e={...r,...t};if(t.fontSize!==void 0||t.lineHeight!==void 0){let i=t.lineHeight??OU(r);e.lineHeight=Math.round(e.fontSize*i)}return e},qr=(r,t,e)=>{let i=r[VC],s=HC(r),o=UU(t,e);if(!i){Yr(r,o);return}let n=sy(s,r.width,iy(r.style)),l=r.x-n+s*i.x,c=r.y+r.height*i.y;Yr(r,o);let h=HC(r),u=sy(h,r.width,iy(r.style));r.x=l-h*i.x+u,r.y=c-r.height*i.y},Ed=(r,t)=>{let e=Kl({...t,measuredWidth:r.width,width:t.__fixedWidth&&typeof t.width=="number"?t.width:r.width});r.x=e.x,r.y=e.y};var zC=r=>{if(!(!r||typeof r!="object")){if(typeof r.button=="number")return r.button;if(typeof r.data?.button=="number")return r.data.button;if(typeof r.nativeEvent?.button=="number")return r.nativeEvent.button}},ie=r=>{let t=zC(r);return t===void 0||t===0},$C=r=>zC(r)===2;var oy=Symbol.for("routeGraphics.setInheritedHover"),XC=Symbol.for("routeGraphics.treeInheritedHoverActive"),ny=Symbol.for("routeGraphics.setInheritedPress"),jC=Symbol.for("routeGraphics.treeInheritedPressActive"),ay=Symbol.for("routeGraphics.setInheritedRightPress"),YC=Symbol.for("routeGraphics.treeInheritedRightPressActive"),cn=r=>Array.isArray(r?.children)?r.children:[],ly=({displayObject:r,symbol:t,source:e,isActive:i})=>{let s=r?.[t];typeof s=="function"&&s(e,i)},Ad=({displayObject:r,symbol:t})=>{r&&t in r&&delete r[t]},cy=({displayObject:r,symbol:t,onStateChange:e})=>{let i=!1,s=new Set,o=({nextDirectActive:n=i,onInheritedChange:a})=>{let l=i||s.size>0;i=n,a?.(s);let c=i||s.size>0;return l!==c&&e(c),c};return r[t]=(n,a)=>o({onInheritedChange:l=>{if(n){if(a){l.add(n);return}l.delete(n)}}}),{setDirectState:n=>o({nextDirectActive:n}),isActive:()=>i||s.size>0,destroy:()=>{Ad({displayObject:r,symbol:t})}}},hn=r=>Ad({displayObject:r,symbol:oy}),Pd=r=>Ad({displayObject:r,symbol:ny}),Cd=r=>Ad({displayObject:r,symbol:ay}),Kr=({displayObject:r,onHoverChange:t})=>{let e=cy({displayObject:r,symbol:oy,onStateChange:t});return{setDirectHover:e.setDirectState,isHovering:e.isActive,destroy:e.destroy}},qi=({displayObject:r,onPressChange:t})=>{let e=cy({displayObject:r,symbol:ny,onStateChange:t});return{setDirectPress:e.setDirectState,isPressed:e.isActive,destroy:e.destroy}},Ki=({displayObject:r,onPressChange:t})=>{let e=cy({displayObject:r,symbol:ay,onStateChange:t});return{setDirectPress:e.setDirectState,isPressed:e.isActive,destroy:e.destroy}},hy=r=>r?.[XC]===!0,uy=r=>r?.[jC]===!0,dy=r=>r?.[YC]===!0,un=({root:r,isHovered:t})=>{if(!r)return;r[XC]=t;let e=[...cn(r)];for(;e.length>0;){let i=e.pop();ly({displayObject:i,symbol:oy,source:r,isActive:t}),e.push(...cn(i))}},Bs=({root:r,isPressed:t})=>{if(!r)return;r[jC]=t;let e=[...cn(r)];for(;e.length>0;){let i=e.pop();ly({displayObject:i,symbol:ny,source:r,isActive:t}),e.push(...cn(i))}},bi=({root:r,isPressed:t})=>{if(!r)return;r[YC]=t;let e=[...cn(r)];for(;e.length>0;){let i=e.pop();ly({displayObject:i,symbol:ay,source:r,isActive:t}),e.push(...cn(i))}};var qC=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=new Cr({label:e.id});c.zIndex=l,c.text=e.content,Yr(c,e.textStyle),wd(c,e),c.alpha=e.alpha,Ed(c,e);let h=e?.hover,u=e?.click,d=e?.rightClick,f=null,p=null,m=null,x=()=>{let _=f?.isHovering()??!1,T=p?.isPressed()??!1;(m?.isPressed()??!1)&&d?.textStyle?qr(c,e.textStyle,d.textStyle):T&&u?.textStyle?qr(c,e.textStyle,u.textStyle):_&&h?.textStyle?qr(c,e.textStyle,h.textStyle):qr(c,e.textStyle)};if(h){let{cursor:_,soundSrc:T,payload:g}=h;c.eventMode="static",f=Kr({displayObject:c,onHoverChange:x});let w=()=>{f.setDirectHover(!0),g&&s&&s("hover",{_event:{id:c.label},...g}),_&&(c.cursor=_),T&&r.audioStage.add({id:`hover-${Date.now()}`,url:T,loop:!1})},b=()=>{f.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",w),c.on("pointerout",b)}if(u){let{soundSrc:_,soundVolume:T,payload:g}=u;c.eventMode="static",p=qi({displayObject:c,onPressChange:x});let w=v=>{ie(v)&&p.setDirectPress(!0)},b=v=>{ie(v)&&(p.setDirectPress(!1),g&&s&&s("click",{_event:{id:c.label},...g}),_&&r.audioStage.add({id:`click-${Date.now()}`,url:_,loop:!1,volume:(T??1e3)/1e3}))},S=()=>{p.setDirectPress(!1)};c.on("pointerdown",w),c.on("pointerup",b),c.on("pointerupoutside",S)}if(d){let{soundSrc:_,payload:T}=d;c.eventMode="static",m=Ki({displayObject:c,onPressChange:x});let g=()=>{m.setDirectPress(!0)},w=()=>{m.setDirectPress(!1)},b=()=>{m.setDirectPress(!1),T&&s&&s("rightClick",{_event:{id:c.label},...T}),_&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:_,loop:!1})},S=()=>{m.setDirectPress(!1)};c.on("rightdown",g),c.on("rightup",w),c.on("rightclick",b),c.on("rightupoutside",S)}t.addChild(c),ot({animations:i,targetId:e.id,animationBus:o,completionTracker:n,element:c,targetState:{...Kl(e),alpha:e.alpha},renderContext:a})};var GU=Object.prototype.hasOwnProperty,gt=(r,t)=>{if(Object.is(r,t))return!0;if(r===null||t===null||typeof r!="object"||typeof t!="object")return!1;let e=Array.isArray(r),i=Array.isArray(t);if(e!==i)return!1;if(e&&i){if(r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!gt(r[n],t[n]))return!1;return!0}let s=Object.keys(r),o=Object.keys(t);if(s.length!==o.length)return!1;for(let n of s)if(!GU.call(t,n)||!gt(r[n],t[n]))return!1;return!0};var KC=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let c=t.children.find(f=>f.label===e.id);if(!c)return;c.zIndex=l;let{alpha:h}=i,u=()=>{if(!gt(e,i)){c.text=i.content,Yr(c,i.textStyle),wd(c,i),Ed(c,i),c.alpha=h,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerdown"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightdown"),c.removeAllListeners("rightclick"),c.removeAllListeners("rightup"),c.removeAllListeners("rightupoutside"),hn(c),Pd(c),Cd(c);let f=i?.hover,p=i?.click,m=i?.rightClick,x=null,_=null,T=null,g=()=>{let w=x?.isHovering()??!1,b=_?.isPressed()??!1;(T?.isPressed()??!1)&&m?.textStyle?qr(c,i.textStyle,m.textStyle):b&&p?.textStyle?qr(c,i.textStyle,p.textStyle):w&&f?.textStyle?qr(c,i.textStyle,f.textStyle):qr(c,i.textStyle)};if(f){let{cursor:w,soundSrc:b,payload:S}=f;c.eventMode="static",x=Kr({displayObject:c,onHoverChange:g});let v=()=>{x.setDirectHover(!0),S&&s&&s("hover",{_event:{id:c.label},...S}),w&&(c.cursor=w),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1})},P=()=>{x.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",v),c.on("pointerout",P)}if(p){let{soundSrc:w,soundVolume:b,payload:S}=p;c.eventMode="static",_=qi({displayObject:c,onPressChange:g});let v=A=>{ie(A)&&_.setDirectPress(!0)},P=A=>{ie(A)&&(_.setDirectPress(!1),S&&s&&s("click",{_event:{id:c.label},...S}),w&&r.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1,volume:(b??1e3)/1e3}))},C=()=>{_.setDirectPress(!1)};c.on("pointerdown",v),c.on("pointerup",P),c.on("pointerupoutside",C)}if(m){let{soundSrc:w,payload:b}=m;c.eventMode="static",T=Ki({displayObject:c,onPressChange:g});let S=()=>{T.setDirectPress(!0)},v=()=>{T.setDirectPress(!1)},P=()=>{T.setDirectPress(!1),b&&s&&s("rightClick",{_event:{id:c.label},...b}),w&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:w,loop:!1})},C=()=>{T.setDirectPress(!1)};c.on("rightdown",S),c.on("rightup",v),c.on("rightclick",P),c.on("rightupoutside",C)}}};ot({animations:o,targetId:e.id,animationBus:n,completionTracker:a,element:c,targetState:{...Kl(i),alpha:h},onComplete:()=>{u()}})||u()};var ZC=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var QC=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,l=t-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var ge=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(Is).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Is).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===Is.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=QC({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var JC=({state:r})=>{let t={...zt,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),typeof r.width=="number"&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let e=String(r.content??""),{width:i,height:s}=kt.measureText(e,new It(t)),o=Math.round(i),n=Math.round(s),a=typeof r.width=="number"?Math.round(r.width):o,c={...ge({...r,width:a,height:n}),content:e,measuredWidth:o,textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}};return Object.defineProperties(c,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),c};var LU=Zt({type:"text",add:qC,update:KC,delete:ZC,parse:JC});var tR="__rtglRectScrollHandled",Rd=({canvas:r,rect:t,width:e,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1;t.eventMode="static",t.hitArea=new Q(0,0,Math.round(e),Math.round(i));let l=(f,p)=>{p?.[tR]||(p&&(p[tR]=!0),f<0&&s?.payload&&n?n("scrollUp",{_event:{id:t.label},...s.payload}):f>0&&o?.payload&&n&&n("scrollDown",{_event:{id:t.label},...o.payload}))},c=()=>{a=!0},h=()=>{a=!1},u=f=>{f.preventDefault?.(),l(f.deltaY,f.nativeEvent)},d=f=>{a&&(f.preventDefault(),l(f.deltaY,f))};t.on("pointerover",c),t.on("pointerout",h),t.on("wheel",u),r?.addEventListener("wheel",d,{passive:!1}),t._cleanupScrollInteraction=()=>{a=!1,t.off("pointerover",c),t.off("pointerout",h),t.off("wheel",u),r?.removeEventListener("wheel",d),t.hitArea=null,delete t._cleanupScrollInteraction}};var DU=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,eR=({app:r,parent:t,element:e,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:c,x:h,y:u,width:d,height:f,fill:p,border:m,alpha:x,scaleX:_,scaleY:T}=e,g=new Bt;g.label=c,g.zIndex=n;let w={x:h,y:u,alpha:x};_!==void 0&&(w.scaleX=_),T!==void 0&&(w.scaleY=T),(()=>{g.clear(),g.rect(0,0,Math.round(d),Math.round(f)).fill(DU(p)),g.x=Math.round(h),g.y=Math.round(u),g.alpha=x,g.scale.x=1,g.scale.y=1,m&&g.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)})})();let S=e?.hover,v=e?.click,P=e?.rightClick,C=e?.scrollUp,A=e?.scrollDown,R=e?.drag;if(S){let{cursor:M,soundSrc:I,payload:k}=S;g.eventMode="static";let W=()=>{k&&o&&o("hover",{_event:{id:g.label},...k}),M&&(g.cursor=M),I&&r.audioStage.add({id:`hover-${Date.now()}`,url:I,loop:!1})},O=()=>{g.cursor="auto"};g.on("pointerover",W),g.on("pointerout",O)}if(v){let{soundSrc:M,soundVolume:I,payload:k}=v;g.eventMode="static";let W=O=>{ie(O)&&(k&&o&&o("click",{_event:{id:g.label},...k}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1,volume:(I??1e3)/1e3}))};g.on("pointerup",W)}if(P){let{soundSrc:M,payload:I}=P;g.eventMode="static";let k=()=>{I&&o&&o("rightClick",{_event:{id:g.label},...I}),M&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:M,loop:!1})};g.on("rightclick",k)}if((C||A)&&Rd({canvas:r.canvas,rect:g,width:d,height:f,scrollUpEvent:C,scrollDownEvent:A,eventHandler:o}),R){let{start:M,end:I,move:k}=R;g.eventMode="static";let W=()=>{g._isDragging=!0,M&&o&&o("dragStart",{_event:{id:g.label},...typeof M?.payload=="object"?M.payload:{}})},O=()=>{g._isDragging=!1,I&&o&&o("dragEnd",{_event:{id:g.label},...typeof I?.payload=="object"?I.payload:{}})},z=V=>{k&&o&&g._isDragging&&o("dragMove",{_event:{id:g.label,x:V.global.x,y:V.global.y},...typeof k?.payload=="object"?k.payload:{}})};g.on("pointerdown",W),g.on("pointerup",O),g.on("globalpointermove",z),g.on("pointerupoutside",O)}t.addChild(g),ot({animations:i,targetId:c,animationBus:s,completionTracker:a,element:g,targetState:w,renderContext:l})};var NU=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,rR=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=t.children.find(S=>S.label===e.id);if(!c)return;c.zIndex=a;let{x:h,y:u,width:d,height:f,fill:p,border:m,alpha:x,scaleX:_,scaleY:T}=i,g={x:h,y:u,alpha:x};_!==void 0&&(g.scaleX=_),T!==void 0&&(g.scaleY=T);let w=()=>{if(!gt(e,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(d),Math.round(f)).fill(NU(p)),c.x=Math.round(h),c.y=Math.round(u),c.alpha=x,c.scale.x=1,c.scale.y=1,m&&c.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)}),c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightclick"),c.removeAllListeners("wheel"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove"),c.removeAllListeners("pointerupoutside");let S=i?.hover,v=i?.click,P=i?.rightClick,C=i?.scrollUp,A=i?.scrollDown,R=i?.drag;if(S){let{cursor:M,soundSrc:I,payload:k}=S;c.eventMode="static";let W=()=>{k&&n&&n("hover",{_event:{id:c.label},...k}),M&&(c.cursor=M),I&&r.audioStage.add({id:`hover-${Date.now()}`,url:I,loop:!1})},O=()=>{c.cursor="auto"};c.on("pointerover",W),c.on("pointerout",O)}if(v){let{soundSrc:M,soundVolume:I,payload:k}=v;c.eventMode="static";let W=O=>{ie(O)&&(k&&n&&n("click",{_event:{id:c.label},...k}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1,volume:(I??1e3)/1e3}))};c.on("pointerup",W)}if(P){let{soundSrc:M,payload:I}=P;c.eventMode="static";let k=()=>{I&&n&&n("rightClick",{_event:{id:c.label},...I}),M&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:M,loop:!1})};c.on("rightclick",k)}if((C||A)&&Rd({canvas:r.canvas,rect:c,width:d,height:f,scrollUpEvent:C,scrollDownEvent:A,eventHandler:n}),R){let{start:M,end:I,move:k}=R;c.eventMode="static";let W=()=>{c._isDragging=!0,M&&n&&n("dragStart",{_event:{id:c.label},...typeof M?.payload=="object"?M.payload:{}})},O=()=>{c._isDragging=!1,I&&n&&n("dragEnd",{_event:{id:c.label},...typeof I?.payload=="object"?I.payload:{}})},z=V=>{k&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:V.global.x,y:V.global.y},...typeof k?.payload=="object"?k.payload:{}})};c.on("pointerdown",W),c.on("pointerup",O),c.on("globalpointermove",z),c.on("pointerupoutside",O)}}};ot({animations:s,targetId:e.id,animationBus:o,completionTracker:l,element:c,targetState:g,onComplete:()=>{w()}})||w()};var iR=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var sR=({state:r})=>{let t=ge(r),e=r.border?.width,i=t;return typeof e=="number"&&e>0&&(i={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:e}}),{...i,...r.fill!==void 0?{fill:r.fill}:{},...r.scaleX!==void 0?{scaleX:r.scaleX}:{},...r.scaleY!==void 0?{scaleY:r.scaleY}:{},rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}}};var HU=Zt({type:"rect",add:eR,update:rR,delete:iR,parse:sR});var oR=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:c,x:h,y:u,width:d,height:f,src:p,alpha:m}=e,x=p?B.from(p):B.EMPTY,_=new wt(x);_.label=c,_.zIndex=l,_.x=Math.round(h),_.y=Math.round(u),_.width=Math.round(d),_.height=Math.round(f),_.alpha=m;let T=e?.hover,g=e?.click,w=e?.rightClick,b=null,S=null,v=null,P=()=>{let C=b?.isHovering()??!1,A=S?.isPressed()??!1;if((v?.isPressed()??!1)&&w?.src){let M=B.from(w.src);_.texture=M}else if(A&&g?.src){let M=B.from(g.src);_.texture=M}else if(C&&T?.src){let M=B.from(T.src);_.texture=M}else _.texture=x};if(T){let{cursor:C,soundSrc:A,payload:R}=T;_.eventMode="static",b=Kr({displayObject:_,onHoverChange:P});let M=()=>{b.setDirectHover(!0),R&&s&&s("hover",{_event:{id:_.label},...R}),C&&(_.cursor=C),A&&r.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},I=()=>{b.setDirectHover(!1),_.cursor="auto"};_.on("pointerover",M),_.on("pointerout",I)}if(g){let{soundSrc:C,soundVolume:A,payload:R}=g;_.eventMode="static",S=qi({displayObject:_,onPressChange:P});let M=W=>{ie(W)&&S.setDirectPress(!0)},I=W=>{ie(W)&&(S.setDirectPress(!1),R&&s&&s("click",{_event:{id:_.label},...R}),C&&r.audioStage.add({id:`click-${Date.now()}`,url:C,loop:!1,volume:(A??1e3)/1e3}))},k=()=>{S.setDirectPress(!1)};_.on("pointerdown",M),_.on("pointerup",I),_.on("pointerupoutside",k)}if(w){let{soundSrc:C,payload:A}=w;_.eventMode="static",v=Ki({displayObject:_,onPressChange:P});let R=()=>{v.setDirectPress(!0)},M=()=>{v.setDirectPress(!1)},I=()=>{v.setDirectPress(!1),A&&s&&s("rightClick",{_event:{id:_.label},...A}),C&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:C,loop:!1})},k=()=>{v.setDirectPress(!1)};_.on("rightdown",R),_.on("rightup",M),_.on("rightclick",I),_.on("rightupoutside",k)}t.addChild(_),ot({animations:i,targetId:c,animationBus:o,completionTracker:n,element:_,targetState:{x:h,y:u,width:d,height:f,alpha:m},renderContext:a})};var nR=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=t.children.find(g=>g.label===e.id);if(!c)return;c.zIndex=l;let{id:h,x:u,y:d,width:f,height:p,src:m,alpha:x}=i,_=()=>{if(!gt(e,i)){let g=m?B.from(m):B.EMPTY;c.texture=g,c.x=Math.round(u),c.y=Math.round(d),c.width=Math.round(f),c.height=Math.round(p),c.alpha=x,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerdown"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightdown"),c.removeAllListeners("rightclick"),c.removeAllListeners("rightup"),c.removeAllListeners("rightupoutside"),hn(c),Pd(c),Cd(c);let w=i?.hover,b=i?.click,S=i?.rightClick,v=null,P=null,C=null,A=()=>{let R=v?.isHovering()??!1,M=P?.isPressed()??!1;if((C?.isPressed()??!1)&&S?.src){let k=B.from(S.src);c.texture=k}else if(M&&b?.src){let k=B.from(b.src);c.texture=k}else if(R&&w?.src){let k=B.from(w.src);c.texture=k}else c.texture=g};if(w){let{cursor:R,soundSrc:M,payload:I}=w;c.eventMode="static",v=Kr({displayObject:c,onHoverChange:A});let k=()=>{v.setDirectHover(!0),I&&a&&a("hover",{_event:{id:c.label},...I}),R&&(c.cursor=R),M&&r.audioStage.add({id:`hover-${Date.now()}`,url:M,loop:!1})},W=()=>{v.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",k),c.on("pointerout",W)}if(b){let{soundSrc:R,soundVolume:M,payload:I}=b;c.eventMode="static",P=qi({displayObject:c,onPressChange:A});let k=z=>{ie(z)&&P.setDirectPress(!0)},W=z=>{ie(z)&&(P.setDirectPress(!1),I&&a&&a("click",{_event:{id:c.label},...I}),R&&r.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:(M??1e3)/1e3}))},O=()=>{P.setDirectPress(!1)};c.on("pointerdown",k),c.on("pointerup",W),c.on("pointerupoutside",O)}if(S){let{soundSrc:R,payload:M}=S;c.eventMode="static",C=Ki({displayObject:c,onPressChange:A});let I=()=>{C.setDirectPress(!0)},k=()=>{C.setDirectPress(!1)},W=()=>{C.setDirectPress(!1),M&&a&&a("rightClick",{_event:{id:c.label},...M}),R&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})},O=()=>{C.setDirectPress(!1)};c.on("rightdown",I),c.on("rightup",k),c.on("rightclick",W),c.on("rightupoutside",O)}}};ot({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:c,targetState:{x:u,y:d,width:f,height:p,alpha:x},onComplete:()=>{_()}})||_()};var aR=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===t.id);if(!o)return;ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var lR=({state:r})=>({...ge(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var VU=Zt({type:"sprite",add:oR,update:nR,delete:aR,parse:lR});var WU=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,fy=({videoElement:r,video:t})=>{t&&r?._videoEndedListener&&t.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},Md=({videoElement:r,video:t,loop:e,completionTracker:i})=>{if(fy({videoElement:r,video:t}),(e??!1)||WU(t))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};t.addEventListener("ended",o),r._videoEndedListener=o,r._playbackStateVersion=s};var cR=({parent:r,element:t,renderContext:e,completionTracker:i,zIndex:s})=>{let{id:o,x:n,y:a,width:l,height:c,src:h,volume:u,loop:d,alpha:f}=t,p=B.from(h),m=p.source.resource;m.pause(),m.currentTime=0,m.loop=d??!1,m.volume=u/1e3,m.muted=!1;let x=new wt(p);x.label=o,x.zIndex=s,x._videoEndedListener=void 0,x._playbackStateVersion=null,x.x=Math.round(n),x.y=Math.round(a),x.width=Math.round(l),x.height=Math.round(c),x.alpha=f??1,Md({videoElement:x,video:m,loop:d,completionTracker:i}),OC(e,m),r.addChild(x)};var hR=({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=r.children.find(x=>x.label===t.id);if(!l)return;l.zIndex=a;let{x:c,y:h,width:u,height:d,alpha:f}=e,p=()=>{if(!gt(t,e)){l.x=Math.round(c),l.y=Math.round(h),l.width=Math.round(u),l.height=Math.round(d),l.alpha=f??1;let x=l.texture.source.resource;if(t.src!==e.src){let _=x;fy({videoElement:l,video:_}),_&&_.pause();let T=B.from(e.src);l.texture=T,x=T.source.resource,x.muted=!1,x.pause(),x.currentTime=0}Md({videoElement:l,video:x,loop:e.loop,completionTracker:n}),x.volume=e.volume/1e3,x.loop=e.loop??!1,t.src!==e.src&&x.play()}};ot({animations:i,targetId:t.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:h,width:u,height:d,alpha:f??1},onComplete:p})||p()};var uR=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(l=>l.label===t.id);if(!o)return;let n=()=>{if(o&&!o.destroyed){o._playbackStateVersion!==null&&s.complete(o._playbackStateVersion);let l=o.texture.source.resource;l&&(o._videoEndedListener&&l.removeEventListener("ended",o._videoEndedListener),l.pause()),r.removeChild(o),o.destroy()}};ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var dR=({state:r})=>({...ge(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var zU=Zt({type:"video",add:cR,update:hR,delete:uR,parse:dR});var fR=0,pR=16,$U=(r,t)=>r!==null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,t),my=r=>Math.max(0,Math.min(1,r)),Fs=r=>r?B.from(r):B.EMPTY,dn=r=>({bar:`${r}-bar`,inactiveBar:`${r}-inactive-bar`,barMask:`${r}-bar-mask`,thumb:`${r}-thumb`}),gR=({sliderContainer:r,fromId:t,toId:e})=>{if(t===e)return;let i=dn(t),s=dn(e);for(let[o,n]of Object.entries(i)){let a=r.getChildByLabel(n);a&&(a.label=s[o])}},fn=({sliderContainer:r,id:t})=>{let e=dn(t);return{bar:r.getChildByLabel(e.bar),inactiveBar:r.getChildByLabel(e.inactiveBar),barMask:r.getChildByLabel(e.barMask),thumb:r.getChildByLabel(e.thumb)}},py=({baseValue:r,override:t,key:e})=>$U(t,e)?t[e]??"":r??"",XU=(r,t=null)=>({thumbSrc:py({baseValue:r.thumbSrc,override:t,key:"thumbSrc"}),barSrc:py({baseValue:r.barSrc,override:t,key:"barSrc"}),inactiveBarSrc:py({baseValue:r.inactiveBarSrc,override:t,key:"inactiveBarSrc"})}),jU=r=>{let t=new wt(B.EMPTY);return t.label=r,t.eventMode="static",t.zIndex=0,t},YU=r=>{let t=new Bt;return t.label=r,t.zIndex=0,t},qU=({sliderContainer:r,id:t,bar:e})=>{let i=dn(t),{inactiveBar:s,barMask:o}=fn({sliderContainer:r,id:t});return s||(s=jU(i.inactiveBar),r.addChild(s)),o||(o=YU(i.barMask),r.addChild(o)),e.mask=o,{inactiveBar:s,barMask:o}},KU=({sliderContainer:r,id:t,bar:e})=>{let{inactiveBar:i,barMask:s}=fn({sliderContainer:r,id:t});e?.mask===s&&(e.mask=null),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy())},xR=({currentValue:r,min:t,max:e})=>{let i=e-t;return i<=0?0:my((r-t)/i)},ZU=({barMask:r,direction:t,width:e,height:i,currentValue:s,min:o,max:n})=>{if(!r)return;let a=xR({currentValue:s,min:o,max:n}),l=Math.round(t==="horizontal"?e*a:e),c=Math.round(t==="horizontal"?i:i*a);r.clear(),!(l<=0||c<=0)&&r.rect(0,0,l,c).fill({color:16777215,alpha:0})},QU=({thumb:r,direction:t,currentValue:e,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=xR({currentValue:e,min:i,max:s});if(t==="horizontal"){r.x=a*(o-r.width),r.y=(n-r.height)/2;return}r.x=(o-r.width)/2,r.y=a*(n-r.height)},Id=({thumb:r,thumbSrc:t,direction:e,trackWidth:i,trackHeight:s})=>{let o=e==="horizontal"?s-fR*2:i-fR*2,n=Fs(t),a=n.width||pR,l=n.height||pR,c=o/a,h=o/l,u=Math.min(c,h);r.width=a*u,r.height=l*u},Zl=({sliderContainer:r,sliderComputedNode:t,thumb:e,currentValue:i,hoverOverride:s=null})=>{let{id:o,width:n,height:a,direction:l,min:c,max:h}=t,{barSrc:u,inactiveBarSrc:d,thumbSrc:f}=XU(t,s),{bar:p}=fn({sliderContainer:r,id:o});if(p){if(p.texture=Fs(u),p.width=n,p.height=a,e.texture=Fs(f),d){let{inactiveBar:m,barMask:x}=qU({sliderContainer:r,id:o,bar:p});m.texture=Fs(d),m.width=n,m.height=a,ZU({barMask:x,direction:l,width:n,height:a,currentValue:i,min:c,max:h})}else KU({sliderContainer:r,id:o,bar:p});QU({thumb:e,direction:l,currentValue:i,min:c,max:h,trackWidth:n,trackHeight:a})}},JU=({position:r,thumb:t,direction:e,min:i,max:s,step:o,trackWidth:n,trackHeight:a})=>{let l=s-i,c;if(e==="horizontal"){let u=r.x-t.width/2,d=Math.max(n-t.width,1);c=my(u/d)}else{let u=r.y-t.height/2,d=Math.max(a-t.height,1);c=my(u/d)}let h=i+c*l;return o>0&&(h=Math.round((h-i)/o)*o+i,h=Math.max(i,Math.min(s,h))),h},mR=({sliderContainer:r,sliderComputedNode:t,cursor:e})=>{let i=e??"auto",{bar:s,inactiveBar:o,thumb:n}=fn({sliderContainer:r,id:t.id});r.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},Bd=({app:r,sliderContainer:t,sliderComputedNode:e,thumb:i,eventHandler:s})=>{hn(t);let{id:o,hover:n,change:a,min:l,max:c,step:h,direction:u,initialValue:d,width:f,height:p}=e,m=d??l,x=!1,_=null,T=()=>{Zl({sliderContainer:t,sliderComputedNode:e,thumb:i,currentValue:m,hoverOverride:_?.isHovering()?n:null})},g=C=>{let A=t.toLocal(C.global),R=JU({position:A,thumb:i,direction:u,min:l,max:c,step:h,trackWidth:f,trackHeight:p});R!==m&&(m=R,T(),a?.payload&&s&&s("change",{_event:{id:o,value:m},...a.payload}))},w=C=>{x=!0,g(C)},b=C=>{x&&g(C)},S=()=>{x&&(x=!1)};if(t.on("pointerdown",w),t.on("globalpointermove",b),t.on("pointerup",S),t.on("pointerupoutside",S),!n)return;_=Kr({displayObject:t,onHoverChange:T});let v=()=>{_.setDirectHover(!0),T(),mR({sliderContainer:t,sliderComputedNode:e,cursor:n.cursor}),n.soundSrc&&r.audioStage.add({id:`hover-${Date.now()}`,url:n.soundSrc,loop:!1})},P=()=>{x||(_.setDirectHover(!1),T(),mR({sliderContainer:t,sliderComputedNode:e,cursor:null}))};t.on("pointerover",v),t.on("pointerout",P),t.on("pointerupoutside",P)};var yR=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{let{id:c,x:h,y:u,width:d,height:f,alpha:p,thumbSrc:m,barSrc:x,initialValue:_,min:T}=e,g=new rt;g.label=c,g.zIndex=l,g.x=h,g.y=u,g.alpha=p,g.sortableChildren=!0,g.eventMode="static";let w=dn(c),b=new wt(Fs(x));b.label=w.bar,b.eventMode="static",b.zIndex=1;let S=new wt(Fs(m));S.label=w.thumb,S.eventMode="static",S.zIndex=2;let v=_??T;Id({thumb:S,thumbSrc:m,direction:e.direction,trackWidth:d,trackHeight:f}),g.addChild(b),g.addChild(S),Zl({sliderContainer:g,sliderComputedNode:e,thumb:S,currentValue:v}),Bd({app:r,sliderContainer:g,sliderComputedNode:e,thumb:S,eventHandler:n}),t.addChild(g),ot({animations:i,targetId:c,animationBus:s,completionTracker:o,element:g,targetState:{x:h,y:u,alpha:p},renderContext:a})};var _R=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=t.children.find(m=>m.label===e.id);if(!c)return;c.zIndex=l;let h=()=>{if(!gt(e,i)){c.x=i.x,c.y=i.y,c.alpha=i.alpha,c.label=i.id,c.pivot.set(i.originX,i.originY),gR({sliderContainer:c,fromId:e.id,toId:i.id});let{bar:m,thumb:x}=fn({sliderContainer:c,id:i.id}),_=!gt(e.hover,i.hover)||!gt(e.change,i.change)||e.min!==i.min||e.max!==i.max||e.step!==i.step||e.direction!==i.direction||e.initialValue!==i.initialValue||e.thumbSrc!==i.thumbSrc||e.barSrc!==i.barSrc||e.inactiveBarSrc!==i.inactiveBarSrc||e.width!==i.width||e.height!==i.height||e.id!==i.id;if(m&&x&&(Id({thumb:x,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),Zl({sliderContainer:c,sliderComputedNode:i,thumb:x,currentValue:i.initialValue})),!m||!x)return;_&&(c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove")),_&&Bd({app:r,sliderContainer:c,sliderComputedNode:i,thumb:x,eventHandler:a})}},{x:u,y:d,alpha:f}=i;ot({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:c,targetState:{x:u,y:d,alpha:f},onComplete:h})||h()};var bR=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};ot({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var vR=({state:r})=>{let t=ge(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValue<e||r.initialValue>i)throw new Error("Input error: slider initialValue must be between min and max");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",...r.inactiveBarSrc!==void 0&&{inactiveBarSrc:r.inactiveBarSrc??""},alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var tG=Zt({type:"slider",add:yR,update:_R,delete:bR,parse:vR});var gn=Symbol("routeGraphicsInputRuntime"),Fd={top:10,right:12,bottom:10,left:12},pn={fill:"#FFFFFF",fillAlpha:1,strokeColor:"#2E2E2E",strokeWidth:1,strokeAlpha:1},kd={strokeColor:"#4A89FF",strokeWidth:2,strokeAlpha:1},TR={fill:"#4A89FF",alpha:.3},gy={fill:"#111111",width:2},eG=(r={})=>{let t=r.fontSize??zt.fontSize,e=r.lineHeight??zt.lineHeight;return typeof e!="number"?Math.round(t*zt.lineHeight):e>8?Math.round(e):Math.round(t*e)},Ld=(r={},t={})=>({...zt,...r,align:r.align??"left",lineHeight:eG(r),wordWrap:!1,breakWords:!1,wordWrapWidth:t.wordWrapWidth??0,whiteSpace:"pre"}),xy=r=>typeof r=="number"?{top:r,right:r,bottom:r,left:r}:Array.isArray(r)?{top:r[0]??0,right:r[1]??r[0]??0,bottom:r[2]??r[0]??0,left:r[3]??r[1]??r[0]??0}:{top:r?.top??Fd.top,right:r?.right??Fd.right,bottom:r?.bottom??Fd.bottom,left:r?.left??Fd.left},mn=r=>String(r??"").replace(/\r\n/g,`
1145
1145
  `).replace(/\r/g,`
1146
- `),rG=(r,t,e)=>{let i=Math.max(0,r-t);return e==="center"?i/2:e==="right"?i:0},ER=r=>new It(r),Ye=(r,t)=>Lt.measureText(r,ER(t)).width,Zi=(r,t,e)=>Math.max(t,Math.min(e,r)),SR=({text:r,style:t,targetX:e})=>{let i=Number.isFinite(e)?e:0;if(i<=0||r.length===0)return 0;let s=Ye(r,t);if(i>=s)return r.length;for(let o=1;o<=r.length;o+=1){let n=Ye(r.slice(0,o-1),t),a=Ye(r.slice(0,o),t),l=n+(a-n)/2;if(i<l)return o-1}return r.length},wR=(r,t)=>{let e=Math.max(r.x,t.x),i=Math.max(r.y,t.y),s=Math.min(r.x+r.width,t.x+t.width),o=Math.min(r.y+r.height,t.y+t.height),n=s-e,a=o-i;return n<=0||a<=0?null:{x:e,y:i,width:n,height:a}},iG=r=>{let t=r?.mask;if(!t?.getBounds)return null;let e=t.getBounds();return!e||e.width<=0||e.height<=0?null:{x:e.x,y:e.y,width:e.width,height:e.height}},sG=({app:r,container:t,fallbackElement:e})=>{if(!t||t.destroyed)return null;let i=t.getBounds?.(),s=i?{x:i.x,y:i.y,width:i.width,height:i.height}:{x:t.x??e.x,y:t.y??e.y,width:e.width,height:e.height};if(s.width<=0||s.height<=0)return null;let o={...s},n=t;for(;n;){if(n.visible===!1||n.renderable===!1)return{fullBounds:s,visibleBounds:null};let l=iG(n);if(l&&(o=wR(o,l),!o))return{fullBounds:s,visibleBounds:null};n=n.parent}let a=r?.renderer?{x:0,y:0,width:r.renderer.width,height:r.renderer.height}:null;return a&&(o=wR(o,a)),{fullBounds:s,visibleBounds:o}},oG=(r,t)=>t?{top:Math.max(0,t.y-r.y),right:Math.max(0,r.x+r.width-(t.x+t.width)),bottom:Math.max(0,r.y+r.height-(t.y+t.height)),left:Math.max(0,t.x-r.x)}:{top:r.height,right:0,bottom:0,left:0},nG=({displayedValue:r,textStyle:t})=>{let e=Ye(r,t);return{lines:[{text:r,width:e,startIndex:0}],lineHeight:t.lineHeight,totalHeight:t.lineHeight,maxLineWidth:e,textValue:r}},aG=({displayedValue:r,textStyle:t})=>{let e=mn(r),i=e.split(`
1146
+ `),rG=(r,t,e)=>{let i=Math.max(0,r-t);return e==="center"?i/2:e==="right"?i:0},ER=r=>new It(r),Ye=(r,t)=>kt.measureText(r,ER(t)).width,Zi=(r,t,e)=>Math.max(t,Math.min(e,r)),SR=({text:r,style:t,targetX:e})=>{let i=Number.isFinite(e)?e:0;if(i<=0||r.length===0)return 0;let s=Ye(r,t);if(i>=s)return r.length;for(let o=1;o<=r.length;o+=1){let n=Ye(r.slice(0,o-1),t),a=Ye(r.slice(0,o),t),l=n+(a-n)/2;if(i<l)return o-1}return r.length},wR=(r,t)=>{let e=Math.max(r.x,t.x),i=Math.max(r.y,t.y),s=Math.min(r.x+r.width,t.x+t.width),o=Math.min(r.y+r.height,t.y+t.height),n=s-e,a=o-i;return n<=0||a<=0?null:{x:e,y:i,width:n,height:a}},iG=r=>{let t=r?.mask;if(!t?.getBounds)return null;let e=t.getBounds();return!e||e.width<=0||e.height<=0?null:{x:e.x,y:e.y,width:e.width,height:e.height}},sG=({app:r,container:t,fallbackElement:e})=>{if(!t||t.destroyed)return null;let i=t.getBounds?.(),s=i?{x:i.x,y:i.y,width:i.width,height:i.height}:{x:t.x??e.x,y:t.y??e.y,width:e.width,height:e.height};if(s.width<=0||s.height<=0)return null;let o={...s},n=t;for(;n;){if(n.visible===!1||n.renderable===!1)return{fullBounds:s,visibleBounds:null};let l=iG(n);if(l&&(o=wR(o,l),!o))return{fullBounds:s,visibleBounds:null};n=n.parent}let a=r?.renderer?{x:0,y:0,width:r.renderer.width,height:r.renderer.height}:null;return a&&(o=wR(o,a)),{fullBounds:s,visibleBounds:o}},oG=(r,t)=>t?{top:Math.max(0,t.y-r.y),right:Math.max(0,r.x+r.width-(t.x+t.width)),bottom:Math.max(0,r.y+r.height-(t.y+t.height)),left:Math.max(0,t.x-r.x)}:{top:r.height,right:0,bottom:0,left:0},nG=({displayedValue:r,textStyle:t})=>{let e=Ye(r,t);return{lines:[{text:r,width:e,startIndex:0}],lineHeight:t.lineHeight,totalHeight:t.lineHeight,maxLineWidth:e,textValue:r}},aG=({displayedValue:r,textStyle:t})=>{let e=mn(r),i=e.split(`
1147
1147
  `),s=i.map((a,l)=>({text:a,width:Ye(a,t),startIndex:l===0?0:i.slice(0,l).reduce((c,h)=>c+h.length+1,0)})),o=s.reduce((a,l)=>Math.max(a,l.width),0),n=t.lineHeight;return{lines:s,lineHeight:n,totalHeight:s.length*n,maxLineWidth:o,textValue:e}},lG=({element:r,displayedValue:t,textStyle:e})=>r.multiline?aG({displayedValue:t,textStyle:e}):nG({displayedValue:t,textStyle:e}),Od=({value:r,index:t})=>{let e=mn(r),i=Zi(t,0,e.length),s=0,o=0;for(let n=0;n<i;n+=1){if(e[n]===`
1148
- `){s+=1,o=0;continue}o+=1}return{line:s,column:o}},yy=({contentWidth:r,lineWidth:t,align:e})=>rG(r,t,e),cG=r=>new Cr({label:r,text:""}),hG=(r,t)=>{for(;r.textNodes.length<t;){let e=cG(`${r.element.id}-text-line-${r.textNodes.length}`);r.text.addChild(e),r.textNodes.push(e)}for(;r.textNodes.length>t;){let e=r.textNodes.pop();e?.removeFromParent(),e?.destroy()}},Ud=({contentWidth:r,lineWidth:t,align:e,scrollOffsetX:i})=>t>r?-i:yy({contentWidth:r,lineWidth:t,align:e}),AR=({contentWidth:r,lineWidth:t,align:e})=>yy({contentWidth:r,lineWidth:t,align:e}),Gd=({padding:r,contentWidth:t,lineWidth:e,align:i,scrollOffsetX:s})=>r.left+AR({contentWidth:t,lineWidth:e,align:i})-s,PR=r=>{let t=new Bt;t.label=`${r.id}-background`;let e=new Bt;e.label=`${r.id}-selection`;let i=new rt;i.label=`${r.id}-text`;let s=new Cr({label:`${r.id}-placeholder`,text:r.placeholder}),o=new Bt;o.label=`${r.id}-caret`;let n=new Bt;return n.label=`${r.id}-clip`,i.mask=n,s.mask=n,e.mask=n,o.mask=n,{background:t,selection:e,text:i,placeholder:s,caret:o,clip:n}},CR=({app:r,container:t,display:e,element:i})=>({app:r,container:t,...e,value:mn(i.value??""),selectionStart:mn(i.value??"").length,selectionEnd:mn(i.value??"").length,focused:!1,nativeFocused:!1,composing:!1,blinkVisible:!0,blinkTick:0,scrollOffsetX:0,scrollOffsetY:0,selectionAnchor:null,draggingSelection:!1,textNodes:[],layoutState:null,lastExternalValue:mn(i.value??""),tickerListener:null,element:i}),Dd=(r,t,e)=>{let i=sG({app:r,container:t,fallbackElement:e});if(!i)return null;let{fullBounds:s,visibleBounds:o}=i,n=oG(s,o);return{x:s.x,y:s.y,width:s.width,height:s.height,visible:!!o&&t.visible!==!1&&t.renderable!==!1,clipInsets:n}},Qt=(r,t)=>{let e=xy(t.padding),i=Math.max(0,t.width-e.left-e.right),s=Math.max(0,t.height-e.top-e.bottom),o=Ld(t.textStyle,{wordWrapWidth:i}),n=Ld({...t.textStyle,fill:"#7A7A7A"},{wordWrapWidth:i}),a=String(r.value??""),l=lG({element:t,displayedValue:a,textStyle:o}),c=o.align??"left",h=Zi(Math.min(r.selectionStart,r.selectionEnd),0,a.length),u=Zi(Math.max(r.selectionStart,r.selectionEnd),0,a.length),d=Zi(r.selectionEnd??a.length,0,a.length);if(r.layoutState={padding:e,contentWidth:i,contentHeight:s,textStyle:o,placeholderStyle:n,displayedValue:a,layout:l,align:c},hG(r,l.lines.length),r.textNodes.forEach((p,m)=>{let x=l.lines[m]??{text:"",width:0};Yr(p,o),p.text=x.text}),Yr(r.placeholder,n),r.placeholder.text=t.placeholder??"",t.multiline){let p=Od({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),x=m?.width??0,_=Ye((m?.text??"").slice(0,p.column),o),T=l.totalHeight,g=p.line*l.lineHeight,w=g+l.lineHeight;if(x<=i)r.scrollOffsetX=0;else if(r.focused){let S=Math.max(0,x-i);_-r.scrollOffsetX>i-8?r.scrollOffsetX=_-(i-8):_-r.scrollOffsetX<8&&(r.scrollOffsetX=_-8),r.scrollOffsetX=Zi(r.scrollOffsetX,0,S)}else r.scrollOffsetX=0;if(T<=s)r.scrollOffsetY=0;else if(r.focused){let b=Math.max(0,T-s);w-r.scrollOffsetY>s?r.scrollOffsetY=w-s:g-r.scrollOffsetY<0&&(r.scrollOffsetY=g),r.scrollOffsetY=Zi(r.scrollOffsetY,0,b)}else r.scrollOffsetY=0}else{let p=l.lines[0],m=Ye(p.text.slice(0,d),o);if(p.width<=i)r.scrollOffsetX=0;else if(r.focused){let _=Math.max(0,p.width-i);m-r.scrollOffsetX>i-8?r.scrollOffsetX=m-(i-8):m-r.scrollOffsetX<8&&(r.scrollOffsetX=m-8),r.scrollOffsetX=Zi(r.scrollOffsetX,0,_)}else r.scrollOffsetX=0;r.scrollOffsetY=0}if(t.multiline)r.text.x=e.left-r.scrollOffsetX,r.text.y=e.top-r.scrollOffsetY,r.textNodes.forEach((p,m)=>{let x=l.lines[m]??{width:0};p.x=AR({contentWidth:i,lineWidth:x.width,align:c}),p.y=m*l.lineHeight});else{let p=l.lines[0],m=r.textNodes[0],x=Ud({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX});m.x=0,m.y=0,r.text.x=e.left+x,r.text.y=e.top+Math.max(0,(s-m.height)/2)}let f=Lt.measureText(r.placeholder.text,ER(n));if(r.placeholder.x=e.left,r.placeholder.y=t.multiline?e.top:e.top+Math.max(0,(s-r.placeholder.height)/2),f.width<=i&&(r.placeholder.x+=yy({contentWidth:i,lineWidth:f.width,align:c})),r.placeholder.visible=r.value.length===0&&r.composing!==!0,r.background.clear(),r.background.rect(0,0,t.width,t.height),r.background.fill({color:pn.fill,alpha:pn.fillAlpha}),pn.strokeWidth>0&&r.background.stroke({color:pn.strokeColor,alpha:pn.strokeAlpha,width:pn.strokeWidth}),r.focused&&kd.strokeWidth>0&&t.disabled!==!0&&r.background.stroke({color:kd.strokeColor,alpha:kd.strokeAlpha,width:kd.strokeWidth}),r.clip.clear(),r.clip.rect(e.left,e.top,i,Math.max(0,s)),r.clip.fill({color:16777215,alpha:1}),r.selection.clear(),r.focused&&h!==u&&t.disabled!==!0){if(t.multiline){let p=Od({value:a,index:h}),m=Od({value:a,index:u});for(let x=p.line;x<=m.line;x+=1){let _=l.lines[x];if(!_)continue;let T=x===p.line?p.column:0,g=x===m.line?m.column:_.text.length,w=Gd({padding:e,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Ye(_.text.slice(0,T),o),b=Gd({padding:e,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Ye(_.text.slice(0,g),o),S=e.top+x*l.lineHeight-r.scrollOffsetY;r.selection.rect(w,S,Math.max(b-w,1),l.lineHeight)}}else{let p=l.lines[0],m=Ud({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),x=e.left+m+Ye(p.text.slice(0,h),o),_=e.left+m+Ye(p.text.slice(0,u),o),T=e.top+Math.max(0,(s-r.text.height)/2);r.selection.rect(x,T,Math.max(_-x,1),Math.max(r.text.height,o.lineHeight))}r.selection.fill({color:TR.fill,alpha:TR.alpha})}if(r.caret.clear(),r.focused&&r.selectionStart===r.selectionEnd&&r.blinkVisible!==!1&&t.disabled!==!0){if(t.multiline){let p=Od({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),x=Gd({padding:e,contentWidth:i,lineWidth:m?.width??0,align:c,scrollOffsetX:r.scrollOffsetX})+Ye((m?.text??"").slice(0,p.column),o),_=e.top+p.line*l.lineHeight-r.scrollOffsetY;r.caret.rect(x,_,gy.width,l.lineHeight)}else{let p=l.lines[0],m=Ud({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),x=e.left+m+Ye(p.text.slice(0,d),o),_=e.top+Math.max(0,(s-r.text.height)/2);r.caret.rect(x,_,gy.width,Math.max(r.text.height,o.lineHeight))}r.caret.fill({color:gy.fill,alpha:1})}},_y=(r,t)=>{let e=r.layoutState;if(!e)return 0;let{padding:i,contentWidth:s,textStyle:o,displayedValue:n,layout:a,align:l}=e,c=t?.x??0,h=t?.y??0;if(!r.element.multiline){let m=a.lines[0]??{text:n,width:Ye(n,o)},x=Ud({contentWidth:s,lineWidth:m.width,align:l,scrollOffsetX:r.scrollOffsetX}),_=i.left+x;return SR({text:m.text,style:o,targetX:c-_})}let u=a.lineHeight||o.lineHeight||1,d=Zi(Math.floor((h-i.top+r.scrollOffsetY)/u),0,Math.max(a.lines.length-1,0)),f=a.lines[d]??{text:"",startIndex:0},p=SR({text:f.text,style:o,targetX:c-Gd({padding:i,contentWidth:s,lineWidth:f.width??0,align:l,scrollOffsetX:r.scrollOffsetX})});return f.startIndex+p};var Qi=({eventHandler:r,eventName:t,element:e,eventConfig:i,snapshot:s})=>{!r||!i||r(t,{_event:{id:e.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},uG=({app:r,container:t,element:e,runtime:i,eventHandler:s})=>({onValueChange:o=>{i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.lastExternalValue=o.value,Qt(i,e),Qi({eventHandler:s,eventName:"change",element:e,eventConfig:e.change,snapshot:o})},onFocus:o=>{let n=i.nativeFocused===!0;i.nativeFocused=!0,i.focused=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.selectionAnchor=o.selectionStart===o.selectionEnd?o.selectionEnd:i.selectionAnchor,i.blinkVisible=!0,i.blinkTick=0,Qt(i,e),!n&&Qi({eventHandler:s,eventName:"focus",element:e,eventConfig:e.focusEvent,snapshot:o})},onBlur:o=>{i.nativeFocused=!1,i.focused=!1,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.blinkVisible=!1,i.composing=!1,Qt(i,e),Qi({eventHandler:s,eventName:"blur",element:e,eventConfig:e.blurEvent,snapshot:o})},onSelectionChange:o=>{i.nativeFocused=o.focused,i.focused=o.focused,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,o.selectionStart===o.selectionEnd&&(i.selectionAnchor=o.selectionEnd),Qt(i,e),Qi({eventHandler:s,eventName:"selectionChange",element:e,eventConfig:e.selectionChange,snapshot:o})},onSubmit:o=>{Qi({eventHandler:s,eventName:"submit",element:e,eventConfig:e.submit,snapshot:o})},onCompositionStart:o=>{i.composing=!0,Qt(i,e),Qi({eventHandler:s,eventName:"compositionStart",element:e,eventConfig:e.compositionStart,snapshot:o})},onCompositionUpdate:o=>{i.composing=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,Qt(i,e),Qi({eventHandler:s,eventName:"compositionUpdate",element:e,eventConfig:e.compositionUpdate,snapshot:o})},onCompositionEnd:o=>{i.composing=!1,i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,Qt(i,e),Qi({eventHandler:s,eventName:"compositionEnd",element:e,eventConfig:e.compositionEnd,snapshot:o})}}),RR=({app:r,parent:t,element:e,eventHandler:i,zIndex:s})=>{if(!r.inputDomBridge?.mount||!r.inputDomBridge?.focus||!r.inputDomBridge?.setSelection)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let o=new rt({label:e.id});o.zIndex=s,o.sortableChildren=!0,o.eventMode="static",o.cursor=e.disabled?"default":"text",o.x=Math.round(e.x),o.y=Math.round(e.y),o.alpha=e.alpha;let n=PR(e),a=CR({app:r,container:o,display:n,element:e});o.addChild(a.background,a.selection,a.text,a.placeholder,a.caret,a.clip),a.tickerListener=f=>{if(!a.focused){if(a.blinkVisible===!1)return;a.blinkVisible=!1,Qt(a,a.element);return}a.blinkTick+=f.deltaMS??f.deltaTime??16,a.blinkTick>=530&&(a.blinkTick=0,a.blinkVisible=!a.blinkVisible,Qt(a,a.element))},r.ticker?.add?.(a.tickerListener);let l=({start:f,end:p,shouldFocus:m=!1})=>{if(m){r.inputDomBridge.focus(e.id,{selectionStart:f,selectionEnd:p});return}r.inputDomBridge.setSelection(e.id,f,p)},c=({start:f,end:p,shouldFocus:m=!1,anchor:x=a.selectionAnchor})=>{a.focused=!0,a.selectionStart=f,a.selectionEnd=p,a.selectionAnchor=x,a.blinkVisible=!0,a.blinkTick=0,Qt(a,a.element),l({start:f,end:p,shouldFocus:m})},h=f=>{if(a.element.disabled===!0)return;let p=o.toLocal(f.global),m=_y(a,p),x=!!f.shiftKey&&a.focused,_=x?a.selectionAnchor??(a.selectionStart!==a.selectionEnd?a.selectionStart:a.selectionEnd):m,T=x?Math.min(_,m):m,g=x?Math.max(_,m):m;a.draggingSelection=!0,c({start:T,end:g,shouldFocus:!0,anchor:_})},u=f=>{if(!a.draggingSelection||a.element.disabled===!0)return;let p=o.toLocal(f.global),m=_y(a,p),x=a.selectionAnchor??m,_=Math.min(x,m),T=Math.max(x,m);c({start:_,end:T,anchor:x})},d=()=>{a.draggingSelection=!1};o.on("pointerdown",h),o.on("globalpointermove",u),o.on("pointerup",d),o.on("pointerupoutside",d),o.on("pointerup",()=>{a.element.disabled!==!0&&r.inputDomBridge.focus(e.id,{selectionStart:a.selectionStart,selectionEnd:a.selectionEnd})}),o[gn]=a,Qt(a,e),r.inputDomBridge.mount(e.id,{...e,value:a.value,callbacks:uG({app:r,container:o,element:e,runtime:a,eventHandler:i}),getGeometry:()=>Dd(r,o,e)}),t.addChild(o)};var Ji=({eventHandler:r,eventName:t,element:e,eventConfig:i,snapshot:s})=>{!r||!i||r(t,{_event:{id:e.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},dG=({element:r,runtime:t,eventHandler:e})=>({onValueChange:i=>{t.value=i.value,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.lastExternalValue=i.value,Qt(t,r),Ji({eventHandler:e,eventName:"change",element:r,eventConfig:r.change,snapshot:i})},onFocus:i=>{let s=t.nativeFocused===!0;t.nativeFocused=!0,t.focused=!0,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.selectionAnchor=i.selectionStart===i.selectionEnd?i.selectionEnd:t.selectionAnchor,t.blinkVisible=!0,t.blinkTick=0,Qt(t,r),!s&&Ji({eventHandler:e,eventName:"focus",element:r,eventConfig:r.focusEvent,snapshot:i})},onBlur:i=>{t.nativeFocused=!1,t.focused=!1,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.blinkVisible=!1,t.composing=!1,Qt(t,r),Ji({eventHandler:e,eventName:"blur",element:r,eventConfig:r.blurEvent,snapshot:i})},onSelectionChange:i=>{t.nativeFocused=i.focused,t.focused=i.focused,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,i.selectionStart===i.selectionEnd&&(t.selectionAnchor=i.selectionEnd),Qt(t,r),Ji({eventHandler:e,eventName:"selectionChange",element:r,eventConfig:r.selectionChange,snapshot:i})},onSubmit:i=>{Ji({eventHandler:e,eventName:"submit",element:r,eventConfig:r.submit,snapshot:i})},onCompositionStart:i=>{t.composing=!0,Qt(t,r),Ji({eventHandler:e,eventName:"compositionStart",element:r,eventConfig:r.compositionStart,snapshot:i})},onCompositionUpdate:i=>{t.composing=!0,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,Qt(t,r),Ji({eventHandler:e,eventName:"compositionUpdate",element:r,eventConfig:r.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{t.composing=!1,t.value=i.value,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,Qt(t,r),Ji({eventHandler:e,eventName:"compositionEnd",element:r,eventConfig:r.compositionEnd,snapshot:i})}}),MR=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,zIndex:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;if(!r.inputDomBridge?.update)throw new Error("Input plugin requires app.inputDomBridge to be initialized");n.zIndex=o;let a=n[gn];if(!a)return;let l={...i},c=a.focused!==!0||i.value!==e.value;c&&a.composing!==!0?(a.value=i.value,a.lastExternalValue=i.value):l.value=a.value,a.element=l,n.label=i.id,n.cursor=i.disabled?"default":"text",n.x=Math.round(i.x),n.y=Math.round(i.y),n.alpha=i.alpha,i.disabled===!0&&(a.draggingSelection=!1),(!gt(e,i)||c)&&Qt(a,l),r.inputDomBridge.update(i.id,{...l,value:a.value,callbacks:dG({element:l,runtime:a,eventHandler:s}),getGeometry:()=>Dd(r,n,l)})};var IR=({app:r,parent:t,element:e})=>{let i=t.getChildByLabel(e.id);if(!i)return;if(!r.inputDomBridge?.unmount)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let s=i[gn];s?.tickerListener&&r.ticker?.remove?.(s.tickerListener),r.inputDomBridge.unmount(e.id),i.destroy({children:!0})};var BR=({state:r})=>{let t=ge(r),e=String(r.value??""),i=String(r.placeholder??"");return delete t.originX,delete t.originY,{...t,value:e,placeholder:i,multiline:r.multiline===!0,disabled:r.disabled===!0,...typeof r.maxLength=="number"&&{maxLength:Math.round(r.maxLength)},textStyle:Ld(r.textStyle),padding:xy(r.padding),...r.change&&{change:r.change},...r.submit&&{submit:r.submit},...r.focusEvent&&{focusEvent:r.focusEvent},...r.blurEvent&&{blurEvent:r.blurEvent},...r.selectionChange&&{selectionChange:r.selectionChange},...r.compositionStart&&{compositionStart:r.compositionStart},...r.compositionUpdate&&{compositionUpdate:r.compositionUpdate},...r.compositionEnd&&{compositionEnd:r.compositionEnd}}};var fG=Zt({type:"input",add:RR,update:MR,delete:IR,parse:BR});var Ql=({container:r,element:t,interactive:e=!0,allowViewportWithoutScroll:i=!1})=>{let s=0,o=0;t.children.forEach(c=>{s=Math.max(c.width+c.x,s),o=Math.max(c.height+c.y,o)});let n=!!(t.height&&o>t.height),a=!!(t.width&&s>t.width);if((t.scroll||i)&&(n||a)){let c=new rt({label:`${r.label}-content`});[...r.children].forEach(x=>{c.addChild(x)}),r.addChild(c);let u=new Bt({label:`${r.label}-clip`}).rect(0,0,t.width||s,t.height||o).fill({color:16711680,alpha:0});r.addChild(u),c.mask=u;let d=-(o-(t.height||o)),f=-(s-(t.width||s)),p=t.anchorToBottom&&n?d:0,m=t.anchorToBottom&&a?f:0;t.anchorToBottom&&(c.y=p,c.x=m),e&&(r.eventMode="static",r.hitArea=new Q(0,0,t.width||s,t.height||o),r.on("wheel",x=>{if(x.preventDefault(),n&&x.deltaY!==0){let _=p-x.deltaY;_>0?p=0:_<d?p=d:p=_,c.y=p}if(a&&(x.deltaX!==0||x.shiftKey&&x.deltaY!==0)){let _=x.deltaX!==0?x.deltaX:x.deltaY,T=m-_;T>0?m=0:T<f?m=f:m=T,c.x=m}}))}},by=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel")};var vy=({container:r,element:t,enabled:e})=>{if(e){r.hitArea=new Q(0,0,t.width,t.height);return}r.hitArea=null},FR=(r,t)=>{let e=t??null;for(;e;){if(e===r)return!0;e=e.parent??null}return!1},pG=(r,t)=>{if(!t||typeof t.x!="number"||typeof t.y!="number")return!1;let e=r.toLocal(t),i=r.hitArea;return i?.contains?i.contains(e.x,e.y):!1},Nd=({app:r,container:t,element:e,eventHandler:i})=>{let s=hy(t),o=uy(t),n=dy(t),a=s;un({root:t,isHovered:!1}),Bs({root:t,isPressed:!1}),bi({root:t,isPressed:!1}),t.removeAllListeners("pointerover"),t.removeAllListeners("pointerout"),t.removeAllListeners("pointerdown"),t.removeAllListeners("pointerup"),t.removeAllListeners("pointerupoutside"),t.removeAllListeners("rightdown"),t.removeAllListeners("rightup"),t.removeAllListeners("rightupoutside"),t.removeAllListeners("rightclick"),t.cursor="auto",e.scroll||(t.eventMode="auto",vy({container:t,element:e,enabled:!1}));let l=e?.hover,c=e?.click,h=e?.rightClick;if(!!(l||c||h)&&(t.eventMode="static",e.scroll?t.hitArea||vy({container:t,element:e,enabled:!0}):vy({container:t,element:e,enabled:!1})),l){let{cursor:d,soundSrc:f,payload:p,inheritToChildren:m}=l,x=T=>{FR(t,T?.relatedTarget)||a||(a=!0,p&&i&&i("hover",{_event:{id:t.label},...p}),d&&(t.cursor=d),f&&r.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),m&&un({root:t,isHovered:!0}))},_=T=>{FR(t,T?.relatedTarget)||pG(t,T?.global)||a&&(a=!1,t.cursor="auto",m&&un({root:t,isHovered:!1}))};t.on("pointerover",x),t.on("pointerout",_)}if(c){let{soundSrc:d,soundVolume:f,payload:p,inheritToChildren:m}=c,x=g=>{ie(g)&&m&&Bs({root:t,isPressed:!0})},_=g=>{ie(g)&&(m&&Bs({root:t,isPressed:!1}),p&&i&&i("click",{_event:{id:t.label},...p}),d&&r.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1,volume:(f??1e3)/1e3}))},T=g=>{ie(g)&&m&&Bs({root:t,isPressed:!1})};t.on("pointerdown",x),t.on("pointerup",_),t.on("pointerupoutside",T)}if(h){let{soundSrc:d,payload:f,inheritToChildren:p}=h,m=()=>{p&&bi({root:t,isPressed:!0})},x=()=>{p&&bi({root:t,isPressed:!1})},_=w=>{$C(w)&&p&&bi({root:t,isPressed:!1})},T=()=>{p&&bi({root:t,isPressed:!1}),f&&i&&i("rightClick",{_event:{id:t.label},...f}),d&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:d,loop:!1})},g=()=>{p&&bi({root:t,isPressed:!1})};t.on("rightdown",m),t.on("rightup",x),t.on("pointerup",_),t.on("rightclick",T),t.on("pointerupoutside",_),t.on("rightupoutside",g)}l?.inheritToChildren&&s&&un({root:t,isHovered:!0}),c?.inheritToChildren&&o&&Bs({root:t,isPressed:!0}),h?.inheritToChildren&&n&&bi({root:t,isPressed:!0})},kR=({container:r})=>{hy(r)&&un({root:r,isHovered:!0})},OR=({container:r})=>{uy(r)&&Bs({root:r,isPressed:!0})},UR=({container:r})=>{dy(r)&&bi({root:r,isPressed:!0})};var Jl=r=>{let t=new Set;if(r.id&&t.add(r.id),r.children&&Array.isArray(r.children))for(let e of r.children)for(let i of Jl(e))t.add(i);return t};var GR=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let c of r)i.add(c.id),s.set(c.id,c);for(let c of t)i.add(c.id),o.set(c.id,c);for(let c of i){let h=s.get(c),u=o.get(c);if(!h&&u)n.push(u);else if(h&&!u)a.push(h);else{let d=Jl(u),f=e instanceof Map?Array.from(e.keys()).some(p=>d.has(p)):e.find(p=>d.has(p.targetId));(!gt(h,u)||f)&&l.push({prev:h,next:u})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var Hd=r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375,mG=r=>r,gG=r=>r*r,xG=r=>1-(1-r)*(1-r),yG=r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,LR=Object.freeze({linear:mG,easeInQuad:gG,easeOutQuad:xG,easeInOutQuad:yG,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>2.70158*r*r*r-1.70158*r*r,easeOutBack:r=>1+2.70158*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>{let e=2.5949095;return r<.5?Math.pow(2*r,2)*((e+1)*2*r-e)/2:(Math.pow(2*r-2,2)*((e+1)*(r*2-2)+e)+2)/2},easeInBounce:r=>1-Hd(1-r),easeOutBounce:Hd,easeInOutBounce:r=>r<.5?(1-Hd(1-2*r))/2:(1+Hd(2*r-1))/2,easeInElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*t)},easeOutElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*t)+1},easeInOutElastic:r=>{let t=2*Math.PI/4.5;return r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*t))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*t)/2+1}}),Vd=Object.freeze(Object.keys(LR)),_G=(r="linear")=>{let t=LR[r];if(!t)throw new Error(`Unsupported easing: ${r}`);return t},xn=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,t.push({time:e,value:s,easing:"linear"});return}o!==void 0&&(e+=o,i=a?i+s:s,t.push({time:e,value:i,easing:n}))}),t},tc=r=>{let t=0;for(let{timeline:e}of r){let i=e[e.length-1];i&&i.time>t&&(t=i.time)}return t},ec=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let l=(t-i)/(n-i);return s+(a-s)*_G(o)(l)}}return r[r.length-1].value};var bG={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},Sy=r=>Math.min(1,Math.max(0,r)),Wd=(r,t,e)=>{if(r===t)return e<r?0:1;let i=Sy((e-r)/(t-r));return i*i*(3-2*i)},HR=r=>r.getLocalBounds().rectangle.clone(),VR=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),DR=(r,t)=>{let e=VR(HR(t)),i=r.renderer.generateTexture({target:t,frame:e}),s=new wt(i);s.x=e.x,s.y=e.y;let o=new rt;return o.x=t.x??0,o.y=t.y??0,o.scale.set(t.scale?.x??1,t.scale?.y??1),o.rotation=t.rotation??0,o.alpha=t.alpha??1,o.addChild(s),{wrapper:o,texture:i}},vG=(r={})=>Object.entries(r).map(([t,e])=>({property:t,timeline:xn([{value:e.initialValue??bG[t]??0},...e.keyframes])})),zd=(r,t,e)=>{if(!r||!t)return{duration:0,apply:()=>{}};let i=vG(t),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:tc(i),apply:o=>{r.x=s.x,r.y=s.y,r.alpha=s.alpha,r.scale.x=s.scaleX,r.scale.y=s.scaleY,r.rotation=s.rotation;for(let{property:n,timeline:a}of i){let l=ec(a,o);switch(n){case"translateX":r.x=s.x+l*e.renderer.width;break;case"translateY":r.y=s.y+l*e.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},TG=r=>xn([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),SG=(r,t)=>{let e=document.createElement("canvas");e.width=r,e.height=t;let i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:e,context:i}},wG=(r,t,e="red")=>{switch(e){case"green":return r[t+1];case"blue":return r[t+2];case"alpha":return r[t+3];default:return r[t]}},Ty=({app:r,texture:t,width:e,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(e*i),a=new wt(B.from(t));a.width=e,a.height=i;let l=new rt;l.addChild(a);let c=gi.create({width:e,height:i});r.renderer.render({container:l,target:c,clear:!0});let h=r.renderer.extract.pixels(c).pixels;for(let u=0,d=0;u<n.length;u++,d+=4){let f=wG(h,d,s);o&&(f=255-f),n[u]=f}return l.destroy({children:!0}),c.destroy(!0),n},EG=(r,t,e,i)=>{let s=null;for(let o of t.items){let n=Ty({app:r,texture:o.texture,width:e,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a<s.length;a++)switch(t.combine??"max"){case"min":s[a]=Math.min(s[a],n[a]);break;case"multiply":s[a]=Math.round(s[a]/255*(n[a]/255)*255);break;case"add":s[a]=Math.min(255,s[a]+n[a]);break;default:s[a]=Math.max(s[a],n[a]);break}}return s??new Uint8ClampedArray(e*i)},AG=(r,t,e,i)=>{let s=TG(t),o=tc([{timeline:s}]),n=Math.max(t?.softness??.001,1e-4);if(!t)return{duration:o,progressTimeline:s,sample:()=>0,destroy:()=>{}};if(t.kind==="single"){let l=Ty({app:r,texture:t.texture,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1});return{duration:o,progressTimeline:s,sample:(c,h)=>Wd(c-n,c+n,l[h]/255),destroy:()=>{}}}if(t.kind==="sequence"){let l=t.textures.map(c=>Ty({app:r,texture:c,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1}));return{duration:o,progressTimeline:s,sample:(c,h)=>{let u=Sy(c)*Math.max(0,l.length-1);if(t.sample==="linear"&&l.length>1){let f=Math.floor(u),p=Math.min(l.length-1,f+1),m=u-f,x=(l[f][h]*(1-m)+l[p][h]*m)/255;return Wd(c-n,c+n,x)}let d=Math.min(l.length-1,Math.max(0,Math.round(u)));return Wd(c-n,c+n,l[d][h]/255)},destroy:()=>{}}}let a=EG(r,t,e,i);return{duration:o,progressTimeline:s,sample:(l,c)=>Wd(l-n,l+n,a[c]/255),destroy:()=>{}}},PG=r=>{let t=new rt;for(let e of r)e?.wrapper&&t.addChild(e.wrapper);return VR(HR(t))},NR=({app:r,container:t,target:e,frame:i})=>{r.renderer.render({container:t,target:e,clear:!0,transform:new U(1,0,0,1,-i.x,-i.y)})},rc=r=>{r?.texture?.destroy(!0)},CG=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=new rt;o.zIndex=s,e?.wrapper&&o.addChild(e.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=zd(e?.wrapper??null,t.prev?.tween,r),a=zd(i?.wrapper??null,t.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),rc(e),rc(i)}}},RG=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=PG([e,i]),n=new rt,a=new rt;e?.wrapper&&n.addChild(e.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=gi.create({width:o.width,height:o.height}),c=gi.create({width:o.width,height:o.height}),{canvas:h,context:u}=SG(o.width,o.height),d=u.createImageData(o.width,o.height),f=B.from(h),p=new rt;p.zIndex=s;let m=new wt(f);m.x=o.x,m.y=o.y,p.addChild(m);let x=AG(r,t.mask,o.width,o.height),_=zd(e?.wrapper??null,t.prev?.tween,r),T=zd(i?.wrapper??null,t.next?.tween,r),g=new Uint8ClampedArray(o.width*o.height*4);return{overlay:p,duration:Math.max(_.duration,T.duration,x.duration),apply:w=>{_.apply(w),T.apply(w);let b=g,S=g;e?.wrapper&&(NR({app:r,container:n,target:l,frame:o}),b=r.renderer.extract.pixels(l).pixels),i?.wrapper&&(NR({app:r,container:a,target:c,frame:o}),S=r.renderer.extract.pixels(c).pixels);let v=Sy(ec(x.progressTimeline,w)),A=d.data;for(let P=0,C=0;P<A.length;P+=4,C+=1){let R=x.sample(v,C),M=1-R;A[P]=Math.round(b[P]*M+S[P]*R),A[P+1]=Math.round(b[P+1]*M+S[P+1]*R),A[P+2]=Math.round(b[P+2]*M+S[P+2]*R),A[P+3]=Math.round(b[P+3]*M+S[P+3]*R)}u.putImageData(d,0,0),f.source.update()},destroy:()=>{p.removeFromParent(),p.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),f.destroy(!0),rc(e),rc(i),x.destroy()}}},MG=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>t.mask?RG({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}):CG({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}),IG=({app:r,parent:t,nextElement:e,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:h,signal:u})=>{if(!e)return null;let d=i.add({app:r,parent:t,element:e,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:h,signal:u});return d&&typeof d.then=="function"?d.then(()=>u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null):u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null},BG=async r=>r&&typeof r.then=="function"?r:r??null,$d=({app:r,parent:t,prevElement:e,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:h,plugin:u,zIndex:d,signal:f})=>{if(!e&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||t.destroyed)return;let p=e?t.children.find(M=>M.label===e.id)??null:null;if(e&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${e.id}".`);let m=p?DR(r,p):null,x=new rt,_=_d({suppressAnimations:!0}),T=a.getVersion(),g=!1,w=()=>{g||(a.track(T),g=!0)},b=()=>{g&&(a.complete(T),g=!1)},S=({flushDeferredEffects:M})=>{if(!P){if(P=!0,v.value&&!v.value.destroyed&&(v.value.visible=!0),A.value?.destroy(),M){LC(_);return}bd(_)}},v={value:null},A={value:null},P=!1;w();let C=M=>{if(f?.aborted||t.destroyed){bd(_),x.destroy({children:!0}),rc(m),b();return}if(i&&!M)throw bd(_),b(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);v.value=M;let I=M?DR(r,M):null;x.destroy({children:!1}),p&&u.delete({app:r,parent:t,element:e,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:h,signal:f}),M&&(M.zIndex=d,t.addChild(M),M.visible=!1);let k=MG({app:r,animation:s,prevSubject:m,nextSubject:I,zIndex:d});A.value=k,t.addChild(k.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:k.duration,applyFrame:k.apply,applyTargetState:()=>{S({flushDeferredEffects:!1})},onComplete:()=>{S({flushDeferredEffects:!0}),b()},onCancel:()=>{b()},isValid:()=>!!k.overlay&&!k.overlay.destroyed&&(!M||!M.destroyed)}})},R=i?IG({app:r,parent:x,nextElement:i,plugin:u,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:f}):null;if(R&&typeof R.then=="function"){BG(R).then(C);return}C(R??null)};var ks=({app:r,parent:t,prevComputedTree:e,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=_d(),signal:h})=>{t.sortableChildren=!0;let u=new Map(l.map(b=>[b.type,b])),d=DC(s),f=new Map,p=new Map;for(let b of e)f.set(b.id,b);for(let b=0;b<i.length;b++)p.set(i[b].id,b);let{toAddElement:m,toDeleteElement:x,toUpdateElement:_}=GR(e,i,s),T=new Set(_.map(({next:b})=>b.id)),g=b=>{let S=u.get(b);if(!S)throw new Error(`No plugin found for element type: ${b}`);return S},w=b=>t.children.find(S=>S.label===b)?.zIndex??-1;for(let b of i){let S=f.get(b.id);!S||T.has(b.id)||!gt(S,b)||g(b.type).shouldUpdateUnchanged?.({app:r,parent:t,prevElement:S,nextElement:b,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(b.id)??-1,signal:h})!==!0||(_.push({prev:S,next:b}),T.add(b.id))}for(let b of t.children){let S=p.get(b.label);S!==void 0&&(b.zIndex=S)}for(let b of x){let S=c.suppressAnimations?null:Sd(d,b.id),v=g(b.type);if(S){$d({app:r,parent:t,prevElement:b,nextElement:null,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:w(b.id),signal:h});continue}v.delete({app:r,parent:t,element:b,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:h})}for(let b of m){let S=c.suppressAnimations?null:Sd(d,b.id),v=g(b.type),A=p.get(b.id)??-1;if(S){$d({app:r,parent:t,prevElement:null,nextElement:b,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:A,signal:h});continue}v.add({app:r,parent:t,element:b,animations:c.suppressAnimations||b.type==="container"?d:[],eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:A,signal:h})}for(let{prev:b,next:S}of _){let v=g(S.type),A=p.get(S.id)??-1,P=c.suppressAnimations?null:Sd(d,S.id);if(P){$d({app:r,parent:t,prevElement:b,nextElement:S,animation:P,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:A,signal:h});continue}v.update({app:r,parent:t,prevElement:b,nextElement:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:A,signal:h})}};var FG=(r=[])=>{let t=new Set;for(let e of r)if(e?.id){if(t.has(e.id))return!0;t.add(e.id)}return!1},kG=({app:r,container:t,children:e,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of e){let h=o.find(u=>u.type===c.type);if(!h)throw new Error(`No plugin found for child element type: ${c.type}`);h.add({app:r,parent:t,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},WR=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:h})=>{let{id:u,x:d,y:f,children:p,scroll:m,alpha:x}=e,_=new rt;_.label=u,_.zIndex=l,_.x=Math.round(d),_.y=Math.round(f),_.alpha=x,t.addChild(_),p&&p.length>0&&(FG(p)?kG({app:r,container:_,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:h}):ks({app:r,parent:_,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:h})),(m||e.anchorToBottom)&&Ql({container:_,element:e,interactive:!!m,allowViewportWithoutScroll:!!e.anchorToBottom}),Nd({app:r,container:_,element:e,eventHandler:s})};var zR=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:h,signal:u})=>{let d=t.children.find(T=>T.label===e.id);if(!d)return;d.zIndex=c;let{x:f,y:p,alpha:m}=i,x=()=>{if(!gt(e,i)){d.x=Math.round(f),d.y=Math.round(p),d.label=i.id,d.alpha=m,d.scale.x=1,d.scale.y=1;let b=e.scroll||e.anchorToBottom,S=i.scroll||i.anchorToBottom;b!==S?S?Ql({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom}):by({container:d}):S&&(by({container:d}),Ql({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom})),Nd({app:r,container:d,element:i,eventHandler:s})}let T=!gt(e.children,i.children),g=Jl({children:i.children}),w=Array.from(g).some(b=>Td(o,b).length>0);if(T||w){let S=d.children.find(v=>v.label===`${i.id}-content`)||d;ks({app:r,parent:S,nextComputedTree:i.children,prevComputedTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:h,renderContext:l,signal:u}),kR({container:d}),OR({container:d}),UR({container:d})}};ot({animations:o,targetId:e.id,animationBus:n,completionTracker:h,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{x()}})||x()};var $R=({app:r,parent:t,element:e,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=t.getChildByLabel(e.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0}))};ot({animations:s,targetId:e.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var XR=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,c=0,h=0,u=0,d=0,f=0,p=0,m=0,x=0;for(let g=0;g<o.length;g++){let w=g<o.length-1?s:0,b=o[g];g>0?e==="horizontal"?(b.x=c,b.y=f):e==="vertical"&&(b.x=p,b.y=h):(e==="horizontal"||e==="vertical")&&(b.x=0,b.y=0);let S=t.find(v=>v.type===b.type);if(S){let v=b.scaleX!==void 0||r.scaleX!==void 0,A=b.scaleY!==void 0||r.scaleY!==void 0,P=(b.scaleX??1)*(r.scaleX??1),C=(b.scaleY??1)*(r.scaleY??1);b=S.parse({state:{...b,...v?{scaleX:P}:{},...A?{scaleY:C}:{}},parserPlugins:t})}e==="horizontal"?(r.width&&b.width+m>r.width&&!i&&!r.anchorToBottom?(c=0,m=0,f+=u+s,u=b.height,b.x=0,b.y=f):u=Math.max(u,b.height),c+=b.width+w,m=b.x+b.width,a=Math.max(c,a),l=Math.max(b.height+b.y,l)):e==="vertical"?(r.height&&b.height+x>r.height&&!i&&!r.anchorToBottom?(h=0,x=0,p+=d+s,d=b.width,b.x=p,b.y=0):d=Math.max(d,b.width),h+=b.height+w,x=b.y+b.height,a=Math.max(b.width+b.x,a),l=Math.max(h,l)):(a=Math.max(b.width+b.x,a),l=Math.max(b.height+b.y,l)),n.push(b)}let T={...ge({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:e,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},rotation:r.rotation??0};return r.rightClick&&(T.rightClick=r.rightClick),T};var OG=Zt({type:"container",add:WR,update:zR,delete:$R,parse:XR});var jR=async({parent:r,element:t,animationBus:e,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new rt;if(a.label=t.id,a.zIndex=o,t.x!==void 0&&(a.x=Math.round(t.x)),t.y!==void 0&&(a.y=Math.round(t.y)),t.alpha!==void 0&&(a.alpha=t.alpha),r.addChild(a),i?.suppressAnimations&&t.revealEffect!=="none"){await _i({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"paused-initial"}),vd(i,{container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n});return}await _i({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"autoplay"})};var YR=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),UG=(r,t)=>YR(r)!==YR(t),qR=async({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=r.children.find(d=>d.label===t.id);if(!c)return;let h=async()=>{if(e.x!==void 0&&(c.x=e.x),e.y!==void 0&&(c.y=e.y),e.alpha!==void 0&&(c.alpha=e.alpha),!UG(t,e)){o?.suppressAnimations!==!0&&e.revealEffect!=="none"&&await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&e.revealEffect!=="none"){await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),vd(o,{container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};ot({animations:i,targetId:t.id,animationBus:s,completionTracker:n,element:c,targetState:{x:e.x??c.x,y:e.y??c.y,alpha:e.alpha??c.alpha},onComplete:()=>{h()}})||await h()};var KR=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(ry(o),o.destroy({children:!0}))};ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var GG=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,l=0,c=[...r],h=new WeakSet,u=Math.max(10,r.reduce((f,p)=>f+(p?.text?.length??0),0)*4);for(;c.length>0;){if(l+=1,l>u)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let f=c[0];if(!f.text||f.text.length===0){c.shift();continue}let p=f.text,m=Math.max(1,Math.round(t-s)),x={...f.textStyle,wordWrapWidth:m},_=Lt.measureText(f.text,new It(x));if(_.lineWidths[0]>m&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let T=_.lines[0]??"",g=_.lines.slice(1).join(" ");if(_.lines.length===1&&f.text.endsWith(" ")&&!T.endsWith(" ")&&(T+=" "),T.length===0&&p.length>0){let v=p.match(/^\s+/)?.[0]??"";T=v.length>0?v:p[0],g=p.slice(T.length)}if(g===p){let v=p.match(/^\s+/)?.[0]??p[0]??"";if(v.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");T=v,g=p.slice(v.length)}let w=Lt.measureText(T,new It({...f.textStyle,wordWrap:!1,breakWords:!1})),b=Math.max(0,Math.round(w.width??_.lineWidths[0]??0)),S={text:T,textStyle:x,height:w.height,x:s,y:o};if(f.furigana&&!h.has(f)){h.add(f);let v=Lt.measureText(f.furigana.text,new It(f.furigana.textStyle)),A=-v.height+o+2,P={text:f.furigana.text,textStyle:f.furigana.textStyle,x:Math.round(s+(b-v.width)/2),y:A};S.furigana=P}i.push(S),n=Math.max(n,w.height),s+=b,a=Math.max(a,s),g&&g.length>0?f.text=g:c.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let f=0;f<e.length;f++){let p=e[f].lineMaxHeight;e[f].lineParts=e[f].lineParts.map(m=>{let x=m.height;m.height&&delete m.height;let _=m.y+(p-x),T=m.furigana;return T&&(T.y=T.y-m.y+_),{...m,...T&&{furigana:T},y:_}})}let d=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:d}},ZR=({state:r})=>{let t={...zt,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(h=>{let u={...t,...h.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(h.furigana){let p={...t,...h.furigana.textStyle||{}};p.lineHeight=Math.round(p.lineHeight*p.fontSize),r.width&&(p.wordWrapWidth=r.width,p.wordWrap=!0),d={text:String(h.furigana.text),textStyle:p}}return{text:String(h.text).replace(/ +$/,p=>"\xA0".repeat(p.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=GG(e,i),a=r.width||o,c=ge({...r,width:a,height:n});if(c.alpha=r.alpha??1,r.indicator){let h=r.indicator;c.indicator={revealing:{src:h.revealing?.src??"",width:h.revealing?.width??12,height:h.revealing?.height??12},complete:{src:h.complete?.src??"",width:h.complete?.width??12,height:h.complete?.height??12},offset:h.offset??12}}return{...c,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var LG=Zt({type:"text-revealing",add:jR,update:qR,delete:KR,parse:ZR,shouldUpdateUnchanged:({parent:r,nextElement:t})=>MC(r.children.find(e=>e.label===t.id))});var Xd=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},jd=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var QR=async({app:r,parent:t,element:e,renderContext:i,zIndex:s,signal:o})=>{if(o?.aborted)return;let{id:n,x:a,y:l,width:c,height:h,spritesheetSrc:u,spritesheetData:d,animation:f,alpha:p}=e,m=d,x=Object.keys(m.frames),_=new Gi(B.from(u),m);if(await _.parse(),o?.aborted||t.destroyed)return;let T=f.frames.map(w=>_.textures[x[w]]),g=new Xl(T);g.label=n,g.zIndex=s,g.animationSpeed=f.animationSpeed??.5,g.loop=f.loop??!0,r.debug?Xd(g,n,r.debug):kC(i,g),g.x=Math.round(a),g.y=Math.round(l),g.width=Math.round(c),g.height=Math.round(h),g.alpha=p,t.addChild(g)};var JR=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=t.children.find(_=>_.label===e.id);if(!c)return;c.zIndex=a;let h=async()=>{if(!(l?.aborted||c.destroyed)&&!gt(e,i)&&(c.x=Math.round(i.x),c.y=Math.round(i.y),c.width=Math.round(i.width),c.height=Math.round(i.height),c.alpha=i.alpha,!gt(e.animation,i.animation))){c.animationSpeed=i.animation.animationSpeed??.5,c.loop=i.animation.loop??!0;let _=i.spritesheetData,T=Object.keys(_.frames),g=new Gi(B.from(i.spritesheetSrc),_);if(await g.parse(),l?.aborted||c.destroyed)return;let w=i.animation.frames.map(b=>g.textures[T[b]]);c.textures=w,r.debug?e.id!==i.id&&(jd(c),Xd(c,i.id,r.debug)):c.play()}},{x:u,y:d,width:f,height:p,alpha:m}=i;ot({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:c,targetState:{x:u,y:d,width:f,height:p,alpha:m},onComplete:()=>{h()}})||await h()};var tM=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(c=>c.label===e.id);if(!n)return;let a=()=>{r.debug&&jd(n),n&&!n.destroyed&&(n.stop(),n.destroy())};ot({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var eM=({state:r})=>({...ge(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var DG=Zt({type:"animated-sprite",add:QR,update:JR,delete:tM,parse:eM});var NG=Jx({type:"tween"});var Os=new Map,HG=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:(r.volume??800)/1e3}),rM=r=>Os.has(r),ic=r=>{let t=Os.get(r);t!==void 0&&(clearTimeout(t),Os.delete(r))},wy=({app:r,element:t})=>{let e=HG(t);if(ic(e.id),t.delay&&t.delay>0){let i=setTimeout(()=>{Os.delete(e.id),r.audioStage.add(e)},t.delay);Os.set(e.id,i);return}r.audioStage.add(e)},Ey=()=>{for(let r of Os.values())clearTimeout(r);Os.clear()},iM=({app:r,element:t})=>{wy({app:r,element:t})};var sM=({app:r,prevElement:t,nextElement:e})=>{let i=t.id;if((e.delay??0)>0){r.audioStage.remove(i),wy({app:r,element:e});return}if(rM(i)){ic(i),r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}o.url=e.src,o.loop=e.loop??!1,o.volume=(e.volume??800)/1e3};var oM=({app:r,element:t})=>{ic(t.id),r.audioStage.remove(t.id)};var VG=ty({type:"sound",add:iM,update:sM,delete:oM});var sc=class extends wt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Ay(r){let t=new Bt;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Py(r){let t=new Bt;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Cy(r){let t=new Bt;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function oc(r,t,e){return r+(t-r)*e}function qd(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function nM(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,l=t&255,c=Math.round(oc(i,n,e)),h=Math.round(oc(s,a,e)),u=Math.round(oc(o,l,e));return c<<16|h<<8|u}var Yd=class r{constructor(t,e,i=!1){this.value=i?qd(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},Rr=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=Yd.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?nM(e.value,e.next.value,i):oc(e.value,e.next.value,i)}};var Kd=class{static type="alpha";constructor(t){this.list=new Rr(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},Zd=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var Qd=class{static type="scale";constructor(t){this.list=new Rr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},Jd=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var WG=Math.PI/180,tf=class{static type="speed";constructor(t){this.list=new Rr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},ef=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},rf=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*WG}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var wmt=Math.PI/180,sf=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},of=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var ts=Math.PI/180,nf=class{static type="rotation";constructor(t){this.minStart=t.minStart*ts,this.maxStart=t.maxStart*ts,this.minSpeed=t.minSpeed*ts,this.maxSpeed=t.maxSpeed*ts,this.accel=(t.accel??0)*ts}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},af=class{static type="rotationStatic";constructor(t){this.min=t.min*ts,this.max=t.max*ts}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},lf=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*ts}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var cf=class{static type="color";constructor(t){this.list=new Rr(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},hf=class{static type="colorStatic";constructor(t){this.color=qd(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var uf=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},df=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},Ry=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},My=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},zG={rect:uf,rectangle:uf,torus:df,circle:df,point:Ry,line:My};var ff=class{static type="spawnShape";constructor(t){let e=zG[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},pf=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var aM=new Map,lM=new Map;function Iy(r,t){aM.set(r,t)}function Ce(r){lM.set(r.type,r)}function cM(r,t){let e=aM.get(r);return e?e(t):null}function hM(r){return lM.get(r)}Iy("circle",Cy);Iy("snowflake",Ay);Iy("raindrop",Py);Ce(Kd);Ce(Zd);Ce(Qd);Ce(Jd);Ce(tf);Ce(ef);Ce(rf);Ce(sf);Ce(of);Ce(nf);Ce(af);Ce(lf);Ce(cf);Ce(hf);Ce(ff);Ce(pf);var mf=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var nc=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new mf(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=hM(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new sc(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function $G(r,t){let e=new Bt,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var ac=({app:r,parent:t,element:e,renderContext:i,zIndex:s})=>{let o=new rt;o.label=e.id,o.zIndex=s,t.addChild(o);let n=e.width,a=e.height;o.x=e.x??0,o.y=e.y??0;let l={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},c;if(typeof e.texture=="object"&&e.texture.shape)c=$G(r,e.texture);else{let d=e.texture??"circle";if(c=cM(d,r),!c)try{c=B.from(d)}catch{console.warn(`Failed to load particle texture: ${d}`);return}}l.texture=c;let h=new nc(o,l);if(o.emitter=h,l.recycleOnBounds){let d=Math.min(e.count??100,l.maxParticles);h.spawn(d);let f=h._activeFirst;for(;f;)f.y=h.random()*a,f.age=h.random()*f.maxLife*.8,f=f.next}let u=d=>{if(h.destroyed){r.ticker.remove(u);return}h.update(d.deltaTime/60)};o.tickerCallback=u,UC(i,{app:r,emitter:h,container:o,tickerCallback:u}),e.alpha!==void 0&&(o.alpha=e.alpha)};var gf=({app:r,parent:t,element:e,animationBus:i,animations:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};ot({animations:s,targetId:e.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var uM=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(h=>h.label===e.id);if(!l){ac({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});return}if(l.zIndex=a,XG(e,i))gf({app:r,parent:t,element:e,animations:s,animationBus:o,completionTracker:n}),ac({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});else{let h=()=>{i.alpha!==void 0&&(l.alpha=i.alpha),i.x!==void 0&&(l.x=i.x),i.y!==void 0&&(l.y=i.y)};ot({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:l,targetState:{x:i.x??l.x,y:i.y??l.y,alpha:i.alpha??l.alpha},onComplete:h})||h()}};function XG(r,t){return r.count!==t.count||!gt(r.texture,t.texture)||!gt(r.behaviors,t.behaviors)||!gt(r.emitter,t.emitter)||r.width!==t.width||r.height!==t.height}function dM(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(Is).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Is).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function fM(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function pM(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function mM(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function gM(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function xM(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var yM=({state:r})=>{dM(r),fM(r),pM(r),mM(r),gM(r),xM(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var jG=Zt({type:"particles",add:ac,update:uM,delete:gf,parse:yM});var _M=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)e.add(l.id),i.set(l.id,l);for(let l of t)e.add(l.id),s.set(l.id,l);for(let l of e){let c=i.get(l),h=s.get(l);!c&&h?o.push(h):c&&!h?n.push(c):(c.src!==h.src||c.volume!==h.volume||c.loop!==h.loop||c.delay!==h.delay)&&a.push({prev:c,next:h})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var By=({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=_M(t,e);for(let a of o){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let c=i.find(h=>h.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);c.update({app:r,prevElement:a,nextElement:l})}};var tr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(tr||{}),Fy=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Fy||{}),xf=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(xf||{}),J=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(J||{}),yn=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(yn||{}),L=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(L||{}),vi=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(vi||{}),nt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(nt||{}),H=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(H||{}),xr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(xr||{}),lc=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(lc||{}),Mr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Mr||{}),er=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(er||{}),es=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(es||{}),yf=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(yf||{}),Ne=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ne||{}),se=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(se||{});var At=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(At||{}),qe=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(qe||{});var ky={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var q={ADAPTER:ky,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};qp();var YG=ki.default??ki,Ir=YG(globalThis.navigator);q.RETINA_PREFIX=/@([0-9\.]+)x/;q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Vs=ls(vM(),1),DN=ls(Jh(),1);var p_=ls(GB(),1);var LB={};function ht(r,t,e=3){if(LB[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1148
+ `){s+=1,o=0;continue}o+=1}return{line:s,column:o}},yy=({contentWidth:r,lineWidth:t,align:e})=>rG(r,t,e),cG=r=>new Cr({label:r,text:""}),hG=(r,t)=>{for(;r.textNodes.length<t;){let e=cG(`${r.element.id}-text-line-${r.textNodes.length}`);r.text.addChild(e),r.textNodes.push(e)}for(;r.textNodes.length>t;){let e=r.textNodes.pop();e?.removeFromParent(),e?.destroy()}},Ud=({contentWidth:r,lineWidth:t,align:e,scrollOffsetX:i})=>t>r?-i:yy({contentWidth:r,lineWidth:t,align:e}),AR=({contentWidth:r,lineWidth:t,align:e})=>yy({contentWidth:r,lineWidth:t,align:e}),Gd=({padding:r,contentWidth:t,lineWidth:e,align:i,scrollOffsetX:s})=>r.left+AR({contentWidth:t,lineWidth:e,align:i})-s,PR=r=>{let t=new Bt;t.label=`${r.id}-background`;let e=new Bt;e.label=`${r.id}-selection`;let i=new rt;i.label=`${r.id}-text`;let s=new Cr({label:`${r.id}-placeholder`,text:r.placeholder}),o=new Bt;o.label=`${r.id}-caret`;let n=new Bt;return n.label=`${r.id}-clip`,i.mask=n,s.mask=n,e.mask=n,o.mask=n,{background:t,selection:e,text:i,placeholder:s,caret:o,clip:n}},CR=({app:r,container:t,display:e,element:i})=>({app:r,container:t,...e,value:mn(i.value??""),selectionStart:mn(i.value??"").length,selectionEnd:mn(i.value??"").length,focused:!1,nativeFocused:!1,composing:!1,blinkVisible:!0,blinkTick:0,scrollOffsetX:0,scrollOffsetY:0,selectionAnchor:null,draggingSelection:!1,textNodes:[],layoutState:null,lastExternalValue:mn(i.value??""),tickerListener:null,element:i}),Dd=(r,t,e)=>{let i=sG({app:r,container:t,fallbackElement:e});if(!i)return null;let{fullBounds:s,visibleBounds:o}=i,n=oG(s,o);return{x:s.x,y:s.y,width:s.width,height:s.height,visible:!!o&&t.visible!==!1&&t.renderable!==!1,clipInsets:n}},Qt=(r,t)=>{let e=xy(t.padding),i=Math.max(0,t.width-e.left-e.right),s=Math.max(0,t.height-e.top-e.bottom),o=Ld(t.textStyle,{wordWrapWidth:i}),n=Ld({...t.textStyle,fill:"#7A7A7A"},{wordWrapWidth:i}),a=String(r.value??""),l=lG({element:t,displayedValue:a,textStyle:o}),c=o.align??"left",h=Zi(Math.min(r.selectionStart,r.selectionEnd),0,a.length),u=Zi(Math.max(r.selectionStart,r.selectionEnd),0,a.length),d=Zi(r.selectionEnd??a.length,0,a.length);if(r.layoutState={padding:e,contentWidth:i,contentHeight:s,textStyle:o,placeholderStyle:n,displayedValue:a,layout:l,align:c},hG(r,l.lines.length),r.textNodes.forEach((p,m)=>{let x=l.lines[m]??{text:"",width:0};Yr(p,o),p.text=x.text}),Yr(r.placeholder,n),r.placeholder.text=t.placeholder??"",t.multiline){let p=Od({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),x=m?.width??0,_=Ye((m?.text??"").slice(0,p.column),o),T=l.totalHeight,g=p.line*l.lineHeight,w=g+l.lineHeight;if(x<=i)r.scrollOffsetX=0;else if(r.focused){let S=Math.max(0,x-i);_-r.scrollOffsetX>i-8?r.scrollOffsetX=_-(i-8):_-r.scrollOffsetX<8&&(r.scrollOffsetX=_-8),r.scrollOffsetX=Zi(r.scrollOffsetX,0,S)}else r.scrollOffsetX=0;if(T<=s)r.scrollOffsetY=0;else if(r.focused){let b=Math.max(0,T-s);w-r.scrollOffsetY>s?r.scrollOffsetY=w-s:g-r.scrollOffsetY<0&&(r.scrollOffsetY=g),r.scrollOffsetY=Zi(r.scrollOffsetY,0,b)}else r.scrollOffsetY=0}else{let p=l.lines[0],m=Ye(p.text.slice(0,d),o);if(p.width<=i)r.scrollOffsetX=0;else if(r.focused){let _=Math.max(0,p.width-i);m-r.scrollOffsetX>i-8?r.scrollOffsetX=m-(i-8):m-r.scrollOffsetX<8&&(r.scrollOffsetX=m-8),r.scrollOffsetX=Zi(r.scrollOffsetX,0,_)}else r.scrollOffsetX=0;r.scrollOffsetY=0}if(t.multiline)r.text.x=e.left-r.scrollOffsetX,r.text.y=e.top-r.scrollOffsetY,r.textNodes.forEach((p,m)=>{let x=l.lines[m]??{width:0};p.x=AR({contentWidth:i,lineWidth:x.width,align:c}),p.y=m*l.lineHeight});else{let p=l.lines[0],m=r.textNodes[0],x=Ud({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX});m.x=0,m.y=0,r.text.x=e.left+x,r.text.y=e.top+Math.max(0,(s-m.height)/2)}let f=kt.measureText(r.placeholder.text,ER(n));if(r.placeholder.x=e.left,r.placeholder.y=t.multiline?e.top:e.top+Math.max(0,(s-r.placeholder.height)/2),f.width<=i&&(r.placeholder.x+=yy({contentWidth:i,lineWidth:f.width,align:c})),r.placeholder.visible=r.value.length===0&&r.composing!==!0,r.background.clear(),r.background.rect(0,0,t.width,t.height),r.background.fill({color:pn.fill,alpha:pn.fillAlpha}),pn.strokeWidth>0&&r.background.stroke({color:pn.strokeColor,alpha:pn.strokeAlpha,width:pn.strokeWidth}),r.focused&&kd.strokeWidth>0&&t.disabled!==!0&&r.background.stroke({color:kd.strokeColor,alpha:kd.strokeAlpha,width:kd.strokeWidth}),r.clip.clear(),r.clip.rect(e.left,e.top,i,Math.max(0,s)),r.clip.fill({color:16777215,alpha:1}),r.selection.clear(),r.focused&&h!==u&&t.disabled!==!0){if(t.multiline){let p=Od({value:a,index:h}),m=Od({value:a,index:u});for(let x=p.line;x<=m.line;x+=1){let _=l.lines[x];if(!_)continue;let T=x===p.line?p.column:0,g=x===m.line?m.column:_.text.length,w=Gd({padding:e,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Ye(_.text.slice(0,T),o),b=Gd({padding:e,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Ye(_.text.slice(0,g),o),S=e.top+x*l.lineHeight-r.scrollOffsetY;r.selection.rect(w,S,Math.max(b-w,1),l.lineHeight)}}else{let p=l.lines[0],m=Ud({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),x=e.left+m+Ye(p.text.slice(0,h),o),_=e.left+m+Ye(p.text.slice(0,u),o),T=e.top+Math.max(0,(s-r.text.height)/2);r.selection.rect(x,T,Math.max(_-x,1),Math.max(r.text.height,o.lineHeight))}r.selection.fill({color:TR.fill,alpha:TR.alpha})}if(r.caret.clear(),r.focused&&r.selectionStart===r.selectionEnd&&r.blinkVisible!==!1&&t.disabled!==!0){if(t.multiline){let p=Od({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),x=Gd({padding:e,contentWidth:i,lineWidth:m?.width??0,align:c,scrollOffsetX:r.scrollOffsetX})+Ye((m?.text??"").slice(0,p.column),o),_=e.top+p.line*l.lineHeight-r.scrollOffsetY;r.caret.rect(x,_,gy.width,l.lineHeight)}else{let p=l.lines[0],m=Ud({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),x=e.left+m+Ye(p.text.slice(0,d),o),_=e.top+Math.max(0,(s-r.text.height)/2);r.caret.rect(x,_,gy.width,Math.max(r.text.height,o.lineHeight))}r.caret.fill({color:gy.fill,alpha:1})}},_y=(r,t)=>{let e=r.layoutState;if(!e)return 0;let{padding:i,contentWidth:s,textStyle:o,displayedValue:n,layout:a,align:l}=e,c=t?.x??0,h=t?.y??0;if(!r.element.multiline){let m=a.lines[0]??{text:n,width:Ye(n,o)},x=Ud({contentWidth:s,lineWidth:m.width,align:l,scrollOffsetX:r.scrollOffsetX}),_=i.left+x;return SR({text:m.text,style:o,targetX:c-_})}let u=a.lineHeight||o.lineHeight||1,d=Zi(Math.floor((h-i.top+r.scrollOffsetY)/u),0,Math.max(a.lines.length-1,0)),f=a.lines[d]??{text:"",startIndex:0},p=SR({text:f.text,style:o,targetX:c-Gd({padding:i,contentWidth:s,lineWidth:f.width??0,align:l,scrollOffsetX:r.scrollOffsetX})});return f.startIndex+p};var Qi=({eventHandler:r,eventName:t,element:e,eventConfig:i,snapshot:s})=>{!r||!i||r(t,{_event:{id:e.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},uG=({app:r,container:t,element:e,runtime:i,eventHandler:s})=>({onValueChange:o=>{i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.lastExternalValue=o.value,Qt(i,e),Qi({eventHandler:s,eventName:"change",element:e,eventConfig:e.change,snapshot:o})},onFocus:o=>{let n=i.nativeFocused===!0;i.nativeFocused=!0,i.focused=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.selectionAnchor=o.selectionStart===o.selectionEnd?o.selectionEnd:i.selectionAnchor,i.blinkVisible=!0,i.blinkTick=0,Qt(i,e),!n&&Qi({eventHandler:s,eventName:"focus",element:e,eventConfig:e.focusEvent,snapshot:o})},onBlur:o=>{i.nativeFocused=!1,i.focused=!1,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.blinkVisible=!1,i.composing=!1,Qt(i,e),Qi({eventHandler:s,eventName:"blur",element:e,eventConfig:e.blurEvent,snapshot:o})},onSelectionChange:o=>{i.nativeFocused=o.focused,i.focused=o.focused,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,o.selectionStart===o.selectionEnd&&(i.selectionAnchor=o.selectionEnd),Qt(i,e),Qi({eventHandler:s,eventName:"selectionChange",element:e,eventConfig:e.selectionChange,snapshot:o})},onSubmit:o=>{Qi({eventHandler:s,eventName:"submit",element:e,eventConfig:e.submit,snapshot:o})},onCompositionStart:o=>{i.composing=!0,Qt(i,e),Qi({eventHandler:s,eventName:"compositionStart",element:e,eventConfig:e.compositionStart,snapshot:o})},onCompositionUpdate:o=>{i.composing=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,Qt(i,e),Qi({eventHandler:s,eventName:"compositionUpdate",element:e,eventConfig:e.compositionUpdate,snapshot:o})},onCompositionEnd:o=>{i.composing=!1,i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,Qt(i,e),Qi({eventHandler:s,eventName:"compositionEnd",element:e,eventConfig:e.compositionEnd,snapshot:o})}}),RR=({app:r,parent:t,element:e,eventHandler:i,zIndex:s})=>{if(!r.inputDomBridge?.mount||!r.inputDomBridge?.focus||!r.inputDomBridge?.setSelection)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let o=new rt({label:e.id});o.zIndex=s,o.sortableChildren=!0,o.eventMode="static",o.cursor=e.disabled?"default":"text",o.x=Math.round(e.x),o.y=Math.round(e.y),o.alpha=e.alpha;let n=PR(e),a=CR({app:r,container:o,display:n,element:e});o.addChild(a.background,a.selection,a.text,a.placeholder,a.caret,a.clip),a.tickerListener=f=>{if(!a.focused){if(a.blinkVisible===!1)return;a.blinkVisible=!1,Qt(a,a.element);return}a.blinkTick+=f.deltaMS??f.deltaTime??16,a.blinkTick>=530&&(a.blinkTick=0,a.blinkVisible=!a.blinkVisible,Qt(a,a.element))},r.ticker?.add?.(a.tickerListener);let l=({start:f,end:p,shouldFocus:m=!1})=>{if(m){r.inputDomBridge.focus(e.id,{selectionStart:f,selectionEnd:p});return}r.inputDomBridge.setSelection(e.id,f,p)},c=({start:f,end:p,shouldFocus:m=!1,anchor:x=a.selectionAnchor})=>{a.focused=!0,a.selectionStart=f,a.selectionEnd=p,a.selectionAnchor=x,a.blinkVisible=!0,a.blinkTick=0,Qt(a,a.element),l({start:f,end:p,shouldFocus:m})},h=f=>{if(a.element.disabled===!0)return;let p=o.toLocal(f.global),m=_y(a,p),x=!!f.shiftKey&&a.focused,_=x?a.selectionAnchor??(a.selectionStart!==a.selectionEnd?a.selectionStart:a.selectionEnd):m,T=x?Math.min(_,m):m,g=x?Math.max(_,m):m;a.draggingSelection=!0,c({start:T,end:g,shouldFocus:!0,anchor:_})},u=f=>{if(!a.draggingSelection||a.element.disabled===!0)return;let p=o.toLocal(f.global),m=_y(a,p),x=a.selectionAnchor??m,_=Math.min(x,m),T=Math.max(x,m);c({start:_,end:T,anchor:x})},d=()=>{a.draggingSelection=!1};o.on("pointerdown",h),o.on("globalpointermove",u),o.on("pointerup",d),o.on("pointerupoutside",d),o.on("pointerup",()=>{a.element.disabled!==!0&&r.inputDomBridge.focus(e.id,{selectionStart:a.selectionStart,selectionEnd:a.selectionEnd})}),o[gn]=a,Qt(a,e),r.inputDomBridge.mount(e.id,{...e,value:a.value,callbacks:uG({app:r,container:o,element:e,runtime:a,eventHandler:i}),getGeometry:()=>Dd(r,o,e)}),t.addChild(o)};var Ji=({eventHandler:r,eventName:t,element:e,eventConfig:i,snapshot:s})=>{!r||!i||r(t,{_event:{id:e.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},dG=({element:r,runtime:t,eventHandler:e})=>({onValueChange:i=>{t.value=i.value,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.lastExternalValue=i.value,Qt(t,r),Ji({eventHandler:e,eventName:"change",element:r,eventConfig:r.change,snapshot:i})},onFocus:i=>{let s=t.nativeFocused===!0;t.nativeFocused=!0,t.focused=!0,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.selectionAnchor=i.selectionStart===i.selectionEnd?i.selectionEnd:t.selectionAnchor,t.blinkVisible=!0,t.blinkTick=0,Qt(t,r),!s&&Ji({eventHandler:e,eventName:"focus",element:r,eventConfig:r.focusEvent,snapshot:i})},onBlur:i=>{t.nativeFocused=!1,t.focused=!1,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.blinkVisible=!1,t.composing=!1,Qt(t,r),Ji({eventHandler:e,eventName:"blur",element:r,eventConfig:r.blurEvent,snapshot:i})},onSelectionChange:i=>{t.nativeFocused=i.focused,t.focused=i.focused,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,i.selectionStart===i.selectionEnd&&(t.selectionAnchor=i.selectionEnd),Qt(t,r),Ji({eventHandler:e,eventName:"selectionChange",element:r,eventConfig:r.selectionChange,snapshot:i})},onSubmit:i=>{Ji({eventHandler:e,eventName:"submit",element:r,eventConfig:r.submit,snapshot:i})},onCompositionStart:i=>{t.composing=!0,Qt(t,r),Ji({eventHandler:e,eventName:"compositionStart",element:r,eventConfig:r.compositionStart,snapshot:i})},onCompositionUpdate:i=>{t.composing=!0,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,Qt(t,r),Ji({eventHandler:e,eventName:"compositionUpdate",element:r,eventConfig:r.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{t.composing=!1,t.value=i.value,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,Qt(t,r),Ji({eventHandler:e,eventName:"compositionEnd",element:r,eventConfig:r.compositionEnd,snapshot:i})}}),MR=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,zIndex:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;if(!r.inputDomBridge?.update)throw new Error("Input plugin requires app.inputDomBridge to be initialized");n.zIndex=o;let a=n[gn];if(!a)return;let l={...i},c=a.focused!==!0||i.value!==e.value;c&&a.composing!==!0?(a.value=i.value,a.lastExternalValue=i.value):l.value=a.value,a.element=l,n.label=i.id,n.cursor=i.disabled?"default":"text",n.x=Math.round(i.x),n.y=Math.round(i.y),n.alpha=i.alpha,i.disabled===!0&&(a.draggingSelection=!1),(!gt(e,i)||c)&&Qt(a,l),r.inputDomBridge.update(i.id,{...l,value:a.value,callbacks:dG({element:l,runtime:a,eventHandler:s}),getGeometry:()=>Dd(r,n,l)})};var IR=({app:r,parent:t,element:e})=>{let i=t.getChildByLabel(e.id);if(!i)return;if(!r.inputDomBridge?.unmount)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let s=i[gn];s?.tickerListener&&r.ticker?.remove?.(s.tickerListener),r.inputDomBridge.unmount(e.id),i.destroy({children:!0})};var BR=({state:r})=>{let t=ge(r),e=String(r.value??""),i=String(r.placeholder??"");return delete t.originX,delete t.originY,{...t,value:e,placeholder:i,multiline:r.multiline===!0,disabled:r.disabled===!0,...typeof r.maxLength=="number"&&{maxLength:Math.round(r.maxLength)},textStyle:Ld(r.textStyle),padding:xy(r.padding),...r.change&&{change:r.change},...r.submit&&{submit:r.submit},...r.focusEvent&&{focusEvent:r.focusEvent},...r.blurEvent&&{blurEvent:r.blurEvent},...r.selectionChange&&{selectionChange:r.selectionChange},...r.compositionStart&&{compositionStart:r.compositionStart},...r.compositionUpdate&&{compositionUpdate:r.compositionUpdate},...r.compositionEnd&&{compositionEnd:r.compositionEnd}}};var fG=Zt({type:"input",add:RR,update:MR,delete:IR,parse:BR});var Ql=({container:r,element:t,interactive:e=!0,allowViewportWithoutScroll:i=!1})=>{let s=0,o=0;t.children.forEach(c=>{s=Math.max(c.width+c.x,s),o=Math.max(c.height+c.y,o)});let n=!!(t.height&&o>t.height),a=!!(t.width&&s>t.width);if((t.scroll||i)&&(n||a)){let c=new rt({label:`${r.label}-content`});[...r.children].forEach(x=>{c.addChild(x)}),r.addChild(c);let u=new Bt({label:`${r.label}-clip`}).rect(0,0,t.width||s,t.height||o).fill({color:16711680,alpha:0});r.addChild(u),c.mask=u;let d=-(o-(t.height||o)),f=-(s-(t.width||s)),p=t.anchorToBottom&&n?d:0,m=t.anchorToBottom&&a?f:0;t.anchorToBottom&&(c.y=p,c.x=m),e&&(r.eventMode="static",r.hitArea=new Q(0,0,t.width||s,t.height||o),r.on("wheel",x=>{if(x.preventDefault(),n&&x.deltaY!==0){let _=p-x.deltaY;_>0?p=0:_<d?p=d:p=_,c.y=p}if(a&&(x.deltaX!==0||x.shiftKey&&x.deltaY!==0)){let _=x.deltaX!==0?x.deltaX:x.deltaY,T=m-_;T>0?m=0:T<f?m=f:m=T,c.x=m}}))}},by=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel")};var vy=({container:r,element:t,enabled:e})=>{if(e){r.hitArea=new Q(0,0,t.width,t.height);return}r.hitArea=null},FR=(r,t)=>{let e=t??null;for(;e;){if(e===r)return!0;e=e.parent??null}return!1},pG=(r,t)=>{if(!t||typeof t.x!="number"||typeof t.y!="number")return!1;let e=r.toLocal(t),i=r.hitArea;return i?.contains?i.contains(e.x,e.y):!1},Nd=({app:r,container:t,element:e,eventHandler:i})=>{let s=hy(t),o=uy(t),n=dy(t),a=s;un({root:t,isHovered:!1}),Bs({root:t,isPressed:!1}),bi({root:t,isPressed:!1}),t.removeAllListeners("pointerover"),t.removeAllListeners("pointerout"),t.removeAllListeners("pointerdown"),t.removeAllListeners("pointerup"),t.removeAllListeners("pointerupoutside"),t.removeAllListeners("rightdown"),t.removeAllListeners("rightup"),t.removeAllListeners("rightupoutside"),t.removeAllListeners("rightclick"),t.cursor="auto",e.scroll||(t.eventMode="auto",vy({container:t,element:e,enabled:!1}));let l=e?.hover,c=e?.click,h=e?.rightClick;if(!!(l||c||h)&&(t.eventMode="static",e.scroll?t.hitArea||vy({container:t,element:e,enabled:!0}):vy({container:t,element:e,enabled:!1})),l){let{cursor:d,soundSrc:f,payload:p,inheritToChildren:m}=l,x=T=>{FR(t,T?.relatedTarget)||a||(a=!0,p&&i&&i("hover",{_event:{id:t.label},...p}),d&&(t.cursor=d),f&&r.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),m&&un({root:t,isHovered:!0}))},_=T=>{FR(t,T?.relatedTarget)||pG(t,T?.global)||a&&(a=!1,t.cursor="auto",m&&un({root:t,isHovered:!1}))};t.on("pointerover",x),t.on("pointerout",_)}if(c){let{soundSrc:d,soundVolume:f,payload:p,inheritToChildren:m}=c,x=g=>{ie(g)&&m&&Bs({root:t,isPressed:!0})},_=g=>{ie(g)&&(m&&Bs({root:t,isPressed:!1}),p&&i&&i("click",{_event:{id:t.label},...p}),d&&r.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1,volume:(f??1e3)/1e3}))},T=g=>{ie(g)&&m&&Bs({root:t,isPressed:!1})};t.on("pointerdown",x),t.on("pointerup",_),t.on("pointerupoutside",T)}if(h){let{soundSrc:d,payload:f,inheritToChildren:p}=h,m=()=>{p&&bi({root:t,isPressed:!0})},x=()=>{p&&bi({root:t,isPressed:!1})},_=w=>{$C(w)&&p&&bi({root:t,isPressed:!1})},T=()=>{p&&bi({root:t,isPressed:!1}),f&&i&&i("rightClick",{_event:{id:t.label},...f}),d&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:d,loop:!1})},g=()=>{p&&bi({root:t,isPressed:!1})};t.on("rightdown",m),t.on("rightup",x),t.on("pointerup",_),t.on("rightclick",T),t.on("pointerupoutside",_),t.on("rightupoutside",g)}l?.inheritToChildren&&s&&un({root:t,isHovered:!0}),c?.inheritToChildren&&o&&Bs({root:t,isPressed:!0}),h?.inheritToChildren&&n&&bi({root:t,isPressed:!0})},kR=({container:r})=>{hy(r)&&un({root:r,isHovered:!0})},OR=({container:r})=>{uy(r)&&Bs({root:r,isPressed:!0})},UR=({container:r})=>{dy(r)&&bi({root:r,isPressed:!0})};var Jl=r=>{let t=new Set;if(r.id&&t.add(r.id),r.children&&Array.isArray(r.children))for(let e of r.children)for(let i of Jl(e))t.add(i);return t};var GR=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let c of r)i.add(c.id),s.set(c.id,c);for(let c of t)i.add(c.id),o.set(c.id,c);for(let c of i){let h=s.get(c),u=o.get(c);if(!h&&u)n.push(u);else if(h&&!u)a.push(h);else{let d=Jl(u),f=e instanceof Map?Array.from(e.keys()).some(p=>d.has(p)):e.find(p=>d.has(p.targetId));(!gt(h,u)||f)&&l.push({prev:h,next:u})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var Hd=r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375,mG=r=>r,gG=r=>r*r,xG=r=>1-(1-r)*(1-r),yG=r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,LR=Object.freeze({linear:mG,easeInQuad:gG,easeOutQuad:xG,easeInOutQuad:yG,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>2.70158*r*r*r-1.70158*r*r,easeOutBack:r=>1+2.70158*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>{let e=2.5949095;return r<.5?Math.pow(2*r,2)*((e+1)*2*r-e)/2:(Math.pow(2*r-2,2)*((e+1)*(r*2-2)+e)+2)/2},easeInBounce:r=>1-Hd(1-r),easeOutBounce:Hd,easeInOutBounce:r=>r<.5?(1-Hd(1-2*r))/2:(1+Hd(2*r-1))/2,easeInElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*t)},easeOutElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*t)+1},easeInOutElastic:r=>{let t=2*Math.PI/4.5;return r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*t))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*t)/2+1}}),Vd=Object.freeze(Object.keys(LR)),_G=(r="linear")=>{let t=LR[r];if(!t)throw new Error(`Unsupported easing: ${r}`);return t},xn=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,t.push({time:e,value:s,easing:"linear"});return}o!==void 0&&(e+=o,i=a?i+s:s,t.push({time:e,value:i,easing:n}))}),t},tc=r=>{let t=0;for(let{timeline:e}of r){let i=e[e.length-1];i&&i.time>t&&(t=i.time)}return t},ec=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let l=(t-i)/(n-i);return s+(a-s)*_G(o)(l)}}return r[r.length-1].value};var bG={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},Sy=r=>Math.min(1,Math.max(0,r)),Wd=(r,t,e)=>{if(r===t)return e<r?0:1;let i=Sy((e-r)/(t-r));return i*i*(3-2*i)},HR=r=>r.getLocalBounds().rectangle.clone(),VR=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),DR=(r,t)=>{let e=VR(HR(t)),i=r.renderer.generateTexture({target:t,frame:e}),s=new wt(i);s.x=e.x,s.y=e.y;let o=new rt;return o.x=t.x??0,o.y=t.y??0,o.scale.set(t.scale?.x??1,t.scale?.y??1),o.rotation=t.rotation??0,o.alpha=t.alpha??1,o.addChild(s),{wrapper:o,texture:i}},vG=(r={})=>Object.entries(r).map(([t,e])=>({property:t,timeline:xn([{value:e.initialValue??bG[t]??0},...e.keyframes])})),zd=(r,t,e)=>{if(!r||!t)return{duration:0,apply:()=>{}};let i=vG(t),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:tc(i),apply:o=>{r.x=s.x,r.y=s.y,r.alpha=s.alpha,r.scale.x=s.scaleX,r.scale.y=s.scaleY,r.rotation=s.rotation;for(let{property:n,timeline:a}of i){let l=ec(a,o);switch(n){case"translateX":r.x=s.x+l*e.renderer.width;break;case"translateY":r.y=s.y+l*e.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},TG=r=>xn([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),SG=(r,t)=>{let e=document.createElement("canvas");e.width=r,e.height=t;let i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:e,context:i}},wG=(r,t,e="red")=>{switch(e){case"green":return r[t+1];case"blue":return r[t+2];case"alpha":return r[t+3];default:return r[t]}},Ty=({app:r,texture:t,width:e,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(e*i),a=new wt(B.from(t));a.width=e,a.height=i;let l=new rt;l.addChild(a);let c=gi.create({width:e,height:i});r.renderer.render({container:l,target:c,clear:!0});let h=r.renderer.extract.pixels(c).pixels;for(let u=0,d=0;u<n.length;u++,d+=4){let f=wG(h,d,s);o&&(f=255-f),n[u]=f}return l.destroy({children:!0}),c.destroy(!0),n},EG=(r,t,e,i)=>{let s=null;for(let o of t.items){let n=Ty({app:r,texture:o.texture,width:e,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a<s.length;a++)switch(t.combine??"max"){case"min":s[a]=Math.min(s[a],n[a]);break;case"multiply":s[a]=Math.round(s[a]/255*(n[a]/255)*255);break;case"add":s[a]=Math.min(255,s[a]+n[a]);break;default:s[a]=Math.max(s[a],n[a]);break}}return s??new Uint8ClampedArray(e*i)},AG=(r,t,e,i)=>{let s=TG(t),o=tc([{timeline:s}]),n=Math.max(t?.softness??.001,1e-4);if(!t)return{duration:o,progressTimeline:s,sample:()=>0,destroy:()=>{}};if(t.kind==="single"){let l=Ty({app:r,texture:t.texture,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1});return{duration:o,progressTimeline:s,sample:(c,h)=>Wd(c-n,c+n,l[h]/255),destroy:()=>{}}}if(t.kind==="sequence"){let l=t.textures.map(c=>Ty({app:r,texture:c,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1}));return{duration:o,progressTimeline:s,sample:(c,h)=>{let u=Sy(c)*Math.max(0,l.length-1);if(t.sample==="linear"&&l.length>1){let f=Math.floor(u),p=Math.min(l.length-1,f+1),m=u-f,x=(l[f][h]*(1-m)+l[p][h]*m)/255;return Wd(c-n,c+n,x)}let d=Math.min(l.length-1,Math.max(0,Math.round(u)));return Wd(c-n,c+n,l[d][h]/255)},destroy:()=>{}}}let a=EG(r,t,e,i);return{duration:o,progressTimeline:s,sample:(l,c)=>Wd(l-n,l+n,a[c]/255),destroy:()=>{}}},PG=r=>{let t=new rt;for(let e of r)e?.wrapper&&t.addChild(e.wrapper);return VR(HR(t))},NR=({app:r,container:t,target:e,frame:i})=>{r.renderer.render({container:t,target:e,clear:!0,transform:new U(1,0,0,1,-i.x,-i.y)})},rc=r=>{r?.texture?.destroy(!0)},CG=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=new rt;o.zIndex=s,e?.wrapper&&o.addChild(e.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=zd(e?.wrapper??null,t.prev?.tween,r),a=zd(i?.wrapper??null,t.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),rc(e),rc(i)}}},RG=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=PG([e,i]),n=new rt,a=new rt;e?.wrapper&&n.addChild(e.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=gi.create({width:o.width,height:o.height}),c=gi.create({width:o.width,height:o.height}),{canvas:h,context:u}=SG(o.width,o.height),d=u.createImageData(o.width,o.height),f=B.from(h),p=new rt;p.zIndex=s;let m=new wt(f);m.x=o.x,m.y=o.y,p.addChild(m);let x=AG(r,t.mask,o.width,o.height),_=zd(e?.wrapper??null,t.prev?.tween,r),T=zd(i?.wrapper??null,t.next?.tween,r),g=new Uint8ClampedArray(o.width*o.height*4);return{overlay:p,duration:Math.max(_.duration,T.duration,x.duration),apply:w=>{_.apply(w),T.apply(w);let b=g,S=g;e?.wrapper&&(NR({app:r,container:n,target:l,frame:o}),b=r.renderer.extract.pixels(l).pixels),i?.wrapper&&(NR({app:r,container:a,target:c,frame:o}),S=r.renderer.extract.pixels(c).pixels);let v=Sy(ec(x.progressTimeline,w)),P=d.data;for(let C=0,A=0;C<P.length;C+=4,A+=1){let R=x.sample(v,A),M=1-R;P[C]=Math.round(b[C]*M+S[C]*R),P[C+1]=Math.round(b[C+1]*M+S[C+1]*R),P[C+2]=Math.round(b[C+2]*M+S[C+2]*R),P[C+3]=Math.round(b[C+3]*M+S[C+3]*R)}u.putImageData(d,0,0),f.source.update()},destroy:()=>{p.removeFromParent(),p.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),f.destroy(!0),rc(e),rc(i),x.destroy()}}},MG=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>t.mask?RG({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}):CG({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}),IG=({app:r,parent:t,nextElement:e,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:h,signal:u})=>{if(!e)return null;let d=i.add({app:r,parent:t,element:e,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:h,signal:u});return d&&typeof d.then=="function"?d.then(()=>u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null):u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null},BG=async r=>r&&typeof r.then=="function"?r:r??null,$d=({app:r,parent:t,prevElement:e,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:h,plugin:u,zIndex:d,signal:f})=>{if(!e&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||t.destroyed)return;let p=e?t.children.find(M=>M.label===e.id)??null:null;if(e&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${e.id}".`);let m=p?DR(r,p):null,x=new rt,_=_d({suppressAnimations:!0}),T=a.getVersion(),g=!1,w=()=>{g||(a.track(T),g=!0)},b=()=>{g&&(a.complete(T),g=!1)},S=({flushDeferredEffects:M})=>{if(!C){if(C=!0,v.value&&!v.value.destroyed&&(v.value.visible=!0),P.value?.destroy(),M){LC(_);return}bd(_)}},v={value:null},P={value:null},C=!1;w();let A=M=>{if(f?.aborted||t.destroyed){bd(_),x.destroy({children:!0}),rc(m),b();return}if(i&&!M)throw bd(_),b(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);v.value=M;let I=M?DR(r,M):null;x.destroy({children:!1}),p&&u.delete({app:r,parent:t,element:e,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:h,signal:f}),M&&(M.zIndex=d,t.addChild(M),M.visible=!1);let k=MG({app:r,animation:s,prevSubject:m,nextSubject:I,zIndex:d});P.value=k,t.addChild(k.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:k.duration,applyFrame:k.apply,applyTargetState:()=>{S({flushDeferredEffects:!1})},onComplete:()=>{S({flushDeferredEffects:!0}),b()},onCancel:()=>{b()},isValid:()=>!!k.overlay&&!k.overlay.destroyed&&(!M||!M.destroyed)}})},R=i?IG({app:r,parent:x,nextElement:i,plugin:u,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:f}):null;if(R&&typeof R.then=="function"){BG(R).then(A);return}A(R??null)};var ks=({app:r,parent:t,prevComputedTree:e,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=_d(),signal:h})=>{t.sortableChildren=!0;let u=new Map(l.map(b=>[b.type,b])),d=DC(s),f=new Map,p=new Map;for(let b of e)f.set(b.id,b);for(let b=0;b<i.length;b++)p.set(i[b].id,b);let{toAddElement:m,toDeleteElement:x,toUpdateElement:_}=GR(e,i,s),T=new Set(_.map(({next:b})=>b.id)),g=b=>{let S=u.get(b);if(!S)throw new Error(`No plugin found for element type: ${b}`);return S},w=b=>t.children.find(S=>S.label===b)?.zIndex??-1;for(let b of i){let S=f.get(b.id);!S||T.has(b.id)||!gt(S,b)||g(b.type).shouldUpdateUnchanged?.({app:r,parent:t,prevElement:S,nextElement:b,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(b.id)??-1,signal:h})!==!0||(_.push({prev:S,next:b}),T.add(b.id))}for(let b of t.children){let S=p.get(b.label);S!==void 0&&(b.zIndex=S)}for(let b of x){let S=c.suppressAnimations?null:Sd(d,b.id),v=g(b.type);if(S){$d({app:r,parent:t,prevElement:b,nextElement:null,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:w(b.id),signal:h});continue}v.delete({app:r,parent:t,element:b,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:h})}for(let b of m){let S=c.suppressAnimations?null:Sd(d,b.id),v=g(b.type),P=p.get(b.id)??-1;if(S){$d({app:r,parent:t,prevElement:null,nextElement:b,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:P,signal:h});continue}v.add({app:r,parent:t,element:b,animations:c.suppressAnimations||b.type==="container"?d:[],eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:P,signal:h})}for(let{prev:b,next:S}of _){let v=g(S.type),P=p.get(S.id)??-1,C=c.suppressAnimations?null:Sd(d,S.id);if(C){$d({app:r,parent:t,prevElement:b,nextElement:S,animation:C,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:P,signal:h});continue}v.update({app:r,parent:t,prevElement:b,nextElement:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:P,signal:h})}};var FG=(r=[])=>{let t=new Set;for(let e of r)if(e?.id){if(t.has(e.id))return!0;t.add(e.id)}return!1},kG=({app:r,container:t,children:e,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of e){let h=o.find(u=>u.type===c.type);if(!h)throw new Error(`No plugin found for child element type: ${c.type}`);h.add({app:r,parent:t,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},WR=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:h})=>{let{id:u,x:d,y:f,children:p,scroll:m,alpha:x}=e,_=new rt;_.label=u,_.zIndex=l,_.x=Math.round(d),_.y=Math.round(f),_.alpha=x,t.addChild(_),p&&p.length>0&&(FG(p)?kG({app:r,container:_,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:h}):ks({app:r,parent:_,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:h})),(m||e.anchorToBottom)&&Ql({container:_,element:e,interactive:!!m,allowViewportWithoutScroll:!!e.anchorToBottom}),Nd({app:r,container:_,element:e,eventHandler:s})};var zR=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:h,signal:u})=>{let d=t.children.find(T=>T.label===e.id);if(!d)return;d.zIndex=c;let{x:f,y:p,alpha:m}=i,x=()=>{if(!gt(e,i)){d.x=Math.round(f),d.y=Math.round(p),d.label=i.id,d.alpha=m,d.scale.x=1,d.scale.y=1;let b=e.scroll||e.anchorToBottom,S=i.scroll||i.anchorToBottom;b!==S?S?Ql({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom}):by({container:d}):S&&(by({container:d}),Ql({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom})),Nd({app:r,container:d,element:i,eventHandler:s})}let T=!gt(e.children,i.children),g=Jl({children:i.children}),w=Array.from(g).some(b=>Td(o,b).length>0);if(T||w){let S=d.children.find(v=>v.label===`${i.id}-content`)||d;ks({app:r,parent:S,nextComputedTree:i.children,prevComputedTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:h,renderContext:l,signal:u}),kR({container:d}),OR({container:d}),UR({container:d})}};ot({animations:o,targetId:e.id,animationBus:n,completionTracker:h,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{x()}})||x()};var $R=({app:r,parent:t,element:e,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=t.getChildByLabel(e.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0}))};ot({animations:s,targetId:e.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var XR=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,c=0,h=0,u=0,d=0,f=0,p=0,m=0,x=0;for(let g=0;g<o.length;g++){let w=g<o.length-1?s:0,b=o[g];g>0?e==="horizontal"?(b.x=c,b.y=f):e==="vertical"&&(b.x=p,b.y=h):(e==="horizontal"||e==="vertical")&&(b.x=0,b.y=0);let S=t.find(v=>v.type===b.type);if(S){let v=b.scaleX!==void 0||r.scaleX!==void 0,P=b.scaleY!==void 0||r.scaleY!==void 0,C=(b.scaleX??1)*(r.scaleX??1),A=(b.scaleY??1)*(r.scaleY??1);b=S.parse({state:{...b,...v?{scaleX:C}:{},...P?{scaleY:A}:{}},parserPlugins:t})}e==="horizontal"?(r.width&&b.width+m>r.width&&!i&&!r.anchorToBottom?(c=0,m=0,f+=u+s,u=b.height,b.x=0,b.y=f):u=Math.max(u,b.height),c+=b.width+w,m=b.x+b.width,a=Math.max(c,a),l=Math.max(b.height+b.y,l)):e==="vertical"?(r.height&&b.height+x>r.height&&!i&&!r.anchorToBottom?(h=0,x=0,p+=d+s,d=b.width,b.x=p,b.y=0):d=Math.max(d,b.width),h+=b.height+w,x=b.y+b.height,a=Math.max(b.width+b.x,a),l=Math.max(h,l)):(a=Math.max(b.width+b.x,a),l=Math.max(b.height+b.y,l)),n.push(b)}let T={...ge({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:e,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},rotation:r.rotation??0};return r.rightClick&&(T.rightClick=r.rightClick),T};var OG=Zt({type:"container",add:WR,update:zR,delete:$R,parse:XR});var jR=async({parent:r,element:t,animationBus:e,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new rt;if(a.label=t.id,a.zIndex=o,t.x!==void 0&&(a.x=Math.round(t.x)),t.y!==void 0&&(a.y=Math.round(t.y)),t.alpha!==void 0&&(a.alpha=t.alpha),r.addChild(a),i?.suppressAnimations&&t.revealEffect!=="none"){await _i({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"paused-initial"}),vd(i,{container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n});return}await _i({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"autoplay"})};var YR=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),UG=(r,t)=>YR(r)!==YR(t),qR=async({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=r.children.find(d=>d.label===t.id);if(!c)return;let h=async()=>{if(e.x!==void 0&&(c.x=e.x),e.y!==void 0&&(c.y=e.y),e.alpha!==void 0&&(c.alpha=e.alpha),!UG(t,e)){o?.suppressAnimations!==!0&&e.revealEffect!=="none"&&await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&e.revealEffect!=="none"){await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),vd(o,{container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};ot({animations:i,targetId:t.id,animationBus:s,completionTracker:n,element:c,targetState:{x:e.x??c.x,y:e.y??c.y,alpha:e.alpha??c.alpha},onComplete:()=>{h()}})||await h()};var KR=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(ry(o),o.destroy({children:!0}))};ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var GG=r=>r===`
1149
+ `||r==="\r",LG=r=>typeof r=="string"&&kt.isBreakingSpace(r),DG=(r,t,e)=>{let i=0,s=0;for(;i<r.length&&s<t.length&&r[i]===t[s];)i+=1,s+=1;if(s<t.length){let a=Math.min(r.length,t.length);return{remainingText:r.slice(a),consumedExplicitNewline:!1}}let o=i,n=o;for(;n<r.length&&LG(r[n]);)n+=1;if(GG(r[n])){let a=n+1;return r[n]==="\r"&&r[n+1]===`
1150
+ `&&(a+=1),{remainingText:r.slice(a),consumedExplicitNewline:!0}}return e?{remainingText:r.slice(n),consumedExplicitNewline:!1}:{remainingText:r.slice(o),consumedExplicitNewline:!1}},NG=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,l=0,c=[...r],h=new WeakSet,u=Math.max(10,r.reduce((p,m)=>p+(m?.text?.length??0),0)*4),d=()=>{e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[]};for(;c.length>0;){if(l+=1,l>u)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let p=c[0];if(!p.text||p.text.length===0){c.shift();continue}let m=p.text,x=Math.max(1,Math.round(t-s)),_={...p.textStyle,wordWrapWidth:x},T=kt.measureText(p.text,new It(_));if(T.lineWidths[0]>x&&i.length>0){d();continue}let g=T.lines[0]??"",w=T.lines.length>1,b="",S=!1;if(T.lines.length===1&&p.text.endsWith(" ")&&!g.endsWith(" ")&&(g+=" "),g.length>0){let A=DG(m,g,w);b=A.remainingText,S=A.consumedExplicitNewline}if(g.length===0&&m.length>0){let A=m.match(/^\s+/)?.[0]??"";g=A.length>0?A:m[0],b=m.slice(g.length)}if(b===m){let A=m.match(/^\s+/)?.[0]??m[0]??"";if(A.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");g=A,b=m.slice(A.length)}let v=kt.measureText(g,new It({...p.textStyle,wordWrap:!1,breakWords:!1})),P=Math.max(0,Math.round(v.width??T.lineWidths[0]??0)),C={text:g,textStyle:_,height:v.height,x:s,y:o};if(p.furigana&&!h.has(p)){h.add(p);let A=kt.measureText(p.furigana.text,new It(p.furigana.textStyle)),R=-A.height+o+2,M={text:p.furigana.text,textStyle:p.furigana.textStyle,x:Math.round(s+(P-A.width)/2),y:R};C.furigana=M}i.push(C),n=Math.max(n,v.height),s+=P,a=Math.max(a,s),b&&b.length>0?p.text=b:c.shift(),(w||S)&&s>0&&d()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let p=0;p<e.length;p++){let m=e[p].lineMaxHeight;e[p].lineParts=e[p].lineParts.map(x=>{let _=x.height;x.height&&delete x.height;let T=x.y+(m-_),g=x.furigana;return g&&(g.y=g.y-x.y+T),{...x,...g&&{furigana:g},y:T}})}let f=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:f}},ZR=({state:r})=>{let t={...zt,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(h=>{let u={...t,...h.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(h.furigana){let p={...t,...h.furigana.textStyle||{}};p.lineHeight=Math.round(p.lineHeight*p.fontSize),r.width&&(p.wordWrapWidth=r.width,p.wordWrap=!0),d={text:String(h.furigana.text),textStyle:p}}return{text:String(h.text).replace(/ +$/,p=>"\xA0".repeat(p.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=NG(e,i),a=r.width||o,c=ge({...r,width:a,height:n});if(c.alpha=r.alpha??1,r.indicator){let h=r.indicator;c.indicator={revealing:{src:h.revealing?.src??"",width:h.revealing?.width??12,height:h.revealing?.height??12},complete:{src:h.complete?.src??"",width:h.complete?.width??12,height:h.complete?.height??12},offset:h.offset??12}}return{...c,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var HG=Zt({type:"text-revealing",add:jR,update:qR,delete:KR,parse:ZR,shouldUpdateUnchanged:({parent:r,nextElement:t})=>MC(r.children.find(e=>e.label===t.id))});var Xd=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},jd=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var QR=async({app:r,parent:t,element:e,renderContext:i,zIndex:s,signal:o})=>{if(o?.aborted)return;let{id:n,x:a,y:l,width:c,height:h,spritesheetSrc:u,spritesheetData:d,animation:f,alpha:p}=e,m=d,x=Object.keys(m.frames),_=new Gi(B.from(u),m);if(await _.parse(),o?.aborted||t.destroyed)return;let T=f.frames.map(w=>_.textures[x[w]]),g=new Xl(T);g.label=n,g.zIndex=s,g.animationSpeed=f.animationSpeed??.5,g.loop=f.loop??!0,r.debug?Xd(g,n,r.debug):kC(i,g),g.x=Math.round(a),g.y=Math.round(l),g.width=Math.round(c),g.height=Math.round(h),g.alpha=p,t.addChild(g)};var JR=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=t.children.find(_=>_.label===e.id);if(!c)return;c.zIndex=a;let h=async()=>{if(!(l?.aborted||c.destroyed)&&!gt(e,i)&&(c.x=Math.round(i.x),c.y=Math.round(i.y),c.width=Math.round(i.width),c.height=Math.round(i.height),c.alpha=i.alpha,!gt(e.animation,i.animation))){c.animationSpeed=i.animation.animationSpeed??.5,c.loop=i.animation.loop??!0;let _=i.spritesheetData,T=Object.keys(_.frames),g=new Gi(B.from(i.spritesheetSrc),_);if(await g.parse(),l?.aborted||c.destroyed)return;let w=i.animation.frames.map(b=>g.textures[T[b]]);c.textures=w,r.debug?e.id!==i.id&&(jd(c),Xd(c,i.id,r.debug)):c.play()}},{x:u,y:d,width:f,height:p,alpha:m}=i;ot({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:c,targetState:{x:u,y:d,width:f,height:p,alpha:m},onComplete:()=>{h()}})||await h()};var tM=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(c=>c.label===e.id);if(!n)return;let a=()=>{r.debug&&jd(n),n&&!n.destroyed&&(n.stop(),n.destroy())};ot({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var eM=({state:r})=>({...ge(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var VG=Zt({type:"animated-sprite",add:QR,update:JR,delete:tM,parse:eM});var WG=Jx({type:"tween"});var Os=new Map,zG=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:(r.volume??800)/1e3}),rM=r=>Os.has(r),ic=r=>{let t=Os.get(r);t!==void 0&&(clearTimeout(t),Os.delete(r))},wy=({app:r,element:t})=>{let e=zG(t);if(ic(e.id),t.delay&&t.delay>0){let i=setTimeout(()=>{Os.delete(e.id),r.audioStage.add(e)},t.delay);Os.set(e.id,i);return}r.audioStage.add(e)},Ey=()=>{for(let r of Os.values())clearTimeout(r);Os.clear()},iM=({app:r,element:t})=>{wy({app:r,element:t})};var sM=({app:r,prevElement:t,nextElement:e})=>{let i=t.id;if((e.delay??0)>0){r.audioStage.remove(i),wy({app:r,element:e});return}if(rM(i)){ic(i),r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}o.url=e.src,o.loop=e.loop??!1,o.volume=(e.volume??800)/1e3};var oM=({app:r,element:t})=>{ic(t.id),r.audioStage.remove(t.id)};var $G=ty({type:"sound",add:iM,update:sM,delete:oM});var sc=class extends wt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Ay(r){let t=new Bt;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Py(r){let t=new Bt;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Cy(r){let t=new Bt;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function oc(r,t,e){return r+(t-r)*e}function qd(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function nM(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,l=t&255,c=Math.round(oc(i,n,e)),h=Math.round(oc(s,a,e)),u=Math.round(oc(o,l,e));return c<<16|h<<8|u}var Yd=class r{constructor(t,e,i=!1){this.value=i?qd(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},Rr=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=Yd.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?nM(e.value,e.next.value,i):oc(e.value,e.next.value,i)}};var Kd=class{static type="alpha";constructor(t){this.list=new Rr(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},Zd=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var Qd=class{static type="scale";constructor(t){this.list=new Rr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},Jd=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var XG=Math.PI/180,tf=class{static type="speed";constructor(t){this.list=new Rr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},ef=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},rf=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*XG}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Pmt=Math.PI/180,sf=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},of=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var ts=Math.PI/180,nf=class{static type="rotation";constructor(t){this.minStart=t.minStart*ts,this.maxStart=t.maxStart*ts,this.minSpeed=t.minSpeed*ts,this.maxSpeed=t.maxSpeed*ts,this.accel=(t.accel??0)*ts}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},af=class{static type="rotationStatic";constructor(t){this.min=t.min*ts,this.max=t.max*ts}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},lf=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*ts}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var cf=class{static type="color";constructor(t){this.list=new Rr(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},hf=class{static type="colorStatic";constructor(t){this.color=qd(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var uf=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},df=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},Ry=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},My=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},jG={rect:uf,rectangle:uf,torus:df,circle:df,point:Ry,line:My};var ff=class{static type="spawnShape";constructor(t){let e=jG[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},pf=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var aM=new Map,lM=new Map;function Iy(r,t){aM.set(r,t)}function Ce(r){lM.set(r.type,r)}function cM(r,t){let e=aM.get(r);return e?e(t):null}function hM(r){return lM.get(r)}Iy("circle",Cy);Iy("snowflake",Ay);Iy("raindrop",Py);Ce(Kd);Ce(Zd);Ce(Qd);Ce(Jd);Ce(tf);Ce(ef);Ce(rf);Ce(sf);Ce(of);Ce(nf);Ce(af);Ce(lf);Ce(cf);Ce(hf);Ce(ff);Ce(pf);var mf=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var nc=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new mf(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=hM(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new sc(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function YG(r,t){let e=new Bt,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var ac=({app:r,parent:t,element:e,renderContext:i,zIndex:s})=>{let o=new rt;o.label=e.id,o.zIndex=s,t.addChild(o);let n=e.width,a=e.height;o.x=e.x??0,o.y=e.y??0;let l={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},c;if(typeof e.texture=="object"&&e.texture.shape)c=YG(r,e.texture);else{let d=e.texture??"circle";if(c=cM(d,r),!c)try{c=B.from(d)}catch{console.warn(`Failed to load particle texture: ${d}`);return}}l.texture=c;let h=new nc(o,l);if(o.emitter=h,l.recycleOnBounds){let d=Math.min(e.count??100,l.maxParticles);h.spawn(d);let f=h._activeFirst;for(;f;)f.y=h.random()*a,f.age=h.random()*f.maxLife*.8,f=f.next}let u=d=>{if(h.destroyed){r.ticker.remove(u);return}h.update(d.deltaTime/60)};o.tickerCallback=u,UC(i,{app:r,emitter:h,container:o,tickerCallback:u}),e.alpha!==void 0&&(o.alpha=e.alpha)};var gf=({app:r,parent:t,element:e,animationBus:i,animations:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};ot({animations:s,targetId:e.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var uM=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(h=>h.label===e.id);if(!l){ac({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});return}if(l.zIndex=a,qG(e,i))gf({app:r,parent:t,element:e,animations:s,animationBus:o,completionTracker:n}),ac({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});else{let h=()=>{i.alpha!==void 0&&(l.alpha=i.alpha),i.x!==void 0&&(l.x=i.x),i.y!==void 0&&(l.y=i.y)};ot({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:l,targetState:{x:i.x??l.x,y:i.y??l.y,alpha:i.alpha??l.alpha},onComplete:h})||h()}};function qG(r,t){return r.count!==t.count||!gt(r.texture,t.texture)||!gt(r.behaviors,t.behaviors)||!gt(r.emitter,t.emitter)||r.width!==t.width||r.height!==t.height}function dM(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(Is).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Is).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function fM(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function pM(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function mM(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function gM(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function xM(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var yM=({state:r})=>{dM(r),fM(r),pM(r),mM(r),gM(r),xM(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var KG=Zt({type:"particles",add:ac,update:uM,delete:gf,parse:yM});var _M=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)e.add(l.id),i.set(l.id,l);for(let l of t)e.add(l.id),s.set(l.id,l);for(let l of e){let c=i.get(l),h=s.get(l);!c&&h?o.push(h):c&&!h?n.push(c):(c.src!==h.src||c.volume!==h.volume||c.loop!==h.loop||c.delay!==h.delay)&&a.push({prev:c,next:h})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var By=({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=_M(t,e);for(let a of o){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let c=i.find(h=>h.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);c.update({app:r,prevElement:a,nextElement:l})}};var tr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(tr||{}),Fy=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Fy||{}),xf=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(xf||{}),J=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(J||{}),yn=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(yn||{}),L=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(L||{}),vi=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(vi||{}),nt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(nt||{}),H=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(H||{}),xr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(xr||{}),lc=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(lc||{}),Mr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Mr||{}),er=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(er||{}),es=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(es||{}),yf=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(yf||{}),Ne=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ne||{}),se=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(se||{});var At=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(At||{}),qe=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(qe||{});var ky={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var q={ADAPTER:ky,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};qp();var ZG=ki.default??ki,Ir=ZG(globalThis.navigator);q.RETINA_PREFIX=/@([0-9\.]+)x/;q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Vs=ls(vM(),1),VN=ls(Jh(),1);var p_=ls(GB(),1);var LB={};function ht(r,t,e=3){if(LB[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1149
1151
  Deprecated since v${r}`):(i=i.split(`
1150
1152
  `).splice(e).join(`
1151
1153
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
1152
1154
  Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
1153
- Deprecated since v${r}`),console.warn(i))),LB[t]=!0}var m_;function g_(){return typeof m_>"u"&&(m_=function(){let r={stencil:!0,failIfMajorPerformanceCaveat:q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!q.ADAPTER.getWebGLRenderingContext())return!1;let t=q.ADAPTER.createCanvas(),e=t.getContext("webgl",r)||t.getContext("experimental-webgl",r),i=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,i}catch{return!1}}()),m_}vp();Tp();hh([uh]);var Rn=class kf{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 kf)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}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 i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="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((s,o)=>s===e[o]);if(t!==null&&e!==null){let s=Object.keys(t),o=Object.keys(e);return s.length!==o.length?!1:s.every(n=>t[n]===e[n])}return t===e}toRgba(){let[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=kf.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,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 i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){let[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(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,i,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,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=kf.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=Ke(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,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,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}};Rn.shared=new Rn,Rn.temp=new Rn,Rn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Br=Rn;function kN(){let r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[J.NORMAL_NPM]=J.NORMAL,r[J.ADD_NPM]=J.ADD,r[J.SCREEN_NPM]=J.SCREEN,t[J.NORMAL]=J.NORMAL_NPM,t[J.ADD]=J.ADD_NPM,t[J.SCREEN]=J.SCREEN_NPM;let e=[];return e.push(t),e.push(r),e}var x_=kN();function Mn(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function Hs(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Of(r){return!(r&r-1)&&!!r}function Uf(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function y_(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var ON=0;function Si(){return++ON}var DB=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};DB.EMPTY=new DB(0,0,0,0);var Gf={},rr=Object.create(null),ti=Object.create(null);function __(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Lf(r,t=1){let e=q.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}var $=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))($||{}),b_=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},HB=(r,t)=>b_(r).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(b_).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(b_).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>HB(o,e)-HB(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};var Tc=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)}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 uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}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`)}}};var NN=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
1154
- `);function HN(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
1155
- else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Df(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let i=NN.replace(/%forloop%/gi,HN(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}var v_=0,T_=1,S_=2,w_=3,E_=4,A_=5,ei=class r{constructor(){this.data=0,this.blendMode=J.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<v_)}set blend(t){!!(this.data&1<<v_)!==t&&(this.data^=1<<v_)}get offsets(){return!!(this.data&1<<T_)}set offsets(t){!!(this.data&1<<T_)!==t&&(this.data^=1<<T_)}get culling(){return!!(this.data&1<<S_)}set culling(t){!!(this.data&1<<S_)!==t&&(this.data^=1<<S_)}get depthTest(){return!!(this.data&1<<w_)}set depthTest(t){!!(this.data&1<<w_)!==t&&(this.data^=1<<w_)}get depthMask(){return!!(this.data&1<<A_)}set depthMask(t){!!(this.data&1<<A_)!==t&&(this.data^=1<<A_)}get clockwiseFrontFace(){return!!(this.data&1<<E_)}set clockwiseFrontFace(t){!!(this.data&1<<E_)!==t&&(this.data^=1<<E_)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==J.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new r;return t.depthTest=!1,t.blend=!0,t}};ei.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var Sc=[];function In(r,t){if(!r)return null;let e="";if(typeof r=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=Sc.length-1;i>=0;--i){let s=Sc[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var Jt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:c,items:h}=this;this._aliasCount++;for(let u=0,d=h.length;u<d;u++)h[u][c](t,e,i,s,o,n,a,l);return h===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(Jt.prototype,{dispatch:{value:Jt.prototype.emit},run:{value:Jt.prototype.emit}});var ir=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Jt("setRealSize"),this.onUpdate=new Jt("update"),this.onError=new Jt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var Ws=class extends ir{constructor(t,e){let{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===er.UNPACK);let o=e.realWidth,n=e.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(e.target,0,i.internalFormat,o,n,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var VN={scaleMode:xr.NEAREST,alphaMode:er.NPM},P_=class Bn extends Vs.default{constructor(t=null,e=null){super(),e=Object.assign({},Bn.defaultOptions,e);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:c,format:h,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof ir)&&(t=In(t,p),t.internal=!0),this.resolution=f||q.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=c,this._scaleMode=n,this.format=h,this.type=u,this.target=d,this.alphaMode=i,this.uid=Si(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Of(this.realWidth)&&Of(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete ti[this.cacheId],delete rr[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Bn.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=q.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${Si()}`}o=t._pixiId}let n=ti[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Bn(t,e),n.cacheId=o,Bn.addToCache(n,o)),n}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);let o=new Ws(t,{width:e,height:i,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=L.RGBA,a=nt.FLOAT):t instanceof Int32Array?(n=L.RGBA_INTEGER,a=nt.INT):t instanceof Uint32Array?(n=L.RGBA_INTEGER,a=nt.UNSIGNED_INT):t instanceof Int16Array?(n=L.RGBA_INTEGER,a=nt.SHORT):t instanceof Uint16Array?(n=L.RGBA_INTEGER,a=nt.UNSIGNED_SHORT):t instanceof Int8Array?(n=L.RGBA,a=nt.BYTE):(n=L.RGBA,a=nt.UNSIGNED_BYTE),o.internal=!0,new Bn(o,Object.assign({},VN,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),ti[e]&&ti[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),ti[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=ti[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete ti[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete ti[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};P_.defaultOptions={mipmap:Mr.POW2,anisotropicLevel:0,scaleMode:xr.LINEAR,wrapMode:lc.CLAMP,alphaMode:er.UNPACK,target:vi.TEXTURE_2D,format:L.RGBA,type:nt.UNSIGNED_BYTE},P_._globalBatch=0;var pt=P_;var wc=class{constructor(){this.texArray=null,this.blend=0,this.type=yn.TRIANGLES,this.start=0,this.size=0,this.data=null}};var WN=0,oe=class r{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=WN++,this.disposeRunner=new Jt("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?qe.ELEMENT_ARRAY_BUFFER:qe.ARRAY_BUFFER}get index(){return this.type===qe.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new r(t)}};var Fn=class r{constructor(t,e=0,i=!1,s=nt.FLOAT,o,n,a,l=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=l}destroy(){this.buffer=null}static from(t,e,i,s,o){return new r(t,e,i,s,o)}};var zN={Float32Array,Uint32Array,Int32Array,Uint8Array};function VB(r,t){let e=0,i=0,s={};for(let l=0;l<r.length;l++)i+=t[l],e+=r[l].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let l=0;l<r.length;l++){let c=t[l],h=r[l],u=Mn(h);s[u]||(s[u]=new zN[u](o)),n=s[u];for(let d=0;d<h.length;d++){let f=(d/c|0)*i+a,p=d%c;n[f+p]=h[d]}a+=c}return new Float32Array(o)}var WB={5126:4,5123:2,5121:1},$N=0,XN={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},wi=class r{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=$N++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Jt("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,o,n,a,l=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof oe||(e instanceof Array&&(e=new Float32Array(e)),e=new oe(e));let c=t.split("|");if(c.length>1){for(let u=0;u<c.length;u++)this.addAttribute(c[u],e,i,s,o);return this}let h=this.buffers.indexOf(e);return h===-1&&(this.buffers.push(e),h=this.buffers.length-1),this.attributes[t]=new Fn(h,i,s,o,n,a,l),this.instanced=this.instanced||l,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof oe||(t instanceof Array&&(t=new Uint16Array(t)),t=new oe(t)),t.type=qe.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let t=[],e=[],i=new oe,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*WB[o.type]/4),o.buffer=0}for(i.data=VB(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new r;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new oe(this.buffers[e].data.slice(0));for(let e in this.attributes){let i=this.attributes[e];t.attributes[e]=new Fn(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=qe.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new r,i=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)s[l]=s[l]||0,s[l]+=n.buffers[l].data.length,o[l]=0}for(let a=0;a<n.buffers.length;a++)i[a]=new XN[Mn(n.buffers[a].data)](s[a]),e.buffers[a]=new oe(i[a]);for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)i[l].set(n.buffers[l].data,o[l]),o[l]+=n.buffers[l].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=qe.ELEMENT_ARRAY_BUFFER;let a=0,l=0,c=0,h=0;for(let u=0;u<n.buffers.length;u++)if(n.buffers[u]!==n.indexBuffer){h=u;break}for(let u in n.attributes){let d=n.attributes[u];(d.buffer|0)===h&&(l+=d.size*WB[d.type]/4)}for(let u=0;u<t.length;u++){let d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+c]+=a;a+=t[u].buffers[h].data.length/l,c+=d.length}}return e}};var Ec=class extends wi{constructor(t=!1){super(),this._buffer=new oe(null,t,!1),this._indexBuffer=new oe(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,nt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,nt.FLOAT).addAttribute("aColor",this._buffer,4,!0,nt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,nt.FLOAT).addIndex(this._indexBuffer)}};var C_=Math.PI*2,jN=180/Math.PI,YN=Math.PI/180,_r=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(_r||{});var ne=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(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}};ne.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var Nf=[new ne,new ne,new ne,new ne],xt=class r{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=_r.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,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}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 P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Nf[0].set(t.left,t.top),l=Nf[1].set(t.left,t.bottom),c=Nf[2].set(t.right,t.top),h=Nf[3].set(t.right,t.bottom);if(c.x<=a.x||l.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(l,l),e.apply(c,c),e.apply(h,h),Math.max(a.x,l.x,c.x,h.x)<=i||Math.min(a.x,l.x,c.x,h.x)>=s||Math.max(a.y,l.y,c.y,h.y)<=o||Math.min(a.y,l.y,c.y,h.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,x=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,x,_)<=d*a.x+f*a.y||Math.min(p,m,x,_)>=d*h.x+f*h.y)return!1;let T=u*(a.y-c.y),g=u*(c.x-a.x),w=T*i+g*o,b=T*s+g*o,S=T*i+g*n,v=T*s+g*n;return!(Math.max(w,b,S,v)<=T*a.x+g*a.y||Math.min(w,b,S,v)>=T*h.x+g*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),i=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(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=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=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=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=i-e,this.y=s,this.height=o-s,this}};xt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Hf=class r{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=_r.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}getBounds(){return new xt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Hf.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Vf=class r{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=_r.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new xt(this.x-this.width,this.y-this.height,this.width,this.height)}};Vf.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Wf=class r{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=_r.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new r(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],c=this.points[n*2],h=this.points[n*2+1];l>e!=h>e&&t<(c-a)*((e-l)/(h-l))+a&&(i=!i)}return i}};Wf.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};var zf=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o,this.type=_r.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}};zf.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Rt=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,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,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new ne;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ne;let i=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,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),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}setTransform(t,e,i,s,o,n,a,l,c){return this.a=Math.cos(a+c)*o,this.b=Math.sin(a+c)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*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 i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*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,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),c=Math.abs(a+l);return c<1e-5||Math.abs(C_-c)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),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*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}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 r;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}static get IDENTITY(){return new r}static get TEMP_MATRIX(){return new r}};Rt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var zs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],$s=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Xs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],js=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],R_=[],zB=[],$f=Math.sign;function qN(){for(let r=0;r<16;r++){let t=[];R_.push(t);for(let e=0;e<16;e++){let i=$f(zs[r]*zs[e]+Xs[r]*$s[e]),s=$f($s[r]*zs[e]+js[r]*$s[e]),o=$f(zs[r]*Xs[e]+Xs[r]*js[e]),n=$f($s[r]*Xs[e]+js[r]*js[e]);for(let a=0;a<16;a++)if(zs[a]===i&&$s[a]===s&&Xs[a]===o&&js[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new Rt;t.set(zs[r],$s[r],Xs[r],js[r],0,0),zB.push(t)}}qN();var kt={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:r=>zs[r],uY:r=>$s[r],vX:r=>Xs[r],vY:r=>js[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>R_[r][t],sub:(r,t)=>R_[r][kt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?kt.S:kt.N:Math.abs(t)*2<=Math.abs(r)?r>0?kt.E:kt.W:t>0?r>0?kt.SE:kt.SW:r>0?kt.NE:kt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=zB[kt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};var Ei=class r{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new r(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};Ei.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var M_=class{constructor(){this.worldTransform=new Rt,this.localTransform=new Rt,this.position=new Ei(this.onChange,this,0,0),this.scale=new Ei(this.onChange,this,1,1),this.pivot=new Ei(this.onChange,this,0,0),this.skew=new Ei(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){let t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){let e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};M_.IDENTITY=new M_;var Xf=M_;Xf.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var $B=`varying vec2 vTextureCoord;
1155
+ Deprecated since v${r}`),console.warn(i))),LB[t]=!0}var m_;function g_(){return typeof m_>"u"&&(m_=function(){let r={stencil:!0,failIfMajorPerformanceCaveat:q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!q.ADAPTER.getWebGLRenderingContext())return!1;let t=q.ADAPTER.createCanvas(),e=t.getContext("webgl",r)||t.getContext("experimental-webgl",r),i=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,i}catch{return!1}}()),m_}vp();Tp();hh([uh]);var Rn=class kf{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 kf)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}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 i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="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((s,o)=>s===e[o]);if(t!==null&&e!==null){let s=Object.keys(t),o=Object.keys(e);return s.length!==o.length?!1:s.every(n=>t[n]===e[n])}return t===e}toRgba(){let[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=kf.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,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 i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){let[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(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,i,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,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=kf.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=Ke(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,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,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}};Rn.shared=new Rn,Rn.temp=new Rn,Rn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Br=Rn;function GN(){let r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[J.NORMAL_NPM]=J.NORMAL,r[J.ADD_NPM]=J.ADD,r[J.SCREEN_NPM]=J.SCREEN,t[J.NORMAL]=J.NORMAL_NPM,t[J.ADD]=J.ADD_NPM,t[J.SCREEN]=J.SCREEN_NPM;let e=[];return e.push(t),e.push(r),e}var x_=GN();function Mn(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function Hs(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Of(r){return!(r&r-1)&&!!r}function Uf(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function y_(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s<o;++s)r[s]=r[s+e];r.length=o}var LN=0;function Si(){return++LN}var DB=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};DB.EMPTY=new DB(0,0,0,0);var Gf={},rr=Object.create(null),ti=Object.create(null);function __(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Lf(r,t=1){let e=q.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}var $=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))($||{}),b_=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},HB=(r,t)=>b_(r).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(b_).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(b_).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>HB(o,e)-HB(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};var Tc=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)}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 uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}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`)}}};var WN=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
1156
+ `);function zN(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
1157
+ else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Df(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let i=WN.replace(/%forloop%/gi,zN(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}var v_=0,T_=1,S_=2,w_=3,E_=4,A_=5,ei=class r{constructor(){this.data=0,this.blendMode=J.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<v_)}set blend(t){!!(this.data&1<<v_)!==t&&(this.data^=1<<v_)}get offsets(){return!!(this.data&1<<T_)}set offsets(t){!!(this.data&1<<T_)!==t&&(this.data^=1<<T_)}get culling(){return!!(this.data&1<<S_)}set culling(t){!!(this.data&1<<S_)!==t&&(this.data^=1<<S_)}get depthTest(){return!!(this.data&1<<w_)}set depthTest(t){!!(this.data&1<<w_)!==t&&(this.data^=1<<w_)}get depthMask(){return!!(this.data&1<<A_)}set depthMask(t){!!(this.data&1<<A_)!==t&&(this.data^=1<<A_)}get clockwiseFrontFace(){return!!(this.data&1<<E_)}set clockwiseFrontFace(t){!!(this.data&1<<E_)!==t&&(this.data^=1<<E_)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==J.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new r;return t.depthTest=!1,t.blend=!0,t}};ei.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var Sc=[];function In(r,t){if(!r)return null;let e="";if(typeof r=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=Sc.length-1;i>=0;--i){let s=Sc[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var Jt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:c,items:h}=this;this._aliasCount++;for(let u=0,d=h.length;u<d;u++)h[u][c](t,e,i,s,o,n,a,l);return h===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(Jt.prototype,{dispatch:{value:Jt.prototype.emit},run:{value:Jt.prototype.emit}});var ir=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Jt("setRealSize"),this.onUpdate=new Jt("update"),this.onError=new Jt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var Ws=class extends ir{constructor(t,e){let{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===er.UNPACK);let o=e.realWidth,n=e.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(e.target,0,i.internalFormat,o,n,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var $N={scaleMode:xr.NEAREST,alphaMode:er.NPM},P_=class Bn extends Vs.default{constructor(t=null,e=null){super(),e=Object.assign({},Bn.defaultOptions,e);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:c,format:h,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof ir)&&(t=In(t,p),t.internal=!0),this.resolution=f||q.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=c,this._scaleMode=n,this.format=h,this.type=u,this.target=d,this.alphaMode=i,this.uid=Si(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Of(this.realWidth)&&Of(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete ti[this.cacheId],delete rr[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Bn.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=q.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${Si()}`}o=t._pixiId}let n=ti[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Bn(t,e),n.cacheId=o,Bn.addToCache(n,o)),n}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);let o=new Ws(t,{width:e,height:i,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=L.RGBA,a=nt.FLOAT):t instanceof Int32Array?(n=L.RGBA_INTEGER,a=nt.INT):t instanceof Uint32Array?(n=L.RGBA_INTEGER,a=nt.UNSIGNED_INT):t instanceof Int16Array?(n=L.RGBA_INTEGER,a=nt.SHORT):t instanceof Uint16Array?(n=L.RGBA_INTEGER,a=nt.UNSIGNED_SHORT):t instanceof Int8Array?(n=L.RGBA,a=nt.BYTE):(n=L.RGBA,a=nt.UNSIGNED_BYTE),o.internal=!0,new Bn(o,Object.assign({},$N,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),ti[e]&&ti[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),ti[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=ti[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete ti[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete ti[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};P_.defaultOptions={mipmap:Mr.POW2,anisotropicLevel:0,scaleMode:xr.LINEAR,wrapMode:lc.CLAMP,alphaMode:er.UNPACK,target:vi.TEXTURE_2D,format:L.RGBA,type:nt.UNSIGNED_BYTE},P_._globalBatch=0;var pt=P_;var wc=class{constructor(){this.texArray=null,this.blend=0,this.type=yn.TRIANGLES,this.start=0,this.size=0,this.data=null}};var XN=0,oe=class r{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=XN++,this.disposeRunner=new Jt("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?qe.ELEMENT_ARRAY_BUFFER:qe.ARRAY_BUFFER}get index(){return this.type===qe.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new r(t)}};var Fn=class r{constructor(t,e=0,i=!1,s=nt.FLOAT,o,n,a,l=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=l}destroy(){this.buffer=null}static from(t,e,i,s,o){return new r(t,e,i,s,o)}};var jN={Float32Array,Uint32Array,Int32Array,Uint8Array};function VB(r,t){let e=0,i=0,s={};for(let l=0;l<r.length;l++)i+=t[l],e+=r[l].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let l=0;l<r.length;l++){let c=t[l],h=r[l],u=Mn(h);s[u]||(s[u]=new jN[u](o)),n=s[u];for(let d=0;d<h.length;d++){let f=(d/c|0)*i+a,p=d%c;n[f+p]=h[d]}a+=c}return new Float32Array(o)}var WB={5126:4,5123:2,5121:1},YN=0,qN={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},wi=class r{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=YN++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Jt("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,o,n,a,l=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof oe||(e instanceof Array&&(e=new Float32Array(e)),e=new oe(e));let c=t.split("|");if(c.length>1){for(let u=0;u<c.length;u++)this.addAttribute(c[u],e,i,s,o);return this}let h=this.buffers.indexOf(e);return h===-1&&(this.buffers.push(e),h=this.buffers.length-1),this.attributes[t]=new Fn(h,i,s,o,n,a,l),this.instanced=this.instanced||l,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof oe||(t instanceof Array&&(t=new Uint16Array(t)),t=new oe(t)),t.type=qe.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let t=[],e=[],i=new oe,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*WB[o.type]/4),o.buffer=0}for(i.data=VB(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new r;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new oe(this.buffers[e].data.slice(0));for(let e in this.attributes){let i=this.attributes[e];t.attributes[e]=new Fn(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=qe.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new r,i=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)s[l]=s[l]||0,s[l]+=n.buffers[l].data.length,o[l]=0}for(let a=0;a<n.buffers.length;a++)i[a]=new qN[Mn(n.buffers[a].data)](s[a]),e.buffers[a]=new oe(i[a]);for(let a=0;a<t.length;a++){n=t[a];for(let l=0;l<n.buffers.length;l++)i[l].set(n.buffers[l].data,o[l]),o[l]+=n.buffers[l].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=qe.ELEMENT_ARRAY_BUFFER;let a=0,l=0,c=0,h=0;for(let u=0;u<n.buffers.length;u++)if(n.buffers[u]!==n.indexBuffer){h=u;break}for(let u in n.attributes){let d=n.attributes[u];(d.buffer|0)===h&&(l+=d.size*WB[d.type]/4)}for(let u=0;u<t.length;u++){let d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+c]+=a;a+=t[u].buffers[h].data.length/l,c+=d.length}}return e}};var Ec=class extends wi{constructor(t=!1){super(),this._buffer=new oe(null,t,!1),this._indexBuffer=new oe(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,nt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,nt.FLOAT).addAttribute("aColor",this._buffer,4,!0,nt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,nt.FLOAT).addIndex(this._indexBuffer)}};var C_=Math.PI*2,KN=180/Math.PI,ZN=Math.PI/180,_r=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(_r||{});var ne=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(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}};ne.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var Nf=[new ne,new ne,new ne,new ne],xt=class r{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=_r.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,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}intersects(t,e){if(!e){let P=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=P)return!1;let C=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>C}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Nf[0].set(t.left,t.top),l=Nf[1].set(t.left,t.bottom),c=Nf[2].set(t.right,t.top),h=Nf[3].set(t.right,t.bottom);if(c.x<=a.x||l.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(l,l),e.apply(c,c),e.apply(h,h),Math.max(a.x,l.x,c.x,h.x)<=i||Math.min(a.x,l.x,c.x,h.x)>=s||Math.max(a.y,l.y,c.y,h.y)<=o||Math.min(a.y,l.y,c.y,h.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,x=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,x,_)<=d*a.x+f*a.y||Math.min(p,m,x,_)>=d*h.x+f*h.y)return!1;let T=u*(a.y-c.y),g=u*(c.x-a.x),w=T*i+g*o,b=T*s+g*o,S=T*i+g*n,v=T*s+g*n;return!(Math.max(w,b,S,v)<=T*a.x+g*a.y||Math.min(w,b,S,v)>=T*h.x+g*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),i=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(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=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=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=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=i-e,this.y=s,this.height=o-s,this}};xt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Hf=class r{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=_r.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}getBounds(){return new xt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Hf.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Vf=class r{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=_r.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new xt(this.x-this.width,this.y-this.height,this.width,this.height)}};Vf.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Wf=class r{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;s<o;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=_r.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new r(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],l=this.points[o*2+1],c=this.points[n*2],h=this.points[n*2+1];l>e!=h>e&&t<(c-a)*((e-l)/(h-l))+a&&(i=!i)}return i}};Wf.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};var zf=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o,this.type=_r.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}};zf.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Rt=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,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,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new ne;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ne;let i=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,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),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}setTransform(t,e,i,s,o,n,a,l,c){return this.a=Math.cos(a+c)*o,this.b=Math.sin(a+c)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*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 i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*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,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),c=Math.abs(a+l);return c<1e-5||Math.abs(C_-c)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),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*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}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 r;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}static get IDENTITY(){return new r}static get TEMP_MATRIX(){return new r}};Rt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var zs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],$s=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Xs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],js=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],R_=[],zB=[],$f=Math.sign;function QN(){for(let r=0;r<16;r++){let t=[];R_.push(t);for(let e=0;e<16;e++){let i=$f(zs[r]*zs[e]+Xs[r]*$s[e]),s=$f($s[r]*zs[e]+js[r]*$s[e]),o=$f(zs[r]*Xs[e]+Xs[r]*js[e]),n=$f($s[r]*Xs[e]+js[r]*js[e]);for(let a=0;a<16;a++)if(zs[a]===i&&$s[a]===s&&Xs[a]===o&&js[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new Rt;t.set(zs[r],$s[r],Xs[r],js[r],0,0),zB.push(t)}}QN();var Ot={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>zs[r],uY:r=>$s[r],vX:r=>Xs[r],vY:r=>js[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>R_[r][t],sub:(r,t)=>R_[r][Ot.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Ot.S:Ot.N:Math.abs(t)*2<=Math.abs(r)?r>0?Ot.E:Ot.W:t>0?r>0?Ot.SE:Ot.SW:r>0?Ot.NE:Ot.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=zB[Ot.inv(t)];s.tx=e,s.ty=i,r.append(s)}};var Ei=class r{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new r(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};Ei.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var M_=class{constructor(){this.worldTransform=new Rt,this.localTransform=new Rt,this.position=new Ei(this.onChange,this,0,0),this.scale=new Ei(this.onChange,this,1,1),this.pivot=new Ei(this.onChange,this,0,0),this.skew=new Ei(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){let t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){let e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};M_.IDENTITY=new M_;var Xf=M_;Xf.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var $B=`varying vec2 vTextureCoord;
1156
1158
 
1157
1159
  uniform sampler2D uSampler;
1158
1160
 
@@ -1289,7 +1291,7 @@ void main(void){
1289
1291
  cv[3] = v[3];
1290
1292
 
1291
1293
  gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
1292
- }`}];var KN={float:`
1294
+ }`}];var JN={float:`
1293
1295
  if (cv !== v)
1294
1296
  {
1295
1297
  cu.value = v;
@@ -1425,7 +1427,7 @@ void main(void){
1425
1427
  cu.value = v;
1426
1428
 
1427
1429
  gl.uniform1i(location, v);
1428
- }`},ZN={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function B_(r,t){let e=[`
1430
+ }`},t3={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function B_(r,t){let e=[`
1429
1431
  var v = null;
1430
1432
  var cv = null;
1431
1433
  var cu = null;
@@ -1435,7 +1437,7 @@ void main(void){
1435
1437
  renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');
1436
1438
  `):e.push(`
1437
1439
  renderer.shader.syncUniformGroup(uv.${i}, syncData);
1438
- `));continue}let o=r.uniforms[i],n=!1;for(let a=0;a<ri.length;a++)if(ri[a].test(s,o)){e.push(ri[a].code(i,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?KN:ZN)[s.type].replace("location",`ud["${i}"].location`);e.push(`
1440
+ `));continue}let o=r.uniforms[i],n=!1;for(let a=0;a<ri.length;a++)if(ri[a].test(s,o)){e.push(ri[a].code(i,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?JN:t3)[s.type].replace("location",`ud["${i}"].location`);e.push(`
1439
1441
  cu = ud["${i}"];
1440
1442
  cv = cu.value;
1441
1443
  v = uv["${i}"];
@@ -1443,10 +1445,10 @@ void main(void){
1443
1445
  `))}var jB={},Yf=jB;function qf(){if(Yf===jB||Yf?.isContextLost()){let r=q.ADAPTER.createCanvas(),t;q.PREFER_ENV>=tr.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Yf=t}return Yf}var Kf;function F_(){if(!Kf){Kf=Ne.MEDIUM;let r=qf();if(r&&r.getShaderPrecisionFormat){let t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(Kf=t.precision?Ne.HIGH:Ne.MEDIUM)}}return Kf}function YB(r,t){let e=r.getShaderSource(t).split(`
1444
1446
  `).map((c,h)=>`${h}: ${c}`),i=r.getShaderInfoLog(t),s=i.split(`
1445
1447
  `),o={},n=s.map(c=>parseFloat(c.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(c=>c&&!o[c]?(o[c]=!0,!0):!1),a=[""];n.forEach(c=>{e[c-1]=`%c${e[c-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=e.join(`
1446
- `);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function k_(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||YB(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||YB(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var QN={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Pc(r){return QN[r]}var Zf=null,qB={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"};function Cc(r,t){if(!Zf){let e=Object.keys(qB);Zf={};for(let i=0;i<e.length;++i){let s=e[i];Zf[r[s]]=qB[s]}}return Zf[t]}function Qf(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Ne.HIGH&&e!==Ne.HIGH&&(i=Ne.MEDIUM),`precision ${i} float;
1447
- ${r}`}else if(e!==Ne.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var Rc;function Jf(){if(typeof Rc=="boolean")return Rc;try{Rc=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Rc=!1}return Rc}var JN=0,tp={},O_=class kn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=JN++,this.vertexSrc=t||kn.defaultVertexSrc,this.fragmentSrc=e||kn.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),tp[i]?(tp[i]++,i+=`-${tp[i]}`):tp[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
1448
+ `);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function k_(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||YB(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||YB(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var e3={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Pc(r){return e3[r]}var Zf=null,qB={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"};function Cc(r,t){if(!Zf){let e=Object.keys(qB);Zf={};for(let i=0;i<e.length;++i){let s=e[i];Zf[r[s]]=qB[s]}}return Zf[t]}function Qf(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Ne.HIGH&&e!==Ne.HIGH&&(i=Ne.MEDIUM),`precision ${i} float;
1449
+ ${r}`}else if(e!==Ne.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var Rc;function Jf(){if(typeof Rc=="boolean")return Rc;try{Rc=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Rc=!1}return Rc}var r3=0,tp={},O_=class kn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=r3++,this.vertexSrc=t||kn.defaultVertexSrc,this.fragmentSrc=e||kn.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),tp[i]?(tp[i]++,i+=`-${tp[i]}`):tp[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
1448
1450
  ${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
1449
- ${this.fragmentSrc}`,this.vertexSrc=Qf(this.vertexSrc,kn.defaultVertexPrecision,Ne.HIGH),this.fragmentSrc=Qf(this.fragmentSrc,kn.defaultFragmentPrecision,F_())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return XB}static get defaultFragmentSrc(){return $B}static from(t,e,i){let s=t+e,o=Gf[s];return o||(Gf[s]=o=new kn(t,e,i)),o}};O_.defaultVertexPrecision=Ne.HIGH,O_.defaultFragmentPrecision=Ir.apple.device?Ne.HIGH:Ne.MEDIUM;var br=O_;var t3=0,sr=class r{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=t3++,this.static=!!e,this.ubo=!!i,t instanceof oe?(this.buffer=t,this.buffer.type=qe.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new oe(new Float32Array(1)),this.buffer.type=qe.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(!this.ubo)this.uniforms[t]=new r(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,i){return new r(t,e,i)}static uboFrom(t,e){return new r(t,e??!0,!0)}};var Ys=class r{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof sr?this.uniformGroup=e:this.uniformGroup=new sr(e):this.uniformGroup=new sr({}),this.disposeRunner=new Jt("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(let i in e.uniforms){let s=e.uniforms[i];if(s.group===!0&&this.checkUniformExists(t,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,i){let s=br.from(t,e);return new r(s,i)}};var Mc=class{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){let i=new Int32Array(t);for(let o=0;o<t;o++)i[o]=o;this.defaultGroupCache[t]=sr.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new br(this.vertexSrc,s)}let e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:this.defaultGroupCache[t]};return new Ys(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
1451
+ ${this.fragmentSrc}`,this.vertexSrc=Qf(this.vertexSrc,kn.defaultVertexPrecision,Ne.HIGH),this.fragmentSrc=Qf(this.fragmentSrc,kn.defaultFragmentPrecision,F_())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return XB}static get defaultFragmentSrc(){return $B}static from(t,e,i){let s=t+e,o=Gf[s];return o||(Gf[s]=o=new kn(t,e,i)),o}};O_.defaultVertexPrecision=Ne.HIGH,O_.defaultFragmentPrecision=Ir.apple.device?Ne.HIGH:Ne.MEDIUM;var br=O_;var i3=0,sr=class r{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=i3++,this.static=!!e,this.ubo=!!i,t instanceof oe?(this.buffer=t,this.buffer.type=qe.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new oe(new Float32Array(1)),this.buffer.type=qe.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(!this.ubo)this.uniforms[t]=new r(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,i){return new r(t,e,i)}static uboFrom(t,e){return new r(t,e??!0,!0)}};var Ys=class r{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof sr?this.uniformGroup=e:this.uniformGroup=new sr(e):this.uniformGroup=new sr({}),this.disposeRunner=new Jt("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(let i in e.uniforms){let s=e.uniforms[i];if(s.group===!0&&this.checkUniformExists(t,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,i){let s=br.from(t,e);return new r(s,i)}};var Mc=class{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){let i=new Int32Array(t);for(let o=0;o<t;o++)i[o]=o;this.defaultGroupCache[t]=sr.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new br(this.vertexSrc,s)}let e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:this.defaultGroupCache[t]};return new Ys(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
1450
1452
  `,e+=`
1451
1453
  `;for(let i=0;i<t;i++)i>0&&(e+=`
1452
1454
  else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
@@ -1518,7 +1520,7 @@ void main(void)
1518
1520
  gl_Position = filterVertexPosition();
1519
1521
  vTextureCoord = filterTextureCoord();
1520
1522
  }
1521
- `;var U_=class Fc extends Ys{constructor(t,e,i){let s=br.from(t||Fc.defaultVertexSrc,e||Fc.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Fc.defaultResolution,this.multisample=Fc.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new ei}apply(t,e,i,s,o){t.applyFilter(this,e,i,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return eF}static get defaultFragmentSrc(){return tF}};U_.defaultResolution=1,U_.defaultMultisample=At.NONE;var ii=U_;var Pi=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Br(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:i,backgroundAlpha:s}=t,o=i??e;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}};Pi.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Pi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"background"};K.add(Pi);var On=class{constructor(t){this.renderer=t,this.emptyRenderer=new qs(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:i}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){let{elements:o,ids:n,count:a}=t,l=0;for(let c=0;c<a;c++){let h=o[c],u=h._batchLocation;if(u>=0&&u<s&&e[u]===h){n[c]=u;continue}for(;l<s;){let d=e[l];if(d&&d._batchEnabled===i&&d._batchLocation===l){l++;continue}n[c]=l,h._batchLocation=l,e[l]=h;break}}}destroy(){this.renderer=null}};On.extension={type:$.RendererSystem,name:"batch"};K.add(On);var rF=0,Ci=class{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},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,this.renderer.CONTEXT_UID=rF++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=rF++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(q.PREFER_ENV>=tr.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),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")};this.webGLVersion===1?Object.assign(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")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};Ci.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ci.extension={type:$.RendererSystem,name:"context"};K.add(Ci);var ss=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Jt("disposeFramebuffer"),this.multisample=At.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new pt(null,{scaleMode:xr.NEAREST,resolution:1,mipmap:Mr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new pt(null,{scaleMode:xr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Mr.OFF,format:L.DEPTH_COMPONENT,type:nt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){let s=this.colorTextures[i],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var Ks=class extends pt{constructor(t={}){if(typeof t=="number"){let e=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:i,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=At.NONE),super(null,t),this.mipmap=Mr.OFF,this.valid=!0,this._clear=new Br([0,0,0,0]),this.framebuffer=new ss(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}};var ue=class extends ir{constructor(t){let e=t,i=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=__(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){let o=t.gl,n=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===er.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&i.width===n&&i.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=n,i.height=a,o.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}};var Zs=class extends ue{constructor(t,e){if(e=e||{},typeof t=="string"){let i=new Image;ue.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??q.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{i(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===er.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var Qs=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){let s=e.width,o=e.height;if(i){let n=t.width/2/s,a=t.height/2/o,l=t.x/s+n,c=t.y/o+a;i=kt.add(i,kt.NW),this.x0=l+n*kt.uX(i),this.y0=c+a*kt.uY(i),i=kt.add(i,2),this.x1=l+n*kt.uX(i),this.y1=c+a*kt.uY(i),i=kt.add(i,2),this.x2=l+n*kt.uX(i),this.y2=c+a*kt.uY(i),i=kt.add(i,2),this.x3=l+n*kt.uX(i),this.y3=c+a*kt.uY(i)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};Qs.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var iF=new Qs;function ep(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var kc=class r extends Vs.default{constructor(t,e,i,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new xt(0,0,1,1)),t instanceof r&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=iF,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new ne(n.x,n.y):new ne(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&rr[e.url]&&r.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new r(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===iF&&(this._uvs=new Qs),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=q.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof pt){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${Si()}`,pt.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${Si()}`}o=t._pixiId}let n=rr[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof pt)?(e.resolution||(e.resolution=Lf(t)),n=new r(new pt(t,e)),n.baseTexture.cacheId=o,pt.addToCache(n.baseTexture,o),r.addToCache(n,o)):!n&&t instanceof pt&&(n=new r(t),r.addToCache(n,o)),n}static fromURL(t,e){let i=Object.assign({autoLoad:!1},e?.resourceOptions),s=r.from(t,Object.assign({resourceOptions:i},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new r(pt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){let o=new pt(t,Object.assign({scaleMode:pt.defaultOptions.scaleMode,resolution:Lf(e)},s)),{resource:n}=o;n instanceof Zs&&(n.url=e);let a=new r(o);return i||(i=e),pt.addToCache(a.baseTexture,i),r.addToCache(a,i),i!==e&&(pt.addToCache(a.baseTexture,e),r.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),rr[e]&&rr[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),rr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=rr[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete rr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)rr[t.textureCacheIds[e]]===t&&delete rr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:i,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",c=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,h=`Y: ${i} + ${o} = ${i+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${c} ${l} ${h}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return r._EMPTY||(r._EMPTY=new r(new pt),ep(r._EMPTY),ep(r._EMPTY.baseTexture)),r._EMPTY}static get WHITE(){if(!r._WHITE){let t=q.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),r._WHITE=new r(pt.from(t)),ep(r._WHITE),ep(r._WHITE.baseTexture)}return r._WHITE}};var Js=class r extends kc{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,i&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new r(new Ks(t))}};var Un=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=At.NONE){let s=new Ks(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Js(s)}getOptimalTexture(t,e,i=1,s=At.NONE){let o;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=Hs(t),e=Hs(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(t,e,i){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||At.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};Un.SCREEN_KEY=-1;var Oc=class extends wi{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var Uc=class extends wi{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new oe(this.vertices),this.uvBuffer=new oe(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var Gc=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=At.NONE,this.sourceFrame=new xt,this.destinationFrame=new xt,this.bindingSourceFrame=new xt,this.bindingDestinationFrame=new xt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var rp=[new ne,new ne,new ne,new ne],G_=new Rt,Gn=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Un,this.statePool=[],this.quad=new Oc,this.quadUv=new Uc,this.tempRect=new xt,this.activeState={},this.globalUniforms=new sr({outputFrame:new xt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let i=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new Gc,n=i.renderTexture,a,l;if(n.current){let x=n.current;a=x.resolution,l=x.multisample}else a=i.resolution,l=i.multisample;let c=e[0].resolution||a,h=e[0].multisample??l,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let x=1;x<e.length;x++){let _=e[x];c=Math.min(c,_.resolution||a),h=Math.min(h,_.multisample??l),u=this.useMaxPadding?Math.max(u,_.padding):u+_.padding,d=d&&_.autoFit,f=f||(_.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=c,o.multisample=h,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let p=this.tempRect.copyFrom(n.sourceFrame);i.projection.transform&&this.transformAABB(G_.copyFrom(i.projection.transform).invert(),p),d?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,n.current?n.current.resolution:i.resolution,n.sourceFrame,n.destinationFrame,i.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,c,h),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;let m=this.tempRect;m.x=0,m.y=0,m.width=o.sourceFrame.width,m.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(n.sourceFrame),o.bindingDestinationFrame.copyFrom(n.destinationFrame),o.transform=i.projection.transform,i.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,m),i.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;let s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*e.resolution),n[1]=Math.round(o[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*o[2]-.5*n[2],a[3]=e.sourceFrame.height*o[3]-.5*n[3],e.legacy){let c=s.filterArea;c[0]=e.destinationFrame.width,c[1]=e.destinationFrame.height,c[2]=e.sourceFrame.x,c[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let l=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,l.renderTexture,es.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let c=e.renderTexture,h=this.getOptimalFilterTexture(c.width,c.height,e.resolution);h.filterFrame=c.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(h=this.getOptimalFilterTexture(c.width,c.height,e.resolution),h.filterFrame=c.filterFrame),i[u].apply(this,c,h,es.CLEAR,e);let d=c;c=h,h=d}i[u].apply(this,c,l.renderTexture,es.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(h)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=es.CLEAR){let{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,i.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===es.CLEAR||e===es.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(i,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(yn.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(yn.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Rt.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=At.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||At.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let i=rp[0],s=rp[1],o=rp[2],n=rp[3];i.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(i.x,s.x,o.x,n.x),l=Math.min(i.y,s.y,o.y,n.y),c=Math.max(i.x,s.x,o.x,n.x),h=Math.max(i.y,s.y,o.y,n.y);e.x=a,e.y=l,e.width=c-a,e.height=h-l}roundFrame(t,e,i,s,o){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(o){let{a:n,b:a,c:l,d:c}=o;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(c)>1e-4))return}o=o?G_.copyFrom(o):G_.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};Gn.extension={type:$.RendererSystem,name:"filter"};K.add(Gn);var Lc=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=At.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var e3=new xt,Ln=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new ss(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new xt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;q.PREFER_ENV===tr.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=i),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let n=e.width>>i,a=e.height>>i,l=n/e.width;this.setViewport(e.x*l,e.y*l,n,a)}else{let n=t.width>>i,a=t.height>>i;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=i,o.height=s,this.gl.viewport(t,e,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,s,o=xf.COLOR|xf.DEPTH){let{gl:n}=this;n.clearColor(t,e,i,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,i=new Lc(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){let{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n<o;n++){let a=s[n],l=a.parentTextureArray||a;this.renderer.texture.bind(l,0),n===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,l._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:i}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;i.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let l=0;l<n;l++){let c=o[l],h=c.parentTextureArray||c;this.renderer.texture.bind(h,0),l===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,c.target,h._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+l))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let l=t.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let l,c;this.renderer.context.webGLVersion===1?(l=i.DEPTH_STENCIL_ATTACHMENT,c=i.DEPTH_STENCIL):t.depth&&t.stencil?(l=i.DEPTH_STENCIL_ATTACHMENT,c=i.DEPTH24_STENCIL8):t.depth?(l=i.DEPTH_ATTACHMENT,c=i.DEPTH_COMPONENT24):(l=i.STENCIL_ATTACHMENT,c=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,c,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,i=At.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=At.NONE),i}blit(t,e,i){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let l=s.glFramebuffers[a];if(!l)return;if(!t){if(!l.msaaBuffer)return;let h=s.colorTextures[0];if(!h)return;l.blitFramebuffer||(l.blitFramebuffer=new ss(s.width,s.height),l.blitFramebuffer.addColorTexture(0,h)),t=l.blitFramebuffer,t.colorTextures[0]!==h&&(t.colorTextures[0]=h,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=e3,e.width=s.width,e.height=s.height),i||(i=e);let c=e.width===i.width&&e.height===i.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,l.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,n.COLOR_BUFFER_BIT,c?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let i=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let i=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,l;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,l=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,l,i,s):o.renderbufferStorage(o.RENDERBUFFER,l,i,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new xt}destroy(){this.renderer=null}};Ln.extension={type:$.RendererSystem,name:"framebuffer"};K.add(Ln);var L_={5126:4,5123:2,5121:1},Dn=class{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;q.PREFER_ENV===tr.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,l)=>i.drawElementsInstancedANGLE(s,o,n,a,l),t.drawArraysInstanced=(s,o,n,a)=>i.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:i}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){let i=t.attributes,s=e.attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,i=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let l=this.getSignature(t,a),c=t.glVertexArrayObjects[this.CONTEXT_UID],h=c[l];if(h)return c[a.id]=h,h;let u=t.buffers,d=t.attributes,f={},p={};for(let m in u)f[m]=0,p[m]=0;for(let m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*L_[d[m].type];for(let m in d){let x=d[m],_=x.size;x.stride===void 0&&(f[x.buffer]===_*L_[x.type]?x.stride=0:x.stride=f[x.buffer]),x.start===void 0&&(x.start=p[x.buffer],p[x.buffer]+=_*L_[x.type])}h=s.createVertexArray(),s.bindVertexArray(h);for(let m=0;m<u.length;m++){let x=u[m];n.bind(x),i&&x._glBuffers[o].refCount++}return this.activateVao(t,a),c[a.id]=h,c[l]=h,s.bindVertexArray(null),n.unbind(qe.ARRAY_BUFFER),h}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!i){if(n)for(let a=0;a<o.length;a++){let l=o[a]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in i)if(a[0]==="g"){let l=i[a];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){let i=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let l=null;for(let c in a){let h=a[c],u=n[h.buffer],d=u._glBuffers[s];if(e.attributeData[c]){l!==d&&(o.bind(u),l=d);let f=e.attributeData[c].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,h.size,h.type||i.FLOAT,h.normalized,h.stride,h.start),h.instance)if(this.hasInstance)i.vertexAttribDivisor(f,h.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,l=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,l,(i||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,i,e||n.getSize(),s||1):o.drawArrays(t,i,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Dn.extension={type:$.RendererSystem,name:"geometry"};K.add(Dn);var sF=new Rt,Dc=class{constructor(t,e){this._texture=t,this.mapCoord=new Rt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);let s=e.orig,o=e.trim;o&&(sF.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(sF));let n=e.baseTexture,a=this.uClampFrame,l=this.clampMargin/n.resolution,c=this.clampOffset;return a[0]=(e._frame.x+l+c)/n.width,a[1]=(e._frame.y+l+c)/n.height,a[2]=(e._frame.x+e._frame.width-l+c)/n.width,a[3]=(e._frame.y+e._frame.height-l+c)/n.height,this.uClampOffset[0]=c/n.realWidth,this.uClampOffset[1]=c/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var oF=`varying vec2 vMaskCoord;
1523
+ `;var U_=class Fc extends Ys{constructor(t,e,i){let s=br.from(t||Fc.defaultVertexSrc,e||Fc.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Fc.defaultResolution,this.multisample=Fc.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new ei}apply(t,e,i,s,o){t.applyFilter(this,e,i,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return eF}static get defaultFragmentSrc(){return tF}};U_.defaultResolution=1,U_.defaultMultisample=At.NONE;var ii=U_;var Pi=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Br(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:i,backgroundAlpha:s}=t,o=i??e;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}};Pi.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Pi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"background"};K.add(Pi);var On=class{constructor(t){this.renderer=t,this.emptyRenderer=new qs(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:i}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){let{elements:o,ids:n,count:a}=t,l=0;for(let c=0;c<a;c++){let h=o[c],u=h._batchLocation;if(u>=0&&u<s&&e[u]===h){n[c]=u;continue}for(;l<s;){let d=e[l];if(d&&d._batchEnabled===i&&d._batchLocation===l){l++;continue}n[c]=l,h._batchLocation=l,e[l]=h;break}}}destroy(){this.renderer=null}};On.extension={type:$.RendererSystem,name:"batch"};K.add(On);var rF=0,Ci=class{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},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,this.renderer.CONTEXT_UID=rF++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=rF++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(q.PREFER_ENV>=tr.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),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")};this.webGLVersion===1?Object.assign(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")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};Ci.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ci.extension={type:$.RendererSystem,name:"context"};K.add(Ci);var ss=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Jt("disposeFramebuffer"),this.multisample=At.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new pt(null,{scaleMode:xr.NEAREST,resolution:1,mipmap:Mr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new pt(null,{scaleMode:xr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Mr.OFF,format:L.DEPTH_COMPONENT,type:nt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){let s=this.colorTextures[i],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var Ks=class extends pt{constructor(t={}){if(typeof t=="number"){let e=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:i,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=At.NONE),super(null,t),this.mipmap=Mr.OFF,this.valid=!0,this._clear=new Br([0,0,0,0]),this.framebuffer=new ss(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}};var ue=class extends ir{constructor(t){let e=t,i=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=__(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){let o=t.gl,n=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===er.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&i.width===n&&i.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=n,i.height=a,o.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}};var Zs=class extends ue{constructor(t,e){if(e=e||{},typeof t=="string"){let i=new Image;ue.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??q.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{i(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===er.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var Qs=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){let s=e.width,o=e.height;if(i){let n=t.width/2/s,a=t.height/2/o,l=t.x/s+n,c=t.y/o+a;i=Ot.add(i,Ot.NW),this.x0=l+n*Ot.uX(i),this.y0=c+a*Ot.uY(i),i=Ot.add(i,2),this.x1=l+n*Ot.uX(i),this.y1=c+a*Ot.uY(i),i=Ot.add(i,2),this.x2=l+n*Ot.uX(i),this.y2=c+a*Ot.uY(i),i=Ot.add(i,2),this.x3=l+n*Ot.uX(i),this.y3=c+a*Ot.uY(i)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};Qs.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var iF=new Qs;function ep(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var kc=class r extends Vs.default{constructor(t,e,i,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new xt(0,0,1,1)),t instanceof r&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=iF,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new ne(n.x,n.y):new ne(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&rr[e.url]&&r.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new r(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===iF&&(this._uvs=new Qs),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=q.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof pt){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${Si()}`,pt.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${Si()}`}o=t._pixiId}let n=rr[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof pt)?(e.resolution||(e.resolution=Lf(t)),n=new r(new pt(t,e)),n.baseTexture.cacheId=o,pt.addToCache(n.baseTexture,o),r.addToCache(n,o)):!n&&t instanceof pt&&(n=new r(t),r.addToCache(n,o)),n}static fromURL(t,e){let i=Object.assign({autoLoad:!1},e?.resourceOptions),s=r.from(t,Object.assign({resourceOptions:i},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new r(pt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){let o=new pt(t,Object.assign({scaleMode:pt.defaultOptions.scaleMode,resolution:Lf(e)},s)),{resource:n}=o;n instanceof Zs&&(n.url=e);let a=new r(o);return i||(i=e),pt.addToCache(a.baseTexture,i),r.addToCache(a,i),i!==e&&(pt.addToCache(a.baseTexture,e),r.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),rr[e]&&rr[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),rr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=rr[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete rr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)rr[t.textureCacheIds[e]]===t&&delete rr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:i,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",c=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,h=`Y: ${i} + ${o} = ${i+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${c} ${l} ${h}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return r._EMPTY||(r._EMPTY=new r(new pt),ep(r._EMPTY),ep(r._EMPTY.baseTexture)),r._EMPTY}static get WHITE(){if(!r._WHITE){let t=q.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),r._WHITE=new r(pt.from(t)),ep(r._WHITE),ep(r._WHITE.baseTexture)}return r._WHITE}};var Js=class r extends kc{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,i&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new r(new Ks(t))}};var Un=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=At.NONE){let s=new Ks(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Js(s)}getOptimalTexture(t,e,i=1,s=At.NONE){let o;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=Hs(t),e=Hs(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(t,e,i){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||At.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};Un.SCREEN_KEY=-1;var Oc=class extends wi{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var Uc=class extends wi{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new oe(this.vertices),this.uvBuffer=new oe(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var Gc=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=At.NONE,this.sourceFrame=new xt,this.destinationFrame=new xt,this.bindingSourceFrame=new xt,this.bindingDestinationFrame=new xt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var rp=[new ne,new ne,new ne,new ne],G_=new Rt,Gn=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Un,this.statePool=[],this.quad=new Oc,this.quadUv=new Uc,this.tempRect=new xt,this.activeState={},this.globalUniforms=new sr({outputFrame:new xt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let i=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new Gc,n=i.renderTexture,a,l;if(n.current){let x=n.current;a=x.resolution,l=x.multisample}else a=i.resolution,l=i.multisample;let c=e[0].resolution||a,h=e[0].multisample??l,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let x=1;x<e.length;x++){let _=e[x];c=Math.min(c,_.resolution||a),h=Math.min(h,_.multisample??l),u=this.useMaxPadding?Math.max(u,_.padding):u+_.padding,d=d&&_.autoFit,f=f||(_.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=c,o.multisample=h,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let p=this.tempRect.copyFrom(n.sourceFrame);i.projection.transform&&this.transformAABB(G_.copyFrom(i.projection.transform).invert(),p),d?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,n.current?n.current.resolution:i.resolution,n.sourceFrame,n.destinationFrame,i.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,c,h),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;let m=this.tempRect;m.x=0,m.y=0,m.width=o.sourceFrame.width,m.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(n.sourceFrame),o.bindingDestinationFrame.copyFrom(n.destinationFrame),o.transform=i.projection.transform,i.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,m),i.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;let s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*e.resolution),n[1]=Math.round(o[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*o[2]-.5*n[2],a[3]=e.sourceFrame.height*o[3]-.5*n[3],e.legacy){let c=s.filterArea;c[0]=e.destinationFrame.width,c[1]=e.destinationFrame.height,c[2]=e.sourceFrame.x,c[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let l=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,l.renderTexture,es.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let c=e.renderTexture,h=this.getOptimalFilterTexture(c.width,c.height,e.resolution);h.filterFrame=c.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(h=this.getOptimalFilterTexture(c.width,c.height,e.resolution),h.filterFrame=c.filterFrame),i[u].apply(this,c,h,es.CLEAR,e);let d=c;c=h,h=d}i[u].apply(this,c,l.renderTexture,es.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(h)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=es.CLEAR){let{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,i.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===es.CLEAR||e===es.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(i,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(yn.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(yn.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Rt.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=At.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||At.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let i=rp[0],s=rp[1],o=rp[2],n=rp[3];i.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(i.x,s.x,o.x,n.x),l=Math.min(i.y,s.y,o.y,n.y),c=Math.max(i.x,s.x,o.x,n.x),h=Math.max(i.y,s.y,o.y,n.y);e.x=a,e.y=l,e.width=c-a,e.height=h-l}roundFrame(t,e,i,s,o){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(o){let{a:n,b:a,c:l,d:c}=o;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(c)>1e-4))return}o=o?G_.copyFrom(o):G_.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};Gn.extension={type:$.RendererSystem,name:"filter"};K.add(Gn);var Lc=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=At.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var s3=new xt,Ln=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new ss(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new xt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;q.PREFER_ENV===tr.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=i),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let n=e.width>>i,a=e.height>>i,l=n/e.width;this.setViewport(e.x*l,e.y*l,n,a)}else{let n=t.width>>i,a=t.height>>i;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=i,o.height=s,this.gl.viewport(t,e,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,s,o=xf.COLOR|xf.DEPTH){let{gl:n}=this;n.clearColor(t,e,i,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,i=new Lc(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){let{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n<o;n++){let a=s[n],l=a.parentTextureArray||a;this.renderer.texture.bind(l,0),n===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,l._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:i}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;i.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let l=0;l<n;l++){let c=o[l],h=c.parentTextureArray||c;this.renderer.texture.bind(h,0),l===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,c.target,h._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+l))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let l=t.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let l,c;this.renderer.context.webGLVersion===1?(l=i.DEPTH_STENCIL_ATTACHMENT,c=i.DEPTH_STENCIL):t.depth&&t.stencil?(l=i.DEPTH_STENCIL_ATTACHMENT,c=i.DEPTH24_STENCIL8):t.depth?(l=i.DEPTH_ATTACHMENT,c=i.DEPTH_COMPONENT24):(l=i.STENCIL_ATTACHMENT,c=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,c,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,i=At.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=At.NONE),i}blit(t,e,i){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let l=s.glFramebuffers[a];if(!l)return;if(!t){if(!l.msaaBuffer)return;let h=s.colorTextures[0];if(!h)return;l.blitFramebuffer||(l.blitFramebuffer=new ss(s.width,s.height),l.blitFramebuffer.addColorTexture(0,h)),t=l.blitFramebuffer,t.colorTextures[0]!==h&&(t.colorTextures[0]=h,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=s3,e.width=s.width,e.height=s.height),i||(i=e);let c=e.width===i.width&&e.height===i.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,l.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,n.COLOR_BUFFER_BIT,c?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let i=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let i=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,l;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,l=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,l,i,s):o.renderbufferStorage(o.RENDERBUFFER,l,i,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new xt}destroy(){this.renderer=null}};Ln.extension={type:$.RendererSystem,name:"framebuffer"};K.add(Ln);var L_={5126:4,5123:2,5121:1},Dn=class{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;q.PREFER_ENV===tr.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,l)=>i.drawElementsInstancedANGLE(s,o,n,a,l),t.drawArraysInstanced=(s,o,n,a)=>i.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:i}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){let s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){let i=t.attributes,s=e.attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let i=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,i=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let l=this.getSignature(t,a),c=t.glVertexArrayObjects[this.CONTEXT_UID],h=c[l];if(h)return c[a.id]=h,h;let u=t.buffers,d=t.attributes,f={},p={};for(let m in u)f[m]=0,p[m]=0;for(let m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*L_[d[m].type];for(let m in d){let x=d[m],_=x.size;x.stride===void 0&&(f[x.buffer]===_*L_[x.type]?x.stride=0:x.stride=f[x.buffer]),x.start===void 0&&(x.start=p[x.buffer],p[x.buffer]+=_*L_[x.type])}h=s.createVertexArray(),s.bindVertexArray(h);for(let m=0;m<u.length;m++){let x=u[m];n.bind(x),i&&x._glBuffers[o].refCount++}return this.activateVao(t,a),c[a.id]=h,c[l]=h,s.bindVertexArray(null),n.unbind(qe.ARRAY_BUFFER),h}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!i){if(n)for(let a=0;a<o.length;a++){let l=o[a]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in i)if(a[0]==="g"){let l=i[a];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){let i=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let l=null;for(let c in a){let h=a[c],u=n[h.buffer],d=u._glBuffers[s];if(e.attributeData[c]){l!==d&&(o.bind(u),l=d);let f=e.attributeData[c].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,h.size,h.type||i.FLOAT,h.normalized,h.stride,h.start),h.instance)if(this.hasInstance)i.vertexAttribDivisor(f,h.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,l=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,l,(i||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,i,e||n.getSize(),s||1):o.drawArrays(t,i,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Dn.extension={type:$.RendererSystem,name:"geometry"};K.add(Dn);var sF=new Rt,Dc=class{constructor(t,e){this._texture=t,this.mapCoord=new Rt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*i.a+n*i.c+i.tx,e[s+1]=o*i.b+n*i.d+i.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);let s=e.orig,o=e.trim;o&&(sF.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(sF));let n=e.baseTexture,a=this.uClampFrame,l=this.clampMargin/n.resolution,c=this.clampOffset;return a[0]=(e._frame.x+l+c)/n.width,a[1]=(e._frame.y+l+c)/n.height,a[2]=(e._frame.x+e._frame.width-l+c)/n.width,a[3]=(e._frame.y+e._frame.height-l+c)/n.height,this.uClampOffset[0]=c/n.realWidth,this.uClampOffset[1]=c/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var oF=`varying vec2 vMaskCoord;
1522
1524
  varying vec2 vTextureCoord;
1523
1525
 
1524
1526
  uniform sampler2D uSampler;
@@ -1559,7 +1561,7 @@ void main(void)
1559
1561
  vTextureCoord = aTextureCoord;
1560
1562
  vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
1561
1563
  }
1562
- `;var Nc=class extends ii{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||nF,e||oF,i),this.maskSprite=s,this.maskMatrix=new Rt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new Dc(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,o).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}};var Hc=class{constructor(t=null){this.type=se.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ii.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=se.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}};var Nn=class{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){let o=this.maskDataPool.pop()||new Hc;o.pooled=!0,o.maskObject=e,i=o}let s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==se.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case se.SCISSOR:this.renderer.scissor.push(i);break;case se.STENCIL:this.renderer.stencil.push(i);break;case se.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case se.COLOR:this.pushColorMask(i);break;default:break}i.type===se.SPRITE&&this.maskStack.push(i)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case se.SCISSOR:this.renderer.scissor.pop(e);break;case se.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case se.SPRITE:this.popSpriteMask(e);break;case se.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){let i=this.maskStack[this.maskStack.length-1];i.type===se.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=se.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=se.SCISSOR:t.type=se.STENCIL:t.type=se.COLOR}pushSpriteMask(t){let{maskObject:e}=t,i=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new Nc])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;let o=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=o,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){let e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){let e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};Nn.extension={type:$.RendererSystem,name:"mask"};K.add(Nn);var Hn=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var aF=new Rt,lF=[],cF=class ip extends Hn{constructor(t){super(t),this.glConst=q.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,lF.pop()??new xt);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:i,c:s,d:o}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(o)>1e-4)}testScissor(t){let{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||ip.isMatrixRotated(e.worldTransform)||ip.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,o){ip.isMatrixRotated(o)||(o=o?aF.copyFrom(o):aF.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&lF.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t=this.maskStack[this.maskStack.length-1]._scissorRect,e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};cF.extension={type:$.RendererSystem,name:"scissor"};var D_=cF;K.add(D_);var Vn=class extends Hn{constructor(t){super(t),this.glConst=q.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,i.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{let i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}};Vn.extension={type:$.RendererSystem,name:"stencil"};K.add(Vn);var Wn=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}};Wn.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_plugin"};K.add(Wn);var zn=class{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Rt,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);let o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/e.width*2,o.d=n*(1/e.height*2),o.tx=-1-e.x*o.a,o.ty=-n-e.y*o.d}setTransform(t){}destroy(){this.renderer=null}};zn.extension={type:$.RendererSystem,name:"projection"};K.add(zn);var r3=new Xf,hF=new xt,$n=class{constructor(t){this.renderer=t,this._tempMatrix=new Rt}generateTexture(t,e){let{region:i,...s}=e||{},o=i?.copyTo(hF)||t.getLocalBounds(hF,!0),n=s.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/n),o.height=Math.max(o.height,1/n),s.width=o.width,s.height=o.height,s.resolution=n,s.multisample??(s.multisample=this.renderer.multisample);let a=Js.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=t.transform;return t.transform=r3,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}};$n.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"textureGenerator"};K.add($n);var to=new xt,Vc=new xt,Xn=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new xt,this.destinationFrame=new xt,this.viewportFrame=new xt}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(to.width=t.frame.width,to.height=t.frame.height,e=to),i||(Vc.x=t.frame.x,Vc.y=t.frame.y,Vc.width=e.width,Vc.height=e.height,i=Vc),n=o.framebuffer):(a=s.resolution,e||(to.width=s._view.screen.width,to.height=s._view.screen.height,e=to),i||(i=to,i.width=e.width,i.height=e.height));let l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,t||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(n,l),this.renderer.projection.update(i,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Br.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);let o=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=o.width!==n.width||o.height!==n.height;if(a){let{x:l,y:c,width:h,height:u}=this.viewportFrame;l=Math.round(l),c=Math.round(c),h=Math.round(h),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,c,h,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};Xn.extension={type:$.RendererSystem,name:"renderTexture"};K.add(Xn);var Wc=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function uF(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let o=t.getActiveAttrib(r,s);if(o.name.startsWith("gl_"))continue;let n=Cc(t,o.type),a={type:n,name:o.name,size:Pc(n),location:t.getAttribLocation(r,o.name)};e[o.name]=a}return e}function dF(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=t.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=Cc(t,o.type);e[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:Ac(l,o.size)}}return e}function N_(r,t){let e=jf(r,r.VERTEX_SHADER,t.vertexSrc),i=jf(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.extra?.transformFeedbackVaryings;if(o&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||k_(r,s,e,i),t.attributeData=uF(s,r),t.uniformData=dF(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let a=Object.keys(t.attributeData);a.sort((l,c)=>l>c?1:-1);for(let l=0;l<a.length;l++)t.attributeData[a[l]].location=l,r.bindAttribLocation(s,l,a[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);let n={};for(let a in t.uniformData){let l=t.uniformData[a];n[a]={location:r.getUniformLocation(s,a),value:Ac(l.type,l.size)}}return new Wc(s,n)}function i3(r,t,e,i,s){e.buffer.update(s)}var s3={float:`
1564
+ `;var Nc=class extends ii{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||nF,e||oF,i),this.maskSprite=s,this.maskMatrix=new Rt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new Dc(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,o).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}};var Hc=class{constructor(t=null){this.type=se.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ii.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=se.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}};var Nn=class{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){let o=this.maskDataPool.pop()||new Hc;o.pooled=!0,o.maskObject=e,i=o}let s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==se.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case se.SCISSOR:this.renderer.scissor.push(i);break;case se.STENCIL:this.renderer.stencil.push(i);break;case se.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case se.COLOR:this.pushColorMask(i);break;default:break}i.type===se.SPRITE&&this.maskStack.push(i)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case se.SCISSOR:this.renderer.scissor.pop(e);break;case se.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case se.SPRITE:this.popSpriteMask(e);break;case se.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){let i=this.maskStack[this.maskStack.length-1];i.type===se.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=se.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=se.SCISSOR:t.type=se.STENCIL:t.type=se.COLOR}pushSpriteMask(t){let{maskObject:e}=t,i=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new Nc])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;let o=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=o,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){let e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){let e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};Nn.extension={type:$.RendererSystem,name:"mask"};K.add(Nn);var Hn=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var aF=new Rt,lF=[],cF=class ip extends Hn{constructor(t){super(t),this.glConst=q.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,lF.pop()??new xt);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:i,c:s,d:o}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(o)>1e-4)}testScissor(t){let{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||ip.isMatrixRotated(e.worldTransform)||ip.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,o){ip.isMatrixRotated(o)||(o=o?aF.copyFrom(o):aF.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&lF.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t=this.maskStack[this.maskStack.length-1]._scissorRect,e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};cF.extension={type:$.RendererSystem,name:"scissor"};var D_=cF;K.add(D_);var Vn=class extends Hn{constructor(t){super(t),this.glConst=q.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,i.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{let i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}};Vn.extension={type:$.RendererSystem,name:"stencil"};K.add(Vn);var Wn=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}};Wn.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_plugin"};K.add(Wn);var zn=class{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Rt,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);let o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/e.width*2,o.d=n*(1/e.height*2),o.tx=-1-e.x*o.a,o.ty=-n-e.y*o.d}setTransform(t){}destroy(){this.renderer=null}};zn.extension={type:$.RendererSystem,name:"projection"};K.add(zn);var o3=new Xf,hF=new xt,$n=class{constructor(t){this.renderer=t,this._tempMatrix=new Rt}generateTexture(t,e){let{region:i,...s}=e||{},o=i?.copyTo(hF)||t.getLocalBounds(hF,!0),n=s.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/n),o.height=Math.max(o.height,1/n),s.width=o.width,s.height=o.height,s.resolution=n,s.multisample??(s.multisample=this.renderer.multisample);let a=Js.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=t.transform;return t.transform=o3,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}};$n.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"textureGenerator"};K.add($n);var to=new xt,Vc=new xt,Xn=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new xt,this.destinationFrame=new xt,this.viewportFrame=new xt}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(to.width=t.frame.width,to.height=t.frame.height,e=to),i||(Vc.x=t.frame.x,Vc.y=t.frame.y,Vc.width=e.width,Vc.height=e.height,i=Vc),n=o.framebuffer):(a=s.resolution,e||(to.width=s._view.screen.width,to.height=s._view.screen.height,e=to),i||(i=to,i.width=e.width,i.height=e.height));let l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,t||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(n,l),this.renderer.projection.update(i,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Br.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);let o=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=o.width!==n.width||o.height!==n.height;if(a){let{x:l,y:c,width:h,height:u}=this.viewportFrame;l=Math.round(l),c=Math.round(c),h=Math.round(h),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,c,h,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};Xn.extension={type:$.RendererSystem,name:"renderTexture"};K.add(Xn);var Wc=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function uF(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let o=t.getActiveAttrib(r,s);if(o.name.startsWith("gl_"))continue;let n=Cc(t,o.type),a={type:n,name:o.name,size:Pc(n),location:t.getAttribLocation(r,o.name)};e[o.name]=a}return e}function dF(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=t.getActiveUniform(r,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=Cc(t,o.type);e[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:Ac(l,o.size)}}return e}function N_(r,t){let e=jf(r,r.VERTEX_SHADER,t.vertexSrc),i=jf(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.extra?.transformFeedbackVaryings;if(o&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||k_(r,s,e,i),t.attributeData=uF(s,r),t.uniformData=dF(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let a=Object.keys(t.attributeData);a.sort((l,c)=>l>c?1:-1);for(let l=0;l<a.length;l++)t.attributeData[a[l]].location=l,r.bindAttribLocation(s,l,a[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);let n={};for(let a in t.uniformData){let l=t.uniformData[a];n[a]={location:r.getUniformLocation(s,a),value:Ac(l.type,l.size)}}return new Wc(s,n)}function n3(r,t,e,i,s){e.buffer.update(s)}var a3={float:`
1563
1565
  data[offset] = v;
1564
1566
  `,vec2:`
1565
1567
  data[offset] = v[0];
@@ -1597,7 +1599,7 @@ void main(void)
1597
1599
  {
1598
1600
  data[offset + i] = v[i];
1599
1601
  }
1600
- `},fF={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function pF(r){let t=r.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),e=0,i=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(e=fF[n.data.type],n.data.size>1&&(e=Math.max(e,16)*n.data.size),n.dataLen=e,i%e!==0&&i<16){let a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=e,i=e):(n.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function mF(r,t){let e=[];for(let i in r)t[i]&&e.push(t[i]);return e.sort((i,s)=>i.index-s.index),e}function H_(r,t){if(!r.autoManage)return{size:0,syncFunc:i3};let e=mF(r.uniforms,t),{uboElements:i,size:s}=pF(e),o=[`
1602
+ `},fF={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function pF(r){let t=r.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),e=0,i=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(e=fF[n.data.type],n.data.size>1&&(e=Math.max(e,16)*n.data.size),n.dataLen=e,i%e!==0&&i<16){let a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=e,i=e):(n.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function mF(r,t){let e=[];for(let i in r)t[i]&&e.push(t[i]);return e.sort((i,s)=>i.index-s.index),e}function H_(r,t){if(!r.autoManage)return{size:0,syncFunc:n3};let e=mF(r.uniforms,t),{uboElements:i,size:s}=pF(e),o=[`
1601
1603
  var v = null;
1602
1604
  var v2 = null;
1603
1605
  var cv = null;
@@ -1621,7 +1623,7 @@ void main(void)
1621
1623
  offset += ${p};
1622
1624
  }
1623
1625
 
1624
- `)}else{let u=s3[a.data.type];o.push(`
1626
+ `)}else{let u=a3[a.data.type];o.push(`
1625
1627
  cv = ud.${c}.value;
1626
1628
  v = uv.${c};
1627
1629
  offset = ${a.offset/4};
@@ -1629,7 +1631,7 @@ void main(void)
1629
1631
  `)}}return o.push(`
1630
1632
  renderer.buffer.update(buffer);
1631
1633
  `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
1632
- `))}}var o3=0,sp={textureCount:0,uboCount:0},os=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=o3++}systemCheck(){if(!Jf())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(sp.textureCount=0,sp.uboCount=0,this.syncUniformGroup(t.uniformGroup,sp)),s}setUniforms(t){let e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){let i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=B_(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;let s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,sp,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=H_(t,this.shader.program.uniformData)),t.autoManage){let l=new Float32Array(a.size/4);t.buffer.update(l)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,i=t.program,s=N_(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};os.extension={type:$.RendererSystem,name:"shader"};K.add(os);var Ri=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};Ri.defaultOptions={hello:!1},Ri.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"startup"};K.add(Ri);function gF(r,t=[]){return t[J.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.ADD]=[r.ONE,r.ONE],t[J.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.NONE]=[0,0],t[J.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[J.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[J.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[J.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[J.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[J.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[J.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[J.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[J.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[J.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}var n3=0,a3=1,l3=2,c3=3,h3=4,u3=5,xF=class V_{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=J.NONE,this._blendEq=!1,this.map=[],this.map[n3]=this.setBlend,this.map[a3]=this.setOffset,this.map[l3]=this.setCullFace,this.map[c3]=this.setDepthTest,this.map[h3]=this.setFrontFace,this.map[u3]=this.setDepthMask,this.checks=[],this.defaultState=new ei,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=gF(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;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(V_.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(V_.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.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){let i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};xF.extension={type:$.RendererSystem,name:"state"};var W_=xF;K.add(W_);var jn=class extends Vs.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Jt(e)})}addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){let i=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var zc=class op{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=op.defaultMaxIdle,this.checkCountMax=op.defaultCheckCountMax,this.mode=op.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==yf.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,i=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};zc.defaultMode=yf.AUTO,zc.defaultMaxIdle=60*60,zc.defaultCheckCountMax=60*10,zc.extension={type:$.RendererSystem,name:"textureGC"};var si=zc;K.add(si);var eo=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=nt.UNSIGNED_BYTE,this.internalFormat=L.RGBA,this.samplerType=0}};function yF(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.R8]:H.FLOAT,[r.R8_SNORM]:H.FLOAT,[r.RG8]:H.FLOAT,[r.RG8_SNORM]:H.FLOAT,[r.RGB8]:H.FLOAT,[r.RGB8_SNORM]:H.FLOAT,[r.RGB565]:H.FLOAT,[r.RGBA4]:H.FLOAT,[r.RGB5_A1]:H.FLOAT,[r.RGBA8]:H.FLOAT,[r.RGBA8_SNORM]:H.FLOAT,[r.RGB10_A2]:H.FLOAT,[r.RGB10_A2UI]:H.FLOAT,[r.SRGB8]:H.FLOAT,[r.SRGB8_ALPHA8]:H.FLOAT,[r.R16F]:H.FLOAT,[r.RG16F]:H.FLOAT,[r.RGB16F]:H.FLOAT,[r.RGBA16F]:H.FLOAT,[r.R32F]:H.FLOAT,[r.RG32F]:H.FLOAT,[r.RGB32F]:H.FLOAT,[r.RGBA32F]:H.FLOAT,[r.R11F_G11F_B10F]:H.FLOAT,[r.RGB9_E5]:H.FLOAT,[r.R8I]:H.INT,[r.R8UI]:H.UINT,[r.R16I]:H.INT,[r.R16UI]:H.UINT,[r.R32I]:H.INT,[r.R32UI]:H.UINT,[r.RG8I]:H.INT,[r.RG8UI]:H.UINT,[r.RG16I]:H.INT,[r.RG16UI]:H.UINT,[r.RG32I]:H.INT,[r.RG32UI]:H.UINT,[r.RGB8I]:H.INT,[r.RGB8UI]:H.UINT,[r.RGB16I]:H.INT,[r.RGB16UI]:H.UINT,[r.RGB32I]:H.INT,[r.RGB32UI]:H.UINT,[r.RGBA8I]:H.INT,[r.RGBA8UI]:H.UINT,[r.RGBA16I]:H.INT,[r.RGBA16UI]:H.UINT,[r.RGBA32I]:H.INT,[r.RGBA32UI]:H.UINT,[r.DEPTH_COMPONENT16]:H.FLOAT,[r.DEPTH_COMPONENT24]:H.FLOAT,[r.DEPTH_COMPONENT32F]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT,[r.DEPTH24_STENCIL8]:H.FLOAT,[r.DEPTH32F_STENCIL8]:H.FLOAT}:t={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT},t}function _F(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[nt.UNSIGNED_BYTE]:{[L.RGBA]:r.RGBA8,[L.RGB]:r.RGB8,[L.RG]:r.RG8,[L.RED]:r.R8,[L.RGBA_INTEGER]:r.RGBA8UI,[L.RGB_INTEGER]:r.RGB8UI,[L.RG_INTEGER]:r.RG8UI,[L.RED_INTEGER]:r.R8UI,[L.ALPHA]:r.ALPHA,[L.LUMINANCE]:r.LUMINANCE,[L.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[nt.BYTE]:{[L.RGBA]:r.RGBA8_SNORM,[L.RGB]:r.RGB8_SNORM,[L.RG]:r.RG8_SNORM,[L.RED]:r.R8_SNORM,[L.RGBA_INTEGER]:r.RGBA8I,[L.RGB_INTEGER]:r.RGB8I,[L.RG_INTEGER]:r.RG8I,[L.RED_INTEGER]:r.R8I},[nt.UNSIGNED_SHORT]:{[L.RGBA_INTEGER]:r.RGBA16UI,[L.RGB_INTEGER]:r.RGB16UI,[L.RG_INTEGER]:r.RG16UI,[L.RED_INTEGER]:r.R16UI,[L.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[nt.SHORT]:{[L.RGBA_INTEGER]:r.RGBA16I,[L.RGB_INTEGER]:r.RGB16I,[L.RG_INTEGER]:r.RG16I,[L.RED_INTEGER]:r.R16I},[nt.UNSIGNED_INT]:{[L.RGBA_INTEGER]:r.RGBA32UI,[L.RGB_INTEGER]:r.RGB32UI,[L.RG_INTEGER]:r.RG32UI,[L.RED_INTEGER]:r.R32UI,[L.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[nt.INT]:{[L.RGBA_INTEGER]:r.RGBA32I,[L.RGB_INTEGER]:r.RGB32I,[L.RG_INTEGER]:r.RG32I,[L.RED_INTEGER]:r.R32I},[nt.FLOAT]:{[L.RGBA]:r.RGBA32F,[L.RGB]:r.RGB32F,[L.RG]:r.RG32F,[L.RED]:r.R32F,[L.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[nt.HALF_FLOAT]:{[L.RGBA]:r.RGBA16F,[L.RGB]:r.RGB16F,[L.RG]:r.RG16F,[L.RED]:r.R16F},[nt.UNSIGNED_SHORT_5_6_5]:{[L.RGB]:r.RGB565},[nt.UNSIGNED_SHORT_4_4_4_4]:{[L.RGBA]:r.RGBA4},[nt.UNSIGNED_SHORT_5_5_5_1]:{[L.RGBA]:r.RGB5_A1},[nt.UNSIGNED_INT_2_10_10_10_REV]:{[L.RGBA]:r.RGB10_A2,[L.RGBA_INTEGER]:r.RGB10_A2UI},[nt.UNSIGNED_INT_10F_11F_11F_REV]:{[L.RGB]:r.R11F_G11F_B10F},[nt.UNSIGNED_INT_5_9_9_9_REV]:{[L.RGB]:r.RGB9_E5},[nt.UNSIGNED_INT_24_8]:{[L.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[nt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[L.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[nt.UNSIGNED_BYTE]:{[L.RGBA]:r.RGBA,[L.RGB]:r.RGB,[L.ALPHA]:r.ALPHA,[L.LUMINANCE]:r.LUMINANCE,[L.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[nt.UNSIGNED_SHORT_5_6_5]:{[L.RGB]:r.RGB},[nt.UNSIGNED_SHORT_4_4_4_4]:{[L.RGBA]:r.RGBA},[nt.UNSIGNED_SHORT_5_5_5_1]:{[L.RGBA]:r.RGBA}},t}var Yn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new pt,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=_F(t),this.samplerTypes=yF(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new eo(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new eo(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:i}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==H.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new eo(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??H.FLOAT,this.webGLVersion===2&&t.type===nt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==H.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=i.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&y_(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Mr.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=lc.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let i=this.gl;if(e.mipmap&&t.mipmap!==Mr.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===xr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===xr.LINEAR){let o=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===xr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===xr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};Yn.extension={type:$.RendererSystem,name:"texture"};K.add(Yn);var qn=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:i,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};qn.extension={type:$.RendererSystem,name:"transformFeedback"};K.add(qn);var Mi=class{constructor(t){this.renderer=t}init(t){this.screen=new xt(0,0,t.width,t.height),this.element=t.view||q.ADAPTER.createCanvas(),this.resolution=t.resolution||q.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};Mi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Mi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_view"};K.add(Mi);q.PREFER_ENV=tr.WEBGL2;q.STRICT_TEXTURE_CACHE=!1;q.RENDER_OPTIONS={...Ci.defaultOptions,...Pi.defaultOptions,...Mi.defaultOptions,...Ri.defaultOptions};Object.defineProperties(q,{WRAP_MODE:{get(){return pt.defaultOptions.wrapMode},set(r){ht("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),pt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return pt.defaultOptions.scaleMode},set(r){ht("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),pt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return pt.defaultOptions.mipmap},set(r){ht("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),pt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return pt.defaultOptions.anisotropicLevel},set(r){ht("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),pt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return ht("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ii.defaultResolution},set(r){ii.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return ht("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ii.defaultMultisample},set(r){ii.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Ai.defaultMaxTextures},set(r){ht("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Ai.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Ai.defaultBatchSize},set(r){ht("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Ai.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Ai.canUploadSameBuffer},set(r){ht("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Ai.canUploadSameBuffer=r}},GC_MODE:{get(){return si.defaultMode},set(r){ht("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),si.defaultMode=r}},GC_MAX_IDLE:{get(){return si.defaultMaxIdle},set(r){ht("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),si.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return si.defaultCheckCountMax},set(r){ht("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),si.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return br.defaultVertexPrecision},set(r){ht("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),br.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return br.defaultFragmentPrecision},set(r){ht("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),br.defaultFragmentPrecision=r}}});var ro=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(ro||{});var Kn=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,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 bF=class or{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 Kn(null,null,1/0),this.deltaMS=1/or.targetFPMS,this.elapsedMS=1/or.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,i=ro.NORMAL){return this._addListener(new Kn(t,e,i))}addOnce(t,e,i=ro.NORMAL){return this._addListener(new Kn(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.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*or.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this.deltaTime);i.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),i=Math.min(Math.max(0,e)/1e3,or.targetFPMS);this._maxElapsedMS=1/i}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(!or._shared){let t=or._shared=new or;t.autoStart=!0,t._protected=!0}return or._shared}static get system(){if(!or._system){let t=or._system=new or;t.autoStart=!0,t._protected=!0}return or._system}};bF.targetFPMS=.06;var vr=bF;Object.defineProperties(q,{TARGET_FPMS:{get(){return vr.targetFPMS},set(r){ht("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),vr.targetFPMS=r}}});var $c=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,ro.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?vr.shared:new vr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};$c.extension=$.Application;K.add($c);var d3=[];K.handleByList($.Renderer,d3);var Xc=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{let i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=At.HIGH?this.multisample=At.HIGH:e>=At.MEDIUM?this.multisample=At.MEDIUM:e>=At.LOW?this.multisample=At.LOW:this.multisample=At.NONE}destroy(){}};Xc.extension={type:$.RendererSystem,name:"_multisample"};K.add(Xc);var np=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var jc=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}update(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new np(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};jc.extension={type:$.RendererSystem,name:"buffer"};K.add(jc);var Yc=class{constructor(t){this.renderer=t}render(t,e){let i=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){let l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Yc.extension={type:$.RendererSystem,name:"objectRenderer"};K.add(Yc);var ap=class z_ extends jn{constructor(t){super(),this.type=Fy.WEBGL,t=Object.assign({},q.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new sr({projectionMatrix:new Rt},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:z_.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ht("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=z_.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:g_()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ht("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ht("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ht("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ht("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};ap.extension={type:$.Renderer,priority:1},ap.__plugins={},ap.__systems={};var lp=ap;K.handleByMap($.RendererPlugin,lp.__plugins);K.handleByMap($.RendererSystem,lp.__systems);K.add(lp);var ns=class extends ir{constructor(t,e){let{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new pt;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof ir?this.addResourceAt(t[i],i):this.addResourceAt(In(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}};var qc=class extends ns{constructor(t,e){let{width:i,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:i,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=vi.TEXTURE_2D_ARRAY}upload(t,e,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let l=0;l<s;l++){let c=n[l];o[l]<c.dirtyId&&(o[l]=c.dirtyId,c.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,c.resource.width,c.resource.height,1,e.format,i.type,c.resource.source))}return!0}};var Kc=class extends ue{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var vF=class Zc extends ns{constructor(t,e){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Zc.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Zc.SIDES;a++)this.items[a].target=vi.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=vi.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=vi.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){let s=this.itemDirtyIds;for(let o=0;o<Zc.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,i),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Zc.SIDES}};vF.SIDES=6;var $_=vF;var Qc=class r extends ue{constructor(t,e){e=e||{};let i,s,o;typeof t=="string"?(i=r.EMPTY,s=t,o=!0):(i=t,s=null,o=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let i=await q.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await i.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===er.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return r._EMPTY=r._EMPTY??q.ADAPTER.createCanvas(0,0),r._EMPTY}};var X_=class cp extends ue{constructor(t,e){e=e||{},super(q.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},cp.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;ue.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,o=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${Si()}`,n.getContext("2d").drawImage(t,0,0,e,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=cp.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&cp.SVG_XML.test(t)}};X_.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,X_.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var j_=X_;var hp=class extends ue{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var Y_=class q_ extends ue{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];ue.crossOrigin(i,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:l}=t[o];if(a=a||t[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let c=a.split("?").shift().toLowerCase(),h=c.slice(c.lastIndexOf(".")+1);l=l||q_.MIME_TYPES[h]||`video/${h}`}n.src=a,l&&(n.type=l),i.appendChild(n)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,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._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=vr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;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._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;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._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}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.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(vr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(vr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(vr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||q_.TYPES.includes(e)}};Y_.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Y_.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var K_=Y_;Sc.push(Qc,Zs,Kc,K_,hp,j_,Ws,$_,qc);var f3={vec3(r,t,e,i){(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2])&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],r.uniform3f(t,i[0],i[1],i[2]))},int(r,t,e,i){r.uniform1i(t,i)},ivec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},ivec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},ivec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},uint(r,t,e,i){r.uniform1ui(t,i)},uvec2(r,t,e,i){r.uniform2ui(t,i[0],i[1])},uvec3(r,t,e,i){r.uniform3ui(t,i[0],i[1],i[2])},uvec4(r,t,e,i){r.uniform4ui(t,i[0],i[1],i[2],i[3])},bvec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},bvec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},bvec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},mat2(r,t,e,i){r.uniformMatrix2fv(t,!1,i)},mat4(r,t,e,i){r.uniformMatrix4fv(t,!1,i)}},p3={float(r,t,e,i){r.uniform1fv(t,i)},vec2(r,t,e,i){r.uniform2fv(t,i)},vec3(r,t,e,i){r.uniform3fv(t,i)},vec4(r,t,e,i){r.uniform4fv(t,i)},int(r,t,e,i){r.uniform1iv(t,i)},ivec2(r,t,e,i){r.uniform2iv(t,i)},ivec3(r,t,e,i){r.uniform3iv(t,i)},ivec4(r,t,e,i){r.uniform4iv(t,i)},uint(r,t,e,i){r.uniform1uiv(t,i)},uvec2(r,t,e,i){r.uniform2uiv(t,i)},uvec3(r,t,e,i){r.uniform3uiv(t,i)},uvec4(r,t,e,i){r.uniform4uiv(t,i)},bool(r,t,e,i){r.uniform1iv(t,i)},bvec2(r,t,e,i){r.uniform2iv(t,i)},bvec3(r,t,e,i){r.uniform3iv(t,i)},bvec4(r,t,e,i){r.uniform4iv(t,i)},sampler2D(r,t,e,i){r.uniform1iv(t,i)},samplerCube(r,t,e,i){r.uniform1iv(t,i)},sampler2DArray(r,t,e,i){r.uniform1iv(t,i)}};function TF(r,t,e,i,s){let o=0,n=null,a=null,l=s.gl;for(let c in r.uniforms){let h=t[c],u=i[c],d=e[c],f=r.uniforms[c];if(!h){f.group===!0&&s.shader.syncUniformGroup(u);continue}h.type==="float"&&h.size===1&&!h.isArray?u!==d.value&&(d.value=u,l.uniform1f(d.location,u)):h.type==="bool"&&h.size===1&&!h.isArray?u!==d.value&&(d.value=u,l.uniform1i(d.location,Number(u))):(h.type==="sampler2D"||h.type==="samplerCube"||h.type==="sampler2DArray")&&h.size===1&&!h.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):h.type==="mat3"&&h.size===1&&!h.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,u.toArray(!0)):l.uniformMatrix3fv(d.location,!1,u):h.type==="vec2"&&h.size===1&&!h.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,l.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):h.type==="vec4"&&h.size===1&&!h.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,l.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],l.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(h.size===1&&!h.isArray?f3:p3)[h.type].call(null,l,d.location,d.value,u)}}function m3(){Object.assign(os.prototype,{systemCheck(){},syncUniforms(r,t){let{shader:e,renderer:i}=this;TF(r,e.program.uniformData,t.uniformData,r.uniforms,i)}})}m3();var Jc=new(window.AudioContext||window.webkitAudioContext),g3=(r,t)=>{let e,i=Jc.createGain();i.gain.value=t.volume??1,i.connect(Jc.destination);let s={id:r,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=ln.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Jc.createBufferSource(),e.buffer=m,e.loop=s.loop,i.gain.setValueAtTime(s.volume,Jc.currentTime),e.connect(i),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),i.disconnect(),i.connect(Jc.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,i.gain.value=m},get id(){return s.id},get url(){return s.url},get loop(){return s.loop},get volume(){return s.volume},gainNode:i}},SF=()=>{let r=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(l=>l.id!==a)},getById:a=>t.find(l=>l.id===a),tick:()=>{for(let l of t){let c=r.find(h=>h.id===l.id);if(!c){let h=g3(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(h),h.play();continue}(c.url!==l.url||c.loop!==l.loop)&&(c.stop(),c.setUrl(l.url),c.setLoop(l.loop??!1),c.play()),c.getVolume()!==(l.volume??1)&&c.setVolume(l.volume??1)}let a=[];for(let l of r)t.find(c=>c.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],t=[]}}};var x3=({JSONObject:r,parserPlugins:t=[]})=>r.map(i=>{let s=t.find(o=>o.type===i.type);if(!s)throw new Error(`No parser plugin found for element type: ${i.type} (id: ${i.id??"unknown"})`);return s.parse({state:i,parserPlugins:t})});var Z_=x3;var wF=({type:r,parse:t})=>({type:r,parse:t});var Q_=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function J_(r,t,e,i){r.addEventListener?r.addEventListener(t,e,i):r.attachEvent&&r.attachEvent(`on${t}`,e)}function th(r,t,e,i){r&&(r.removeEventListener?r.removeEventListener(t,e,i):r.detachEvent&&r.detachEvent(`on${t}`,e))}function PF(r,t){let e=t.slice(0,t.length-1),i=[];for(let s=0;s<e.length;s++)i.push(r[e[s].toLowerCase()]);return i}function CF(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let t=r.split(","),e=t.lastIndexOf("");for(;e>=0;)t[e-1]+=",",t.splice(e,1),e=t.lastIndexOf("");return t}function y3(r,t){let e=r.length>=t.length?r:t,i=r.length>=t.length?t:r,s=!0;for(let o=0;o<e.length;o++)i.indexOf(e[o])===-1&&(s=!1);return s}function RF(r){let t=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(t=r.code.charCodeAt(3)),t}var ih={backspace:8,"\u232B":8,tab:9,clear:12,enter:13,"\u21A9":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":Q_?173:189,"=":Q_?61:187,";":Q_?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},kr={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},eh={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Te={16:!1,18:!1,17:!1,91:!1},$t={};for(let r=1;r<20;r++)ih[`f${r}`]=111+r;var Dt=[],rh=null,MF="all",Ii=new Map,Zn=r=>ih[r.toLowerCase()]||kr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),_3=r=>Object.keys(ih).find(t=>ih[t]===r),b3=r=>Object.keys(kr).find(t=>kr[t]===r),IF=r=>{MF=r||"all"},sh=()=>MF||"all",v3=()=>Dt.slice(0),T3=()=>Dt.map(r=>_3(r)||b3(r)||String.fromCharCode(r)),S3=()=>{let r=[];return Object.keys($t).forEach(t=>{$t[t].forEach(({key:e,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:e.split("+").map(n=>Zn(n))})})}),r},BF=r=>{let t=r.target||r.srcElement,{tagName:e}=t,i=!0,s=e==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(s||e==="TEXTAREA"||e==="SELECT")&&!t.readOnly)&&(i=!1),i},w3=r=>(typeof r=="string"&&(r=Zn(r)),Dt.indexOf(r)!==-1),E3=(r,t)=>{let e,i;r||(r=sh());for(let s in $t)if(Object.prototype.hasOwnProperty.call($t,s))for(e=$t[s],i=0;i<e.length;)e[i].scope===r?e.splice(i,1).forEach(({element:o})=>eb(o)):i++;sh()===r&&IF(t||"all")};function A3(r){let t=RF(r);r.key&&r.key.toLowerCase()==="capslock"&&(t=Zn(r.key));let e=Dt.indexOf(t);if(e>=0&&Dt.splice(e,1),r.key&&r.key.toLowerCase()==="meta"&&Dt.splice(0,Dt.length),(t===93||t===224)&&(t=91),t in Te){Te[t]=!1;for(let i in kr)kr[i]===t&&(nr[i]=!1)}}var FF=(r,...t)=>{if(typeof r>"u")Object.keys($t).forEach(e=>{Array.isArray($t[e])&&$t[e].forEach(i=>up(i)),delete $t[e]}),eb(null);else if(Array.isArray(r))r.forEach(e=>{e.key&&up(e)});else if(typeof r=="object")r.key&&up(r);else if(typeof r=="string"){let[e,i]=t;typeof e=="function"&&(i=e,e=""),up({key:r,scope:e,method:i,splitKey:"+"})}},up=({key:r,scope:t,method:e,splitKey:i="+"})=>{CF(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":Zn(a);if(!$t[l])return;t||(t=sh());let c=n>1?PF(kr,o):[],h=[];$t[l]=$t[l].filter(u=>{let d=(e?u.method===e:!0)&&u.scope===t&&y3(u.mods,c);return d&&h.push(u.element),!d}),h.forEach(u=>eb(u))})};function EF(r,t,e,i){if(t.element!==i)return;let s;if(t.scope===e||t.scope==="all"){s=t.mods.length>0;for(let o in Te)Object.prototype.hasOwnProperty.call(Te,o)&&(!Te[o]&&t.mods.indexOf(+o)>-1||Te[o]&&t.mods.indexOf(+o)===-1)&&(s=!1);(t.mods.length===0&&!Te[16]&&!Te[18]&&!Te[17]&&!Te[91]||s||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(Dt),t.method(r,t)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function AF(r,t){let e=$t["*"],i=RF(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(nr.filter||BF).call(this,r))return;if((i===93||i===224)&&(i=91),Dt.indexOf(i)===-1&&i!==229&&Dt.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=eh[a];r[a]&&Dt.indexOf(l)===-1?Dt.push(l):!r[a]&&Dt.indexOf(l)>-1?Dt.splice(Dt.indexOf(l),1):a==="metaKey"&&r[a]&&(Dt=Dt.filter(c=>c in eh||c===i))}),i in Te){Te[i]=!0;for(let a in kr)if(Object.prototype.hasOwnProperty.call(kr,a)){let l=eh[kr[a]];nr[a]=r[l]}if(!e)return}for(let a in Te)Object.prototype.hasOwnProperty.call(Te,a)&&(Te[a]=r[eh[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(Dt.indexOf(17)===-1&&Dt.push(17),Dt.indexOf(18)===-1&&Dt.push(18),Te[17]=!0,Te[18]=!0);let s=sh();if(e)for(let a=0;a<e.length;a++)e[a].scope===s&&(r.type==="keydown"&&e[a].keydown||r.type==="keyup"&&e[a].keyup)&&EF(r,e[a],s,t);if(!(i in $t))return;let o=$t[i],n=o.length;for(let a=0;a<n;a++)if((r.type==="keydown"&&o[a].keydown||r.type==="keyup"&&o[a].keyup)&&o[a].key){let l=o[a],{splitKey:c}=l,h=l.key.split(c),u=[];for(let d=0;d<h.length;d++)u.push(Zn(h[d]));u.sort().join("")===Dt.sort().join("")&&EF(r,l,s,t)}}var nr=function(r,t,e){Dt=[];let i=CF(r),s=[],o="all",n=document,a=0,l=!1,c=!0,h="+",u=!1,d=!1;if(e===void 0&&typeof t=="function"&&(e=t),Object.prototype.toString.call(t)==="[object Object]"){let f=t;f.scope&&(o=f.scope),f.element&&(n=f.element),f.keyup&&(l=f.keyup),f.keydown!==void 0&&(c=f.keydown),f.capture!==void 0&&(u=f.capture),typeof f.splitKey=="string"&&(h=f.splitKey),f.single===!0&&(d=!0)}for(typeof t=="string"&&(o=t),d&&FF(r,o);a<i.length;a++){let f=i[a].split(h);s=[],f.length>1&&(s=PF(kr,f));let p=f[f.length-1];p=p==="*"?"*":Zn(p),p in $t||($t[p]=[]),$t[p].push({keyup:l,keydown:c,scope:o,mods:s,shortcut:i[a],method:e,key:i[a],splitKey:h,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!Ii.has(n)){let f=(m=window.event)=>AF(m,n),p=(m=window.event)=>{AF(m,n),A3(m)};Ii.set(n,{keydownListener:f,keyupListenr:p,capture:u}),J_(n,"keydown",f,u),J_(n,"keyup",p,u)}if(!rh){let f=()=>{Dt=[]};rh={listener:f,capture:u},J_(window,"focus",f,u)}}};function P3(r,t="all"){Object.keys($t).forEach(e=>{$t[e].filter(i=>i.scope===t&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function eb(r){let t=Object.values($t).flat();if(t.findIndex(({element:e})=>e===r)<0&&r){let{keydownListener:e,keyupListenr:i,capture:s}=Ii.get(r)||{};e&&i&&(th(r,"keyup",i,s),th(r,"keydown",e,s),Ii.delete(r))}if((t.length<=0||Ii.size<=0)&&(Array.from(Ii.keys()).forEach(e=>{let{keydownListener:i,keyupListenr:s,capture:o}=Ii.get(e)||{};i&&s&&(th(e,"keyup",s,o),th(e,"keydown",i,o),Ii.delete(e))}),Ii.clear(),Object.keys($t).forEach(e=>delete $t[e]),rh)){let{listener:e,capture:i}=rh;th(window,"focus",e,i),rh=null}}var tb={getPressedKeyString:T3,setScope:IF,getScope:sh,deleteScope:E3,getPressedKeyCodes:v3,getAllKeyCodes:S3,isPressed:w3,filter:BF,trigger:P3,unbind:FF,keyMap:ih,modifier:kr,modifierMap:eh};for(let r in tb){let t=r;Object.prototype.hasOwnProperty.call(tb,t)&&(nr[t]=tb[t])}if(typeof window<"u"){let r=window.hotkeys;nr.noConflict=t=>(t&&window.hotkeys===nr&&(window.hotkeys=r),nr),window.hotkeys=nr}var C3=Object.prototype.hasOwnProperty,kF=r=>{let t=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let c=t.get(l);c?gt(c.payload,s[l].payload)||(n.push(l),nr.unbind(l)):o.push(l)}),t.forEach((l,c)=>{C3.call(s,c)||a.push(c)}),a.forEach(l=>{nr.unbind(l),t.delete(l)}),[...o,...n].forEach(l=>{let h=s[l].payload??{};nr(l,()=>{r&&r("keydown",{_event:{key:l},...h})}),t.set(l,{value:l,payload:h})})},destroy:()=>{for(let s of t.keys())nr.unbind(s);t.clear()}}};var UF=(r,t)=>typeof t!="string"?t:r[t]??t,R3=(r,t,e,i)=>{let s=UF(e,t);if(typeof s=="string"){let n=r[s];return n===void 0?i:n}let o=r;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:o},OF=(r,t,e,i)=>{let s=UF(e,t);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},M3=(r,t,e)=>{if(!r||!Object.prototype.hasOwnProperty.call(r,t))throw new Error(`Animation "${e}" cannot auto-resolve property "${t}" from targetState.`);return r[t]},I3=(r,t,e,i,s)=>Object.entries(t).map(([o,n])=>{if(!dd[o])throw new Error(`${o} is not a supported property for animation.`);let a=R3(r,o,e,0);if(n.auto){let h=M3(i,o,s);if(a===h)return null;let u=xn([{value:a},{duration:n.auto.duration,value:h,easing:n.auto.easing}]);return{property:o,timeline:u}}let l=n.initialValue??a,c=xn([{value:l},...n.keyframes]);return{property:o,timeline:c}}).filter(Boolean),GF=()=>{let r=[],t=new Map,e=new Map,i=0,s=(S,v)=>{e.get(S)?.forEach(A=>{try{A(v)}catch{}})},o=S=>{if(s("completed",{id:S.id}),S.onComplete)try{S.onComplete()}catch{}},n=S=>{let{id:v,element:A,properties:P,targetState:C,onComplete:R,onCancel:M,propertyPathMap:I=fd}=S,k=I3(A,P,I,C,v);if(k.length===0){o({id:v,onComplete:R});return}let W={id:v,kind:"property",element:A,timelines:k,duration:tc(k),currentTime:0,stateVersion:i,targetState:C,onComplete:R,onCancel:M,applyFrame:O=>{for(let{property:z,timeline:V}of k){let G=ec(V,O);try{OF(A,z,I,G)}catch{}}},applyTargetState:()=>{if(!(!A||A.destroyed)){if(C===null){A.destroy();return}if(C)for(let[O,z]of Object.entries(C))try{OF(A,O,I,z)}catch{}}},isValid:()=>!!A&&!A.destroyed};W.applyFrame(0),t.set(v,W),s("started",{id:v})},a=S=>{let v={id:S.id,kind:"custom",duration:S.duration??0,currentTime:0,stateVersion:i,onComplete:S.onComplete,onCancel:S.onCancel,applyFrame:S.applyFrame??(()=>{}),applyTargetState:S.applyTargetState??(()=>{}),isValid:S.isValid??(()=>!0)};v.applyFrame(0),t.set(v.id,v),s("started",{id:v.id})},l=S=>{if(S.driver==="custom"){a(S);return}n(S)},c=S=>{try{S.applyTargetState?.()}catch{}if(S.onCancel)try{S.onCancel()}catch{}},h=S=>{switch(S.type){case"START":l(S.payload);break;case"CANCEL":d(S.id);break}},u=()=>{let S=r.splice(0);for(let v of S)h(v)},d=S=>{let v=t.get(S);v&&(c(v),t.delete(S),s("cancelled",{id:S}))},f=S=>{r.push(S)},p=()=>{for(let[S,v]of t)c(v),s("cancelled",{id:S});t.clear(),i++},m=S=>{u();let v=[];for(let[A,P]of t){if(P.stateVersion!==i){v.push(A);continue}if(!P.isValid()){v.push(A);continue}if(P.currentTime+=S,P.currentTime>=P.duration){P.applyFrame(P.duration),o(P),v.push(A);continue}P.applyFrame(P.currentTime)}for(let A of v)t.delete(A)},x=()=>{u()},_=(S,v)=>(e.has(S)||e.set(S,new Set),e.get(S).add(v),()=>T(S,v)),T=(S,v)=>{e.get(S)?.delete(v)};return{dispatch:f,cancelAll:p,flush:x,tick:m,on:_,off:T,getState:()=>({stateVersion:i,activeCount:t.size,animations:Array.from(t.entries()).map(([S,v])=>({id:S,currentTime:v.currentTime,duration:v.duration,progress:v.duration>0?v.currentTime/v.duration:0}))}),isAnimating:S=>t.has(S),destroy:()=>{p(),e.clear()}}};var LF=r=>{let t=0,e=0,i=null;return{reset:c=>{t>0&&i!==null&&r?.("renderComplete",{id:i,aborted:!0}),e++,t=0,i=c},track:c=>{c===e&&t++},complete:c=>{c===e&&(t--,t===0&&r?.("renderComplete",{id:i,aborted:!1}))},getVersion:()=>e,completeIfEmpty:()=>{t===0&&r?.("renderComplete",{id:i,aborted:!1})}}};var DF=new Set(["update","transition"]),B3=new Set(["alpha","x","y","scaleX","scaleY","rotation"]),F3=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),NF=new Set(["single","sequence","composite"]),dp=new Set(["red","green","blue","alpha"]),HF=new Set(["max","min","multiply","add"]),WF=new Set(Vd),oi=(r,t)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${t} must be an object.`)},io=(r,t)=>{if(typeof r!="string"||r.length===0)throw new Error(`${t} must be a non-empty string.`)},oh=(r,t)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${t} must be a number.`)},k3=(r,t)=>{if(oi(r,t),oh(r.duration,`${t}.duration`),r.easing!==void 0&&typeof r.easing!="string")throw new Error(`${t}.easing must be a string.`);if(r.easing!==void 0&&!WF.has(r.easing))throw new Error(`${t}.easing must be one of: ${Vd.join(", ")}.`);return{duration:r.duration,easing:r.easing??"linear"}},ib=(r,t)=>{oi(r,t);let e={};if(r.initialValue!==void 0&&(oh(r.initialValue,`${t}.initialValue`),e.initialValue=r.initialValue),!Array.isArray(r.keyframes)||r.keyframes.length===0)throw new Error(`${t}.keyframes must be a non-empty array.`);return e.keyframes=r.keyframes.map((i,s)=>{let o=`${t}.keyframes[${s}]`;if(oi(i,o),oh(i.value,`${o}.value`),oh(i.duration,`${o}.duration`),i.easing!==void 0&&typeof i.easing!="string")throw new Error(`${o}.easing must be a string.`);if(i.easing!==void 0&&!WF.has(i.easing))throw new Error(`${o}.easing must be one of: ${Vd.join(", ")}.`);if(i.relative!==void 0&&typeof i.relative!="boolean")throw new Error(`${o}.relative must be a boolean.`);return{value:i.value,duration:i.duration,easing:i.easing??"linear",...i.relative!==void 0?{relative:i.relative}:{}}}),e},O3=(r,t)=>{oi(r,t);let e=r.keyframes!==void 0,i=r.auto!==void 0;if(e&&i)throw new Error(`${t} cannot define both keyframes and auto.`);if(!e&&!i)throw new Error(`${t} must define keyframes or auto.`);if(i){if(r.initialValue!==void 0)throw new Error(`${t}.initialValue is not valid when auto is defined.`);return{auto:k3(r.auto,`${t}.auto`)}}return ib(r,t)},zF=(r,t,e,i=ib)=>{oi(r,t);let s=Object.entries(r).map(([o,n])=>{if(!e.has(o))throw new Error(`${t}.${o} is not a supported animation property.`);return[o,i(n,`${t}.${o}`)]});if(s.length===0)throw new Error(`${t} must define at least one property.`);return Object.fromEntries(s)},U3=(r,t)=>{if(oi(r,t),io(r.texture,`${t}.texture`),r.channel!==void 0&&!dp.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(dp).join(", ")}.`);if(r.invert!==void 0&&typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);return{texture:r.texture,...r.channel?{channel:r.channel}:{},...r.invert!==void 0?{invert:r.invert}:{}}},G3=(r,t)=>{if(oi(r,t),!NF.has(r.kind))throw new Error(`${t}.kind must be one of: ${Array.from(NF).join(", ")}.`);let e={kind:r.kind};if(r.channel!==void 0){if(!dp.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(dp).join(", ")}.`);e.channel=r.channel}if(r.softness!==void 0&&(oh(r.softness,`${t}.softness`),e.softness=r.softness),r.invert!==void 0){if(typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);e.invert=r.invert}if(r.progress!==void 0&&(e.progress=ib(r.progress,`${t}.progress`)),r.kind==="single"&&(io(r.texture,`${t}.texture`),e.texture=r.texture),r.kind==="sequence"){if(!Array.isArray(r.textures)||r.textures.length===0)throw new Error(`${t}.textures must be a non-empty array.`);e.textures=r.textures.map((i,s)=>(io(i,`${t}.textures[${s}]`),i)),r.sample!==void 0&&(io(r.sample,`${t}.sample`),e.sample=r.sample)}if(r.kind==="composite"){if(!HF.has(r.combine??"max"))throw new Error(`${t}.combine must be one of: ${Array.from(HF).join(", ")}.`);if(!Array.isArray(r.items)||r.items.length===0)throw new Error(`${t}.items must be a non-empty array.`);e.combine=r.combine??"max",e.items=r.items.map((i,s)=>U3(i,`${t}.items[${s}]`))}return e.progress||(e.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),e},VF=(r,t)=>{if(oi(r,t),r.mask!==void 0)throw new Error(`${t}.mask is not valid. Define mask on ${t}.`);let e={};if(r.tween!==void 0&&(e.tween=zF(r.tween,`${t}.tween`,F3)),Object.keys(e).length===0)throw new Error(`${t} must define tween.`);return e},L3=(r,t)=>{let e={};if(r.shader!==void 0)throw new Error(`${t}.shader is not supported.`);if(r.prev!==void 0&&(e.prev=VF(r.prev,`${t}.prev`)),r.next!==void 0&&(e.next=VF(r.next,`${t}.next`)),r.mask!==void 0&&(e.mask=G3(r.mask,`${t}.mask`)),e.prev===void 0&&e.next===void 0&&e.mask===void 0)throw new Error(`${t} must define prev, next, or mask.`);return e},rb=(r,t,e)=>{if(r!==void 0)throw new Error(`${t} ${e}`)},$F=(r=[])=>{if(!Array.isArray(r))throw new Error("Input error: `animations` must be an array.");let t=r.map((i,s)=>{let o=`animations[${s}]`;if(oi(i,o),io(i.id,`${o}.id`),io(i.targetId,`${o}.targetId`),io(i.type,`${o}.type`),!DF.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(DF).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(oi(i.complete,`${o}.complete`),n.complete=i.complete),rb(i.operation,`${o}.operation`,"is no longer supported. Use `type: update | transition` instead."),rb(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),rb(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="update"){if(n.tween=zF(i.tween,`${o}.tween`,B3,O3),i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(i.prev!==void 0)throw new Error(`${o}.prev is only valid for transition animations.`);if(i.next!==void 0)throw new Error(`${o}.next is only valid for transition animations.`);if(i.mask!==void 0)throw new Error(`${o}.mask is only valid for transition animations.`);if(i.shader!==void 0)throw new Error(`${o}.shader is not supported.`);return n}if(i.tween!==void 0)throw new Error(`${o}.tween is not valid for transition animations.`);if(i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let a=L3(i,o);return a.prev!==void 0&&(n.prev=a.prev),a.next!==void 0&&(n.next=a.next),a.mask!==void 0&&(n.mask=a.mask),n}),e=new Map;for(let i of t){let s=e.get(i.targetId)??new Set;s.add(i.type),e.set(i.targetId,s)}for(let[i,s]of e)if(s.has("transition")&&s.size>1)throw new Error(`Animations targeting "${i}" cannot mix update and transition types in the same state.`);return t};var sb=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let t={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};if(!Array.isArray(t.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(t.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(t.audio))throw new Error("Input error: `audio` must be an array.");return t.animations=$F(t.animations),t};var D3="0",Qn=(r,t)=>{let e=r?.[t];return typeof e=="number"?e:0},ar=r=>({value:r.element.value??"",selectionStart:Qn(r.element,"selectionStart"),selectionEnd:Qn(r.element,"selectionEnd"),focused:document.activeElement===r.element,composing:r.composing===!0}),N3=(r,t)=>!r||!t?!1:r.value===t.value&&r.selectionStart===t.selectionStart&&r.selectionEnd===t.selectionEnd&&r.focused===t.focused&&r.composing===t.composing,H3=r=>r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement,nh=r=>{r.element.style.pointerEvents="none"},ob=(r,t,e)=>{if(typeof r?.setSelectionRange=="function")try{r.setSelectionRange(t,e)}catch{}},V3=({app:r,geometry:t})=>{let e=r.canvas;if(!t||!e||t.visible===!1)return null;let i=e.getBoundingClientRect(),s=r.renderer?.width||i.width||1,o=r.renderer?.height||i.height||1,n=i.width/s,a=i.height/o,l=t.clipInsets??{top:0,right:0,bottom:0,left:0},c=i.left+(t.x+l.left)*n,h=i.top+(t.y+l.top)*a,u=i.left+(t.x+t.width-l.right)*n,d=i.top+(t.y+t.height-l.bottom)*a;return u<=c||d<=h?null:{left:c,top:h,right:u,bottom:d}},W3=({app:r,entry:t,event:e})=>{let i=t.options.getGeometry?.(),s=V3({app:r,geometry:i}),o=e.clientX,n=e.clientY;return!!s&&Number.isFinite(o)&&Number.isFinite(n)&&o>=s.left&&o<=s.right&&n>=s.top&&n<=s.bottom},XF=({app:r})=>{let t=new Map,e,i=null,s=()=>{e||(e=document.createElement("div"),e.dataset.routeGraphicsInputBridge="true",e.style.position="fixed",e.style.left="0",e.style.top="0",e.style.pointerEvents="none",e.style.zIndex="1000",e.style.width="0",e.style.height="0");let g=r.canvas?.parentNode??document.body;e.isConnected||g.appendChild(e)},o=(g,w=g.lastSnapshot)=>{let b=ar(g);b.focused&&i!==g.id?i=g.id:!b.focused&&i===g.id&&(i=null),nh(g,i),w?.value!==b.value&&g.callbacks.onValueChange?.(b),(w?.selectionStart!==b.selectionStart||w?.selectionEnd!==b.selectionEnd||w?.focused!==b.focused||w?.composing!==b.composing)&&g.callbacks.onSelectionChange?.(b),g.lastSnapshot=b},n=g=>{let{disabled:w=!1,multiline:b=!1,maxLength:S,textStyle:v,padding:A,placeholder:P="",autocomplete:C="off",autocapitalize:R="off",spellcheck:M=!1}=g.options,{element:I}=g;I instanceof HTMLInputElement&&(I.type="text"),I.disabled=w,I.placeholder=P,I.autocomplete=C,I.autocapitalize=R,I.spellcheck=!!M,I.style.opacity=D3,I.style.color="transparent",I.style.caretColor="transparent",I.style.background="transparent",I.style.paddingTop=`${A.top}px`,I.style.paddingRight=`${A.right}px`,I.style.paddingBottom=`${A.bottom}px`,I.style.paddingLeft=`${A.left}px`,I.style.fontFamily=v?.fontFamily??"Arial",I.style.fontSize=`${v?.fontSize??16}px`,I.style.fontWeight=v?.fontWeight??"400",I.style.textAlign=v?.align??"left",I.style.lineHeight=typeof v?.lineHeight=="number"?`${v.lineHeight}px`:"normal",I.style.whiteSpace=b?"pre":"nowrap",I.style.overflowWrap="normal",I.style.resize="none",I.style.overflow="hidden",typeof S=="number"?I.maxLength=S:I.removeAttribute("maxLength"),I.tabIndex=-1,b&&I instanceof HTMLTextAreaElement&&(I.wrap="off",I.rows=1),nh(g,i)},a=g=>{s();let w=r.canvas,b=g.options.getGeometry?.();if(!w||!b||b.visible===!1){g.element.style.display="none";return}let S=w.getBoundingClientRect(),v=r.renderer?.width||S.width||1,A=r.renderer?.height||S.height||1,P=S.width/v,C=S.height/A,R=b.clipInsets??{top:0,right:0,bottom:0,left:0},M={top:R.top*C,right:R.right*P,bottom:R.bottom*C,left:R.left*P};g.element.style.display="block",g.element.style.left=`${S.left+b.x*P}px`,g.element.style.top=`${S.top+b.y*C}px`,g.element.style.width=`${b.width*P}px`,g.element.style.height=`${b.height*C}px`;let I=Object.values(M).some(k=>k>0);g.element.style.clipPath=I?`inset(${M.top}px ${M.right}px ${M.bottom}px ${M.left}px)`:"none"},l=g=>{if(!i)return;let w=t.get(i),b=g.target;!w||b===w.element||w.element.contains(b)||H3(b)&&e?.contains(b)||W3({app:r,entry:w,event:g})||w.element.blur()},c=()=>{for(let g of t.values()){if(a(g),!g.lastSnapshot){g.lastSnapshot=ar(g);continue}let w=ar(g);N3(w,g.lastSnapshot)||o(g,g.lastSnapshot)}},h=({id:g,options:w})=>{let b=w.multiline===!0?document.createElement("textarea"):document.createElement("input");return b.dataset.routeGraphicsInputId=g,b.style.position="fixed",b.style.border="none",b.style.outline="none",b.style.margin="0",b.style.boxSizing="border-box",b.style.borderRadius="0",b.style.transformOrigin="top left",b.style.appearance="none",b.style.boxShadow="none",b.style.userSelect="none",b.style.webkitUserSelect="none",b},u=g=>{let{id:w,element:b}=g,S=()=>{o(g)};b.addEventListener("focus",()=>{g.pendingBlurTimer&&(clearTimeout(g.pendingBlurTimer),g.pendingBlurTimer=null),i=w,nh(g,i);let v=ar(g);g.lastSnapshot=v,g.callbacks.onFocus?.(v),g.callbacks.onSelectionChange?.(v)}),b.addEventListener("blur",()=>{i===w&&(i=null),nh(g,i),g.pendingBlurTimer=setTimeout(()=>{g.pendingBlurTimer=null;let v=ar(g);if(v.focused){g.lastSnapshot=v;return}g.lastSnapshot=v,g.callbacks.onBlur?.(v),g.callbacks.onSelectionChange?.(v)},0)}),b.addEventListener("input",S),b.addEventListener("select",S),b.addEventListener("click",()=>queueMicrotask(S)),b.addEventListener("keyup",()=>queueMicrotask(S)),b.addEventListener("keydown",v=>{let A=v.key==="Enter"&&g.options.multiline!==!0&&!v.shiftKey,P=v.key==="Enter"&&g.options.multiline===!0&&(v.ctrlKey||v.metaKey);(A||P)&&(v.preventDefault(),g.callbacks.onSubmit?.(ar(g),v)),v.key==="Escape"&&b.blur(),queueMicrotask(S)}),b.addEventListener("compositionstart",()=>{g.composing=!0;let v=ar(g);g.lastSnapshot=v,g.callbacks.onCompositionStart?.(v),g.callbacks.onSelectionChange?.(v)}),b.addEventListener("compositionupdate",()=>{let v=ar(g);g.lastSnapshot=v,g.callbacks.onCompositionUpdate?.(v),g.callbacks.onSelectionChange?.(v)}),b.addEventListener("compositionend",()=>{g.composing=!1,S(),g.callbacks.onCompositionEnd?.(ar(g))})};document.addEventListener("pointerdown",l,!0),r.ticker?.add?.(c);let d=(g,w)=>{s();let b=t.get(g);if(b)return b.options=w,b.callbacks=w.callbacks??{},n(b),a(b),typeof w.value=="string"&&b.element.value!==w.value&&(b.element.value=w.value),b.lastSnapshot=ar(b),b.element;let S={id:g,element:h({id:g,options:w}),options:w,callbacks:w.callbacks??{},composing:!1,pendingBlurTimer:null,lastSnapshot:null};return u(S),typeof w.value=="string"&&(S.element.value=w.value),n(S),e.appendChild(S.element),t.set(g,S),a(S),S.lastSnapshot=ar(S),S.element};return{mount:d,update:(g,w)=>{let b=t.get(g);if(!b)return d(g,w);let S=w.multiline===!0!=b.element instanceof HTMLTextAreaElement;if(b.options=w,b.callbacks=w.callbacks??{},S){let v=b.element,A=document.activeElement===v,P=Qn(v,"selectionStart"),C=Qn(v,"selectionEnd");return b.element=h({id:g,options:w}),u(b),v.replaceWith(b.element),b.element.value=typeof w.value=="string"?w.value:v.value,n(b),a(b),b.lastSnapshot=ar(b),A&&!w.disabled&&queueMicrotask(()=>{b.element.focus(),ob(b.element,P,C)}),b.element}return typeof w.value=="string"&&w.value!==b.element.value&&b.composing!==!0&&(b.element.value=w.value),n(b),a(b),b.lastSnapshot=ar(b),b.element},focus:(g,{selectAll:w=!1,selectionStart:b,selectionEnd:S}={})=>{let v=t.get(g);if(!v||v.element.disabled)return;let A=document.activeElement===v.element;if(i=g,nh(v,i),A||v.element.focus(),w){v.element.select?.(),o(v,v.lastSnapshot);return}if(typeof b=="number"||typeof S=="number"){let P=typeof b=="number"?b:Qn(v.element,"selectionStart"),C=typeof S=="number"?S:typeof b=="number"?b:Qn(v.element,"selectionEnd");ob(v.element,P,C)}o(v,v.lastSnapshot)},setSelection:(g,w,b=w,{focus:S=!1}={})=>{let v=t.get(g);if(!v||v.element.disabled)return;let A=()=>{ob(v.element,w,b),o(v,v.lastSnapshot)};if(S&&document.activeElement!==v.element){v.element.focus(),A();return}A()},blur:g=>{t.get(g)?.element.blur()},unmount:g=>{let w=t.get(g);w&&(i===g&&(i=null),w.pendingBlurTimer&&(clearTimeout(w.pendingBlurTimer),w.pendingBlurTimer=null),w.element.remove(),t.delete(g),t.size===0&&e?.remove())},destroy:()=>{document.removeEventListener("pointerdown",l,!0),r.ticker?.remove?.(c);for(let g of t.values())g.pendingBlurTimer&&(clearTimeout(g.pendingBlurTimer),g.pendingBlurTimer=null),g.element.remove();t.clear(),i=null,e?.remove(),e=void 0}}};var z3=()=>{let r,t=SF(),e={elements:[],animations:[],audio:[]},i,s={animations:[],elements:[],audio:[],parsers:[]},o,n,a,l,c=!1,h,u,d,f,p=new Map,m,x=(v,A,P,C)=>{v.clear(),v.rect(0,0,A,P),v.fill(C??0)},_=v=>v?v.startsWith("audio/")?"audio":v.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(v)?"font":v.startsWith("video/")?"video":"texture":"texture",T=(v,A,{revokable:P=!1}={})=>{p.set(v,{url:A,revokable:P})},g=()=>{for(let v of p.values())v?.revokable===!0&&typeof v?.url=="string"&&URL.revokeObjectURL(v.url);p.clear()},w=(v,A,P)=>{o&&o.registerHotkeys(P?.keyboard??{}),v.renderer.events.cursorStyles||(v.renderer.events.cursorStyles={}),v.renderer.events.cursorStyles.default||(v.renderer.events.cursorStyles.default="default"),v.renderer.events.cursorStyles.hover||(v.renderer.events.cursorStyles.hover="pointer");let C=A?.cursorStyles,R=P?.cursorStyles;gt(C,R)||(R?(R.default&&(v.renderer.events.cursorStyles.default=R.default,v.canvas.style.cursor=R.default),R.hover&&(v.renderer.events.cursorStyles.hover=R.hover)):C&&(v.renderer.events.cursorStyles.default="default",v.renderer.events.cursorStyles.hover="pointer"))},b=(v,A,P,C)=>{h&&h.abort(),h=new AbortController;let R=h.signal;a.reset(P.id),w(v,e.global,P.global),n.cancelAll(),ks({app:v,parent:A,prevComputedTree:e.elements,nextComputedTree:P.elements,animations:P.animations,elementPlugins:s.elements,animationBus:n,completionTracker:a,eventHandler:C,signal:R}),n.flush(),By({app:v,prevAudioTree:e.audio,nextAudioTree:P.audio,audioPlugins:s.audio}),e=P,typeof v.render=="function"&&v.render(),a.completeIfEmpty(),c||(c=!0,l&&l())},S={rendererName:"pixi",get canvas(){return r.canvas},findElementByLabel:v=>r.stage.getChildByLabel(v,!0)??null,extractBase64:async v=>{let A=new Q(0,0,r.renderer.width,r.renderer.height);if(!v)return await r.renderer.extract.base64({target:r.stage,frame:A});let P=r.stage.getChildByLabel(v,!0);if(!P)throw new Error(`Element with label '${v}' not found`);return await r.renderer.extract.base64({target:P,frame:A})},assignStageEvent:(v,A)=>{r.stage.eventMode="static",r.stage.on(v,A)},init:async v=>{let{eventHandler:A,plugins:P,width:C,height:R,backgroundColor:M,debug:I=!1,onFirstRender:k}=v;l=k;let W=[];return P?.elements?.forEach(O=>{O?.parse&&W.push(wF({type:O.type,parse:O.parse}))}),s={animations:P?.animations??[],elements:P?.elements??[],audio:P?.audio??[],parsers:W},i=A,o=kF(A),a=LF(A),r=new Wl,r.audioStage=t,await r.init({width:C,height:R,backgroundColor:M,preference:"webgl"}),typeof r.ticker?.remove=="function"&&r.ticker.remove(r.render,r),r.debug=I,r.inputDomBridge=XF({app:r}),f=O=>{O.preventDefault()},r.canvas.addEventListener("contextmenu",f),m=new Bt,m.label="__route_graphics_background__",x(m,C,R,M),r.stage.addChild(m),r.stage.width=C,r.stage.height=R,r.ticker.add(r.audioStage.tick),n=GF(),I?(u=O=>{O?.detail?.deltaMS&&(n.tick(Number(O.detail.deltaMS)),typeof r.render=="function"&&r.render())},window.addEventListener("snapShotKeyFrame",u)):(d=O=>{n.tick(O.deltaMS),typeof r.render=="function"&&r.render()},r.ticker.add(d)),S},destroy:()=>{h&&(h.abort(),h=void 0),u&&(window.removeEventListener("snapShotKeyFrame",u),u=void 0),d&&typeof r?.ticker?.remove=="function"&&(r.ticker.remove(d),d=void 0),f&&r?.canvas&&(r.canvas.removeEventListener("contextmenu",f),f=void 0),r?.inputDomBridge?.destroy?.(),o?.destroy(),Ey(),n&&n.destroy(),r?.audioStage&&r.audioStage.destroy();let v=A=>{for(let P of A.children){let C=P.texture?.source?.resource;C instanceof HTMLVideoElement&&C.pause(),P.children&&v(P)}};r?.stage&&v(r.stage),r&&r.destroy(),m=void 0,g()},loadAssets:async v=>{if(!v)throw new Error("assetBufferMap is required");let A={audio:{},font:{},video:{},texture:{}};for(let[R,M]of Object.entries(v)){let I=_(M.type);A[I][R]=M}await Promise.all(Object.entries(A.audio).map(([R,M])=>ln.load(R,M.buffer))),await Promise.all(Object.entries(A.font).map(async([R,M])=>{let I=new Blob([M.buffer],{type:M.type}),k=URL.createObjectURL(I),W=new FontFace(R,`url(${k})`);try{await W.load(),document.fonts.add(W)}catch(O){console.error(`Failed to load font ${R}:`,O)}finally{URL.revokeObjectURL(k)}}));let P=Object.entries(A.texture).map(async([R,M])=>{if(gr.cache.has(R))return gr.cache.get(R);if(M?.source==="url"&&typeof M?.url=="string")return gr.load({alias:R,src:M.url,parser:"loadTextures"});let I=new Blob([M.buffer],{type:M.type}),k=await createImageBitmap(I),W=B.from(k);return gr.cache.set(R,W),W}),C=Object.entries(A.video).map(async([R,M])=>{let I=M?.source==="url"&&typeof M?.url=="string"?M.url:URL.createObjectURL(new Blob([M.buffer],{type:M.type})),k=M?.source!=="url";T(R,I,{revokable:k});let W={alias:R,src:I,parser:"loadVideo",data:{}};return typeof M?.type=="string"&&M.type.length>0&&(W.data.mime=M.type),gr.load(W).then(O=>O).catch(O=>{throw p.delete(R),k&&URL.revokeObjectURL(I),O})});return Promise.all([...P,...C])},loadAudioAssets:async v=>Promise.all(v.map(async A=>{let C=await(await fetch(A)).arrayBuffer();return ln.load(A,C)})),updatedBackgroundColor:v=>{r.renderer.background.color=v,m&&x(m,r.renderer.width,r.renderer.height,v),typeof r.render=="function"&&r.render()},render:v=>{let A=sb(v),P=Z_({JSONObject:A.elements,parserPlugins:s.parsers}),C={...A,elements:P};b(r,r.stage,C,i)},parse:v=>{let A=sb(v),P=Z_({JSONObject:A.elements,parserPlugins:s.parsers});return{...A,elements:P}}};return S},jF=z3;var LCt=jF;export{Wl as Application,gr as Assets,ln as AudioAsset,DG as animatedSpritePlugin,OG as containerPlugin,Jx as createAnimationPlugin,rk as createAssetBufferManager,ty as createAudioPlugin,Zt as createElementPlugin,LCt as default,fG as inputPlugin,jG as particlesPlugin,HU as rectPlugin,By as renderAudio,ks as renderElements,tG as sliderPlugin,VG as soundPlugin,VU as spritePlugin,LU as textPlugin,LG as textRevealingPlugin,NG as tweenPlugin,zU as videoPlugin};
1634
+ `))}}var l3=0,sp={textureCount:0,uboCount:0},os=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=l3++}systemCheck(){if(!Jf())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(sp.textureCount=0,sp.uboCount=0,this.syncUniformGroup(t.uniformGroup,sp)),s}setUniforms(t){let e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){let i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=B_(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;let s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,sp,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=H_(t,this.shader.program.uniformData)),t.autoManage){let l=new Float32Array(a.size/4);t.buffer.update(l)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,i=t.program,s=N_(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};os.extension={type:$.RendererSystem,name:"shader"};K.add(os);var Ri=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};Ri.defaultOptions={hello:!1},Ri.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"startup"};K.add(Ri);function gF(r,t=[]){return t[J.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.ADD]=[r.ONE,r.ONE],t[J.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.NONE]=[0,0],t[J.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[J.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[J.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[J.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[J.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[J.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[J.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[J.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[J.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[J.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[J.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}var c3=0,h3=1,u3=2,d3=3,f3=4,p3=5,xF=class V_{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=J.NONE,this._blendEq=!1,this.map=[],this.map[c3]=this.setBlend,this.map[h3]=this.setOffset,this.map[u3]=this.setCullFace,this.map[d3]=this.setDepthTest,this.map[f3]=this.setFrontFace,this.map[p3]=this.setDepthMask,this.checks=[],this.defaultState=new ei,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=gF(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;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(V_.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(V_.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.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){let i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};xF.extension={type:$.RendererSystem,name:"state"};var W_=xF;K.add(W_);var jn=class extends Vs.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Jt(e)})}addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){let i=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var zc=class op{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=op.defaultMaxIdle,this.checkCountMax=op.defaultCheckCountMax,this.mode=op.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==yf.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,i=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};zc.defaultMode=yf.AUTO,zc.defaultMaxIdle=60*60,zc.defaultCheckCountMax=60*10,zc.extension={type:$.RendererSystem,name:"textureGC"};var si=zc;K.add(si);var eo=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=nt.UNSIGNED_BYTE,this.internalFormat=L.RGBA,this.samplerType=0}};function yF(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.R8]:H.FLOAT,[r.R8_SNORM]:H.FLOAT,[r.RG8]:H.FLOAT,[r.RG8_SNORM]:H.FLOAT,[r.RGB8]:H.FLOAT,[r.RGB8_SNORM]:H.FLOAT,[r.RGB565]:H.FLOAT,[r.RGBA4]:H.FLOAT,[r.RGB5_A1]:H.FLOAT,[r.RGBA8]:H.FLOAT,[r.RGBA8_SNORM]:H.FLOAT,[r.RGB10_A2]:H.FLOAT,[r.RGB10_A2UI]:H.FLOAT,[r.SRGB8]:H.FLOAT,[r.SRGB8_ALPHA8]:H.FLOAT,[r.R16F]:H.FLOAT,[r.RG16F]:H.FLOAT,[r.RGB16F]:H.FLOAT,[r.RGBA16F]:H.FLOAT,[r.R32F]:H.FLOAT,[r.RG32F]:H.FLOAT,[r.RGB32F]:H.FLOAT,[r.RGBA32F]:H.FLOAT,[r.R11F_G11F_B10F]:H.FLOAT,[r.RGB9_E5]:H.FLOAT,[r.R8I]:H.INT,[r.R8UI]:H.UINT,[r.R16I]:H.INT,[r.R16UI]:H.UINT,[r.R32I]:H.INT,[r.R32UI]:H.UINT,[r.RG8I]:H.INT,[r.RG8UI]:H.UINT,[r.RG16I]:H.INT,[r.RG16UI]:H.UINT,[r.RG32I]:H.INT,[r.RG32UI]:H.UINT,[r.RGB8I]:H.INT,[r.RGB8UI]:H.UINT,[r.RGB16I]:H.INT,[r.RGB16UI]:H.UINT,[r.RGB32I]:H.INT,[r.RGB32UI]:H.UINT,[r.RGBA8I]:H.INT,[r.RGBA8UI]:H.UINT,[r.RGBA16I]:H.INT,[r.RGBA16UI]:H.UINT,[r.RGBA32I]:H.INT,[r.RGBA32UI]:H.UINT,[r.DEPTH_COMPONENT16]:H.FLOAT,[r.DEPTH_COMPONENT24]:H.FLOAT,[r.DEPTH_COMPONENT32F]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT,[r.DEPTH24_STENCIL8]:H.FLOAT,[r.DEPTH32F_STENCIL8]:H.FLOAT}:t={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT},t}function _F(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[nt.UNSIGNED_BYTE]:{[L.RGBA]:r.RGBA8,[L.RGB]:r.RGB8,[L.RG]:r.RG8,[L.RED]:r.R8,[L.RGBA_INTEGER]:r.RGBA8UI,[L.RGB_INTEGER]:r.RGB8UI,[L.RG_INTEGER]:r.RG8UI,[L.RED_INTEGER]:r.R8UI,[L.ALPHA]:r.ALPHA,[L.LUMINANCE]:r.LUMINANCE,[L.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[nt.BYTE]:{[L.RGBA]:r.RGBA8_SNORM,[L.RGB]:r.RGB8_SNORM,[L.RG]:r.RG8_SNORM,[L.RED]:r.R8_SNORM,[L.RGBA_INTEGER]:r.RGBA8I,[L.RGB_INTEGER]:r.RGB8I,[L.RG_INTEGER]:r.RG8I,[L.RED_INTEGER]:r.R8I},[nt.UNSIGNED_SHORT]:{[L.RGBA_INTEGER]:r.RGBA16UI,[L.RGB_INTEGER]:r.RGB16UI,[L.RG_INTEGER]:r.RG16UI,[L.RED_INTEGER]:r.R16UI,[L.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[nt.SHORT]:{[L.RGBA_INTEGER]:r.RGBA16I,[L.RGB_INTEGER]:r.RGB16I,[L.RG_INTEGER]:r.RG16I,[L.RED_INTEGER]:r.R16I},[nt.UNSIGNED_INT]:{[L.RGBA_INTEGER]:r.RGBA32UI,[L.RGB_INTEGER]:r.RGB32UI,[L.RG_INTEGER]:r.RG32UI,[L.RED_INTEGER]:r.R32UI,[L.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[nt.INT]:{[L.RGBA_INTEGER]:r.RGBA32I,[L.RGB_INTEGER]:r.RGB32I,[L.RG_INTEGER]:r.RG32I,[L.RED_INTEGER]:r.R32I},[nt.FLOAT]:{[L.RGBA]:r.RGBA32F,[L.RGB]:r.RGB32F,[L.RG]:r.RG32F,[L.RED]:r.R32F,[L.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[nt.HALF_FLOAT]:{[L.RGBA]:r.RGBA16F,[L.RGB]:r.RGB16F,[L.RG]:r.RG16F,[L.RED]:r.R16F},[nt.UNSIGNED_SHORT_5_6_5]:{[L.RGB]:r.RGB565},[nt.UNSIGNED_SHORT_4_4_4_4]:{[L.RGBA]:r.RGBA4},[nt.UNSIGNED_SHORT_5_5_5_1]:{[L.RGBA]:r.RGB5_A1},[nt.UNSIGNED_INT_2_10_10_10_REV]:{[L.RGBA]:r.RGB10_A2,[L.RGBA_INTEGER]:r.RGB10_A2UI},[nt.UNSIGNED_INT_10F_11F_11F_REV]:{[L.RGB]:r.R11F_G11F_B10F},[nt.UNSIGNED_INT_5_9_9_9_REV]:{[L.RGB]:r.RGB9_E5},[nt.UNSIGNED_INT_24_8]:{[L.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[nt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[L.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[nt.UNSIGNED_BYTE]:{[L.RGBA]:r.RGBA,[L.RGB]:r.RGB,[L.ALPHA]:r.ALPHA,[L.LUMINANCE]:r.LUMINANCE,[L.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[nt.UNSIGNED_SHORT_5_6_5]:{[L.RGB]:r.RGB},[nt.UNSIGNED_SHORT_4_4_4_4]:{[L.RGBA]:r.RGBA},[nt.UNSIGNED_SHORT_5_5_5_1]:{[L.RGBA]:r.RGBA}},t}var Yn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new pt,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=_F(t),this.samplerTypes=yF(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new eo(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new eo(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:i}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==H.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new eo(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??H.FLOAT,this.webGLVersion===2&&t.type===nt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==H.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=i.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&y_(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Mr.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=lc.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let i=this.gl;if(e.mipmap&&t.mipmap!==Mr.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===xr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===xr.LINEAR){let o=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===xr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===xr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};Yn.extension={type:$.RendererSystem,name:"texture"};K.add(Yn);var qn=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:i,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};qn.extension={type:$.RendererSystem,name:"transformFeedback"};K.add(qn);var Mi=class{constructor(t){this.renderer=t}init(t){this.screen=new xt(0,0,t.width,t.height),this.element=t.view||q.ADAPTER.createCanvas(),this.resolution=t.resolution||q.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};Mi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Mi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_view"};K.add(Mi);q.PREFER_ENV=tr.WEBGL2;q.STRICT_TEXTURE_CACHE=!1;q.RENDER_OPTIONS={...Ci.defaultOptions,...Pi.defaultOptions,...Mi.defaultOptions,...Ri.defaultOptions};Object.defineProperties(q,{WRAP_MODE:{get(){return pt.defaultOptions.wrapMode},set(r){ht("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),pt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return pt.defaultOptions.scaleMode},set(r){ht("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),pt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return pt.defaultOptions.mipmap},set(r){ht("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),pt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return pt.defaultOptions.anisotropicLevel},set(r){ht("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),pt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return ht("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ii.defaultResolution},set(r){ii.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return ht("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ii.defaultMultisample},set(r){ii.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Ai.defaultMaxTextures},set(r){ht("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Ai.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Ai.defaultBatchSize},set(r){ht("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Ai.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Ai.canUploadSameBuffer},set(r){ht("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Ai.canUploadSameBuffer=r}},GC_MODE:{get(){return si.defaultMode},set(r){ht("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),si.defaultMode=r}},GC_MAX_IDLE:{get(){return si.defaultMaxIdle},set(r){ht("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),si.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return si.defaultCheckCountMax},set(r){ht("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),si.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return br.defaultVertexPrecision},set(r){ht("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),br.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return br.defaultFragmentPrecision},set(r){ht("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),br.defaultFragmentPrecision=r}}});var ro=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(ro||{});var Kn=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,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 bF=class or{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 Kn(null,null,1/0),this.deltaMS=1/or.targetFPMS,this.elapsedMS=1/or.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,i=ro.NORMAL){return this._addListener(new Kn(t,e,i))}addOnce(t,e,i=ro.NORMAL){return this._addListener(new Kn(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.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*or.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this.deltaTime);i.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),i=Math.min(Math.max(0,e)/1e3,or.targetFPMS);this._maxElapsedMS=1/i}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(!or._shared){let t=or._shared=new or;t.autoStart=!0,t._protected=!0}return or._shared}static get system(){if(!or._system){let t=or._system=new or;t.autoStart=!0,t._protected=!0}return or._system}};bF.targetFPMS=.06;var vr=bF;Object.defineProperties(q,{TARGET_FPMS:{get(){return vr.targetFPMS},set(r){ht("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),vr.targetFPMS=r}}});var $c=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,ro.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?vr.shared:new vr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};$c.extension=$.Application;K.add($c);var m3=[];K.handleByList($.Renderer,m3);var Xc=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{let i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=At.HIGH?this.multisample=At.HIGH:e>=At.MEDIUM?this.multisample=At.MEDIUM:e>=At.LOW?this.multisample=At.LOW:this.multisample=At.NONE}destroy(){}};Xc.extension={type:$.RendererSystem,name:"_multisample"};K.add(Xc);var np=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var jc=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}update(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new np(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};jc.extension={type:$.RendererSystem,name:"buffer"};K.add(jc);var Yc=class{constructor(t){this.renderer=t}render(t,e){let i=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){let l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Yc.extension={type:$.RendererSystem,name:"objectRenderer"};K.add(Yc);var ap=class z_ extends jn{constructor(t){super(),this.type=Fy.WEBGL,t=Object.assign({},q.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new sr({projectionMatrix:new Rt},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:z_.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ht("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=z_.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:g_()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ht("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ht("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ht("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ht("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};ap.extension={type:$.Renderer,priority:1},ap.__plugins={},ap.__systems={};var lp=ap;K.handleByMap($.RendererPlugin,lp.__plugins);K.handleByMap($.RendererSystem,lp.__systems);K.add(lp);var ns=class extends ir{constructor(t,e){let{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new pt;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof ir?this.addResourceAt(t[i],i):this.addResourceAt(In(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}};var qc=class extends ns{constructor(t,e){let{width:i,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:i,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=vi.TEXTURE_2D_ARRAY}upload(t,e,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let l=0;l<s;l++){let c=n[l];o[l]<c.dirtyId&&(o[l]=c.dirtyId,c.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,c.resource.width,c.resource.height,1,e.format,i.type,c.resource.source))}return!0}};var Kc=class extends ue{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var vF=class Zc extends ns{constructor(t,e){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Zc.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Zc.SIDES;a++)this.items[a].target=vi.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=vi.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=vi.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){let s=this.itemDirtyIds;for(let o=0;o<Zc.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,i),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Zc.SIDES}};vF.SIDES=6;var $_=vF;var Qc=class r extends ue{constructor(t,e){e=e||{};let i,s,o;typeof t=="string"?(i=r.EMPTY,s=t,o=!0):(i=t,s=null,o=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let i=await q.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await i.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===er.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return r._EMPTY=r._EMPTY??q.ADAPTER.createCanvas(0,0),r._EMPTY}};var X_=class cp extends ue{constructor(t,e){e=e||{},super(q.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},cp.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;ue.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,o=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${Si()}`,n.getContext("2d").drawImage(t,0,0,e,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=cp.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&cp.SVG_XML.test(t)}};X_.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,X_.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var j_=X_;var hp=class extends ue{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var Y_=class q_ extends ue{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];ue.crossOrigin(i,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:l}=t[o];if(a=a||t[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let c=a.split("?").shift().toLowerCase(),h=c.slice(c.lastIndexOf(".")+1);l=l||q_.MIME_TYPES[h]||`video/${h}`}n.src=a,l&&(n.type=l),i.appendChild(n)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,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._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=vr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;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._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;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._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}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.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(vr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(vr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(vr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||q_.TYPES.includes(e)}};Y_.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Y_.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var K_=Y_;Sc.push(Qc,Zs,Kc,K_,hp,j_,Ws,$_,qc);var g3={vec3(r,t,e,i){(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2])&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],r.uniform3f(t,i[0],i[1],i[2]))},int(r,t,e,i){r.uniform1i(t,i)},ivec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},ivec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},ivec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},uint(r,t,e,i){r.uniform1ui(t,i)},uvec2(r,t,e,i){r.uniform2ui(t,i[0],i[1])},uvec3(r,t,e,i){r.uniform3ui(t,i[0],i[1],i[2])},uvec4(r,t,e,i){r.uniform4ui(t,i[0],i[1],i[2],i[3])},bvec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},bvec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},bvec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},mat2(r,t,e,i){r.uniformMatrix2fv(t,!1,i)},mat4(r,t,e,i){r.uniformMatrix4fv(t,!1,i)}},x3={float(r,t,e,i){r.uniform1fv(t,i)},vec2(r,t,e,i){r.uniform2fv(t,i)},vec3(r,t,e,i){r.uniform3fv(t,i)},vec4(r,t,e,i){r.uniform4fv(t,i)},int(r,t,e,i){r.uniform1iv(t,i)},ivec2(r,t,e,i){r.uniform2iv(t,i)},ivec3(r,t,e,i){r.uniform3iv(t,i)},ivec4(r,t,e,i){r.uniform4iv(t,i)},uint(r,t,e,i){r.uniform1uiv(t,i)},uvec2(r,t,e,i){r.uniform2uiv(t,i)},uvec3(r,t,e,i){r.uniform3uiv(t,i)},uvec4(r,t,e,i){r.uniform4uiv(t,i)},bool(r,t,e,i){r.uniform1iv(t,i)},bvec2(r,t,e,i){r.uniform2iv(t,i)},bvec3(r,t,e,i){r.uniform3iv(t,i)},bvec4(r,t,e,i){r.uniform4iv(t,i)},sampler2D(r,t,e,i){r.uniform1iv(t,i)},samplerCube(r,t,e,i){r.uniform1iv(t,i)},sampler2DArray(r,t,e,i){r.uniform1iv(t,i)}};function TF(r,t,e,i,s){let o=0,n=null,a=null,l=s.gl;for(let c in r.uniforms){let h=t[c],u=i[c],d=e[c],f=r.uniforms[c];if(!h){f.group===!0&&s.shader.syncUniformGroup(u);continue}h.type==="float"&&h.size===1&&!h.isArray?u!==d.value&&(d.value=u,l.uniform1f(d.location,u)):h.type==="bool"&&h.size===1&&!h.isArray?u!==d.value&&(d.value=u,l.uniform1i(d.location,Number(u))):(h.type==="sampler2D"||h.type==="samplerCube"||h.type==="sampler2DArray")&&h.size===1&&!h.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):h.type==="mat3"&&h.size===1&&!h.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,u.toArray(!0)):l.uniformMatrix3fv(d.location,!1,u):h.type==="vec2"&&h.size===1&&!h.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,l.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):h.type==="vec4"&&h.size===1&&!h.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,l.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],l.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(h.size===1&&!h.isArray?g3:x3)[h.type].call(null,l,d.location,d.value,u)}}function y3(){Object.assign(os.prototype,{systemCheck(){},syncUniforms(r,t){let{shader:e,renderer:i}=this;TF(r,e.program.uniformData,t.uniformData,r.uniforms,i)}})}y3();var Jc=new(window.AudioContext||window.webkitAudioContext),_3=(r,t)=>{let e,i=Jc.createGain();i.gain.value=t.volume??1,i.connect(Jc.destination);let s={id:r,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=ln.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Jc.createBufferSource(),e.buffer=m,e.loop=s.loop,i.gain.setValueAtTime(s.volume,Jc.currentTime),e.connect(i),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),i.disconnect(),i.connect(Jc.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,i.gain.value=m},get id(){return s.id},get url(){return s.url},get loop(){return s.loop},get volume(){return s.volume},gainNode:i}},SF=()=>{let r=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(l=>l.id!==a)},getById:a=>t.find(l=>l.id===a),tick:()=>{for(let l of t){let c=r.find(h=>h.id===l.id);if(!c){let h=_3(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(h),h.play();continue}(c.url!==l.url||c.loop!==l.loop)&&(c.stop(),c.setUrl(l.url),c.setLoop(l.loop??!1),c.play()),c.getVolume()!==(l.volume??1)&&c.setVolume(l.volume??1)}let a=[];for(let l of r)t.find(c=>c.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],t=[]}}};var b3=({JSONObject:r,parserPlugins:t=[]})=>r.map(i=>{let s=t.find(o=>o.type===i.type);if(!s)throw new Error(`No parser plugin found for element type: ${i.type} (id: ${i.id??"unknown"})`);return s.parse({state:i,parserPlugins:t})});var Z_=b3;var wF=({type:r,parse:t})=>({type:r,parse:t});var Q_=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function J_(r,t,e,i){r.addEventListener?r.addEventListener(t,e,i):r.attachEvent&&r.attachEvent(`on${t}`,e)}function th(r,t,e,i){r&&(r.removeEventListener?r.removeEventListener(t,e,i):r.detachEvent&&r.detachEvent(`on${t}`,e))}function PF(r,t){let e=t.slice(0,t.length-1),i=[];for(let s=0;s<e.length;s++)i.push(r[e[s].toLowerCase()]);return i}function CF(r){typeof r!="string"&&(r=""),r=r.replace(/\s/g,"");let t=r.split(","),e=t.lastIndexOf("");for(;e>=0;)t[e-1]+=",",t.splice(e,1),e=t.lastIndexOf("");return t}function v3(r,t){let e=r.length>=t.length?r:t,i=r.length>=t.length?t:r,s=!0;for(let o=0;o<e.length;o++)i.indexOf(e[o])===-1&&(s=!1);return s}function RF(r){let t=r.keyCode||r.which||r.charCode;return r.code&&/^Key[A-Z]$/.test(r.code)&&(t=r.code.charCodeAt(3)),t}var ih={backspace:8,"\u232B":8,tab:9,clear:12,enter:13,"\u21A9":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":Q_?173:189,"=":Q_?61:187,";":Q_?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},kr={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},eh={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Te={16:!1,18:!1,17:!1,91:!1},$t={};for(let r=1;r<20;r++)ih[`f${r}`]=111+r;var Dt=[],rh=null,MF="all",Ii=new Map,Zn=r=>ih[r.toLowerCase()]||kr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),T3=r=>Object.keys(ih).find(t=>ih[t]===r),S3=r=>Object.keys(kr).find(t=>kr[t]===r),IF=r=>{MF=r||"all"},sh=()=>MF||"all",w3=()=>Dt.slice(0),E3=()=>Dt.map(r=>T3(r)||S3(r)||String.fromCharCode(r)),A3=()=>{let r=[];return Object.keys($t).forEach(t=>{$t[t].forEach(({key:e,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:e.split("+").map(n=>Zn(n))})})}),r},BF=r=>{let t=r.target||r.srcElement,{tagName:e}=t,i=!0,s=e==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(s||e==="TEXTAREA"||e==="SELECT")&&!t.readOnly)&&(i=!1),i},P3=r=>(typeof r=="string"&&(r=Zn(r)),Dt.indexOf(r)!==-1),C3=(r,t)=>{let e,i;r||(r=sh());for(let s in $t)if(Object.prototype.hasOwnProperty.call($t,s))for(e=$t[s],i=0;i<e.length;)e[i].scope===r?e.splice(i,1).forEach(({element:o})=>eb(o)):i++;sh()===r&&IF(t||"all")};function R3(r){let t=RF(r);r.key&&r.key.toLowerCase()==="capslock"&&(t=Zn(r.key));let e=Dt.indexOf(t);if(e>=0&&Dt.splice(e,1),r.key&&r.key.toLowerCase()==="meta"&&Dt.splice(0,Dt.length),(t===93||t===224)&&(t=91),t in Te){Te[t]=!1;for(let i in kr)kr[i]===t&&(nr[i]=!1)}}var FF=(r,...t)=>{if(typeof r>"u")Object.keys($t).forEach(e=>{Array.isArray($t[e])&&$t[e].forEach(i=>up(i)),delete $t[e]}),eb(null);else if(Array.isArray(r))r.forEach(e=>{e.key&&up(e)});else if(typeof r=="object")r.key&&up(r);else if(typeof r=="string"){let[e,i]=t;typeof e=="function"&&(i=e,e=""),up({key:r,scope:e,method:i,splitKey:"+"})}},up=({key:r,scope:t,method:e,splitKey:i="+"})=>{CF(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":Zn(a);if(!$t[l])return;t||(t=sh());let c=n>1?PF(kr,o):[],h=[];$t[l]=$t[l].filter(u=>{let d=(e?u.method===e:!0)&&u.scope===t&&v3(u.mods,c);return d&&h.push(u.element),!d}),h.forEach(u=>eb(u))})};function EF(r,t,e,i){if(t.element!==i)return;let s;if(t.scope===e||t.scope==="all"){s=t.mods.length>0;for(let o in Te)Object.prototype.hasOwnProperty.call(Te,o)&&(!Te[o]&&t.mods.indexOf(+o)>-1||Te[o]&&t.mods.indexOf(+o)===-1)&&(s=!1);(t.mods.length===0&&!Te[16]&&!Te[18]&&!Te[17]&&!Te[91]||s||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(Dt),t.method(r,t)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function AF(r,t){let e=$t["*"],i=RF(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(nr.filter||BF).call(this,r))return;if((i===93||i===224)&&(i=91),Dt.indexOf(i)===-1&&i!==229&&Dt.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=eh[a];r[a]&&Dt.indexOf(l)===-1?Dt.push(l):!r[a]&&Dt.indexOf(l)>-1?Dt.splice(Dt.indexOf(l),1):a==="metaKey"&&r[a]&&(Dt=Dt.filter(c=>c in eh||c===i))}),i in Te){Te[i]=!0;for(let a in kr)if(Object.prototype.hasOwnProperty.call(kr,a)){let l=eh[kr[a]];nr[a]=r[l]}if(!e)return}for(let a in Te)Object.prototype.hasOwnProperty.call(Te,a)&&(Te[a]=r[eh[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(Dt.indexOf(17)===-1&&Dt.push(17),Dt.indexOf(18)===-1&&Dt.push(18),Te[17]=!0,Te[18]=!0);let s=sh();if(e)for(let a=0;a<e.length;a++)e[a].scope===s&&(r.type==="keydown"&&e[a].keydown||r.type==="keyup"&&e[a].keyup)&&EF(r,e[a],s,t);if(!(i in $t))return;let o=$t[i],n=o.length;for(let a=0;a<n;a++)if((r.type==="keydown"&&o[a].keydown||r.type==="keyup"&&o[a].keyup)&&o[a].key){let l=o[a],{splitKey:c}=l,h=l.key.split(c),u=[];for(let d=0;d<h.length;d++)u.push(Zn(h[d]));u.sort().join("")===Dt.sort().join("")&&EF(r,l,s,t)}}var nr=function(r,t,e){Dt=[];let i=CF(r),s=[],o="all",n=document,a=0,l=!1,c=!0,h="+",u=!1,d=!1;if(e===void 0&&typeof t=="function"&&(e=t),Object.prototype.toString.call(t)==="[object Object]"){let f=t;f.scope&&(o=f.scope),f.element&&(n=f.element),f.keyup&&(l=f.keyup),f.keydown!==void 0&&(c=f.keydown),f.capture!==void 0&&(u=f.capture),typeof f.splitKey=="string"&&(h=f.splitKey),f.single===!0&&(d=!0)}for(typeof t=="string"&&(o=t),d&&FF(r,o);a<i.length;a++){let f=i[a].split(h);s=[],f.length>1&&(s=PF(kr,f));let p=f[f.length-1];p=p==="*"?"*":Zn(p),p in $t||($t[p]=[]),$t[p].push({keyup:l,keydown:c,scope:o,mods:s,shortcut:i[a],method:e,key:i[a],splitKey:h,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!Ii.has(n)){let f=(m=window.event)=>AF(m,n),p=(m=window.event)=>{AF(m,n),R3(m)};Ii.set(n,{keydownListener:f,keyupListenr:p,capture:u}),J_(n,"keydown",f,u),J_(n,"keyup",p,u)}if(!rh){let f=()=>{Dt=[]};rh={listener:f,capture:u},J_(window,"focus",f,u)}}};function M3(r,t="all"){Object.keys($t).forEach(e=>{$t[e].filter(i=>i.scope===t&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function eb(r){let t=Object.values($t).flat();if(t.findIndex(({element:e})=>e===r)<0&&r){let{keydownListener:e,keyupListenr:i,capture:s}=Ii.get(r)||{};e&&i&&(th(r,"keyup",i,s),th(r,"keydown",e,s),Ii.delete(r))}if((t.length<=0||Ii.size<=0)&&(Array.from(Ii.keys()).forEach(e=>{let{keydownListener:i,keyupListenr:s,capture:o}=Ii.get(e)||{};i&&s&&(th(e,"keyup",s,o),th(e,"keydown",i,o),Ii.delete(e))}),Ii.clear(),Object.keys($t).forEach(e=>delete $t[e]),rh)){let{listener:e,capture:i}=rh;th(window,"focus",e,i),rh=null}}var tb={getPressedKeyString:E3,setScope:IF,getScope:sh,deleteScope:C3,getPressedKeyCodes:w3,getAllKeyCodes:A3,isPressed:P3,filter:BF,trigger:M3,unbind:FF,keyMap:ih,modifier:kr,modifierMap:eh};for(let r in tb){let t=r;Object.prototype.hasOwnProperty.call(tb,t)&&(nr[t]=tb[t])}if(typeof window<"u"){let r=window.hotkeys;nr.noConflict=t=>(t&&window.hotkeys===nr&&(window.hotkeys=r),nr),window.hotkeys=nr}var I3=Object.prototype.hasOwnProperty,kF=r=>{let t=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let c=t.get(l);c?gt(c.payload,s[l].payload)||(n.push(l),nr.unbind(l)):o.push(l)}),t.forEach((l,c)=>{I3.call(s,c)||a.push(c)}),a.forEach(l=>{nr.unbind(l),t.delete(l)}),[...o,...n].forEach(l=>{let h=s[l].payload??{};nr(l,()=>{r&&r("keydown",{_event:{key:l},...h})}),t.set(l,{value:l,payload:h})})},destroy:()=>{for(let s of t.keys())nr.unbind(s);t.clear()}}};var UF=(r,t)=>typeof t!="string"?t:r[t]??t,B3=(r,t,e,i)=>{let s=UF(e,t);if(typeof s=="string"){let n=r[s];return n===void 0?i:n}let o=r;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:o},OF=(r,t,e,i)=>{let s=UF(e,t);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n<s.length-1;n++){let a=s[n];a in o||(o[a]={}),o=o[a]}return o[s[s.length-1]]=i,r},F3=(r,t,e)=>{if(!r||!Object.prototype.hasOwnProperty.call(r,t))throw new Error(`Animation "${e}" cannot auto-resolve property "${t}" from targetState.`);return r[t]},k3=(r,t,e,i,s)=>Object.entries(t).map(([o,n])=>{if(!dd[o])throw new Error(`${o} is not a supported property for animation.`);let a=B3(r,o,e,0);if(n.auto){let h=F3(i,o,s);if(a===h)return null;let u=xn([{value:a},{duration:n.auto.duration,value:h,easing:n.auto.easing}]);return{property:o,timeline:u}}let l=n.initialValue??a,c=xn([{value:l},...n.keyframes]);return{property:o,timeline:c}}).filter(Boolean),GF=()=>{let r=[],t=new Map,e=new Map,i=0,s=(S,v)=>{e.get(S)?.forEach(P=>{try{P(v)}catch{}})},o=S=>{if(s("completed",{id:S.id}),S.onComplete)try{S.onComplete()}catch{}},n=S=>{let{id:v,element:P,properties:C,targetState:A,onComplete:R,onCancel:M,propertyPathMap:I=fd}=S,k=k3(P,C,I,A,v);if(k.length===0){o({id:v,onComplete:R});return}let W={id:v,kind:"property",element:P,timelines:k,duration:tc(k),currentTime:0,stateVersion:i,targetState:A,onComplete:R,onCancel:M,applyFrame:O=>{for(let{property:z,timeline:V}of k){let G=ec(V,O);try{OF(P,z,I,G)}catch{}}},applyTargetState:()=>{if(!(!P||P.destroyed)){if(A===null){P.destroy();return}if(A)for(let[O,z]of Object.entries(A))try{OF(P,O,I,z)}catch{}}},isValid:()=>!!P&&!P.destroyed};W.applyFrame(0),t.set(v,W),s("started",{id:v})},a=S=>{let v={id:S.id,kind:"custom",duration:S.duration??0,currentTime:0,stateVersion:i,onComplete:S.onComplete,onCancel:S.onCancel,applyFrame:S.applyFrame??(()=>{}),applyTargetState:S.applyTargetState??(()=>{}),isValid:S.isValid??(()=>!0)};v.applyFrame(0),t.set(v.id,v),s("started",{id:v.id})},l=S=>{if(S.driver==="custom"){a(S);return}n(S)},c=S=>{try{S.applyTargetState?.()}catch{}if(S.onCancel)try{S.onCancel()}catch{}},h=S=>{switch(S.type){case"START":l(S.payload);break;case"CANCEL":d(S.id);break}},u=()=>{let S=r.splice(0);for(let v of S)h(v)},d=S=>{let v=t.get(S);v&&(c(v),t.delete(S),s("cancelled",{id:S}))},f=S=>{r.push(S)},p=()=>{for(let[S,v]of t)c(v),s("cancelled",{id:S});t.clear(),i++},m=S=>{u();let v=[];for(let[P,C]of t){if(C.stateVersion!==i){v.push(P);continue}if(!C.isValid()){v.push(P);continue}if(C.currentTime+=S,C.currentTime>=C.duration){C.applyFrame(C.duration),o(C),v.push(P);continue}C.applyFrame(C.currentTime)}for(let P of v)t.delete(P)},x=()=>{u()},_=(S,v)=>(e.has(S)||e.set(S,new Set),e.get(S).add(v),()=>T(S,v)),T=(S,v)=>{e.get(S)?.delete(v)};return{dispatch:f,cancelAll:p,flush:x,tick:m,on:_,off:T,getState:()=>({stateVersion:i,activeCount:t.size,animations:Array.from(t.entries()).map(([S,v])=>({id:S,currentTime:v.currentTime,duration:v.duration,progress:v.duration>0?v.currentTime/v.duration:0}))}),isAnimating:S=>t.has(S),destroy:()=>{p(),e.clear()}}};var LF=r=>{let t=0,e=0,i=null;return{reset:c=>{t>0&&i!==null&&r?.("renderComplete",{id:i,aborted:!0}),e++,t=0,i=c},track:c=>{c===e&&t++},complete:c=>{c===e&&(t--,t===0&&r?.("renderComplete",{id:i,aborted:!1}))},getVersion:()=>e,completeIfEmpty:()=>{t===0&&r?.("renderComplete",{id:i,aborted:!1})}}};var DF=new Set(["update","transition"]),O3=new Set(["alpha","x","y","scaleX","scaleY","rotation"]),U3=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),NF=new Set(["single","sequence","composite"]),dp=new Set(["red","green","blue","alpha"]),HF=new Set(["max","min","multiply","add"]),WF=new Set(Vd),oi=(r,t)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${t} must be an object.`)},io=(r,t)=>{if(typeof r!="string"||r.length===0)throw new Error(`${t} must be a non-empty string.`)},oh=(r,t)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${t} must be a number.`)},G3=(r,t)=>{if(oi(r,t),oh(r.duration,`${t}.duration`),r.easing!==void 0&&typeof r.easing!="string")throw new Error(`${t}.easing must be a string.`);if(r.easing!==void 0&&!WF.has(r.easing))throw new Error(`${t}.easing must be one of: ${Vd.join(", ")}.`);return{duration:r.duration,easing:r.easing??"linear"}},ib=(r,t)=>{oi(r,t);let e={};if(r.initialValue!==void 0&&(oh(r.initialValue,`${t}.initialValue`),e.initialValue=r.initialValue),!Array.isArray(r.keyframes)||r.keyframes.length===0)throw new Error(`${t}.keyframes must be a non-empty array.`);return e.keyframes=r.keyframes.map((i,s)=>{let o=`${t}.keyframes[${s}]`;if(oi(i,o),oh(i.value,`${o}.value`),oh(i.duration,`${o}.duration`),i.easing!==void 0&&typeof i.easing!="string")throw new Error(`${o}.easing must be a string.`);if(i.easing!==void 0&&!WF.has(i.easing))throw new Error(`${o}.easing must be one of: ${Vd.join(", ")}.`);if(i.relative!==void 0&&typeof i.relative!="boolean")throw new Error(`${o}.relative must be a boolean.`);return{value:i.value,duration:i.duration,easing:i.easing??"linear",...i.relative!==void 0?{relative:i.relative}:{}}}),e},L3=(r,t)=>{oi(r,t);let e=r.keyframes!==void 0,i=r.auto!==void 0;if(e&&i)throw new Error(`${t} cannot define both keyframes and auto.`);if(!e&&!i)throw new Error(`${t} must define keyframes or auto.`);if(i){if(r.initialValue!==void 0)throw new Error(`${t}.initialValue is not valid when auto is defined.`);return{auto:G3(r.auto,`${t}.auto`)}}return ib(r,t)},zF=(r,t,e,i=ib)=>{oi(r,t);let s=Object.entries(r).map(([o,n])=>{if(!e.has(o))throw new Error(`${t}.${o} is not a supported animation property.`);return[o,i(n,`${t}.${o}`)]});if(s.length===0)throw new Error(`${t} must define at least one property.`);return Object.fromEntries(s)},D3=(r,t)=>{if(oi(r,t),io(r.texture,`${t}.texture`),r.channel!==void 0&&!dp.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(dp).join(", ")}.`);if(r.invert!==void 0&&typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);return{texture:r.texture,...r.channel?{channel:r.channel}:{},...r.invert!==void 0?{invert:r.invert}:{}}},N3=(r,t)=>{if(oi(r,t),!NF.has(r.kind))throw new Error(`${t}.kind must be one of: ${Array.from(NF).join(", ")}.`);let e={kind:r.kind};if(r.channel!==void 0){if(!dp.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(dp).join(", ")}.`);e.channel=r.channel}if(r.softness!==void 0&&(oh(r.softness,`${t}.softness`),e.softness=r.softness),r.invert!==void 0){if(typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);e.invert=r.invert}if(r.progress!==void 0&&(e.progress=ib(r.progress,`${t}.progress`)),r.kind==="single"&&(io(r.texture,`${t}.texture`),e.texture=r.texture),r.kind==="sequence"){if(!Array.isArray(r.textures)||r.textures.length===0)throw new Error(`${t}.textures must be a non-empty array.`);e.textures=r.textures.map((i,s)=>(io(i,`${t}.textures[${s}]`),i)),r.sample!==void 0&&(io(r.sample,`${t}.sample`),e.sample=r.sample)}if(r.kind==="composite"){if(!HF.has(r.combine??"max"))throw new Error(`${t}.combine must be one of: ${Array.from(HF).join(", ")}.`);if(!Array.isArray(r.items)||r.items.length===0)throw new Error(`${t}.items must be a non-empty array.`);e.combine=r.combine??"max",e.items=r.items.map((i,s)=>D3(i,`${t}.items[${s}]`))}return e.progress||(e.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),e},VF=(r,t)=>{if(oi(r,t),r.mask!==void 0)throw new Error(`${t}.mask is not valid. Define mask on ${t}.`);let e={};if(r.tween!==void 0&&(e.tween=zF(r.tween,`${t}.tween`,U3)),Object.keys(e).length===0)throw new Error(`${t} must define tween.`);return e},H3=(r,t)=>{let e={};if(r.shader!==void 0)throw new Error(`${t}.shader is not supported.`);if(r.prev!==void 0&&(e.prev=VF(r.prev,`${t}.prev`)),r.next!==void 0&&(e.next=VF(r.next,`${t}.next`)),r.mask!==void 0&&(e.mask=N3(r.mask,`${t}.mask`)),e.prev===void 0&&e.next===void 0&&e.mask===void 0)throw new Error(`${t} must define prev, next, or mask.`);return e},rb=(r,t,e)=>{if(r!==void 0)throw new Error(`${t} ${e}`)},$F=(r=[])=>{if(!Array.isArray(r))throw new Error("Input error: `animations` must be an array.");let t=r.map((i,s)=>{let o=`animations[${s}]`;if(oi(i,o),io(i.id,`${o}.id`),io(i.targetId,`${o}.targetId`),io(i.type,`${o}.type`),!DF.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(DF).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(oi(i.complete,`${o}.complete`),n.complete=i.complete),rb(i.operation,`${o}.operation`,"is no longer supported. Use `type: update | transition` instead."),rb(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),rb(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="update"){if(n.tween=zF(i.tween,`${o}.tween`,O3,L3),i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(i.prev!==void 0)throw new Error(`${o}.prev is only valid for transition animations.`);if(i.next!==void 0)throw new Error(`${o}.next is only valid for transition animations.`);if(i.mask!==void 0)throw new Error(`${o}.mask is only valid for transition animations.`);if(i.shader!==void 0)throw new Error(`${o}.shader is not supported.`);return n}if(i.tween!==void 0)throw new Error(`${o}.tween is not valid for transition animations.`);if(i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let a=H3(i,o);return a.prev!==void 0&&(n.prev=a.prev),a.next!==void 0&&(n.next=a.next),a.mask!==void 0&&(n.mask=a.mask),n}),e=new Map;for(let i of t){let s=e.get(i.targetId)??new Set;s.add(i.type),e.set(i.targetId,s)}for(let[i,s]of e)if(s.has("transition")&&s.size>1)throw new Error(`Animations targeting "${i}" cannot mix update and transition types in the same state.`);return t};var sb=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let t={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};if(!Array.isArray(t.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(t.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(t.audio))throw new Error("Input error: `audio` must be an array.");return t.animations=$F(t.animations),t};var V3="0",Qn=(r,t)=>{let e=r?.[t];return typeof e=="number"?e:0},ar=r=>({value:r.element.value??"",selectionStart:Qn(r.element,"selectionStart"),selectionEnd:Qn(r.element,"selectionEnd"),focused:document.activeElement===r.element,composing:r.composing===!0}),W3=(r,t)=>!r||!t?!1:r.value===t.value&&r.selectionStart===t.selectionStart&&r.selectionEnd===t.selectionEnd&&r.focused===t.focused&&r.composing===t.composing,z3=r=>r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement,nh=r=>{r.element.style.pointerEvents="none"},ob=(r,t,e)=>{if(typeof r?.setSelectionRange=="function")try{r.setSelectionRange(t,e)}catch{}},$3=({app:r,geometry:t})=>{let e=r.canvas;if(!t||!e||t.visible===!1)return null;let i=e.getBoundingClientRect(),s=r.renderer?.width||i.width||1,o=r.renderer?.height||i.height||1,n=i.width/s,a=i.height/o,l=t.clipInsets??{top:0,right:0,bottom:0,left:0},c=i.left+(t.x+l.left)*n,h=i.top+(t.y+l.top)*a,u=i.left+(t.x+t.width-l.right)*n,d=i.top+(t.y+t.height-l.bottom)*a;return u<=c||d<=h?null:{left:c,top:h,right:u,bottom:d}},X3=({app:r,entry:t,event:e})=>{let i=t.options.getGeometry?.(),s=$3({app:r,geometry:i}),o=e.clientX,n=e.clientY;return!!s&&Number.isFinite(o)&&Number.isFinite(n)&&o>=s.left&&o<=s.right&&n>=s.top&&n<=s.bottom},XF=({app:r})=>{let t=new Map,e,i=null,s=()=>{e||(e=document.createElement("div"),e.dataset.routeGraphicsInputBridge="true",e.style.position="fixed",e.style.left="0",e.style.top="0",e.style.pointerEvents="none",e.style.zIndex="1000",e.style.width="0",e.style.height="0");let g=r.canvas?.parentNode??document.body;e.isConnected||g.appendChild(e)},o=(g,w=g.lastSnapshot)=>{let b=ar(g);b.focused&&i!==g.id?i=g.id:!b.focused&&i===g.id&&(i=null),nh(g,i),w?.value!==b.value&&g.callbacks.onValueChange?.(b),(w?.selectionStart!==b.selectionStart||w?.selectionEnd!==b.selectionEnd||w?.focused!==b.focused||w?.composing!==b.composing)&&g.callbacks.onSelectionChange?.(b),g.lastSnapshot=b},n=g=>{let{disabled:w=!1,multiline:b=!1,maxLength:S,textStyle:v,padding:P,placeholder:C="",autocomplete:A="off",autocapitalize:R="off",spellcheck:M=!1}=g.options,{element:I}=g;I instanceof HTMLInputElement&&(I.type="text"),I.disabled=w,I.placeholder=C,I.autocomplete=A,I.autocapitalize=R,I.spellcheck=!!M,I.style.opacity=V3,I.style.color="transparent",I.style.caretColor="transparent",I.style.background="transparent",I.style.paddingTop=`${P.top}px`,I.style.paddingRight=`${P.right}px`,I.style.paddingBottom=`${P.bottom}px`,I.style.paddingLeft=`${P.left}px`,I.style.fontFamily=v?.fontFamily??"Arial",I.style.fontSize=`${v?.fontSize??16}px`,I.style.fontWeight=v?.fontWeight??"400",I.style.textAlign=v?.align??"left",I.style.lineHeight=typeof v?.lineHeight=="number"?`${v.lineHeight}px`:"normal",I.style.whiteSpace=b?"pre":"nowrap",I.style.overflowWrap="normal",I.style.resize="none",I.style.overflow="hidden",typeof S=="number"?I.maxLength=S:I.removeAttribute("maxLength"),I.tabIndex=-1,b&&I instanceof HTMLTextAreaElement&&(I.wrap="off",I.rows=1),nh(g,i)},a=g=>{s();let w=r.canvas,b=g.options.getGeometry?.();if(!w||!b||b.visible===!1){g.element.style.display="none";return}let S=w.getBoundingClientRect(),v=r.renderer?.width||S.width||1,P=r.renderer?.height||S.height||1,C=S.width/v,A=S.height/P,R=b.clipInsets??{top:0,right:0,bottom:0,left:0},M={top:R.top*A,right:R.right*C,bottom:R.bottom*A,left:R.left*C};g.element.style.display="block",g.element.style.left=`${S.left+b.x*C}px`,g.element.style.top=`${S.top+b.y*A}px`,g.element.style.width=`${b.width*C}px`,g.element.style.height=`${b.height*A}px`;let I=Object.values(M).some(k=>k>0);g.element.style.clipPath=I?`inset(${M.top}px ${M.right}px ${M.bottom}px ${M.left}px)`:"none"},l=g=>{if(!i)return;let w=t.get(i),b=g.target;!w||b===w.element||w.element.contains(b)||z3(b)&&e?.contains(b)||X3({app:r,entry:w,event:g})||w.element.blur()},c=()=>{for(let g of t.values()){if(a(g),!g.lastSnapshot){g.lastSnapshot=ar(g);continue}let w=ar(g);W3(w,g.lastSnapshot)||o(g,g.lastSnapshot)}},h=({id:g,options:w})=>{let b=w.multiline===!0?document.createElement("textarea"):document.createElement("input");return b.dataset.routeGraphicsInputId=g,b.style.position="fixed",b.style.border="none",b.style.outline="none",b.style.margin="0",b.style.boxSizing="border-box",b.style.borderRadius="0",b.style.transformOrigin="top left",b.style.appearance="none",b.style.boxShadow="none",b.style.userSelect="none",b.style.webkitUserSelect="none",b},u=g=>{let{id:w,element:b}=g,S=()=>{o(g)};b.addEventListener("focus",()=>{g.pendingBlurTimer&&(clearTimeout(g.pendingBlurTimer),g.pendingBlurTimer=null),i=w,nh(g,i);let v=ar(g);g.lastSnapshot=v,g.callbacks.onFocus?.(v),g.callbacks.onSelectionChange?.(v)}),b.addEventListener("blur",()=>{i===w&&(i=null),nh(g,i),g.pendingBlurTimer=setTimeout(()=>{g.pendingBlurTimer=null;let v=ar(g);if(v.focused){g.lastSnapshot=v;return}g.lastSnapshot=v,g.callbacks.onBlur?.(v),g.callbacks.onSelectionChange?.(v)},0)}),b.addEventListener("input",S),b.addEventListener("select",S),b.addEventListener("click",()=>queueMicrotask(S)),b.addEventListener("keyup",()=>queueMicrotask(S)),b.addEventListener("keydown",v=>{let P=v.key==="Enter"&&g.options.multiline!==!0&&!v.shiftKey,C=v.key==="Enter"&&g.options.multiline===!0&&(v.ctrlKey||v.metaKey);(P||C)&&(v.preventDefault(),g.callbacks.onSubmit?.(ar(g),v)),v.key==="Escape"&&b.blur(),queueMicrotask(S)}),b.addEventListener("compositionstart",()=>{g.composing=!0;let v=ar(g);g.lastSnapshot=v,g.callbacks.onCompositionStart?.(v),g.callbacks.onSelectionChange?.(v)}),b.addEventListener("compositionupdate",()=>{let v=ar(g);g.lastSnapshot=v,g.callbacks.onCompositionUpdate?.(v),g.callbacks.onSelectionChange?.(v)}),b.addEventListener("compositionend",()=>{g.composing=!1,S(),g.callbacks.onCompositionEnd?.(ar(g))})};document.addEventListener("pointerdown",l,!0),r.ticker?.add?.(c);let d=(g,w)=>{s();let b=t.get(g);if(b)return b.options=w,b.callbacks=w.callbacks??{},n(b),a(b),typeof w.value=="string"&&b.element.value!==w.value&&(b.element.value=w.value),b.lastSnapshot=ar(b),b.element;let S={id:g,element:h({id:g,options:w}),options:w,callbacks:w.callbacks??{},composing:!1,pendingBlurTimer:null,lastSnapshot:null};return u(S),typeof w.value=="string"&&(S.element.value=w.value),n(S),e.appendChild(S.element),t.set(g,S),a(S),S.lastSnapshot=ar(S),S.element};return{mount:d,update:(g,w)=>{let b=t.get(g);if(!b)return d(g,w);let S=w.multiline===!0!=b.element instanceof HTMLTextAreaElement;if(b.options=w,b.callbacks=w.callbacks??{},S){let v=b.element,P=document.activeElement===v,C=Qn(v,"selectionStart"),A=Qn(v,"selectionEnd");return b.element=h({id:g,options:w}),u(b),v.replaceWith(b.element),b.element.value=typeof w.value=="string"?w.value:v.value,n(b),a(b),b.lastSnapshot=ar(b),P&&!w.disabled&&queueMicrotask(()=>{b.element.focus(),ob(b.element,C,A)}),b.element}return typeof w.value=="string"&&w.value!==b.element.value&&b.composing!==!0&&(b.element.value=w.value),n(b),a(b),b.lastSnapshot=ar(b),b.element},focus:(g,{selectAll:w=!1,selectionStart:b,selectionEnd:S}={})=>{let v=t.get(g);if(!v||v.element.disabled)return;let P=document.activeElement===v.element;if(i=g,nh(v,i),P||v.element.focus(),w){v.element.select?.(),o(v,v.lastSnapshot);return}if(typeof b=="number"||typeof S=="number"){let C=typeof b=="number"?b:Qn(v.element,"selectionStart"),A=typeof S=="number"?S:typeof b=="number"?b:Qn(v.element,"selectionEnd");ob(v.element,C,A)}o(v,v.lastSnapshot)},setSelection:(g,w,b=w,{focus:S=!1}={})=>{let v=t.get(g);if(!v||v.element.disabled)return;let P=()=>{ob(v.element,w,b),o(v,v.lastSnapshot)};if(S&&document.activeElement!==v.element){v.element.focus(),P();return}P()},blur:g=>{t.get(g)?.element.blur()},unmount:g=>{let w=t.get(g);w&&(i===g&&(i=null),w.pendingBlurTimer&&(clearTimeout(w.pendingBlurTimer),w.pendingBlurTimer=null),w.element.remove(),t.delete(g),t.size===0&&e?.remove())},destroy:()=>{document.removeEventListener("pointerdown",l,!0),r.ticker?.remove?.(c);for(let g of t.values())g.pendingBlurTimer&&(clearTimeout(g.pendingBlurTimer),g.pendingBlurTimer=null),g.element.remove();t.clear(),i=null,e?.remove(),e=void 0}}};var j3=()=>{let r,t=SF(),e={elements:[],animations:[],audio:[]},i,s={animations:[],elements:[],audio:[],parsers:[]},o,n,a,l,c=!1,h,u,d,f,p=new Map,m,x=(v,P,C,A)=>{v.clear(),v.rect(0,0,P,C),v.fill(A??0)},_=v=>v?v.startsWith("audio/")?"audio":v.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(v)?"font":v.startsWith("video/")?"video":"texture":"texture",T=(v,P,{revokable:C=!1}={})=>{p.set(v,{url:P,revokable:C})},g=()=>{for(let v of p.values())v?.revokable===!0&&typeof v?.url=="string"&&URL.revokeObjectURL(v.url);p.clear()},w=(v,P,C)=>{o&&o.registerHotkeys(C?.keyboard??{}),v.renderer.events.cursorStyles||(v.renderer.events.cursorStyles={}),v.renderer.events.cursorStyles.default||(v.renderer.events.cursorStyles.default="default"),v.renderer.events.cursorStyles.hover||(v.renderer.events.cursorStyles.hover="pointer");let A=P?.cursorStyles,R=C?.cursorStyles;gt(A,R)||(R?(R.default&&(v.renderer.events.cursorStyles.default=R.default,v.canvas.style.cursor=R.default),R.hover&&(v.renderer.events.cursorStyles.hover=R.hover)):A&&(v.renderer.events.cursorStyles.default="default",v.renderer.events.cursorStyles.hover="pointer"))},b=(v,P,C,A)=>{h&&h.abort(),h=new AbortController;let R=h.signal;a.reset(C.id),w(v,e.global,C.global),n.cancelAll(),ks({app:v,parent:P,prevComputedTree:e.elements,nextComputedTree:C.elements,animations:C.animations,elementPlugins:s.elements,animationBus:n,completionTracker:a,eventHandler:A,signal:R}),n.flush(),By({app:v,prevAudioTree:e.audio,nextAudioTree:C.audio,audioPlugins:s.audio}),e=C,typeof v.render=="function"&&v.render(),a.completeIfEmpty(),c||(c=!0,l&&l())},S={rendererName:"pixi",get canvas(){return r.canvas},findElementByLabel:v=>r.stage.getChildByLabel(v,!0)??null,extractBase64:async v=>{let P=new Q(0,0,r.renderer.width,r.renderer.height);if(!v)return await r.renderer.extract.base64({target:r.stage,frame:P});let C=r.stage.getChildByLabel(v,!0);if(!C)throw new Error(`Element with label '${v}' not found`);return await r.renderer.extract.base64({target:C,frame:P})},assignStageEvent:(v,P)=>{r.stage.eventMode="static",r.stage.on(v,P)},init:async v=>{let{eventHandler:P,plugins:C,width:A,height:R,backgroundColor:M,debug:I=!1,onFirstRender:k}=v;l=k;let W=[];return C?.elements?.forEach(O=>{O?.parse&&W.push(wF({type:O.type,parse:O.parse}))}),s={animations:C?.animations??[],elements:C?.elements??[],audio:C?.audio??[],parsers:W},i=P,o=kF(P),a=LF(P),r=new Wl,r.audioStage=t,await r.init({width:A,height:R,backgroundColor:M,preference:"webgl"}),typeof r.ticker?.remove=="function"&&r.ticker.remove(r.render,r),r.debug=I,r.inputDomBridge=XF({app:r}),f=O=>{O.preventDefault()},r.canvas.addEventListener("contextmenu",f),m=new Bt,m.label="__route_graphics_background__",x(m,A,R,M),r.stage.addChild(m),r.stage.width=A,r.stage.height=R,r.ticker.add(r.audioStage.tick),n=GF(),I?(u=O=>{O?.detail?.deltaMS&&(n.tick(Number(O.detail.deltaMS)),typeof r.render=="function"&&r.render())},window.addEventListener("snapShotKeyFrame",u)):(d=O=>{n.tick(O.deltaMS),typeof r.render=="function"&&r.render()},r.ticker.add(d)),S},destroy:()=>{h&&(h.abort(),h=void 0),u&&(window.removeEventListener("snapShotKeyFrame",u),u=void 0),d&&typeof r?.ticker?.remove=="function"&&(r.ticker.remove(d),d=void 0),f&&r?.canvas&&(r.canvas.removeEventListener("contextmenu",f),f=void 0),r?.inputDomBridge?.destroy?.(),o?.destroy(),Ey(),n&&n.destroy(),r?.audioStage&&r.audioStage.destroy();let v=P=>{for(let C of P.children){let A=C.texture?.source?.resource;A instanceof HTMLVideoElement&&A.pause(),C.children&&v(C)}};r?.stage&&v(r.stage),r&&r.destroy(),m=void 0,g()},loadAssets:async v=>{if(!v)throw new Error("assetBufferMap is required");let P={audio:{},font:{},video:{},texture:{}};for(let[R,M]of Object.entries(v)){let I=_(M.type);P[I][R]=M}await Promise.all(Object.entries(P.audio).map(([R,M])=>ln.load(R,M.buffer))),await Promise.all(Object.entries(P.font).map(async([R,M])=>{let I=new Blob([M.buffer],{type:M.type}),k=URL.createObjectURL(I),W=new FontFace(R,`url(${k})`);try{await W.load(),document.fonts.add(W)}catch(O){console.error(`Failed to load font ${R}:`,O)}finally{URL.revokeObjectURL(k)}}));let C=Object.entries(P.texture).map(async([R,M])=>{if(gr.cache.has(R))return gr.cache.get(R);if(M?.source==="url"&&typeof M?.url=="string")return gr.load({alias:R,src:M.url,parser:"loadTextures"});let I=new Blob([M.buffer],{type:M.type}),k=await createImageBitmap(I),W=B.from(k);return gr.cache.set(R,W),W}),A=Object.entries(P.video).map(async([R,M])=>{let I=M?.source==="url"&&typeof M?.url=="string"?M.url:URL.createObjectURL(new Blob([M.buffer],{type:M.type})),k=M?.source!=="url";T(R,I,{revokable:k});let W={alias:R,src:I,parser:"loadVideo",data:{}};return typeof M?.type=="string"&&M.type.length>0&&(W.data.mime=M.type),gr.load(W).then(O=>O).catch(O=>{throw p.delete(R),k&&URL.revokeObjectURL(I),O})});return Promise.all([...C,...A])},loadAudioAssets:async v=>Promise.all(v.map(async P=>{let A=await(await fetch(P)).arrayBuffer();return ln.load(P,A)})),updatedBackgroundColor:v=>{r.renderer.background.color=v,m&&x(m,r.renderer.width,r.renderer.height,v),typeof r.render=="function"&&r.render()},render:v=>{let P=sb(v),C=Z_({JSONObject:P.elements,parserPlugins:s.parsers}),A={...P,elements:C};b(r,r.stage,A,i)},parse:v=>{let P=sb(v),C=Z_({JSONObject:P.elements,parserPlugins:s.parsers});return{...P,elements:C}}};return S},jF=j3;var HCt=jF;export{Wl as Application,gr as Assets,ln as AudioAsset,VG as animatedSpritePlugin,OG as containerPlugin,Jx as createAnimationPlugin,rk as createAssetBufferManager,ty as createAudioPlugin,Zt as createElementPlugin,HCt as default,fG as inputPlugin,KG as particlesPlugin,HU as rectPlugin,By as renderAudio,ks as renderElements,tG as sliderPlugin,$G as soundPlugin,VU as spritePlugin,LU as textPlugin,HG as textRevealingPlugin,WG as tweenPlugin,zU as videoPlugin};
1633
1635
  /*! Bundled license information:
1634
1636
 
1635
1637
  punycode/punycode.js: