route-graphics 1.23.4 → 1.23.6
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.
- package/dist/RouteGraphics.js +37 -37
- package/package.json +1 -1
package/dist/RouteGraphics.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var EL=Object.create;var zm=Object.defineProperty;var AL=Object.getOwnPropertyDescriptor;var PL=Object.getOwnPropertyNames;var CL=Object.getPrototypeOf,RL=Object.prototype.hasOwnProperty;var T=(t,e)=>()=>(t&&(e=t(t=0)),e);var ce=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),O0=(t,e)=>{for(var r in e)zm(t,r,{get:e[r],enumerable:!0})},ML=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of PL(e))!RL.call(t,s)&&s!==r&&zm(t,s,{get:()=>e[s],enumerable:!(i=AL(e,s))||i.enumerable});return t};var Xs=(t,e,r)=>(r=t!=null?EL(CL(t)):{},ML(e||!t||!t.__esModule?zm(r,"default",{value:t,enumerable:!0}):r,t));var w,Xm,Mh,K,O=T(()=>{"use strict";w=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(w||{}),Xm=t=>{if(typeof t=="function"||typeof t=="object"&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={...typeof t.extension!="object"?{type:t.extension}:t.extension,ref:t}}if(typeof t=="object")t={...t};else throw new Error("Invalid extension type");return typeof t.type=="string"&&(t.type=[t.type]),t},Mh=(t,e)=>Xm(t).priority??e,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Xm).forEach(e=>{e.type.forEach(r=>this._removeHandlers[r]?.(e))}),this},add(...t){return t.map(Xm).forEach(e=>{e.type.forEach(r=>{let i=this._addHandlers,s=this._queue;i[r]?i[r]?.(e):(s[r]=s[r]||[],s[r]?.push(e))})}),this},handle(t,e,r){let i=this._addHandlers,s=this._removeHandlers;if(i[t]||s[t])throw new Error(`Extension type ${t} already has a handler`);i[t]=e,s[t]=r;let o=this._queue;return o[t]&&(o[t]?.forEach(n=>e(n)),delete o[t]),this},handleByMap(t,e){return this.handle(t,r=>{r.name&&(e[r.name]=r.ref)},r=>{r.name&&delete e[r.name]})},handleByNamedList(t,e,r=-1){return this.handle(t,i=>{e.findIndex(o=>o.name===i.name)>=0||(e.push({name:i.name,value:i.ref}),e.sort((o,n)=>Mh(n.value,r)-Mh(o.value,r)))},i=>{let s=e.findIndex(o=>o.name===i.name);s!==-1&&e.splice(s,1)})},handleByList(t,e,r=-1){return this.handle(t,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,o)=>Mh(o,r)-Mh(s,r)))},i=>{let s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})},mixin(t,...e){for(let r of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(r))}}});var G0=ce((r6,Ym)=>{"use strict";var BL=Object.prototype.hasOwnProperty,Kt="~";function ml(){}Object.create&&(ml.prototype=Object.create(null),new ml().__proto__||(Kt=!1));function FL(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function L0(t,e,r,i,s){if(typeof r!="function")throw new TypeError("The listener must be a function");var o=new FL(r,i||t,s),n=Kt?Kt+e:e;return t._events[n]?t._events[n].fn?t._events[n]=[t._events[n],o]:t._events[n].push(o):(t._events[n]=o,t._eventsCount++),t}function Ih(t,e){--t._eventsCount===0?t._events=new ml:delete t._events[e]}function Nt(){this._events=new ml,this._eventsCount=0}Nt.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)BL.call(r,i)&&e.push(Kt?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Nt.prototype.listeners=function(e){var r=Kt?Kt+e:e,i=this._events[r];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};Nt.prototype.listenerCount=function(e){var r=Kt?Kt+e:e,i=this._events[r];return i?i.fn?1:i.length:0};Nt.prototype.emit=function(e,r,i,s,o,n){var a=Kt?Kt+e:e;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,u,h;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,r),!0;case 3:return l.fn.call(l.context,r,i),!0;case 4:return l.fn.call(l.context,r,i,s),!0;case 5:return l.fn.call(l.context,r,i,s,o),!0;case 6:return l.fn.call(l.context,r,i,s,o,n),!0}for(h=1,u=new Array(c-1);h<c;h++)u[h-1]=arguments[h];l.fn.apply(l.context,u)}else{var d=l.length,f;for(h=0;h<d;h++)switch(l[h].once&&this.removeListener(e,l[h].fn,void 0,!0),c){case 1:l[h].fn.call(l[h].context);break;case 2:l[h].fn.call(l[h].context,r);break;case 3:l[h].fn.call(l[h].context,r,i);break;case 4:l[h].fn.call(l[h].context,r,i,s);break;default:if(!u)for(f=1,u=new Array(c-1);f<c;f++)u[f-1]=arguments[f];l[h].fn.apply(l[h].context,u)}}return!0};Nt.prototype.on=function(e,r,i){return L0(this,e,r,i,!1)};Nt.prototype.once=function(e,r,i){return L0(this,e,r,i,!0)};Nt.prototype.removeListener=function(e,r,i,s){var o=Kt?Kt+e:e;if(!this._events[o])return this;if(!r)return Ih(this,o),this;var n=this._events[o];if(n.fn)n.fn===r&&(!s||n.once)&&(!i||n.context===i)&&Ih(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==r||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Ih(this,o)}return this};Nt.prototype.removeAllListeners=function(e){var r;return e?(r=Kt?Kt+e:e,this._events[r]&&Ih(this,r)):(this._events=new ml,this._eventsCount=0),this};Nt.prototype.off=Nt.prototype.removeListener;Nt.prototype.addListener=Nt.prototype.on;Nt.prefixed=Kt;Nt.EventEmitter=Nt;typeof Ym<"u"&&(Ym.exports=Nt)});var D0,We,Vt=T(()=>{D0=Xs(G0(),1),We=D0.default});var kL,Ui,Ct,Mr,Y0,N0,jm,UL,Bh,j0,q0,V0,H0,W0,gl,OL,LL,GL,DL,Zm,$0,NL,qm,Km,z0,Qm,mr,X0,Fh,Jm=T(()=>{kL={grad:.9,turn:360,rad:360/(2*Math.PI)},Ui=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},Ct=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},Mr=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},Y0=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},N0=function(t){return{r:Mr(t.r,0,255),g:Mr(t.g,0,255),b:Mr(t.b,0,255),a:Mr(t.a)}},jm=function(t){return{r:Ct(t.r),g:Ct(t.g),b:Ct(t.b),a:Ct(t.a,3)}},UL=/^#([0-9a-f]{3,8})$/i,Bh=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},j0=function(t){var e=t.r,r=t.g,i=t.b,s=t.a,o=Math.max(e,r,i),n=o-Math.min(e,r,i),a=n?o===e?(r-i)/n:o===r?2+(i-e)/n:4+(e-r)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},q0=function(t){var e=t.h,r=t.s,i=t.v,s=t.a;e=e/360*6,r/=100,i/=100;var o=Math.floor(e),n=i*(1-r),a=i*(1-(e-o)*r),l=i*(1-(1-e+o)*r),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}},V0=function(t){return{h:Y0(t.h),s:Mr(t.s,0,100),l:Mr(t.l,0,100),a:Mr(t.a)}},H0=function(t){return{h:Ct(t.h),s:Ct(t.s),l:Ct(t.l),a:Ct(t.a,3)}},W0=function(t){return q0((r=(e=t).s,{h:e.h,s:(r*=((i=e.l)<50?i:100-i)/100)>0?2*r/(i+r)*100:0,v:i+r,a:e.a}));var e,r,i},gl=function(t){return{h:(e=j0(t)).h,s:(s=(200-(r=e.s))*(i=e.v)/100)>0&&s<200?r*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,r,i,s},OL=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,LL=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,GL=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,DL=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zm={string:[[function(t){var e=UL.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Ct(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?Ct(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=GL.exec(t)||DL.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:N0({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=OL.exec(t)||LL.exec(t);if(!e)return null;var r,i,s=V0({h:(r=e[1],i=e[2],i===void 0&&(i="deg"),Number(r)*(kL[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return W0(s)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,i=t.b,s=t.a,o=s===void 0?1:s;return Ui(e)&&Ui(r)&&Ui(i)?N0({r:Number(e),g:Number(r),b:Number(i),a:Number(o)}):null},"rgb"],[function(t){var e=t.h,r=t.s,i=t.l,s=t.a,o=s===void 0?1:s;if(!Ui(e)||!Ui(r)||!Ui(i))return null;var n=V0({h:Number(e),s:Number(r),l:Number(i),a:Number(o)});return W0(n)},"hsl"],[function(t){var e=t.h,r=t.s,i=t.v,s=t.a,o=s===void 0?1:s;if(!Ui(e)||!Ui(r)||!Ui(i))return null;var n=function(a){return{h:Y0(a.h),s:Mr(a.s,0,100),v:Mr(a.v,0,100),a:Mr(a.a)}}({h:Number(e),s:Number(r),v:Number(i),a:Number(o)});return q0(n)},"hsv"]]},$0=function(t,e){for(var r=0;r<e.length;r++){var i=e[r][0](t);if(i)return[i,e[r][1]]}return[null,void 0]},NL=function(t){return typeof t=="string"?$0(t.trim(),Zm.string):typeof t=="object"&&t!==null?$0(t,Zm.object):[null,void 0]},qm=function(t,e){var r=gl(t);return{h:r.h,s:Mr(r.s+100*e,0,100),l:r.l,a:r.a}},Km=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},z0=function(t,e){var r=gl(t);return{h:r.h,s:r.s,l:Mr(r.l+100*e,0,100),a:r.a}},Qm=function(){function t(e){this.parsed=NL(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return Ct(Km(this.rgba),2)},t.prototype.isDark=function(){return Km(this.rgba)<.5},t.prototype.isLight=function(){return Km(this.rgba)>=.5},t.prototype.toHex=function(){return e=jm(this.rgba),r=e.r,i=e.g,s=e.b,n=(o=e.a)<1?Bh(Ct(255*o)):"","#"+Bh(r)+Bh(i)+Bh(s)+n;var e,r,i,s,o,n},t.prototype.toRgb=function(){return jm(this.rgba)},t.prototype.toRgbString=function(){return e=jm(this.rgba),r=e.r,i=e.g,s=e.b,(o=e.a)<1?"rgba("+r+", "+i+", "+s+", "+o+")":"rgb("+r+", "+i+", "+s+")";var e,r,i,s,o},t.prototype.toHsl=function(){return H0(gl(this.rgba))},t.prototype.toHslString=function(){return e=H0(gl(this.rgba)),r=e.h,i=e.s,s=e.l,(o=e.a)<1?"hsla("+r+", "+i+"%, "+s+"%, "+o+")":"hsl("+r+", "+i+"%, "+s+"%)";var e,r,i,s,o},t.prototype.toHsv=function(){return e=j0(this.rgba),{h:Ct(e.h),s:Ct(e.s),v:Ct(e.v),a:Ct(e.a,3)};var e},t.prototype.invert=function(){return mr({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),mr(qm(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),mr(qm(this.rgba,-e))},t.prototype.grayscale=function(){return mr(qm(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),mr(z0(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),mr(z0(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?mr({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):Ct(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=gl(this.rgba);return typeof e=="number"?mr({h:e,s:r.s,l:r.l,a:r.a}):Ct(r.h)},t.prototype.isEqual=function(e){return this.toHex()===mr(e).toHex()},t}(),mr=function(t){return t instanceof Qm?t:new Qm(t)},X0=[],Fh=function(t){t.forEach(function(e){X0.indexOf(e)<0&&(e(Qm,Zm),X0.push(e))})}});function kh(t,e){var r={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 r)i[r[s]]=s;var o={};t.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 u=this.toRgb(),h=1/0,d="black";if(!o.length)for(var f in r)o[f]=new t(r[f]).toRgb();for(var p in r){var m=(a=u,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<h&&(h=m,d=p)}return d}},e.string.push([function(n){var a=n.toLowerCase(),l=a==="transparent"?"#0000":r[a];return l?new t(l).toRgb():null},"name"])}var eg=T(()=>{});var on,me,Bt=T(()=>{Jm();eg();Fh([kh]);on=class xl{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}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(e){return this.value=e,this}set value(e){if(e instanceof xl)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,r){let i=typeof e;if(i!==typeof r)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===r;if(Array.isArray(e)&&Array.isArray(r)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(r))return e.length!==r.length?!1:e.every((o,n)=>o===r[n]);if(e!==null&&r!==null){let o=Object.keys(e),n=Object.keys(r);return o.length!==n.length?!1:o.every(a=>e[a]===r[a])}return e===r}toRgba(){let[e,r,i,s]=this._components;return{r:e,g:r,b:i,a:s}}toRgb(){let[e,r,i]=this._components;return{r:e,g:r,b:i}}toRgbaString(){let[e,r,i]=this.toUint8RgbArray();return`rgba(${e},${r},${i},${this.alpha})`}toUint8RgbArray(e){let[r,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(r*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);let[r,i,s,o]=this._components;return e[0]=r,e[1]=i,e[2]=s,e[3]=o,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);let[r,i,s]=this._components;return e[0]=r,e[1]=i,e[2]=s,e}toNumber(){return this._int}toBgrNumber(){let[e,r,i]=this.toUint8RgbArray();return(i<<16)+(r<<8)+e}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[r,i,s,o]=xl._temp.setValue(e)._components;return this._components[0]*=r,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(e,r=!0){return r&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,r=!0){if(e===1)return(255<<24)+this._int;if(e===0)return r?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return r&&(i=i*e+.5|0,s=s*e+.5|0,o=o*e+.5|0),(e*255<<24)+(i<<16)+(s<<8)+o}toHex(){let e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){let r=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-r.length)+r}setAlpha(e){return this._components[3]=this._clamp(e),this}_normalize(e){let r,i,s,o;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let n=e;r=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[r,i,s,o=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[r,i,s,o=255]=e,r/=255,i/=255,s/=255,o/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let a=xl.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}let n=mr(e);n.isValid()&&({r,g:i,b:s,a:o}=n.rgba,r/=255,i/=255,s/=255)}if(r!==void 0)this._components[0]=r,this._components[1]=i,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${e}`)}_refreshInt(){this._clamp(this._components);let[e,r,i]=this._components;this._int=(e*255<<16)+(r*255<<8)+(i*255|0)}_clamp(e,r=0,i=1){return typeof e=="number"?Math.min(Math.max(e,r),i):(e.forEach((s,o)=>{e[o]=Math.min(Math.max(s,r),i)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof xl||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}};on.shared=new on;on._temp=new on;on.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;me=on});var K0,Z0=T(()=>{"use strict";K0={cullArea:null,cullable:!1,cullableChildren:!0}});var Q0,J0,eT,tg=T(()=>{"use strict";Q0=Math.PI*2,J0=180/Math.PI,eT=Math.PI/180});var ve,rg,gr=T(()=>{"use strict";ve=class t{constructor(e=0,r=0){this.x=0,this.y=0,this.x=e,this.y=r}clone(){return new t(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,r=e){return this.x=e,this.y=r,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return rg.x=0,rg.y=0,rg}},rg=new ve});var V,VL,HL,Ae=T(()=>{tg();gr();V=class t{constructor(e=1,r=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=r,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,r,i,s,o,n){return this.a=e,this.b=r,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,r){this.array||(this.array=new Float32Array(9));let i=r||this.array;return e?(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(e,r){r=r||new ve;let i=e.x,s=e.y;return r.x=this.a*i+this.c*s+this.tx,r.y=this.b*i+this.d*s+this.ty,r}applyInverse(e,r){r=r||new ve;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),u=e.x,h=e.y;return r.x=n*c*u+-o*c*h+(l*o-a*n)*c,r.y=i*c*h+-s*c*u+(-l*i+a*s)*c,r}translate(e,r){return this.tx+=e,this.ty+=r,this}scale(e,r){return this.a*=e,this.d*=r,this.c*=e,this.b*=r,this.tx*=e,this.ty*=r,this}rotate(e){let r=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*r-this.b*i,this.b=s*i+this.b*r,this.c=o*r-this.d*i,this.d=o*i+this.d*r,this.tx=n*r-this.ty*i,this.ty=n*i+this.ty*r,this}append(e){let r=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*r+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*r+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*r+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}appendFrom(e,r){let i=e.a,s=e.b,o=e.c,n=e.d,a=e.tx,l=e.ty,c=r.a,u=r.b,h=r.c,d=r.d;return this.a=i*c+s*h,this.b=i*u+s*d,this.c=o*c+n*h,this.d=o*u+n*d,this.tx=a*c+l*h+r.tx,this.ty=a*u+l*d+r.ty,this}setTransform(e,r,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=e-(i*this.a+s*this.c),this.ty=r-(i*this.b+s*this.d),this}prepend(e){let r=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let i=this.a,s=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=r*e.a+this.ty*e.c+e.tx,this.ty=r*e.b+this.ty*e.d+e.ty,this}decompose(e){let r=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,r),c=Math.abs(a+l);return c<1e-5||Math.abs(Q0-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(r*r+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*r+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,r=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-r*i;return this.a=s/n,this.b=-r/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-r*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 e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.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 HL.identity()}static get shared(){return VL.identity()}},VL=new V,HL=new V});var Ft,Uh=T(()=>{"use strict";Ft=class t{constructor(e,r,i){this._x=r||0,this._y=i||0,this._observer=e}clone(e){return new t(e??this._observer,this._x,this._y)}set(e=0,r=e){return(this._x!==e||this._y!==r)&&(this._x=e,this._y=r,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}});function Te(t="default"){return ig[t]===void 0&&(ig[t]=-1),++ig[t]}var ig,kt=T(()=>{"use strict";ig={default:-1}});function J(t,e,r=3){if(tT[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
1
|
+
var EL=Object.create;var zm=Object.defineProperty;var AL=Object.getOwnPropertyDescriptor;var PL=Object.getOwnPropertyNames;var CL=Object.getPrototypeOf,RL=Object.prototype.hasOwnProperty;var T=(t,e)=>()=>(t&&(e=t(t=0)),e);var ce=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),O0=(t,e)=>{for(var r in e)zm(t,r,{get:e[r],enumerable:!0})},ML=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of PL(e))!RL.call(t,s)&&s!==r&&zm(t,s,{get:()=>e[s],enumerable:!(i=AL(e,s))||i.enumerable});return t};var Xs=(t,e,r)=>(r=t!=null?EL(CL(t)):{},ML(e||!t||!t.__esModule?zm(r,"default",{value:t,enumerable:!0}):r,t));var w,Xm,Mh,K,O=T(()=>{"use strict";w=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(w||{}),Xm=t=>{if(typeof t=="function"||typeof t=="object"&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={...typeof t.extension!="object"?{type:t.extension}:t.extension,ref:t}}if(typeof t=="object")t={...t};else throw new Error("Invalid extension type");return typeof t.type=="string"&&(t.type=[t.type]),t},Mh=(t,e)=>Xm(t).priority??e,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Xm).forEach(e=>{e.type.forEach(r=>this._removeHandlers[r]?.(e))}),this},add(...t){return t.map(Xm).forEach(e=>{e.type.forEach(r=>{let i=this._addHandlers,s=this._queue;i[r]?i[r]?.(e):(s[r]=s[r]||[],s[r]?.push(e))})}),this},handle(t,e,r){let i=this._addHandlers,s=this._removeHandlers;if(i[t]||s[t])throw new Error(`Extension type ${t} already has a handler`);i[t]=e,s[t]=r;let o=this._queue;return o[t]&&(o[t]?.forEach(n=>e(n)),delete o[t]),this},handleByMap(t,e){return this.handle(t,r=>{r.name&&(e[r.name]=r.ref)},r=>{r.name&&delete e[r.name]})},handleByNamedList(t,e,r=-1){return this.handle(t,i=>{e.findIndex(o=>o.name===i.name)>=0||(e.push({name:i.name,value:i.ref}),e.sort((o,n)=>Mh(n.value,r)-Mh(o.value,r)))},i=>{let s=e.findIndex(o=>o.name===i.name);s!==-1&&e.splice(s,1)})},handleByList(t,e,r=-1){return this.handle(t,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,o)=>Mh(o,r)-Mh(s,r)))},i=>{let s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})},mixin(t,...e){for(let r of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(r))}}});var G0=ce((n6,Ym)=>{"use strict";var BL=Object.prototype.hasOwnProperty,Kt="~";function ml(){}Object.create&&(ml.prototype=Object.create(null),new ml().__proto__||(Kt=!1));function FL(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function L0(t,e,r,i,s){if(typeof r!="function")throw new TypeError("The listener must be a function");var o=new FL(r,i||t,s),n=Kt?Kt+e:e;return t._events[n]?t._events[n].fn?t._events[n]=[t._events[n],o]:t._events[n].push(o):(t._events[n]=o,t._eventsCount++),t}function Ih(t,e){--t._eventsCount===0?t._events=new ml:delete t._events[e]}function Nt(){this._events=new ml,this._eventsCount=0}Nt.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)BL.call(r,i)&&e.push(Kt?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Nt.prototype.listeners=function(e){var r=Kt?Kt+e:e,i=this._events[r];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};Nt.prototype.listenerCount=function(e){var r=Kt?Kt+e:e,i=this._events[r];return i?i.fn?1:i.length:0};Nt.prototype.emit=function(e,r,i,s,o,n){var a=Kt?Kt+e:e;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,u,h;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,r),!0;case 3:return l.fn.call(l.context,r,i),!0;case 4:return l.fn.call(l.context,r,i,s),!0;case 5:return l.fn.call(l.context,r,i,s,o),!0;case 6:return l.fn.call(l.context,r,i,s,o,n),!0}for(h=1,u=new Array(c-1);h<c;h++)u[h-1]=arguments[h];l.fn.apply(l.context,u)}else{var d=l.length,f;for(h=0;h<d;h++)switch(l[h].once&&this.removeListener(e,l[h].fn,void 0,!0),c){case 1:l[h].fn.call(l[h].context);break;case 2:l[h].fn.call(l[h].context,r);break;case 3:l[h].fn.call(l[h].context,r,i);break;case 4:l[h].fn.call(l[h].context,r,i,s);break;default:if(!u)for(f=1,u=new Array(c-1);f<c;f++)u[f-1]=arguments[f];l[h].fn.apply(l[h].context,u)}}return!0};Nt.prototype.on=function(e,r,i){return L0(this,e,r,i,!1)};Nt.prototype.once=function(e,r,i){return L0(this,e,r,i,!0)};Nt.prototype.removeListener=function(e,r,i,s){var o=Kt?Kt+e:e;if(!this._events[o])return this;if(!r)return Ih(this,o),this;var n=this._events[o];if(n.fn)n.fn===r&&(!s||n.once)&&(!i||n.context===i)&&Ih(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==r||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Ih(this,o)}return this};Nt.prototype.removeAllListeners=function(e){var r;return e?(r=Kt?Kt+e:e,this._events[r]&&Ih(this,r)):(this._events=new ml,this._eventsCount=0),this};Nt.prototype.off=Nt.prototype.removeListener;Nt.prototype.addListener=Nt.prototype.on;Nt.prefixed=Kt;Nt.EventEmitter=Nt;typeof Ym<"u"&&(Ym.exports=Nt)});var D0,$e,Vt=T(()=>{D0=Xs(G0(),1),$e=D0.default});var kL,Ui,Ct,Mr,Y0,N0,jm,UL,Bh,j0,q0,V0,H0,W0,gl,OL,LL,GL,DL,Zm,$0,NL,qm,Km,z0,Qm,mr,X0,Fh,Jm=T(()=>{kL={grad:.9,turn:360,rad:360/(2*Math.PI)},Ui=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},Ct=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},Mr=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},Y0=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},N0=function(t){return{r:Mr(t.r,0,255),g:Mr(t.g,0,255),b:Mr(t.b,0,255),a:Mr(t.a)}},jm=function(t){return{r:Ct(t.r),g:Ct(t.g),b:Ct(t.b),a:Ct(t.a,3)}},UL=/^#([0-9a-f]{3,8})$/i,Bh=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},j0=function(t){var e=t.r,r=t.g,i=t.b,s=t.a,o=Math.max(e,r,i),n=o-Math.min(e,r,i),a=n?o===e?(r-i)/n:o===r?2+(i-e)/n:4+(e-r)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},q0=function(t){var e=t.h,r=t.s,i=t.v,s=t.a;e=e/360*6,r/=100,i/=100;var o=Math.floor(e),n=i*(1-r),a=i*(1-(e-o)*r),l=i*(1-(1-e+o)*r),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}},V0=function(t){return{h:Y0(t.h),s:Mr(t.s,0,100),l:Mr(t.l,0,100),a:Mr(t.a)}},H0=function(t){return{h:Ct(t.h),s:Ct(t.s),l:Ct(t.l),a:Ct(t.a,3)}},W0=function(t){return q0((r=(e=t).s,{h:e.h,s:(r*=((i=e.l)<50?i:100-i)/100)>0?2*r/(i+r)*100:0,v:i+r,a:e.a}));var e,r,i},gl=function(t){return{h:(e=j0(t)).h,s:(s=(200-(r=e.s))*(i=e.v)/100)>0&&s<200?r*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,r,i,s},OL=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,LL=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,GL=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,DL=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zm={string:[[function(t){var e=UL.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Ct(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?Ct(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=GL.exec(t)||DL.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:N0({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=OL.exec(t)||LL.exec(t);if(!e)return null;var r,i,s=V0({h:(r=e[1],i=e[2],i===void 0&&(i="deg"),Number(r)*(kL[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return W0(s)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,i=t.b,s=t.a,o=s===void 0?1:s;return Ui(e)&&Ui(r)&&Ui(i)?N0({r:Number(e),g:Number(r),b:Number(i),a:Number(o)}):null},"rgb"],[function(t){var e=t.h,r=t.s,i=t.l,s=t.a,o=s===void 0?1:s;if(!Ui(e)||!Ui(r)||!Ui(i))return null;var n=V0({h:Number(e),s:Number(r),l:Number(i),a:Number(o)});return W0(n)},"hsl"],[function(t){var e=t.h,r=t.s,i=t.v,s=t.a,o=s===void 0?1:s;if(!Ui(e)||!Ui(r)||!Ui(i))return null;var n=function(a){return{h:Y0(a.h),s:Mr(a.s,0,100),v:Mr(a.v,0,100),a:Mr(a.a)}}({h:Number(e),s:Number(r),v:Number(i),a:Number(o)});return q0(n)},"hsv"]]},$0=function(t,e){for(var r=0;r<e.length;r++){var i=e[r][0](t);if(i)return[i,e[r][1]]}return[null,void 0]},NL=function(t){return typeof t=="string"?$0(t.trim(),Zm.string):typeof t=="object"&&t!==null?$0(t,Zm.object):[null,void 0]},qm=function(t,e){var r=gl(t);return{h:r.h,s:Mr(r.s+100*e,0,100),l:r.l,a:r.a}},Km=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},z0=function(t,e){var r=gl(t);return{h:r.h,s:r.s,l:Mr(r.l+100*e,0,100),a:r.a}},Qm=function(){function t(e){this.parsed=NL(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return Ct(Km(this.rgba),2)},t.prototype.isDark=function(){return Km(this.rgba)<.5},t.prototype.isLight=function(){return Km(this.rgba)>=.5},t.prototype.toHex=function(){return e=jm(this.rgba),r=e.r,i=e.g,s=e.b,n=(o=e.a)<1?Bh(Ct(255*o)):"","#"+Bh(r)+Bh(i)+Bh(s)+n;var e,r,i,s,o,n},t.prototype.toRgb=function(){return jm(this.rgba)},t.prototype.toRgbString=function(){return e=jm(this.rgba),r=e.r,i=e.g,s=e.b,(o=e.a)<1?"rgba("+r+", "+i+", "+s+", "+o+")":"rgb("+r+", "+i+", "+s+")";var e,r,i,s,o},t.prototype.toHsl=function(){return H0(gl(this.rgba))},t.prototype.toHslString=function(){return e=H0(gl(this.rgba)),r=e.h,i=e.s,s=e.l,(o=e.a)<1?"hsla("+r+", "+i+"%, "+s+"%, "+o+")":"hsl("+r+", "+i+"%, "+s+"%)";var e,r,i,s,o},t.prototype.toHsv=function(){return e=j0(this.rgba),{h:Ct(e.h),s:Ct(e.s),v:Ct(e.v),a:Ct(e.a,3)};var e},t.prototype.invert=function(){return mr({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),mr(qm(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),mr(qm(this.rgba,-e))},t.prototype.grayscale=function(){return mr(qm(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),mr(z0(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),mr(z0(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?mr({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):Ct(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=gl(this.rgba);return typeof e=="number"?mr({h:e,s:r.s,l:r.l,a:r.a}):Ct(r.h)},t.prototype.isEqual=function(e){return this.toHex()===mr(e).toHex()},t}(),mr=function(t){return t instanceof Qm?t:new Qm(t)},X0=[],Fh=function(t){t.forEach(function(e){X0.indexOf(e)<0&&(e(Qm,Zm),X0.push(e))})}});function kh(t,e){var r={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 r)i[r[s]]=s;var o={};t.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 u=this.toRgb(),h=1/0,d="black";if(!o.length)for(var f in r)o[f]=new t(r[f]).toRgb();for(var p in r){var m=(a=u,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<h&&(h=m,d=p)}return d}},e.string.push([function(n){var a=n.toLowerCase(),l=a==="transparent"?"#0000":r[a];return l?new t(l).toRgb():null},"name"])}var eg=T(()=>{});var on,me,Bt=T(()=>{Jm();eg();Fh([kh]);on=class xl{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}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(e){return this.value=e,this}set value(e){if(e instanceof xl)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,r){let i=typeof e;if(i!==typeof r)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===r;if(Array.isArray(e)&&Array.isArray(r)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(r))return e.length!==r.length?!1:e.every((o,n)=>o===r[n]);if(e!==null&&r!==null){let o=Object.keys(e),n=Object.keys(r);return o.length!==n.length?!1:o.every(a=>e[a]===r[a])}return e===r}toRgba(){let[e,r,i,s]=this._components;return{r:e,g:r,b:i,a:s}}toRgb(){let[e,r,i]=this._components;return{r:e,g:r,b:i}}toRgbaString(){let[e,r,i]=this.toUint8RgbArray();return`rgba(${e},${r},${i},${this.alpha})`}toUint8RgbArray(e){let[r,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(r*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);let[r,i,s,o]=this._components;return e[0]=r,e[1]=i,e[2]=s,e[3]=o,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);let[r,i,s]=this._components;return e[0]=r,e[1]=i,e[2]=s,e}toNumber(){return this._int}toBgrNumber(){let[e,r,i]=this.toUint8RgbArray();return(i<<16)+(r<<8)+e}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[r,i,s,o]=xl._temp.setValue(e)._components;return this._components[0]*=r,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(e,r=!0){return r&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,r=!0){if(e===1)return(255<<24)+this._int;if(e===0)return r?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return r&&(i=i*e+.5|0,s=s*e+.5|0,o=o*e+.5|0),(e*255<<24)+(i<<16)+(s<<8)+o}toHex(){let e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){let r=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-r.length)+r}setAlpha(e){return this._components[3]=this._clamp(e),this}_normalize(e){let r,i,s,o;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let n=e;r=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[r,i,s,o=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[r,i,s,o=255]=e,r/=255,i/=255,s/=255,o/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let a=xl.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}let n=mr(e);n.isValid()&&({r,g:i,b:s,a:o}=n.rgba,r/=255,i/=255,s/=255)}if(r!==void 0)this._components[0]=r,this._components[1]=i,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${e}`)}_refreshInt(){this._clamp(this._components);let[e,r,i]=this._components;this._int=(e*255<<16)+(r*255<<8)+(i*255|0)}_clamp(e,r=0,i=1){return typeof e=="number"?Math.min(Math.max(e,r),i):(e.forEach((s,o)=>{e[o]=Math.min(Math.max(s,r),i)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof xl||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}};on.shared=new on;on._temp=new on;on.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;me=on});var K0,Z0=T(()=>{"use strict";K0={cullArea:null,cullable:!1,cullableChildren:!0}});var Q0,J0,eT,tg=T(()=>{"use strict";Q0=Math.PI*2,J0=180/Math.PI,eT=Math.PI/180});var ve,rg,gr=T(()=>{"use strict";ve=class t{constructor(e=0,r=0){this.x=0,this.y=0,this.x=e,this.y=r}clone(){return new t(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,r=e){return this.x=e,this.y=r,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return rg.x=0,rg.y=0,rg}},rg=new ve});var V,VL,HL,Ae=T(()=>{tg();gr();V=class t{constructor(e=1,r=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=r,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,r,i,s,o,n){return this.a=e,this.b=r,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,r){this.array||(this.array=new Float32Array(9));let i=r||this.array;return e?(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(e,r){r=r||new ve;let i=e.x,s=e.y;return r.x=this.a*i+this.c*s+this.tx,r.y=this.b*i+this.d*s+this.ty,r}applyInverse(e,r){r=r||new ve;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),u=e.x,h=e.y;return r.x=n*c*u+-o*c*h+(l*o-a*n)*c,r.y=i*c*h+-s*c*u+(-l*i+a*s)*c,r}translate(e,r){return this.tx+=e,this.ty+=r,this}scale(e,r){return this.a*=e,this.d*=r,this.c*=e,this.b*=r,this.tx*=e,this.ty*=r,this}rotate(e){let r=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*r-this.b*i,this.b=s*i+this.b*r,this.c=o*r-this.d*i,this.d=o*i+this.d*r,this.tx=n*r-this.ty*i,this.ty=n*i+this.ty*r,this}append(e){let r=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*r+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*r+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*r+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}appendFrom(e,r){let i=e.a,s=e.b,o=e.c,n=e.d,a=e.tx,l=e.ty,c=r.a,u=r.b,h=r.c,d=r.d;return this.a=i*c+s*h,this.b=i*u+s*d,this.c=o*c+n*h,this.d=o*u+n*d,this.tx=a*c+l*h+r.tx,this.ty=a*u+l*d+r.ty,this}setTransform(e,r,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=e-(i*this.a+s*this.c),this.ty=r-(i*this.b+s*this.d),this}prepend(e){let r=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let i=this.a,s=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=r*e.a+this.ty*e.c+e.tx,this.ty=r*e.b+this.ty*e.d+e.ty,this}decompose(e){let r=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,r),c=Math.abs(a+l);return c<1e-5||Math.abs(Q0-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(r*r+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*r+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,r=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-r*i;return this.a=s/n,this.b=-r/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-r*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 e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.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 HL.identity()}static get shared(){return VL.identity()}},VL=new V,HL=new V});var Ft,Uh=T(()=>{"use strict";Ft=class t{constructor(e,r,i){this._x=r||0,this._y=i||0,this._observer=e}clone(e){return new t(e??this._observer,this._x,this._y)}set(e=0,r=e){return(this._x!==e||this._y!==r)&&(this._x=e,this._y=r,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}});function Te(t="default"){return ig[t]===void 0&&(ig[t]=-1),++ig[t]}var ig,kt=T(()=>{"use strict";ig={default:-1}});function J(t,e,r=3){if(tT[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
2
2
|
Deprecated since v${t}`):(i=i.split(`
|
|
3
3
|
`).splice(r).join(`
|
|
4
4
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}
|
|
5
5
|
Deprecated since v${t}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
6
|
-
Deprecated since v${t}`),console.warn(i))),tT[e]=!0}var tT,ue,rT,tt=T(()=>{"use strict";tT={},ue="8.0.0",rT="8.3.4"});var Ys,sg=T(()=>{"use strict";Ys=class{constructor(e,r){this._pool=[],this._count=0,this._index=0,this._classType=e,r&&this.prepopulate(r)}prepopulate(e){for(let r=0;r<e;r++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){let r;return this._index>0?r=this._pool[--this._index]:r=new this._classType,r.init?.(e),r}return(e){e.reset?.(),this._pool[this._index++]=e}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 og,fe,Zt=T(()=>{sg();og=class{constructor(){this._poolsByClass=new Map}prepopulate(e,r){this.getPool(e).prepopulate(r)}get(e,r){return this.getPool(e).get(r)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new Ys(e)),this._poolsByClass.get(e)}stats(){let e={};return this._poolsByClass.forEach(r=>{let i=e[r._classType.name]?r._classType.name+r._classType.ID:r._classType.name;e[i]={free:r.totalFree,used:r.totalUsed,size:r.totalSize}}),e}},fe=new og});var iT,sT=T(()=>{tt();iT={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(t){typeof t=="boolean"&&t===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(t===!0?{}:t))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){J("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}}});function Oh(t,e,r){let i=t.length,s;if(e>=i||r===0)return;r=e+r>i?i-e:r;let o=i-r;for(s=e;s<o;++s)t[s]=t[s+r];t.length=o}var ng=T(()=>{"use strict"});var oT,nT=T(()=>{ng();tt();oT={allowChildren:!0,removeChildren(t=0,e){let r=e??this.children.length,i=r-t,s=[];if(i>0&&i<=r){for(let n=r-1;n>=t;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Oh(this.children,t,r);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(t){let e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){let e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||J(ue,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:r}=this;if(e<0||e>r.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${r.length}`);if(t.parent){let s=t.parent.children.indexOf(t);if(t.parent===this&&s===e)return t;s!==-1&&t.parent.children.splice(s,1)}e===r.length?r.push(t):r.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(t),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",t,this,e),t.emit("added",this),t},swapChildren(t,e){if(t===e)return;let r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=t;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...t){return t.length===1?this.reparentChildAt(t[0],this.children.length):(t.forEach(e=>this.reparentChildAt(e,this.children.length)),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;let r=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);let i=this.worldTransform.clone();return i.invert(),r.prepend(i),t.setFromMatrix(r),t}}});var aT,lT=T(()=>{"use strict";aT={collectRenderables(t,e,r){this.parentRenderLayer&&this.parentRenderLayer!==r||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,r):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,r))},collectRenderablesSimple(t,e,r){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(t,e,r)},collectRenderablesWithEffects(t,e,r){let{renderPipes:i}=e;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,t)}this.collectRenderablesSimple(t,e,r);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,t)}}}});var Oi,Lh=T(()=>{"use strict";Oi=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}});var ag,Gh,cT=T(()=>{O();Zt();ag=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let r=0;r<this._tests.length;r++){let i=this._tests[r];if(i.test(e))return fe.get(i.maskClass,e)}return e}returnMaskEffect(e){fe.return(e)}},Gh=new ag;K.handleByList(w.MaskEffect,Gh._effectClasses)});var uT,hT=T(()=>{Lh();cT();uT={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){this.effects.indexOf(t)===-1&&(this.effects.push(t),this.effects.sort((r,i)=>r.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){let e=this.effects.indexOf(t);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){let e=this._maskEffect;e?.mask!==t&&(e&&(this.removeEffect(e),Gh.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=Gh.getMaskEffect(t),this.addEffect(this._maskEffect)))},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(t){!Array.isArray(t)&&t&&(t=[t]);let e=this._filterEffect||(this._filterEffect=new Oi);t=t;let r=t?.length>0,i=e.filters?.length>0,s=r!==i;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),s&&(r?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){return this._filterEffect?.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new Oi),this._filterEffect.filterArea=t},get filterArea(){return this._filterEffect?.filterArea}}});var dT,fT=T(()=>{tt();dT={label:null,get name(){return J(ue,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){J(ue,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){let r=this.children;for(let i=0;i<r.length;i++){let s=r[i];if(s.label===t||t instanceof RegExp&&t.test(s.label))return s}if(e)for(let i=0;i<r.length;i++){let o=r[i].getChildByLabel(t,!0);if(o)return o}return null},getChildrenByLabel(t,e=!1,r=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===t||t instanceof RegExp&&t.test(o.label))&&r.push(o)}if(e)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(t,!0,r);return r}}});var Dh,te,vt=T(()=>{gr();Dh=[new ve,new ve,new ve,new ve],te=class t{constructor(e=0,r=0,i=0,s=0){this.type="rectangle",this.x=Number(e),this.y=Number(r),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 t(0,0,0,0)}clone(){return new t(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,r){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height}strokeContains(e,r,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),u=i-c,h=a-c,d=a+o+c,f=l-c,p=l+n+c,m=a+u,x=a+o-u,v=l+u,y=l+n-u;return e>=h&&e<=d&&r>=f&&r<=p&&!(e>m&&e<x&&r>v&&r<y)}intersects(e,r){if(!r){let P=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=P)return!1;let M=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>M}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Dh[0].set(e.left,e.top),l=Dh[1].set(e.left,e.bottom),c=Dh[2].set(e.right,e.top),u=Dh[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(r.a*r.d-r.b*r.c);if(h===0||(r.apply(a,a),r.apply(l,l),r.apply(c,c),r.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=i||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=o||Math.min(a.y,l.y,c.y,u.y)>=n))return!1;let d=h*(l.y-a.y),f=h*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,x=d*i+f*n,v=d*s+f*n;if(Math.max(p,m,x,v)<=d*a.x+f*a.y||Math.min(p,m,x,v)>=d*u.x+f*u.y)return!1;let y=h*(a.y-c.y),g=h*(c.x-a.x),b=y*i+g*o,_=y*s+g*o,S=y*i+g*n,E=y*s+g*n;return!(Math.max(b,_,S,E)<=y*a.x+g*a.y||Math.min(b,_,S,E)>=y*u.x+g*u.y)}pad(e=0,r=e){return this.x-=e,this.y-=r,this.width+=e*2,this.height+=r*2,this}fit(e){let r=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=r,this.width=Math.max(i-r,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,r=.001){let i=Math.ceil((this.x+this.width-r)*e)/e,s=Math.ceil((this.y+this.height-r)*e)/e;return this.x=Math.floor((this.x+r)*e)/e,this.y=Math.floor((this.y+r)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let r=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=r,this.width=i-r,this.y=s,this.height=o-s,this}getBounds(e){return e||(e=new t),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;let r=e.x,i=e.y,s=e.x+e.width,o=e.y+e.height;return r>=this.x&&r<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 pT,De,ar=T(()=>{Ae();vt();pT=new V,De=class t{constructor(e=1/0,r=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=pT,this.minX=e,this.minY=r,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new te);let e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=pT,this}set(e,r,i,s){this.minX=e,this.minY=r,this.maxX=i,this.maxY=s}addFrame(e,r,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,c=o.d,u=o.tx,h=o.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,x=n*e+l*r+u,v=a*e+c*r+h;x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),x=n*i+l*r+u,v=a*i+c*r+h,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),x=n*e+l*s+u,v=a*e+c*s+h,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),x=n*i+l*s+u,v=a*i+c*s+h,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(e,r){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,r)}addBounds(e,r){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,r)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){let r=this.minX,i=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:c,tx:u,ty:h}=e,d=n*r+l*i+u,f=a*r+c*i+h;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+l*i+u,f=a*s+c*i+h,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*r+l*o+u,f=a*r+c*o+h,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+u,f=a*s+c*o+h,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(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,r,i,s){return this.minX<e&&(this.minX=e),this.maxX>r&&(this.maxX=r),this.minY<i&&(this.minY=i),this.maxY>s&&(this.maxY=s),this}pad(e,r=e){return this.minX-=e,this.maxX+=e,this.minY-=r,this.maxY+=r,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 t(this.minX,this.minY,this.maxX,this.maxY)}scale(e,r=e){return this.minX*=e,this.minY*=r,this.maxX*=e,this.maxY*=r,this}get x(){return this.minX}set x(e){let r=this.maxX-this.minX;this.minX=e,this.maxX=e+r}get y(){return this.minY}set y(e){let r=this.maxY-this.minY;this.minY=e,this.maxY=e+r}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}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(e,r,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let c=s.a,u=s.b,h=s.c,d=s.d,f=s.tx,p=s.ty;for(let m=r;m<i;m+=2){let x=e[m],v=e[m+1],y=c*x+h*v+f,g=u*x+d*v+p;o=y<o?y:o,n=g<n?g:n,a=y>a?y:a,l=g>l?g:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}containsPoint(e,r){return this.minX<=e&&this.minY<=r&&this.maxX>=e&&this.maxY>=r}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}});var mt,xr,js=T(()=>{Ae();sg();ar();mt=new Ys(V),xr=new Ys(De)});var WL,mT,gT=T(()=>{Ae();ar();js();WL=new V,mT={getFastGlobalBounds(t,e){e||(e=new De),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);let r=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(r.worldTransform),e},_getGlobalBoundsRecursive(t,e,r){let i=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==r||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=xr.get().clear()),this.boundsArea)e.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(t,i,r)}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(WL).invert()),e.addBounds(i,this.relativeGroupTransform)),e.addBounds(i),xr.return(i)}else this.renderGroup&&(e.addBounds(i,this.relativeGroupTransform),xr.return(i))}}});function nn(t,e,r){r.clear();let i,s;return t.parent?e?i=t.parent.worldTransform:(s=mt.get().identity(),i=Nh(t,s)):i=V.IDENTITY,xT(t,r,i,e),s&&mt.return(s),r.isValid||r.set(0,0,0,0),r}function xT(t,e,r,i){if(!t.visible||!t.measurable)return;let s;i?s=t.worldTransform:(t.updateLocalTransform(),s=mt.get(),s.appendFrom(t.localTransform,r));let o=e,n=!!t.effects.length;if(n&&(e=xr.get().clear()),t.boundsArea)e.addRect(t.boundsArea,s);else{t.bounds&&(e.matrix=s,e.addBounds(t.bounds));for(let a=0;a<t.children.length;a++)xT(t.children[a],e,s,i)}if(n){for(let a=0;a<t.effects.length;a++)t.effects[a].addBounds?.(e);o.addBounds(e,V.IDENTITY),xr.return(e)}i||mt.return(s)}function Nh(t,e){let r=t.parent;return r&&(Nh(r,e),r.updateLocalTransform(),e.append(r.localTransform)),e}var yl=T(()=>{Ae();js()});function Vh(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;let r=t>>16&255,i=t>>8&255,s=t&255,o=e>>16&255,n=e>>8&255,a=e&255,l=r*o/255|0,c=i*n/255|0,u=s*a/255|0;return(l<<16)+(c<<8)+u}var lg=T(()=>{"use strict"});function an(t,e){return t===yT?e:e===yT?t:Vh(t,e)}var yT,cg=T(()=>{lg();yT=16777215});function _l(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}var _T,bT=T(()=>{yl();js();cg();_T={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,r=this.parent;for(;r;)e*=r.alpha,r=r.parent;return e},getGlobalTransform(t,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();let r=Nh(this,mt.get().identity());return t.appendFrom(this.localTransform,r),mt.return(r),t},getGlobalTint(t){if(t)return this.renderGroup?_l(this.renderGroup.worldColor):this.parentRenderGroup?_l(an(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,r=this.parent;for(;r;)e=an(e,r.localColor),r=r.parent;return _l(e)}}});function Z(...t){ug!==vT&&(ug++,ug===vT?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}var ug,vT,Ne=T(()=>{"use strict";ug=0,vT=500});function ln(t,e,r){return e.clear(),r||(r=V.IDENTITY),TT(t,e,r,t,!0),e.isValid||e.set(0,0,0,0),e}function TT(t,e,r,i,s){let o;if(s)o=mt.get(),o=r.copyTo(o);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();let l=t.localTransform;o=mt.get(),o.appendFrom(l,r)}let n=e,a=!!t.effects.length;if(a&&(e=xr.get().clear()),t.boundsArea)e.addRect(t.boundsArea,o);else{t.renderPipeId&&(e.matrix=o,e.addBounds(t.bounds));let l=t.children;for(let c=0;c<l.length;c++)TT(l[c],e,o,i,!1)}if(a){for(let l=0;l<t.effects.length;l++)t.effects[l].addLocalBounds?.(e,i);n.addBounds(e,V.IDENTITY),xr.return(e)}mt.return(o)}var Hh=T(()=>{Ae();js()});function hg(t,e){let r=t.children;for(let i=0;i<r.length;i++){let s=r[i],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=e.index;(e.data[a]!==o||e.data[a+1]!==n)&&(e.data[e.index]=o,e.data[e.index+1]=n,e.didChange=!0),e.index=a+2,s.children.length&&hg(s,e)}return e.didChange}var ST=T(()=>{"use strict"});var $L,wT,ET=T(()=>{Ae();ar();yl();Hh();ST();$L=new V,wT={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){let r=Math.sign(this.scale.x)||1;e!==0?this.scale.x=t/e*r:this.scale.x=r},_setHeight(t,e){let r=Math.sign(this.scale.y)||1;e!==0?this.scale.y=t/e*r:this.scale.y=r},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new De});let t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),hg(this,t),t.didChange&&ln(this,t.localBounds,$L),t.localBounds},getBounds(t,e){return nn(this,t,e||new De)}}});var AT,PT=T(()=>{"use strict";AT={_onRender:null,set onRender(t){let e=this.renderGroup||this.parentRenderGroup;if(!t){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}}});function zL(t,e){return t._zIndex-e._zIndex}var CT,RT=T(()=>{"use strict";CT={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,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(zL))}}});var MT,IT=T(()=>{gr();js();MT={getGlobalPosition(t=new ve,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,r=!1){let i=this.getGlobalTransform(mt.get(),r);return e=i.apply(t,e),mt.return(i),e},toLocal(t,e,r,i){e&&(t=e.toGlobal(t,r,i));let s=this.getGlobalTransform(mt.get(),i);return r=s.applyInverse(t,r),mt.return(s),r}}});var cn,dg=T(()=>{kt();cn=class{constructor(){this.uid=Te("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function Li(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function fg(t){return!(t&t-1)&&!!t}var bl=T(()=>{"use strict"});function Wh(t){let e={};for(let r in t)t[r]!==void 0&&(e[r]=t[r]);return e}var pg=T(()=>{"use strict"});function XL(t){let e=BT[t];return e===void 0&&(BT[t]=Te("resource")),e}var BT,FT,$h,mg=T(()=>{Vt();kt();tt();BT=Object.create(null);FT=class kT extends We{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...kT.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){J(ue,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,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 e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=XL(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};FT.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};$h=FT});var UT,Re,Qt=T(()=>{Vt();bl();pg();kt();mg();UT=class OT extends We{constructor(e={}){super(),this.options=e,this.uid=Te("textureSource"),this._resourceType="textureSource",this._resourceId=Te("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,e={...OT.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.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=e.format,this.dimension=e.dimensions,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new $h(Wh(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._style?.off("change",this._onStyleChange,this),this._style=e,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))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=Te("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){let{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,r,i){i||(i=this._resolution),e||(e=this.width),r||(r=this.height);let s=Math.round(e*i),o=Math.round(r*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=Te("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=fg(this.pixelWidth)&&fg(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};UT.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};Re=UT});function YL(){for(let t=0;t<16;t++){let e=[];gg.push(e);for(let r=0;r<16;r++){let i=zh(qs[t]*qs[r]+Zs[t]*Ks[r]),s=zh(Ks[t]*qs[r]+Qs[t]*Ks[r]),o=zh(qs[t]*Zs[r]+Zs[t]*Qs[r]),n=zh(Ks[t]*Zs[r]+Qs[t]*Qs[r]);for(let a=0;a<16;a++)if(qs[a]===i&&Ks[a]===s&&Zs[a]===o&&Qs[a]===n){e.push(a);break}}}for(let t=0;t<16;t++){let e=new V;e.set(qs[t],Ks[t],Zs[t],Qs[t],0,0),LT.push(e)}}var qs,Ks,Zs,Qs,gg,LT,zh,rt,GT=T(()=>{Ae();qs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ks=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Zs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Qs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],gg=[],LT=[],zh=Math.sign;YL();rt={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:t=>qs[t],uY:t=>Ks[t],vX:t=>Zs[t],vY:t=>Qs[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>gg[t][e],sub:(t,e)=>gg[t][rt.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?rt.S:rt.N:Math.abs(e)*2<=Math.abs(t)?t>0?rt.E:rt.W:e>0?t>0?rt.SE:rt.SW:t>0?rt.NE:rt.NW,matrixAppendRotationInv:(t,e,r=0,i=0)=>{let s=LT[rt.inv(e)];s.tx=r,s.ty=i,t.append(s)}}});var xg,DT=T(()=>{"use strict";xg=()=>{}});var Js,yg=T(()=>{O();Qt();Js=class extends Re{constructor(e){let r=e.resource||new Float32Array(e.width*e.height*4),i=e.format;i||(r instanceof Float32Array?i="rgba32float":r instanceof Int32Array||r instanceof Uint32Array?i="rgba32uint":r instanceof Int16Array||r instanceof Uint16Array?i="rgba16uint":(r instanceof Int8Array,i="bgra8unorm")),super({...e,resource:r,format:i}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}};Js.extension=w.TextureSource});var NT,un,_g=T(()=>{Ae();NT=new V,un=class{constructor(e,r){this.mapCoord=new V,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof r>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=r,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){this.texture!==e&&(this._texture?.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(e,r){r===void 0&&(r=e);let i=this.mapCoord;for(let s=0;s<e.length;s+=2){let o=e[s],n=e[s+1];r[s]=o*i.a+n*i.c+i.tx,r[s+1]=o*i.b+n*i.d+i.ty}return r}update(){let e=this._texture;this._updateID++;let r=e.uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);let i=e.orig,s=e.trim;s&&(NT.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(NT));let o=e.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return n[0]=(e.frame.x+a+l)/o.width,n[1]=(e.frame.y+a+l)/o.height,n[2]=(e.frame.x+e.frame.width-a+l)/o.width,n[3]=(e.frame.y+e.frame.height-a+l)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=e.frame.width===o.width&&e.frame.height===o.height&&e.rotate===0,!0}}});var B,Fe=T(()=>{Vt();GT();vt();kt();tt();DT();yg();Qt();_g();B=class extends We{constructor({source:e,label:r,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=Te("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new te,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=r,this.source=e?.source??new Re,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:u,height:h}=this._source;this.frame.width=u,this.frame.height=h}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(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new un(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:e,frame:r}=this,{width:i,height:s}=this._source,o=r.x/i,n=r.y/s,a=r.width/i,l=r.height/s,c=this.rotate;if(c){let u=a/2,h=l/2,d=o+u,f=n+h;c=rt.add(c,rt.NW),e.x0=d+u*rt.uX(c),e.y0=f+h*rt.uY(c),c=rt.add(c,2),e.x1=d+u*rt.uX(c),e.y1=f+h*rt.uY(c),c=rt.add(c,2),e.x2=d+u*rt.uX(c),e.y2=f+h*rt.uY(c),c=rt.add(c,2),e.x3=d+u*rt.uX(c),e.y3=f+h*rt.uY(c)}else e.x0=o,e.y0=n,e.x1=o+a,e.y1=n,e.x2=o+a,e.y2=n+l,e.x3=o,e.y3=n+l}destroy(e=!1){this._source&&e&&(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 J(ue,"Texture.baseTexture is now Texture.source"),this._source}};B.EMPTY=new B({label:"EMPTY",source:new Re({label:"EMPTY"})});B.EMPTY.destroy=xg;B.WHITE=new B({source:new Js({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});B.WHITE.destroy=xg});var jL,bg,Ve,ui=T(()=>{bl();Qt();Fe();jL=0,bg=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,r,i){let s=new Re({...this.textureOptions,width:e,height:r,resolution:1,antialias:i,autoGarbageCollect:!1});return new B({source:s,label:`texturePool_${jL++}`})}getOptimalTexture(e,r,i=1,s){let o=Math.ceil(e*i-1e-6),n=Math.ceil(r*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=e,l.frame.height=r,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(e,r=!1){let i=e.source;return this.getOptimalTexture(e.width,e.height,i._resolution,r)}returnTexture(e){let r=this._poolKeyHash[e.uid];this._texturePool[r].push(e)}clear(e){if(e=e!==!1,e)for(let r in this._texturePool){let i=this._texturePool[r];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},Ve=new bg});var Xh,VT=T(()=>{Ae();dg();ui();Xh=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new V,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 cn,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;let r=e.children;for(let i=0;i<r.length;i++){let s=r[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Ve.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let e in this.childrenToUpdate){let r=this.childrenToUpdate[e];r.list.fill(null),r.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(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){let r=this.renderGroupChildren.indexOf(e);r>-1&&this.renderGroupChildren.splice(r,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);let r=e.children;for(let i=0;i<r.length;i++)this.addChild(r[i])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}let r=e.children;for(let i=0;i<r.length;i++)this.removeChild(r[i])}removeChildren(e){for(let r=0;r<e.length;r++)this.removeChild(e[r])}onChildUpdate(e){let r=this.childrenToUpdate[e.relativeRenderGroupDepth];r||(r=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),r.list[r.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let r=0;r<this._onRenderContainers.length;r++)this._onRenderContainers[r]._onRender(e)}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(e=[]){let r=this.root.children;for(let i=0;i<r.length;i++)this._getChildren(r[i],e);return e}_getChildren(e,r=[]){if(r.push(e),e.renderGroup)return r;let i=e.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],r);return r}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new V),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new V),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 e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new V),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function HT(t,e,r={}){for(let i in e)!r[i]&&e[i]!==void 0&&(t[i]=e[i])}var WT=T(()=>{"use strict"});var vg,Tg,Sg,hn,vl,eo,ie,Yr=T(()=>{Vt();Bt();Z0();O();Ae();tg();Uh();kt();tt();Zt();sT();nT();lT();hT();fT();gT();bT();ET();PT();RT();IT();VT();WT();vg=new Ft(null),Tg=new Ft(null),Sg=new Ft(null,1,1),hn=1,vl=2,eo=4,ie=class t extends We{constructor(e={}){super(),this.uid=Te("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 V,this.relativeGroupTransform=new V,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ft(this,0,0),this._scale=Sg,this._pivot=Tg,this._skew=vg,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=[],HT(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(r=>this.addChild(r)),e.parent?.addChild(this)}static mixin(e){J("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),K.mixin(t,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||J(ue,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let s=0;s<e.length;s++)this.addChild(e[s]);return e[0]}let r=e[0],i=this.renderGroup||this.parentRenderGroup;return r.parent===this?(this.children.splice(this.children.indexOf(r),1),this.children.push(r),i&&(i.structureDidChange=!0),r):(r.parent&&r.parent.removeChild(r),this.children.push(r),this.sortableChildren&&(this.sortDirty=!0),r.parent=this,r.didChange=!0,r._updateFlags=15,i&&i.addChild(r),this.emit("childAdded",r,this,this.children.length-1),r.emit("added",this),this._didViewChangeTick++,r._zIndex!==0&&r.depthOfChildModified(),r)}removeChild(...e){if(e.length>1){for(let s=0;s<e.length;s++)this.removeChild(e[s]);return e[0]}let r=e[0],i=this.children.indexOf(r);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(r):this.parentRenderGroup&&this.parentRenderGroup.removeChild(r),r.parentRenderLayer&&r.parentRenderLayer.detach(r),r.parent=null,this.emit("childRemoved",r,this,i),r.emit("removed",this)),r}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=fe.get(Xh,this),this.groupTransform=V.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),fe.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new V),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(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*J0}set angle(e){this.rotation=e*eT}get pivot(){return this._pivot===Tg&&(this._pivot=new Ft(this,0,0)),this._pivot}set pivot(e){this._pivot===Tg&&(this._pivot=new Ft(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===vg&&(this._skew=new Ft(this,0,0)),this._skew}set skew(e){this._skew===vg&&(this._skew=new Ft(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Sg&&(this._scale=new Ft(this,1,1)),this._scale}set scale(e){this._scale===Sg&&(this._scale=new Ft(this,0,0)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let r=this.getLocalBounds().width;this._setWidth(e,r)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let r=this.getLocalBounds().height;this._setHeight(e,r)}getSize(e){e||(e={});let r=this.getLocalBounds();return e.width=Math.abs(this.scale.x*r.width),e.height=Math.abs(this.scale.y*r.height),e}setSize(e,r){let i=this.getLocalBounds();typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,i.width),r!==void 0&&this._setHeight(r,i.height)}_updateSkew(){let e=this._rotation,r=this._skew;this._cx=Math.cos(e+r._y),this._sx=Math.sin(e+r._y),this._cy=-Math.sin(e-r._x),this._sy=Math.cos(e-r._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;let r=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,c=s._y;r.a=this._cx*n,r.b=this._sx*n,r.c=this._cy*a,r.d=this._sy*a,r.tx=o._x-(l*r.a+c*r.c),r.ty=o._y-(l*r.b+c*r.d)}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=hn,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let i=me.shared.setValue(e??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=hn,this._onUpdate())}get tint(){return _l(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=vl,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let r=e?2:0;(this.localDisplayStatus&2)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=eo,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let r=e?0:4;(this.localDisplayStatus&4)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=eo,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let r=e?1:0;(this.localDisplayStatus&1)!==r&&(this._updateFlags|=eo,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0;let r;if(this.children.length&&(r=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 e=="boolean"?e:e?.children)&&r)for(let s=0;s<r.length;++s)r[s].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}};K.mixin(ie,oT,mT,MT,AT,wT,uT,dT,CT,K0,iT,_T,aT)});var ls,Yh=T(()=>{gr();ls=class t{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=t.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ve,this.page=new ve,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}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(e,r,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,r,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 qL(t){return function(e){return e.test(t)}}function cs(t){var e={userAgent:"",platform:"",maxTouchPoints:0};!t&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof t=="string"?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0});var r=e.userAgent,i=r.split("[FBAN");typeof i[1]<"u"&&(r=i[0]),i=r.split("Twitter"),typeof i[1]<"u"&&(r=i[0]);var s=qL(r),o={apple:{phone:s(wg)&&!s(Gi),ipod:s($T),tablet:!s(wg)&&(s(zT)||eS(e))&&!s(Gi),universal:s(XT),device:(s(wg)||s($T)||s(zT)||s(XT)||eS(e))&&!s(Gi)},amazon:{phone:s(dn),tablet:!s(dn)&&s(jh),device:s(dn)||s(jh)},android:{phone:!s(Gi)&&s(dn)||!s(Gi)&&s(Eg),tablet:!s(Gi)&&!s(dn)&&!s(Eg)&&(s(jh)||s(YT)),device:!s(Gi)&&(s(dn)||s(jh)||s(Eg)||s(YT))||s(/\bokhttp\b/i)},windows:{phone:s(Gi),tablet:s(jT),device:s(Gi)||s(jT)},other:{blackberry:s(qT),blackberry10:s(KT),opera:s(ZT),firefox:s(JT),chrome:s(QT),device:s(qT)||s(KT)||s(ZT)||s(JT)||s(QT)},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 wg,$T,zT,XT,Eg,YT,dn,jh,Gi,jT,qT,KT,ZT,QT,JT,eS,Ag=T(()=>{wg=/iPhone/i,$T=/iPod/i,zT=/iPad/i,XT=/\biOS-universal(?:.+)Mac\b/i,Eg=/\bAndroid(?:.+)Mobile\b/i,YT=/Android/i,dn=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,jh=/Silk/i,Gi=/Windows Phone/i,jT=/\bWindows(?:.+)ARM\b/i,qT=/BlackBerry/i,KT=/BB10/i,ZT=/Opera Mini/i,QT=/\b(CriOS|Chrome)(?:.+)Mobile/i,JT=/Mobile(?:.+)Firefox\b/i,eS=function(t){return typeof t<"u"&&t.platform==="MacIntel"&&typeof t.maxTouchPoints=="number"&&t.maxTouchPoints>1&&typeof MSStream>"u"}});var Pg=T(()=>{Ag();Ag()});var KL,tS,rS=T(()=>{Pg();KL=cs.default??cs,tS=KL(globalThis.navigator)});var ZL,qh,QL,JL,iS,sS,eG,tG,rG,Cg,nS,aS=T(()=>{Yh();O();rS();ng();ZL=9,qh=100,QL=0,JL=0,iS=2,sS=1,eG=-1e3,tG=-1e3,rG=2,Cg=class oS{constructor(e,r=tS){this._mobileInfo=r,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,(r.tablet||r.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let e=document.createElement("button");e.style.width=`${sS}px`,e.style.height=`${sS}px`,e.style.position="absolute",e.style.top=`${eG}px`,e.style.left=`${tG}px`,e.style.zIndex=rG.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_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=`${qh}px`,this._div.style.height=`${qh}px`,this._div.style.position="absolute",this._div.style.top=`${QL}px`,this._div.style.left=`${JL}px`,this._div.style.zIndex=iS.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 e=this._renderer.view.canvas;if(e.parentNode)e.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let r=new MutationObserver(()=>{e.parentNode&&(e.parentNode.appendChild(this._div),r.disconnect(),this._initAccessibilitySetup())});r.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 e of this._children)e._accessibleDiv&&e._accessibleDiv.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;this._pool.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let r=e.children;if(r)for(let i=0;i<r.length;i++)this._updateAccessibleObjects(r[i])}init(e){let i={accessibilityOptions:{...oS.defaultOptions,...e?.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 e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let r=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let i of this._children)i._renderId===this._renderId&&r.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];r.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Oh(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(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:r,height:i}=this._renderer;e.x+e.width>r&&(e.width=r-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let r=this._pool.pop();r||(e.accessibleType==="button"?r=document.createElement("button"):(r=document.createElement(e.accessibleType),r.style.cssText=`
|
|
6
|
+
Deprecated since v${t}`),console.warn(i))),tT[e]=!0}var tT,ue,rT,tt=T(()=>{"use strict";tT={},ue="8.0.0",rT="8.3.4"});var Ys,sg=T(()=>{"use strict";Ys=class{constructor(e,r){this._pool=[],this._count=0,this._index=0,this._classType=e,r&&this.prepopulate(r)}prepopulate(e){for(let r=0;r<e;r++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){let r;return this._index>0?r=this._pool[--this._index]:r=new this._classType,r.init?.(e),r}return(e){e.reset?.(),this._pool[this._index++]=e}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 og,fe,Zt=T(()=>{sg();og=class{constructor(){this._poolsByClass=new Map}prepopulate(e,r){this.getPool(e).prepopulate(r)}get(e,r){return this.getPool(e).get(r)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new Ys(e)),this._poolsByClass.get(e)}stats(){let e={};return this._poolsByClass.forEach(r=>{let i=e[r._classType.name]?r._classType.name+r._classType.ID:r._classType.name;e[i]={free:r.totalFree,used:r.totalUsed,size:r.totalSize}}),e}},fe=new og});var iT,sT=T(()=>{tt();iT={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(t){typeof t=="boolean"&&t===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(t===!0?{}:t))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){J("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}}});function Oh(t,e,r){let i=t.length,s;if(e>=i||r===0)return;r=e+r>i?i-e:r;let o=i-r;for(s=e;s<o;++s)t[s]=t[s+r];t.length=o}var ng=T(()=>{"use strict"});var oT,nT=T(()=>{ng();tt();oT={allowChildren:!0,removeChildren(t=0,e){let r=e??this.children.length,i=r-t,s=[];if(i>0&&i<=r){for(let n=r-1;n>=t;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Oh(this.children,t,r);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(t){let e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){let e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||J(ue,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:r}=this;if(e<0||e>r.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${r.length}`);if(t.parent){let s=t.parent.children.indexOf(t);if(t.parent===this&&s===e)return t;s!==-1&&t.parent.children.splice(s,1)}e===r.length?r.push(t):r.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(t),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",t,this,e),t.emit("added",this),t},swapChildren(t,e){if(t===e)return;let r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=t;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...t){return t.length===1?this.reparentChildAt(t[0],this.children.length):(t.forEach(e=>this.reparentChildAt(e,this.children.length)),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;let r=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);let i=this.worldTransform.clone();return i.invert(),r.prepend(i),t.setFromMatrix(r),t}}});var aT,lT=T(()=>{"use strict";aT={collectRenderables(t,e,r){this.parentRenderLayer&&this.parentRenderLayer!==r||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,r):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,r))},collectRenderablesSimple(t,e,r){let i=this.children,s=i.length;for(let o=0;o<s;o++)i[o].collectRenderables(t,e,r)},collectRenderablesWithEffects(t,e,r){let{renderPipes:i}=e;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];i[o.pipe].push(o,this,t)}this.collectRenderablesSimple(t,e,r);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,t)}}}});var Oi,Lh=T(()=>{"use strict";Oi=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}});var ag,Gh,cT=T(()=>{O();Zt();ag=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let r=0;r<this._tests.length;r++){let i=this._tests[r];if(i.test(e))return fe.get(i.maskClass,e)}return e}returnMaskEffect(e){fe.return(e)}},Gh=new ag;K.handleByList(w.MaskEffect,Gh._effectClasses)});var uT,hT=T(()=>{Lh();cT();uT={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){this.effects.indexOf(t)===-1&&(this.effects.push(t),this.effects.sort((r,i)=>r.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){let e=this.effects.indexOf(t);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){let e=this._maskEffect;e?.mask!==t&&(e&&(this.removeEffect(e),Gh.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=Gh.getMaskEffect(t),this.addEffect(this._maskEffect)))},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(t){!Array.isArray(t)&&t&&(t=[t]);let e=this._filterEffect||(this._filterEffect=new Oi);t=t;let r=t?.length>0,i=e.filters?.length>0,s=r!==i;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),s&&(r?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){return this._filterEffect?.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new Oi),this._filterEffect.filterArea=t},get filterArea(){return this._filterEffect?.filterArea}}});var dT,fT=T(()=>{tt();dT={label:null,get name(){return J(ue,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){J(ue,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){let r=this.children;for(let i=0;i<r.length;i++){let s=r[i];if(s.label===t||t instanceof RegExp&&t.test(s.label))return s}if(e)for(let i=0;i<r.length;i++){let o=r[i].getChildByLabel(t,!0);if(o)return o}return null},getChildrenByLabel(t,e=!1,r=[]){let i=this.children;for(let s=0;s<i.length;s++){let o=i[s];(o.label===t||t instanceof RegExp&&t.test(o.label))&&r.push(o)}if(e)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(t,!0,r);return r}}});var Dh,te,vt=T(()=>{gr();Dh=[new ve,new ve,new ve,new ve],te=class t{constructor(e=0,r=0,i=0,s=0){this.type="rectangle",this.x=Number(e),this.y=Number(r),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 t(0,0,0,0)}clone(){return new t(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,r){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height}strokeContains(e,r,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),u=i-c,h=a-c,d=a+o+c,f=l-c,p=l+n+c,m=a+u,x=a+o-u,v=l+u,y=l+n-u;return e>=h&&e<=d&&r>=f&&r<=p&&!(e>m&&e<x&&r>v&&r<y)}intersects(e,r){if(!r){let P=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=P)return!1;let M=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>M}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Dh[0].set(e.left,e.top),l=Dh[1].set(e.left,e.bottom),c=Dh[2].set(e.right,e.top),u=Dh[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(r.a*r.d-r.b*r.c);if(h===0||(r.apply(a,a),r.apply(l,l),r.apply(c,c),r.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=i||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=o||Math.min(a.y,l.y,c.y,u.y)>=n))return!1;let d=h*(l.y-a.y),f=h*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,x=d*i+f*n,v=d*s+f*n;if(Math.max(p,m,x,v)<=d*a.x+f*a.y||Math.min(p,m,x,v)>=d*u.x+f*u.y)return!1;let y=h*(a.y-c.y),g=h*(c.x-a.x),b=y*i+g*o,_=y*s+g*o,S=y*i+g*n,E=y*s+g*n;return!(Math.max(b,_,S,E)<=y*a.x+g*a.y||Math.min(b,_,S,E)>=y*u.x+g*u.y)}pad(e=0,r=e){return this.x-=e,this.y-=r,this.width+=e*2,this.height+=r*2,this}fit(e){let r=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=r,this.width=Math.max(i-r,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,r=.001){let i=Math.ceil((this.x+this.width-r)*e)/e,s=Math.ceil((this.y+this.height-r)*e)/e;return this.x=Math.floor((this.x+r)*e)/e,this.y=Math.floor((this.y+r)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let r=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=r,this.width=i-r,this.y=s,this.height=o-s,this}getBounds(e){return e||(e=new t),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;let r=e.x,i=e.y,s=e.x+e.width,o=e.y+e.height;return r>=this.x&&r<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 pT,De,ar=T(()=>{Ae();vt();pT=new V,De=class t{constructor(e=1/0,r=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=pT,this.minX=e,this.minY=r,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new te);let e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=pT,this}set(e,r,i,s){this.minX=e,this.minY=r,this.maxX=i,this.maxY=s}addFrame(e,r,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,c=o.d,u=o.tx,h=o.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,x=n*e+l*r+u,v=a*e+c*r+h;x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),x=n*i+l*r+u,v=a*i+c*r+h,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),x=n*e+l*s+u,v=a*e+c*s+h,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),x=n*i+l*s+u,v=a*i+c*s+h,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>m&&(m=v),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(e,r){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,r)}addBounds(e,r){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,r)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){let r=this.minX,i=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:l,d:c,tx:u,ty:h}=e,d=n*r+l*i+u,f=a*r+c*i+h;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+l*i+u,f=a*s+c*i+h,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*r+l*o+u,f=a*r+c*o+h,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+u,f=a*s+c*o+h,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(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,r,i,s){return this.minX<e&&(this.minX=e),this.maxX>r&&(this.maxX=r),this.minY<i&&(this.minY=i),this.maxY>s&&(this.maxY=s),this}pad(e,r=e){return this.minX-=e,this.maxX+=e,this.minY-=r,this.maxY+=r,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 t(this.minX,this.minY,this.maxX,this.maxY)}scale(e,r=e){return this.minX*=e,this.minY*=r,this.maxX*=e,this.maxY*=r,this}get x(){return this.minX}set x(e){let r=this.maxX-this.minX;this.minX=e,this.maxX=e+r}get y(){return this.minY}set y(e){let r=this.maxY-this.minY;this.minY=e,this.maxY=e+r}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}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(e,r,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let c=s.a,u=s.b,h=s.c,d=s.d,f=s.tx,p=s.ty;for(let m=r;m<i;m+=2){let x=e[m],v=e[m+1],y=c*x+h*v+f,g=u*x+d*v+p;o=y<o?y:o,n=g<n?g:n,a=y>a?y:a,l=g>l?g:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}containsPoint(e,r){return this.minX<=e&&this.minY<=r&&this.maxX>=e&&this.maxY>=r}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}});var mt,xr,js=T(()=>{Ae();sg();ar();mt=new Ys(V),xr=new Ys(De)});var WL,mT,gT=T(()=>{Ae();ar();js();WL=new V,mT={getFastGlobalBounds(t,e){e||(e=new De),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);let r=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(r.worldTransform),e},_getGlobalBoundsRecursive(t,e,r){let i=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==r||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=xr.get().clear()),this.boundsArea)e.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(t,i,r)}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(WL).invert()),e.addBounds(i,this.relativeGroupTransform)),e.addBounds(i),xr.return(i)}else this.renderGroup&&(e.addBounds(i,this.relativeGroupTransform),xr.return(i))}}});function nn(t,e,r){r.clear();let i,s;return t.parent?e?i=t.parent.worldTransform:(s=mt.get().identity(),i=Nh(t,s)):i=V.IDENTITY,xT(t,r,i,e),s&&mt.return(s),r.isValid||r.set(0,0,0,0),r}function xT(t,e,r,i){if(!t.visible||!t.measurable)return;let s;i?s=t.worldTransform:(t.updateLocalTransform(),s=mt.get(),s.appendFrom(t.localTransform,r));let o=e,n=!!t.effects.length;if(n&&(e=xr.get().clear()),t.boundsArea)e.addRect(t.boundsArea,s);else{t.bounds&&(e.matrix=s,e.addBounds(t.bounds));for(let a=0;a<t.children.length;a++)xT(t.children[a],e,s,i)}if(n){for(let a=0;a<t.effects.length;a++)t.effects[a].addBounds?.(e);o.addBounds(e,V.IDENTITY),xr.return(e)}i||mt.return(s)}function Nh(t,e){let r=t.parent;return r&&(Nh(r,e),r.updateLocalTransform(),e.append(r.localTransform)),e}var yl=T(()=>{Ae();js()});function Vh(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;let r=t>>16&255,i=t>>8&255,s=t&255,o=e>>16&255,n=e>>8&255,a=e&255,l=r*o/255|0,c=i*n/255|0,u=s*a/255|0;return(l<<16)+(c<<8)+u}var lg=T(()=>{"use strict"});function an(t,e){return t===yT?e:e===yT?t:Vh(t,e)}var yT,cg=T(()=>{lg();yT=16777215});function _l(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}var _T,bT=T(()=>{yl();js();cg();_T={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,r=this.parent;for(;r;)e*=r.alpha,r=r.parent;return e},getGlobalTransform(t,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();let r=Nh(this,mt.get().identity());return t.appendFrom(this.localTransform,r),mt.return(r),t},getGlobalTint(t){if(t)return this.renderGroup?_l(this.renderGroup.worldColor):this.parentRenderGroup?_l(an(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,r=this.parent;for(;r;)e=an(e,r.localColor),r=r.parent;return _l(e)}}});function Z(...t){ug!==vT&&(ug++,ug===vT?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}var ug,vT,Ne=T(()=>{"use strict";ug=0,vT=500});function ln(t,e,r){return e.clear(),r||(r=V.IDENTITY),TT(t,e,r,t,!0),e.isValid||e.set(0,0,0,0),e}function TT(t,e,r,i,s){let o;if(s)o=mt.get(),o=r.copyTo(o);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();let l=t.localTransform;o=mt.get(),o.appendFrom(l,r)}let n=e,a=!!t.effects.length;if(a&&(e=xr.get().clear()),t.boundsArea)e.addRect(t.boundsArea,o);else{t.renderPipeId&&(e.matrix=o,e.addBounds(t.bounds));let l=t.children;for(let c=0;c<l.length;c++)TT(l[c],e,o,i,!1)}if(a){for(let l=0;l<t.effects.length;l++)t.effects[l].addLocalBounds?.(e,i);n.addBounds(e,V.IDENTITY),xr.return(e)}mt.return(o)}var Hh=T(()=>{Ae();js()});function hg(t,e){let r=t.children;for(let i=0;i<r.length;i++){let s=r[i],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=e.index;(e.data[a]!==o||e.data[a+1]!==n)&&(e.data[e.index]=o,e.data[e.index+1]=n,e.didChange=!0),e.index=a+2,s.children.length&&hg(s,e)}return e.didChange}var ST=T(()=>{"use strict"});var $L,wT,ET=T(()=>{Ae();ar();yl();Hh();ST();$L=new V,wT={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){let r=Math.sign(this.scale.x)||1;e!==0?this.scale.x=t/e*r:this.scale.x=r},_setHeight(t,e){let r=Math.sign(this.scale.y)||1;e!==0?this.scale.y=t/e*r:this.scale.y=r},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new De});let t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),hg(this,t),t.didChange&&ln(this,t.localBounds,$L),t.localBounds},getBounds(t,e){return nn(this,t,e||new De)}}});var AT,PT=T(()=>{"use strict";AT={_onRender:null,set onRender(t){let e=this.renderGroup||this.parentRenderGroup;if(!t){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}}});function zL(t,e){return t._zIndex-e._zIndex}var CT,RT=T(()=>{"use strict";CT={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,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(zL))}}});var MT,IT=T(()=>{gr();js();MT={getGlobalPosition(t=new ve,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,r=!1){let i=this.getGlobalTransform(mt.get(),r);return e=i.apply(t,e),mt.return(i),e},toLocal(t,e,r,i){e&&(t=e.toGlobal(t,r,i));let s=this.getGlobalTransform(mt.get(),i);return r=s.applyInverse(t,r),mt.return(s),r}}});var cn,dg=T(()=>{kt();cn=class{constructor(){this.uid=Te("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function Li(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function fg(t){return!(t&t-1)&&!!t}var bl=T(()=>{"use strict"});function Wh(t){let e={};for(let r in t)t[r]!==void 0&&(e[r]=t[r]);return e}var pg=T(()=>{"use strict"});function XL(t){let e=BT[t];return e===void 0&&(BT[t]=Te("resource")),e}var BT,FT,$h,mg=T(()=>{Vt();kt();tt();BT=Object.create(null);FT=class kT extends $e{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...kT.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){J(ue,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,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 e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=XL(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};FT.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};$h=FT});var UT,Re,Qt=T(()=>{Vt();bl();pg();kt();mg();UT=class OT extends $e{constructor(e={}){super(),this.options=e,this.uid=Te("textureSource"),this._resourceType="textureSource",this._resourceId=Te("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,e={...OT.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.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=e.format,this.dimension=e.dimensions,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new $h(Wh(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._style?.off("change",this._onStyleChange,this),this._style=e,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))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=Te("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){let{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,r,i){i||(i=this._resolution),e||(e=this.width),r||(r=this.height);let s=Math.round(e*i),o=Math.round(r*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=Te("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=fg(this.pixelWidth)&&fg(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};UT.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};Re=UT});function YL(){for(let t=0;t<16;t++){let e=[];gg.push(e);for(let r=0;r<16;r++){let i=zh(qs[t]*qs[r]+Zs[t]*Ks[r]),s=zh(Ks[t]*qs[r]+Qs[t]*Ks[r]),o=zh(qs[t]*Zs[r]+Zs[t]*Qs[r]),n=zh(Ks[t]*Zs[r]+Qs[t]*Qs[r]);for(let a=0;a<16;a++)if(qs[a]===i&&Ks[a]===s&&Zs[a]===o&&Qs[a]===n){e.push(a);break}}}for(let t=0;t<16;t++){let e=new V;e.set(qs[t],Ks[t],Zs[t],Qs[t],0,0),LT.push(e)}}var qs,Ks,Zs,Qs,gg,LT,zh,rt,GT=T(()=>{Ae();qs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ks=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Zs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Qs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],gg=[],LT=[],zh=Math.sign;YL();rt={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:t=>qs[t],uY:t=>Ks[t],vX:t=>Zs[t],vY:t=>Qs[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>gg[t][e],sub:(t,e)=>gg[t][rt.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?rt.S:rt.N:Math.abs(e)*2<=Math.abs(t)?t>0?rt.E:rt.W:e>0?t>0?rt.SE:rt.SW:t>0?rt.NE:rt.NW,matrixAppendRotationInv:(t,e,r=0,i=0)=>{let s=LT[rt.inv(e)];s.tx=r,s.ty=i,t.append(s)}}});var xg,DT=T(()=>{"use strict";xg=()=>{}});var Js,yg=T(()=>{O();Qt();Js=class extends Re{constructor(e){let r=e.resource||new Float32Array(e.width*e.height*4),i=e.format;i||(r instanceof Float32Array?i="rgba32float":r instanceof Int32Array||r instanceof Uint32Array?i="rgba32uint":r instanceof Int16Array||r instanceof Uint16Array?i="rgba16uint":(r instanceof Int8Array,i="bgra8unorm")),super({...e,resource:r,format:i}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}};Js.extension=w.TextureSource});var NT,un,_g=T(()=>{Ae();NT=new V,un=class{constructor(e,r){this.mapCoord=new V,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof r>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=r,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){this.texture!==e&&(this._texture?.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(e,r){r===void 0&&(r=e);let i=this.mapCoord;for(let s=0;s<e.length;s+=2){let o=e[s],n=e[s+1];r[s]=o*i.a+n*i.c+i.tx,r[s+1]=o*i.b+n*i.d+i.ty}return r}update(){let e=this._texture;this._updateID++;let r=e.uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);let i=e.orig,s=e.trim;s&&(NT.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(NT));let o=e.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return n[0]=(e.frame.x+a+l)/o.width,n[1]=(e.frame.y+a+l)/o.height,n[2]=(e.frame.x+e.frame.width-a+l)/o.width,n[3]=(e.frame.y+e.frame.height-a+l)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=e.frame.width===o.width&&e.frame.height===o.height&&e.rotate===0,!0}}});var B,Fe=T(()=>{Vt();GT();vt();kt();tt();DT();yg();Qt();_g();B=class extends $e{constructor({source:e,label:r,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=Te("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new te,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=r,this.source=e?.source??new Re,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:u,height:h}=this._source;this.frame.width=u,this.frame.height=h}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(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new un(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:e,frame:r}=this,{width:i,height:s}=this._source,o=r.x/i,n=r.y/s,a=r.width/i,l=r.height/s,c=this.rotate;if(c){let u=a/2,h=l/2,d=o+u,f=n+h;c=rt.add(c,rt.NW),e.x0=d+u*rt.uX(c),e.y0=f+h*rt.uY(c),c=rt.add(c,2),e.x1=d+u*rt.uX(c),e.y1=f+h*rt.uY(c),c=rt.add(c,2),e.x2=d+u*rt.uX(c),e.y2=f+h*rt.uY(c),c=rt.add(c,2),e.x3=d+u*rt.uX(c),e.y3=f+h*rt.uY(c)}else e.x0=o,e.y0=n,e.x1=o+a,e.y1=n,e.x2=o+a,e.y2=n+l,e.x3=o,e.y3=n+l}destroy(e=!1){this._source&&e&&(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 J(ue,"Texture.baseTexture is now Texture.source"),this._source}};B.EMPTY=new B({label:"EMPTY",source:new Re({label:"EMPTY"})});B.EMPTY.destroy=xg;B.WHITE=new B({source:new Js({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});B.WHITE.destroy=xg});var jL,bg,Ve,ui=T(()=>{bl();Qt();Fe();jL=0,bg=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,r,i){let s=new Re({...this.textureOptions,width:e,height:r,resolution:1,antialias:i,autoGarbageCollect:!1});return new B({source:s,label:`texturePool_${jL++}`})}getOptimalTexture(e,r,i=1,s){let o=Math.ceil(e*i-1e-6),n=Math.ceil(r*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=e,l.frame.height=r,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(e,r=!1){let i=e.source;return this.getOptimalTexture(e.width,e.height,i._resolution,r)}returnTexture(e){let r=this._poolKeyHash[e.uid];this._texturePool[r].push(e)}clear(e){if(e=e!==!1,e)for(let r in this._texturePool){let i=this._texturePool[r];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}},Ve=new bg});var Xh,VT=T(()=>{Ae();dg();ui();Xh=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new V,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 cn,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;let r=e.children;for(let i=0;i<r.length;i++){let s=r[i];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Ve.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let e in this.childrenToUpdate){let r=this.childrenToUpdate[e];r.list.fill(null),r.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(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){let r=this.renderGroupChildren.indexOf(e);r>-1&&this.renderGroupChildren.splice(r,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);let r=e.children;for(let i=0;i<r.length;i++)this.addChild(r[i])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}let r=e.children;for(let i=0;i<r.length;i++)this.removeChild(r[i])}removeChildren(e){for(let r=0;r<e.length;r++)this.removeChild(e[r])}onChildUpdate(e){let r=this.childrenToUpdate[e.relativeRenderGroupDepth];r||(r=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),r.list[r.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let r=0;r<this._onRenderContainers.length;r++)this._onRenderContainers[r]._onRender(e)}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(e=[]){let r=this.root.children;for(let i=0;i<r.length;i++)this._getChildren(r[i],e);return e}_getChildren(e,r=[]){if(r.push(e),e.renderGroup)return r;let i=e.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],r);return r}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new V),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new V),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 e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new V),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function HT(t,e,r={}){for(let i in e)!r[i]&&e[i]!==void 0&&(t[i]=e[i])}var WT=T(()=>{"use strict"});var vg,Tg,Sg,hn,vl,eo,ie,Yr=T(()=>{Vt();Bt();Z0();O();Ae();tg();Uh();kt();tt();Zt();sT();nT();lT();hT();fT();gT();bT();ET();PT();RT();IT();VT();WT();vg=new Ft(null),Tg=new Ft(null),Sg=new Ft(null,1,1),hn=1,vl=2,eo=4,ie=class t extends $e{constructor(e={}){super(),this.uid=Te("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 V,this.relativeGroupTransform=new V,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ft(this,0,0),this._scale=Sg,this._pivot=Tg,this._skew=vg,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=[],HT(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(r=>this.addChild(r)),e.parent?.addChild(this)}static mixin(e){J("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),K.mixin(t,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||J(ue,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let s=0;s<e.length;s++)this.addChild(e[s]);return e[0]}let r=e[0],i=this.renderGroup||this.parentRenderGroup;return r.parent===this?(this.children.splice(this.children.indexOf(r),1),this.children.push(r),i&&(i.structureDidChange=!0),r):(r.parent&&r.parent.removeChild(r),this.children.push(r),this.sortableChildren&&(this.sortDirty=!0),r.parent=this,r.didChange=!0,r._updateFlags=15,i&&i.addChild(r),this.emit("childAdded",r,this,this.children.length-1),r.emit("added",this),this._didViewChangeTick++,r._zIndex!==0&&r.depthOfChildModified(),r)}removeChild(...e){if(e.length>1){for(let s=0;s<e.length;s++)this.removeChild(e[s]);return e[0]}let r=e[0],i=this.children.indexOf(r);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(r):this.parentRenderGroup&&this.parentRenderGroup.removeChild(r),r.parentRenderLayer&&r.parentRenderLayer.detach(r),r.parent=null,this.emit("childRemoved",r,this,i),r.emit("removed",this)),r}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=fe.get(Xh,this),this.groupTransform=V.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),fe.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new V),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(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*J0}set angle(e){this.rotation=e*eT}get pivot(){return this._pivot===Tg&&(this._pivot=new Ft(this,0,0)),this._pivot}set pivot(e){this._pivot===Tg&&(this._pivot=new Ft(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===vg&&(this._skew=new Ft(this,0,0)),this._skew}set skew(e){this._skew===vg&&(this._skew=new Ft(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Sg&&(this._scale=new Ft(this,1,1)),this._scale}set scale(e){this._scale===Sg&&(this._scale=new Ft(this,0,0)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let r=this.getLocalBounds().width;this._setWidth(e,r)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let r=this.getLocalBounds().height;this._setHeight(e,r)}getSize(e){e||(e={});let r=this.getLocalBounds();return e.width=Math.abs(this.scale.x*r.width),e.height=Math.abs(this.scale.y*r.height),e}setSize(e,r){let i=this.getLocalBounds();typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,i.width),r!==void 0&&this._setHeight(r,i.height)}_updateSkew(){let e=this._rotation,r=this._skew;this._cx=Math.cos(e+r._y),this._sx=Math.sin(e+r._y),this._cy=-Math.sin(e-r._x),this._sy=Math.cos(e-r._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;let r=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,c=s._y;r.a=this._cx*n,r.b=this._sx*n,r.c=this._cy*a,r.d=this._sy*a,r.tx=o._x-(l*r.a+c*r.c),r.ty=o._y-(l*r.b+c*r.d)}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=hn,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let i=me.shared.setValue(e??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=hn,this._onUpdate())}get tint(){return _l(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=vl,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let r=e?2:0;(this.localDisplayStatus&2)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=eo,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let r=e?0:4;(this.localDisplayStatus&4)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=eo,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let r=e?1:0;(this.localDisplayStatus&1)!==r&&(this._updateFlags|=eo,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0;let r;if(this.children.length&&(r=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 e=="boolean"?e:e?.children)&&r)for(let s=0;s<r.length;++s)r[s].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}};K.mixin(ie,oT,mT,MT,AT,wT,uT,dT,CT,K0,iT,_T,aT)});var ls,Yh=T(()=>{gr();ls=class t{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=t.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ve,this.page=new ve,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}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(e,r,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,r,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 qL(t){return function(e){return e.test(t)}}function cs(t){var e={userAgent:"",platform:"",maxTouchPoints:0};!t&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof t=="string"?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0});var r=e.userAgent,i=r.split("[FBAN");typeof i[1]<"u"&&(r=i[0]),i=r.split("Twitter"),typeof i[1]<"u"&&(r=i[0]);var s=qL(r),o={apple:{phone:s(wg)&&!s(Gi),ipod:s($T),tablet:!s(wg)&&(s(zT)||eS(e))&&!s(Gi),universal:s(XT),device:(s(wg)||s($T)||s(zT)||s(XT)||eS(e))&&!s(Gi)},amazon:{phone:s(dn),tablet:!s(dn)&&s(jh),device:s(dn)||s(jh)},android:{phone:!s(Gi)&&s(dn)||!s(Gi)&&s(Eg),tablet:!s(Gi)&&!s(dn)&&!s(Eg)&&(s(jh)||s(YT)),device:!s(Gi)&&(s(dn)||s(jh)||s(Eg)||s(YT))||s(/\bokhttp\b/i)},windows:{phone:s(Gi),tablet:s(jT),device:s(Gi)||s(jT)},other:{blackberry:s(qT),blackberry10:s(KT),opera:s(ZT),firefox:s(JT),chrome:s(QT),device:s(qT)||s(KT)||s(ZT)||s(JT)||s(QT)},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 wg,$T,zT,XT,Eg,YT,dn,jh,Gi,jT,qT,KT,ZT,QT,JT,eS,Ag=T(()=>{wg=/iPhone/i,$T=/iPod/i,zT=/iPad/i,XT=/\biOS-universal(?:.+)Mac\b/i,Eg=/\bAndroid(?:.+)Mobile\b/i,YT=/Android/i,dn=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,jh=/Silk/i,Gi=/Windows Phone/i,jT=/\bWindows(?:.+)ARM\b/i,qT=/BlackBerry/i,KT=/BB10/i,ZT=/Opera Mini/i,QT=/\b(CriOS|Chrome)(?:.+)Mobile/i,JT=/Mobile(?:.+)Firefox\b/i,eS=function(t){return typeof t<"u"&&t.platform==="MacIntel"&&typeof t.maxTouchPoints=="number"&&t.maxTouchPoints>1&&typeof MSStream>"u"}});var Pg=T(()=>{Ag();Ag()});var KL,tS,rS=T(()=>{Pg();KL=cs.default??cs,tS=KL(globalThis.navigator)});var ZL,qh,QL,JL,iS,sS,eG,tG,rG,Cg,nS,aS=T(()=>{Yh();O();rS();ng();ZL=9,qh=100,QL=0,JL=0,iS=2,sS=1,eG=-1e3,tG=-1e3,rG=2,Cg=class oS{constructor(e,r=tS){this._mobileInfo=r,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,(r.tablet||r.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let e=document.createElement("button");e.style.width=`${sS}px`,e.style.height=`${sS}px`,e.style.position="absolute",e.style.top=`${eG}px`,e.style.left=`${tG}px`,e.style.zIndex=rG.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_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=`${qh}px`,this._div.style.height=`${qh}px`,this._div.style.position="absolute",this._div.style.top=`${QL}px`,this._div.style.left=`${JL}px`,this._div.style.zIndex=iS.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 e=this._renderer.view.canvas;if(e.parentNode)e.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let r=new MutationObserver(()=>{e.parentNode&&(e.parentNode.appendChild(this._div),r.disconnect(),this._initAccessibilitySetup())});r.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 e of this._children)e._accessibleDiv&&e._accessibleDiv.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;this._pool.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let r=e.children;if(r)for(let i=0;i<r.length;i++)this._updateAccessibleObjects(r[i])}init(e){let i={accessibilityOptions:{...oS.defaultOptions,...e?.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 e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let r=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let i of this._children)i._renderId===this._renderId&&r.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let s=this._children[i];r.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Oh(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(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:r,height:i}=this._renderer;e.x+e.width>r&&(e.width=r-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let r=this._pool.pop();r||(e.accessibleType==="button"?r=document.createElement("button"):(r=document.createElement(e.accessibleType),r.style.cssText=`
|
|
7
7
|
color: transparent;
|
|
8
8
|
pointer-events: none;
|
|
9
9
|
padding: 0;
|
|
@@ -16,9 +16,9 @@ Deprecated since v${t}`),console.warn(i))),tT[e]=!0}var tT,ue,rT,tt=T(()=>{"use
|
|
|
16
16
|
-webkit-user-select: none;
|
|
17
17
|
-moz-user-select: none;
|
|
18
18
|
-ms-user-select: none;
|
|
19
|
-
`,e.accessibleText&&(r.innerText=e.accessibleText)),r.style.width=`${qh}px`,r.style.height=`${qh}px`,r.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",r.style.position="absolute",r.style.zIndex=iS.toString(),r.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?r.setAttribute("aria-live","off"):r.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?r.setAttribute("aria-relevant","additions"):r.setAttribute("aria-relevant","text"),r.addEventListener("click",this._onClick.bind(this)),r.addEventListener("focus",this._onFocus.bind(this)),r.addEventListener("focusout",this._onFocusOut.bind(this))),r.style.pointerEvents=e.accessiblePointerEvents,r.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?r.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(r.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&r.setAttribute("aria-label",e.accessibleHint),this.debug&&this._updateDebugHTML(r),e._accessibleActive=!0,e._accessibleDiv=r,r.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv),e.interactive&&(e._accessibleDiv.tabIndex=e.tabIndex)}_dispatchEvent(e,r){let{container:i}=e.target,s=this._renderer.events.rootBoundary,o=Object.assign(new ls(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,r.forEach(n=>s.dispatchEvent(o,n))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode!==ZL||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}};Cg.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"accessibility"};Cg.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};nS=Cg});var lS,cS=T(()=>{"use strict";lS={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var uS=T(()=>{O();Yr();aS();cS();K.add(nS);K.mixin(ie,lS)});var Tl,hS=T(()=>{O();Tl=class{static init(e){Object.defineProperty(this,"resizeTo",{set(r){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=r,r&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let r,i;if(this._resizeTo===globalThis.window)r=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;r=s,i=o}this.renderer.resize(r,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};Tl.extension=w.Application});var hi,Sl=T(()=>{"use strict";hi=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(hi||{})});var fn,dS=T(()=>{"use strict";fn=class{constructor(e,r=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=r,this.priority=i,this._once=s}match(e,r=null){return this._fn===e&&this._context===r}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));let r=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),r}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!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 r=this.next;return this.next=e?null:r,this.previous=null,r}}});var fS,Tt,pn=T(()=>{Sl();dS();fS=class yr{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 fn(null,null,1/0),this.deltaMS=1/yr.targetFPMS,this.elapsedMS=1/yr.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,r,i=hi.NORMAL){return this._addListener(new fn(e,r,i))}addOnce(e,r,i=hi.NORMAL){return this._addListener(new fn(e,r,i,!0))}_addListener(e){let r=this._head.next,i=this._head;if(!r)e.connect(i);else{for(;r;){if(e.priority>r.priority){e.connect(i);break}i=r,r=r.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,r){let i=this._head.next;for(;i;)i.match(e,r)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,r=this._head;for(;r=r.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let r;if(e>this.lastTime){if(r=this.elapsedMS=e-this.lastTime,r>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){let o=e-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=e-o%this._minElapsedMS}this.deltaMS=r,this.deltaTime=this.deltaMS*yr.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){let r=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,r)/1e3,yr.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{let r=Math.max(this.minFPS,e);this._minElapsedMS=1/(r/1e3)}}static get shared(){if(!yr._shared){let e=yr._shared=new yr;e.autoStart=!0,e._protected=!0}return yr._shared}static get system(){if(!yr._system){let e=yr._system=new yr;e.autoStart=!0,e._protected=!0}return yr._system}};fS.targetFPMS=.06;Tt=fS});var wl,pS=T(()=>{O();Sl();pn();wl=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(r){this._ticker&&this._ticker.remove(this.render,this),this._ticker=r,r&&r.add(this.render,this,hi.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Tt.shared:new Tt,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};wl.extension=w.Application});var Rg=T(()=>{O();hS();pS();K.add(Tl);K.add(wl)});var Mg,di,Ig=T(()=>{Sl();pn();Mg=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(Tt.system.add(this._tickerUpdate,this,hi.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Tt.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},di=new Mg});var Di,Kh=T(()=>{gr();Yh();Di=class extends ls{constructor(){super(...arguments),this.client=new ve,this.movement=new ve,this.offset=new ve,this.global=new ve,this.screen=new ve}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,r,i){return e.worldTransform.applyInverse(i||this.global,r)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,r,i,s,o,n,a,l,c,u,h,d,f,p,m){throw new Error("Method not implemented.")}}});var Jt,Bg=T(()=>{Kh();Jt=class extends Di{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var fi,Fg=T(()=>{Kh();fi=class extends Di{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};fi.DOM_DELTA_PIXEL=0;fi.DOM_DELTA_LINE=1;fi.DOM_DELTA_PAGE=2});var iG,sG,El,Zh,mS=T(()=>{Vt();gr();Ne();Ig();Kh();Bg();Fg();iG=2048,sG=new ve,El=new ve,Zh=class{constructor(e){this.dispatch=new We,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,r){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:r,priority:0}),this.mappingTable[e].sort((i,s)=>i.priority-s.priority)}dispatchEvent(e,r){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,r),this.dispatch.emit(r||e.type,e)}mapEvent(e){if(!this.rootTarget)return;let r=this.mappingTable[e.type];if(r)for(let i=0,s=r.length;i<s;i++)r[i].fn(e);else Z(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,r){di.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,sG.set(e,r),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(e,r){if(!e.target)return;let i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let s=0,o=i.length-1;s<o;s++)if(e.currentTarget=i[s],this.notifyTarget(e,r),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,r),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(e.currentTarget=i[s],this.notifyTarget(e,r),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,r,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;let s=Array.isArray(r)?r:[r];for(let o=i.length-1;o>=0;o--)s.forEach(n=>{e.currentTarget=i[o],this.notifyTarget(e,n)})}propagationPath(e){let r=[e];for(let i=0;i<iG&&e!==this.rootTarget&&e.parent;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");r.push(e.parent),e=e.parent}return r.reverse(),r}hitTestMoveRecursive(e,r,i,s,o,n=!1){let a=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||r==="dynamic")&&(di.pauseUpdate=!1),e.interactiveChildren&&e.children){let u=e.children;for(let h=u.length-1;h>=0;h--){let d=u[h],f=this.hitTestMoveRecursive(d,this._isInteractive(r)?r:d.eventMode,i,s,o,n||o(e,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let p=e.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let l=this._isInteractive(r),c=e.isInteractive();return c&&c&&this._allInteractiveElements.push(e),n||this._hitElements.length>0?null:a?this._hitElements:l&&!o(e,i)&&s(e,i)?c?[e]:[]:null}hitTestRecursive(e,r,i,s,o){if(this._interactivePrune(e)||o(e,i))return null;if((e.eventMode==="dynamic"||r==="dynamic")&&(di.pauseUpdate=!1),e.interactiveChildren&&e.children){let l=e.children,c=i;for(let u=l.length-1;u>=0;u--){let h=l[u],d=this.hitTestRecursive(h,this._isInteractive(r)?r:h.eventMode,c,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=e.isInteractive();return(d.length>0||f)&&d.push(e),d}}}let n=this._isInteractive(r),a=e.isInteractive();return n&&s(e,i)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,r){if(e.hitArea&&(e.worldTransform.applyInverse(r,El),!e.hitArea.contains(El.x,El.y)))return!0;if(e.effects&&e.effects.length)for(let i=0;i<e.effects.length;i++){let s=e.effects[i];if(s.containsPoint&&!s.containsPoint(r,this.hitTestFn))return!0}return!1}hitTestFn(e,r){return e.hitArea?!0:e?.containsPoint?(e.worldTransform.applyInverse(r,El),e.containsPoint(El)):!1}notifyTarget(e,r){if(!e.currentTarget.isInteractive())return;r??(r=e.type);let i=`on${r}`;e.currentTarget[i]?.(e);let s=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${r}capture`:r;this._notifyListeners(e,s),e.eventPhase===e.AT_TARGET&&this._notifyListeners(e,r)}mapPointerDown(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let r=this.createPointerEvent(e);if(this.dispatchEvent(r,"pointerdown"),r.pointerType==="touch")this.dispatchEvent(r,"touchstart");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let s=r.button===2;this.dispatchEvent(r,s?"rightdown":"mousedown")}let i=this.trackingData(e.pointerId);i.pressTargetsByButton[e.button]=r.composedPath(),this.freeEvent(r)}mapPointerMove(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let r=this.createPointerEvent(e);this._isPointerMoveEvent=!1;let i=r.pointerType==="mouse"||r.pointerType==="pen",s=this.trackingData(e.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==r.target){let l=e.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(e,l,o);if(this.dispatchEvent(c,"pointerout"),i&&this.dispatchEvent(c,"mouseout"),!r.composedPath().includes(o)){let u=this.createPointerEvent(e,"pointerleave",o);for(u.eventPhase=u.AT_TARGET;u.target&&!r.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),i&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(c)}if(o!==r.target){let l=e.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(r,l);this.dispatchEvent(c,"pointerover"),i&&this.dispatchEvent(c,"mouseover");let u=o?.parent;for(;u&&u!==this.rootTarget.parent&&u!==r.target;)u=u.parent;if(!u||u===this.rootTarget.parent){let d=this.clonePointerEvent(r,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(r,"pointermove"),a&&n.push("globalpointermove"),r.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(r,"touchmove"),a&&n.push("globaltouchmove")),i&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(r,"mousemove"),a&&n.push("globalmousemove"),this.cursor=r.target?.cursor),n.length>0&&this.all(r,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=r.composedPath(),this.freeEvent(r)}mapPointerOver(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let r=this.trackingData(e.pointerId),i=this.createPointerEvent(e),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let o=this.clonePointerEvent(i,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;r.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(o)}mapPointerOut(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let r=this.trackingData(e.pointerId);if(r.overTargets){let i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.findMountedTarget(r.overTargets),o=this.createPointerEvent(e,"pointerout",s);this.dispatchEvent(o),i&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(e,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;r.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let r=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let s=this.trackingData(e.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[e.button]),n=o;if(o&&!i.composedPath().includes(o)){let a=o;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[e.button],n=a}if(n){let a=this.clonePointerEvent(i,"click");a.target=n,a.path=null,s.clicksByButton[e.button]||(s.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:r});let l=s.clicksByButton[e.button];if(l.target===a.target&&r-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=r,a.detail=l.clickCount,a.pointerType==="mouse"){let c=a.button===2;this.dispatchEvent(a,c?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let r=this.trackingData(e.pointerId),i=this.findMountedTarget(r.pressTargetsByButton[e.button]),s=this.createPointerEvent(e);if(i){let o=i;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete r.pressTargetsByButton[e.button]}this.freeEvent(s)}mapWheel(e){if(!(e instanceof fi)){Z("EventBoundary cannot map a non-wheel event as a wheel event");return}let r=this.createWheelEvent(e);this.dispatchEvent(r),this.freeEvent(r)}findMountedTarget(e){if(!e)return null;let r=e[0];for(let i=1;i<e.length&&e[i].parent===r;i++)r=e[i];return r}createPointerEvent(e,r,i){let s=this.allocateEvent(Jt);return this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.nativeEvent=e.nativeEvent,s.originalEvent=e,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof r=="string"&&(s.type=r),s}createWheelEvent(e){let r=this.allocateEvent(fi);return this.copyWheelData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.nativeEvent=e.nativeEvent,r.originalEvent=e,r.target=this.hitTest(r.global.x,r.global.y),r}clonePointerEvent(e,r){let i=this.allocateEvent(Jt);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=r??i.type,i}copyWheelData(e,r){r.deltaMode=e.deltaMode,r.deltaX=e.deltaX,r.deltaY=e.deltaY,r.deltaZ=e.deltaZ}copyPointerData(e,r){e instanceof Jt&&r instanceof Jt&&(r.pointerId=e.pointerId,r.width=e.width,r.height=e.height,r.isPrimary=e.isPrimary,r.pointerType=e.pointerType,r.pressure=e.pressure,r.tangentialPressure=e.tangentialPressure,r.tiltX=e.tiltX,r.tiltY=e.tiltY,r.twist=e.twist)}copyMouseData(e,r){e instanceof Di&&r instanceof Di&&(r.altKey=e.altKey,r.button=e.button,r.buttons=e.buttons,r.client.copyFrom(e.client),r.ctrlKey=e.ctrlKey,r.metaKey=e.metaKey,r.movement.copyFrom(e.movement),r.screen.copyFrom(e.screen),r.shiftKey=e.shiftKey,r.global.copyFrom(e.global))}copyData(e,r){r.isTrusted=e.isTrusted,r.srcElement=e.srcElement,r.timeStamp=performance.now(),r.type=e.type,r.detail=e.detail,r.view=e.view,r.which=e.which,r.layer.copyFrom(e.layer),r.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);let r=this.eventPool.get(e).pop()||new e(this);return r.eventPhase=r.NONE,r.currentTarget=null,r.defaultPrevented=!1,r.path=null,r.target=null,r}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let r=e.constructor;this.eventPool.has(r)||this.eventPool.set(r,[]),this.eventPool.get(r).push(e)}_notifyListeners(e,r){let i=e.currentTarget._events[r];if(i)if("fn"in i)i.once&&e.currentTarget.removeListener(r,i.fn,void 0,!0),i.fn.call(i.context,e);else for(let s=0,o=i.length;s<o&&!e.propagationImmediatelyStopped;s++)i[s].once&&e.currentTarget.removeListener(r,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,e)}}});var oG,nG,Ug,Qh,Og=T(()=>{O();mS();Ig();Bg();Fg();oG=1,nG={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ug=class kg{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new Zh(null),di.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Jt(null),this._rootWheelEvent=new fi(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...kg.defaultEventFeatures},{set:(r,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),r[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){let{canvas:r,resolution:i}=this.renderer;this.setTargetElement(r),this.resolution=i,kg._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||(e="default");let r=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(r=!1),this._currentCursor===e)return;this._currentCursor=e;let i=this.cursorStyles[e];if(i)switch(typeof i){case"string":r&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":r&&Object.assign(this.domElement.style,i);break}else r&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let r=this._normalizeToPointerData(e);this.autoPreventDefault&&r[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,s=r.length;i<s;i++){let o=r[i],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,di.pointerMoved();let r=this._normalizeToPointerData(e);for(let i=0,s=r.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,r[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let r=e.target;e.composedPath&&e.composedPath().length>0&&(r=e.composedPath()[0]);let i=r!==this.domElement?"outside":"",s=this._normalizeToPointerData(e);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let r=this._normalizeToPointerData(e);for(let i=0,s=r.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,r[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;let r=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(r)}setTargetElement(e){this._removeEvents(),this.domElement=e,di.domElement=e,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;di.addTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;di.removeTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(e,r,i){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;e.x=(r-s.left)*(this.domElement.width/s.width)*o,e.y=(i-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(e){let r=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let i=0,s=e.changedTouches.length;i<s;i++){let o=e.changedTouches[i];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=e.type,r.push(o)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){let i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=oG),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,r.push(i)}else r.push(e);return r}normalizeWheelEvent(e){let r=this._rootWheelEvent;return this._transferMouseData(r,e),r.deltaX=e.deltaX,r.deltaY=e.deltaY,r.deltaZ=e.deltaZ,r.deltaMode=e.deltaMode,this.mapPositionToPoint(r.screen,e.clientX,e.clientY),r.global.copyFrom(r.screen),r.offset.copyFrom(r.screen),r.nativeEvent=e,r.type=e.type,r}_bootstrapEvent(e,r){return e.originalEvent=null,e.nativeEvent=r,e.pointerId=r.pointerId,e.width=r.width,e.height=r.height,e.isPrimary=r.isPrimary,e.pointerType=r.pointerType,e.pressure=r.pressure,e.tangentialPressure=r.tangentialPressure,e.tiltX=r.tiltX,e.tiltY=r.tiltY,e.twist=r.twist,this._transferMouseData(e,r),this.mapPositionToPoint(e.screen,r.clientX,r.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=r.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=nG[e.type]||e.type),e}_transferMouseData(e,r){e.isTrusted=r.isTrusted,e.srcElement=r.srcElement,e.timeStamp=performance.now(),e.type=r.type,e.altKey=r.altKey,e.button=r.button,e.buttons=r.buttons,e.client.x=r.clientX,e.client.y=r.clientY,e.ctrlKey=r.ctrlKey,e.metaKey=r.metaKey,e.movement.x=r.movementX,e.movement.y=r.movementY,e.page.x=r.pageX,e.page.y=r.pageY,e.relatedTarget=null,e.shiftKey=r.shiftKey}};Ug.extension={name:"events",type:[w.WebGLSystem,w.CanvasSystem,w.WebGPUSystem],priority:-1};Ug.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};Qh=Ug});var gS,xS=T(()=>{Og();Yh();gS={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(t){this.eventMode=t?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Qh.defaultEventMode},set eventMode(t){this._internalEventMode=t},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(t,e,r){let i=typeof r=="boolean"&&r||typeof r=="object"&&r.capture,s=typeof r=="object"?r.signal:void 0,o=typeof r=="object"?r.once===!0:!1,n=typeof e=="function"?void 0:e;t=i?`${t}capture`:t;let a=typeof e=="function"?e:e.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(t,a,n)}),o?l.once(t,a,n):l.on(t,a,n)},removeEventListener(t,e,r){let i=typeof r=="boolean"&&r||typeof r=="object"&&r.capture,s=typeof e=="function"?void 0:e;t=i?`${t}capture`:t,e=typeof e=="function"?e:e.handleEvent,this.off(t,e,s)},dispatchEvent(t){if(!(t instanceof ls))throw new Error("Container cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}}});var yS=T(()=>{O();Yr();Og();xS();K.add(Qh);K.mixin(ie,gS)});var Al,_S=T(()=>{O();Al=class{constructor(e){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=e,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(e,r){this._attachedDomElements.includes(e)||(this._attachedDomElements.push(e),e.on("destroyed",this._destroyRenderableBound))}updateRenderable(e){}validateRenderable(e){return!0}destroyRenderable(e){let r=this._attachedDomElements.indexOf(e);r!==-1&&this._attachedDomElements.splice(r,1),e.off("destroyed",this._destroyRenderableBound)}postrender(){let e=this._attachedDomElements;if(e.length===0){this._domElement.remove();return}let r=this._renderer.view.canvas;this._domElement.parentNode!==r.parentNode&&r.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${r.offsetLeft}px, ${r.offsetTop}px)`;for(let i=0;i<e.length;i++){let s=e[i],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),e.splice(i,1),i--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,l=s.width*a.x,c=s.height*a.y;o.style.transformOrigin=`${l}px ${c}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-l}, ${n.ty-c})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let e=0;e<this._attachedDomElements.length;e++){let r=this._attachedDomElements[e];r.off("destroyed",this._destroyRenderableBound),r.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};Al.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"dom"}});var us,Jh=T(()=>{ar();Yr();us=class extends ie{constructor(e){super(e),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new De(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){let r=this.bounds,{x:i,y:s}=e;return i>=r.minX&&i<=r.maxX&&s>=r.minY&&s<=r.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}destroy(e){super.destroy(e),this._bounds=null}collectRenderablesSimple(e,r,i){let{renderPipes:s,renderableGC:o}=r;s.blendMode.setBlendMode(this,this.groupBlendMode,e),s[this.renderPipeId].addRenderable(this,e),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,l=a.length;for(let c=0;c<l;c++)a[c].collectRenderables(e,r,i)}}});var bS=T(()=>{O();_S();K.add(Al)});var er,hs=T(()=>{"use strict";er=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(er||{})});var vS,TS=T(()=>{"use strict";vS={createCanvas:(t,e)=>{let r=document.createElement("canvas");return r.width=t,r.height=e,r},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")}});var SS,re,ze=T(()=>{TS();SS=vS,re={get(){return SS},set(t){SS=t}}});function jr(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function Pl(t){return t.split("?")[0].split("#")[0]}function aG(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lG(t,e,r){return t.replace(new RegExp(aG(e),"g"),r)}function cG(t,e){let r="",i=0,s=-1,o=0,n=-1;for(let a=0;a<=t.length;++a){if(a<t.length)n=t.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){let l=r.lastIndexOf("/");if(l!==r.length-1){l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),s=a,o=0;continue}}else if(r.length===2||r.length===1){r="",i=0,s=a,o=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+=`/${t.slice(s+1,a)}`:r=t.slice(s+1,a),i=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return r}var St,to=T(()=>{ze();St={toPosix(t){return lG(t,"\\","/")},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl(t){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t)},isBlobUrl(t){return t.startsWith("blob:")},hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){jr(t),t=this.toPosix(t);let e=/^file:\/\/\//.exec(t);if(e)return e[0];let r=/^[^/:]+:\/{0,2}/.exec(t);return r?r[0]:""},toAbsolute(t,e,r){if(jr(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;let i=Pl(this.toPosix(e??re.get().getBaseUrl())),s=Pl(this.toPosix(r??this.rootname(i)));return t=this.toPosix(t),t.startsWith("/")?St.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(i,t)},normalize(t){if(jr(t),t.length===0)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="",r=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));let i=t.endsWith("/");return t=cG(t,!1),t.length>0&&i&&(t+="/"),r?`/${t}`:e+t},isAbsolute(t){return jr(t),t=this.toPosix(t),this.hasProtocol(t)?!0:t.startsWith("/")},join(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let i=t[r];if(jr(i),i.length>0)if(e===void 0)e=i;else{let s=t[r-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(t){if(jr(t),t.length===0)return".";t=this.toPosix(t);let e=t.charCodeAt(0),r=e===47,i=-1,s=!0,o=this.getProtocol(t),n=t;t=t.slice(o.length);for(let a=t.length-1;a>=1;--a)if(e=t.charCodeAt(a),e===47){if(!s){i=a;break}}else s=!1;return i===-1?r?"/":this.isUrl(n)?o+t:o:r&&i===1?"//":o+t.slice(0,i)},rootname(t){jr(t),t=this.toPosix(t);let e="";if(t.startsWith("/")?e="/":e=this.getProtocol(t),this.isUrl(t)){let r=t.indexOf("/",e.length);r!==-1?e=t.slice(0,r):e=t,e.endsWith("/")||(e+="/")}return e},basename(t,e){jr(t),e&&jr(e),t=Pl(this.toPosix(t));let r=0,i=-1,s=!0,o;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let n=e.length-1,a=-1;for(o=t.length-1;o>=0;--o){let l=t.charCodeAt(o);if(l===47){if(!s){r=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(l===e.charCodeAt(n)?--n===-1&&(i=o):(n=-1,i=a))}return r===i?i=a:i===-1&&(i=t.length),t.slice(r,i)}for(o=t.length-1;o>=0;--o)if(t.charCodeAt(o)===47){if(!s){r=o+1;break}}else i===-1&&(s=!1,i=o+1);return i===-1?"":t.slice(r,i)},extname(t){jr(t),t=Pl(this.toPosix(t));let e=-1,r=0,i=-1,s=!0,o=0;for(let n=t.length-1;n>=0;--n){let a=t.charCodeAt(n);if(a===47){if(!s){r=n+1;break}continue}i===-1&&(s=!1,i=n+1),a===46?e===-1?e=n:o!==1&&(o=1):e!==-1&&(o=-1)}return e===-1||i===-1||o===0||o===1&&e===i-1&&e===r+1?"":t.slice(e,i)},parse(t){jr(t);let e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=Pl(this.toPosix(t));let r=t.charCodeAt(0),i=this.isAbsolute(t),s,o="";e.root=this.rootname(t),i||this.hasProtocol(t)?s=1:s=0;let n=-1,a=0,l=-1,c=!0,u=t.length-1,h=0;for(;u>=s;--u){if(r=t.charCodeAt(u),r===47){if(!c){a=u+1;break}continue}l===-1&&(c=!1,l=u+1),r===46?n===-1?n=u:h!==1&&(h=1):n!==-1&&(h=-1)}return n===-1||l===-1||h===0||h===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&i?e.base=e.name=t.slice(1,l):e.base=e.name=t.slice(a,l)):(a===0&&i?(e.name=t.slice(1,n),e.base=t.slice(1,l)):(e.name=t.slice(a,n),e.base=t.slice(a,l)),e.ext=t.slice(n,l)),e.dir=this.dirname(t),o&&(e.dir=o+e.dir),e},sep:"/",delimiter:":",joinExtensions:[".html"]}});var tr,Cl=T(()=>{"use strict";tr=(t,e,r=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(i=>typeof i=="string"||r?e(i):i):t)});function wS(t,e,r,i,s){let o=e[r];for(let n=0;n<o.length;n++){let a=o[n];r<e.length-1?wS(t.replace(i[r],a),e,r+1,i,s):s.push(t.replace(i[r],a))}}function ES(t){let e=/\{(.*?)\}/g,r=t.match(e),i=[];if(r){let s=[];r.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),wS(t,s,0,r,i)}else i.push(t);return i}var AS=T(()=>{"use strict"});var ro,ed=T(()=>{"use strict";ro=t=>!Array.isArray(t)});function uG(t){return t.split(".").pop().split("?").shift().split("#").shift()}var _r,mn=T(()=>{Ne();to();Cl();AS();ed();_r=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,r)=>`${e}${this._bundleIdConnector}${r}`,extractAssetIdFromBundle:(e,r)=>r.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(r=>{this._preferredOrder.push(r),r.priority||(r.priority=Object.keys(r.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{let r=e;this._defaultSearchParams=Object.keys(r).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(r[i])}`).join("&")}}getAlias(e){let{alias:r,src:i}=e;return tr(r||i,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(e){this._manifest&&Z("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(r=>{this.addBundle(r.name,r.assets)})}addBundle(e,r){let i=[],s=r;Array.isArray(r)||(s=Object.entries(r).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let c=this._createBundleAssetId(e,a);i.push(c),l=[a,c]}else{let c=a.map(u=>this._createBundleAssetId(e,u));i.push(...c),l=[...a,...c]}this.add({...o,alias:l,src:n})}),this._bundles[e]=i}add(e){let r=[];Array.isArray(e)?r.push(...e):r.push(e);let i;i=o=>{this.hasKey(o)&&Z(`[Resolver] already has key: ${o} overwriting`)},tr(r).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:c}=o,u=tr(n).map(f=>typeof f=="string"?ES(f):Array.isArray(f)?f:[f]),h=this.getAlias(o);Array.isArray(h)?h.forEach(i):i(h);let d=[];u.forEach(f=>{f.forEach(p=>{let m={};if(typeof p!="object"){m.src=p;for(let x=0;x<this._parsers.length;x++){let v=this._parsers[x];if(v.test(p)){m=v.parse(p);break}}}else a=p.data??a,l=p.format??l,c=p.loadParser??c,m={...m,...p};if(!h)throw new Error(`[Resolver] alias is undefined for this asset: ${m.src}`);m=this._buildResolvedAsset(m,{aliases:h,data:a,format:l,loadParser:c}),d.push(m)})}),h.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(e){let r=ro(e);e=tr(e);let i={};return e.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let l in n){let c=n[l];a[this._extractAssetIdFromBundle(s,l)]=c}i[s]=a}}),r?i[e[0]]:i}resolveUrl(e){let r=this.resolve(e);if(typeof e!="string"){let i={};for(let s in r)i[s]=r[s].src;return i}return r.src}resolve(e){let r=ro(e);e=tr(e);let i={};return e.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let c=o.filter(u=>u[a]?u[a]===l:!1);c.length&&(o=c)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),r?i[e[0]]:i}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let r=0;r<e.length;r++){let i=e[r],s=this._preferredOrder.find(o=>o.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;let r=/\?/.test(e)?"&":"?";return`${e}${r}${this._defaultSearchParams}`}_buildResolvedAsset(e,r){let{aliases:i,data:s,loadParser:o,format:n}=r;return(this._basePath||this._rootPath)&&(e.src=St.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=i??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...s||{},...e.data},e.loadParser=o??e.loadParser,e.format=n??e.format??uG(e.src),e}};_r.RETINA_PREFIX=/@([0-9\.]+)x/});var Rl,Lg=T(()=>{"use strict";Rl=(t,e)=>{let r=e.split("?")[1];return r&&(t+=`?${r}`),t}});var PS,pi,Gg=T(()=>{vt();Fe();PS=class Ml{constructor(e,r){this.linkedSheets=[],this._texture=e instanceof B?e:null,this.textureSource=e.source,this.textures={},this.animations={},this.data=r;let i=parseFloat(r.meta.scale);i?(this.resolution=i,e.source.resolution=this.resolution):this.resolution=e.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=Ml.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let r=e,i=Ml.BATCH_SIZE;for(;r-e<i&&r<this._frameKeys.length;){let s=this._frameKeys[r],o=this._frames[s],n=o.frame;if(n){let a=null,l=null,c=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,u=new te(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);o.rotated?a=new te(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new te(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(l=new te(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new B({source:this.textureSource,frame:a,orig:u,trim:l,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}r++}}_processAnimations(){let e=this.data.animations||{};for(let r in e){this.animations[r]=[];for(let i=0;i<e[r].length;i++){let s=e[r][i];this.animations[r].push(this.textures[s])}}}_parseComplete(){let e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Ml.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ml.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){for(let r in this.textures)this.textures[r].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};PS.BATCH_SIZE=1e3;pi=PS});function CS(t,e,r){let i={};if(t.forEach(s=>{i[s]=e}),Object.keys(e.textures).forEach(s=>{i[s]=e.textures[s]}),!r){let s=St.dirname(t[0]);e.linkedSheets.forEach((o,n)=>{let a=CS([`${s}/${e.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(i,a)})}return i}var hG,RS,MS=T(()=>{hs();mn();Lg();O();Fe();to();Gg();hG=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];RS={extension:w.Asset,cache:{test:t=>t instanceof pi,getCacheableAssets:(t,e)=>CS(t,e,!1)},resolver:{extension:{type:w.ResolveParser,name:"resolveSpritesheet"},test:t=>{let r=t.split("?")[0].split("."),i=r.pop(),s=r.pop();return i==="json"&&hG.includes(s)},parse:t=>{let e=t.split(".");return{resolution:parseFloat(_r.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:w.LoadParser,priority:er.Normal,name:"spritesheetLoader"},async testParse(t,e){return St.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,r){let{texture:i,imageFilename:s,textureOptions:o}=e?.data??{},n=St.dirname(e.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof B)a=i;else{let u=Rl(n+(s??t.meta.image),e.src);a=(await r.load([{src:u,data:o}]))[u]}let l=new pi(a.source,t);await l.parse();let c=t?.meta?.related_multi_packs;if(Array.isArray(c)){let u=[];for(let d of c){if(typeof d!="string")continue;let f=n+d;e.data?.ignoreMultiPack||(f=Rl(f,e.src),u.push(r.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let h=await Promise.all(u);l.linkedSheets=h,h.forEach(d=>{d.linkedSheets=[l].concat(l.linkedSheets.filter(f=>f!==d))})}return l},async unload(t,e,r){await r.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}}});var td=T(()=>{O();MS();K.add(RS)});function rd(t,e,r){let{width:i,height:s}=r.orig,o=r.trim;if(o){let n=o.width,a=o.height;t.minX=o.x-e._x*i,t.maxX=t.minX+n,t.minY=o.y-e._y*s,t.maxY=t.minY+a}else t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*s,t.maxY=t.minY+s}var Dg=T(()=>{"use strict"});var ke,Il=T(()=>{Uh();Fe();Dg();tt();Jh();ke=class t extends us{constructor(e=B.EMPTY){e instanceof B&&(e={texture:e});let{texture:r=B.EMPTY,anchor:i,roundPixels:s,width:o,height:n,...a}=e;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Ft({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:r.defaultAnchor&&(this.anchor=r.defaultAnchor),this.texture=r,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(e,r=!1){return e instanceof B?new t(e):new t(B.from(e,r))}set texture(e){e||(e=B.EMPTY);let r=this._texture;r!==e&&(r&&r.dynamic&&r.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return rd(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return J("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let e=this._anchor,r=this._texture,i=this._bounds,{width:s,height:o}=r.orig;i.minX=-e._x*s,i.maxX=i.minX+s,i.minY=-e._y*o,i.maxY=i.minY+o}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,r){typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),r!==void 0&&this._setHeight(r,this._texture.orig.height)}}});function id(t,e,r){let i=dG;t.measurable=!0,nn(t,r,i),e.addBoundsMask(i),t.measurable=!1}var dG,Ng=T(()=>{ar();yl();dG=new De});function sd(t,e,r){let i=xr.get();t.measurable=!0;let s=mt.get().identity(),o=IS(t,r,s);ln(t,i,o),t.measurable=!1,e.addBoundsMask(i),mt.return(s),xr.return(i)}function IS(t,e,r){return t?(t!==e&&(IS(t.parent,e,r),t.updateLocalTransform(),r.append(t.localTransform)),r):(Z("Mask bounds, renderable is not inside the root container"),r)}var Vg=T(()=>{Hh();js();Ne()});var Bl,BS=T(()=>{O();Il();Ng();Vg();Bl=class{constructor(e){this.priority=0,this.inverse=!1,this.pipe="alphaMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof ke),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(e,r){this.inverse||id(this.mask,e,r)}addLocalBounds(e,r){sd(this.mask,e,r)}containsPoint(e,r){let i=this.mask;return r(i,e)}destroy(){this.reset()}static test(e){return e instanceof ke}};Bl.extension=w.MaskEffect});var Fl,FS=T(()=>{O();Fl=class{constructor(e){this.priority=0,this.pipe="colorMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}};Fl.extension=w.MaskEffect});var kl,kS=T(()=>{O();Yr();Ng();Vg();kl=class{constructor(e){this.priority=0,this.pipe="stencilMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(e,r){id(this.mask,e,r)}addLocalBounds(e,r){sd(this.mask,e,r)}containsPoint(e,r){let i=this.mask;return r(i,e)}destroy(){this.reset()}static test(e){return e instanceof ie}};kl.extension=w.MaskEffect});var Ht,gn=T(()=>{ze();O();Qt();Ht=class extends Re{constructor(e){e.resource||(e.resource=re.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(e=this.width,r=this.height,i=this._resolution){let s=super.resize(e,r,i);return s&&this.resizeCanvas(),s}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Ht.extension=w.TextureSource});var lr,xn=T(()=>{ze();O();Ne();Qt();lr=class extends Re{constructor(e){if(e.resource&&globalThis.HTMLImageElement&&e.resource instanceof HTMLImageElement){let r=re.get().createCanvas(e.resource.width,e.resource.height);r.getContext("2d").drawImage(e.resource,0,0,e.resource.width,e.resource.height),e.resource=r,Z("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}};lr.extension=w.TextureSource});async function od(){return Hg??(Hg=(async()=>{let e=document.createElement("canvas").getContext("webgl");if(!e)return"premultiply-alpha-on-upload";let r=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!r)return"premultiply-alpha-on-upload";let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);let s=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,s),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r);let o=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,o),e.deleteFramebuffer(s),e.deleteTexture(i),e.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Hg}var Hg,Wg=T(()=>{"use strict"});var nd,yn,$g=T(()=>{O();pn();Wg();Qt();nd=class US extends Re{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...US.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let e=Tt.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let e=this.resource,r=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(r.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.alphaMode=await od(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,r.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${r.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Tt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Tt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Tt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};nd.extension=w.TextureSource;nd.defaultOptions={...Re.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};nd.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};yn=nd});var zg,Ue,ds=T(()=>{Ne();Cl();zg=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){let r=this._cache.get(e);return r||Z(`[Assets] Asset id ${e} was not found in the Cache`),r}set(e,r){let i=tr(e),s;for(let l=0;l<this.parsers.length;l++){let c=this.parsers[l];if(c.test(r)){s=c.getCacheableAssets(i,r);break}}let o=new Map(Object.entries(s||{}));s||i.forEach(l=>{o.set(l,r)});let n=[...o.keys()],a={cacheKeys:n,keys:i};i.forEach(l=>{this._cacheMap.set(l,a)}),n.forEach(l=>{let c=s?s[l]:r;this._cache.has(l)&&this._cache.get(l)!==c&&Z("[Cache] already has key:",l),this._cache.set(l,o.get(l))})}remove(e){if(!this._cacheMap.has(e)){Z(`[Assets] Asset id ${e} was not found in the Cache`);return}let r=this._cacheMap.get(e);r.cacheKeys.forEach(s=>{this._cache.delete(s)}),r.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}},Ue=new zg});function OS(t={}){let e=t&&t.resource,r=e?t.resource:t,i=e?t:{resource:t};for(let s=0;s<Xg.length;s++){let o=Xg[s];if(o.test(r))return new o(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function LS(t={},e=!1){let r=t&&t.resource,i=r?t.resource:t,s=r?t:{resource:t};if(!e&&Ue.has(i))return Ue.get(i);let o=new B({source:OS(s)});return o.on("destroy",()=>{Ue.has(i)&&Ue.remove(i)}),e||Ue.set(i,o),o}function GS(t,e=!1){return typeof t=="string"?Ue.get(t):t instanceof Re?new B({source:t}):LS(t,e)}var Xg,Yg=T(()=>{ds();O();Qt();Fe();Xg=[];K.handleByList(w.TextureSource,Xg);B.from=GS;Re.from=OS});var ad=T(()=>{O();BS();FS();kS();yg();gn();xn();$g();Yg();K.add(Bl,Fl,kl,yn,lr,Ht,Js)});var Rt,fs=T(()=>{"use strict";Rt=class{constructor(e){this.resources=Object.create(null),this._dirty=!0;let r=0;for(let i in e){let s=e[i];this.setResource(s,r++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let e=[],r=0;for(let i in this.resources)e[r++]=this.resources[i]._resourceId;this._key=e.join("|")}setResource(e,r){let i=this.resources[r];e!==i&&(i&&e.off?.("change",this.onResourceChange,this),e.on?.("change",this.onResourceChange,this),this.resources[r]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e){let r=this.resources;for(let i in r)r[i]._touched=e}destroy(){let e=this.resources;for(let r in e)e[r].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(e){if(this._dirty=!0,e.destroyed){let r=this.resources;for(let i in r)r[i]===e&&(r[i]=null)}else this._updateKey()}}});function cd(){return(!ld||ld?.isContextLost())&&(ld=re.get().createCanvas().getContext("webgl",{})),ld}var ld,jg=T(()=>{ze()});function pG(t){let e="";for(let r=0;r<t;++r)r>0&&(e+=`
|
|
19
|
+
`,e.accessibleText&&(r.innerText=e.accessibleText)),r.style.width=`${qh}px`,r.style.height=`${qh}px`,r.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",r.style.position="absolute",r.style.zIndex=iS.toString(),r.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?r.setAttribute("aria-live","off"):r.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?r.setAttribute("aria-relevant","additions"):r.setAttribute("aria-relevant","text"),r.addEventListener("click",this._onClick.bind(this)),r.addEventListener("focus",this._onFocus.bind(this)),r.addEventListener("focusout",this._onFocusOut.bind(this))),r.style.pointerEvents=e.accessiblePointerEvents,r.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?r.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(r.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&r.setAttribute("aria-label",e.accessibleHint),this.debug&&this._updateDebugHTML(r),e._accessibleActive=!0,e._accessibleDiv=r,r.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv),e.interactive&&(e._accessibleDiv.tabIndex=e.tabIndex)}_dispatchEvent(e,r){let{container:i}=e.target,s=this._renderer.events.rootBoundary,o=Object.assign(new ls(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,r.forEach(n=>s.dispatchEvent(o,n))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode!==ZL||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}};Cg.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"accessibility"};Cg.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};nS=Cg});var lS,cS=T(()=>{"use strict";lS={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var uS=T(()=>{O();Yr();aS();cS();K.add(nS);K.mixin(ie,lS)});var Tl,hS=T(()=>{O();Tl=class{static init(e){Object.defineProperty(this,"resizeTo",{set(r){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=r,r&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let r,i;if(this._resizeTo===globalThis.window)r=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;r=s,i=o}this.renderer.resize(r,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};Tl.extension=w.Application});var hi,Sl=T(()=>{"use strict";hi=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(hi||{})});var fn,dS=T(()=>{"use strict";fn=class{constructor(e,r=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=r,this.priority=i,this._once=s}match(e,r=null){return this._fn===e&&this._context===r}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));let r=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),r}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!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 r=this.next;return this.next=e?null:r,this.previous=null,r}}});var fS,Tt,pn=T(()=>{Sl();dS();fS=class yr{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 fn(null,null,1/0),this.deltaMS=1/yr.targetFPMS,this.elapsedMS=1/yr.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,r,i=hi.NORMAL){return this._addListener(new fn(e,r,i))}addOnce(e,r,i=hi.NORMAL){return this._addListener(new fn(e,r,i,!0))}_addListener(e){let r=this._head.next,i=this._head;if(!r)e.connect(i);else{for(;r;){if(e.priority>r.priority){e.connect(i);break}i=r,r=r.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,r){let i=this._head.next;for(;i;)i.match(e,r)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,r=this._head;for(;r=r.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let r;if(e>this.lastTime){if(r=this.elapsedMS=e-this.lastTime,r>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){let o=e-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=e-o%this._minElapsedMS}this.deltaMS=r,this.deltaTime=this.deltaMS*yr.targetFPMS;let i=this._head,s=i.next;for(;s;)s=s.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){let r=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,r)/1e3,yr.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{let r=Math.max(this.minFPS,e);this._minElapsedMS=1/(r/1e3)}}static get shared(){if(!yr._shared){let e=yr._shared=new yr;e.autoStart=!0,e._protected=!0}return yr._shared}static get system(){if(!yr._system){let e=yr._system=new yr;e.autoStart=!0,e._protected=!0}return yr._system}};fS.targetFPMS=.06;Tt=fS});var wl,pS=T(()=>{O();Sl();pn();wl=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(r){this._ticker&&this._ticker.remove(this.render,this),this._ticker=r,r&&r.add(this.render,this,hi.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Tt.shared:new Tt,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};wl.extension=w.Application});var Rg=T(()=>{O();hS();pS();K.add(Tl);K.add(wl)});var Mg,di,Ig=T(()=>{Sl();pn();Mg=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(Tt.system.add(this._tickerUpdate,this,hi.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Tt.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},di=new Mg});var Di,Kh=T(()=>{gr();Yh();Di=class extends ls{constructor(){super(...arguments),this.client=new ve,this.movement=new ve,this.offset=new ve,this.global=new ve,this.screen=new ve}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,r,i){return e.worldTransform.applyInverse(i||this.global,r)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,r,i,s,o,n,a,l,c,u,h,d,f,p,m){throw new Error("Method not implemented.")}}});var Jt,Bg=T(()=>{Kh();Jt=class extends Di{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var fi,Fg=T(()=>{Kh();fi=class extends Di{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};fi.DOM_DELTA_PIXEL=0;fi.DOM_DELTA_LINE=1;fi.DOM_DELTA_PAGE=2});var iG,sG,El,Zh,mS=T(()=>{Vt();gr();Ne();Ig();Kh();Bg();Fg();iG=2048,sG=new ve,El=new ve,Zh=class{constructor(e){this.dispatch=new $e,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,r){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:r,priority:0}),this.mappingTable[e].sort((i,s)=>i.priority-s.priority)}dispatchEvent(e,r){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,r),this.dispatch.emit(r||e.type,e)}mapEvent(e){if(!this.rootTarget)return;let r=this.mappingTable[e.type];if(r)for(let i=0,s=r.length;i<s;i++)r[i].fn(e);else Z(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,r){di.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,sG.set(e,r),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(e,r){if(!e.target)return;let i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let s=0,o=i.length-1;s<o;s++)if(e.currentTarget=i[s],this.notifyTarget(e,r),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,r),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(e.currentTarget=i[s],this.notifyTarget(e,r),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,r,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;let s=Array.isArray(r)?r:[r];for(let o=i.length-1;o>=0;o--)s.forEach(n=>{e.currentTarget=i[o],this.notifyTarget(e,n)})}propagationPath(e){let r=[e];for(let i=0;i<iG&&e!==this.rootTarget&&e.parent;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");r.push(e.parent),e=e.parent}return r.reverse(),r}hitTestMoveRecursive(e,r,i,s,o,n=!1){let a=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||r==="dynamic")&&(di.pauseUpdate=!1),e.interactiveChildren&&e.children){let u=e.children;for(let h=u.length-1;h>=0;h--){let d=u[h],f=this.hitTestMoveRecursive(d,this._isInteractive(r)?r:d.eventMode,i,s,o,n||o(e,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let p=e.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let l=this._isInteractive(r),c=e.isInteractive();return c&&c&&this._allInteractiveElements.push(e),n||this._hitElements.length>0?null:a?this._hitElements:l&&!o(e,i)&&s(e,i)?c?[e]:[]:null}hitTestRecursive(e,r,i,s,o){if(this._interactivePrune(e)||o(e,i))return null;if((e.eventMode==="dynamic"||r==="dynamic")&&(di.pauseUpdate=!1),e.interactiveChildren&&e.children){let l=e.children,c=i;for(let u=l.length-1;u>=0;u--){let h=l[u],d=this.hitTestRecursive(h,this._isInteractive(r)?r:h.eventMode,c,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=e.isInteractive();return(d.length>0||f)&&d.push(e),d}}}let n=this._isInteractive(r),a=e.isInteractive();return n&&s(e,i)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,r){if(e.hitArea&&(e.worldTransform.applyInverse(r,El),!e.hitArea.contains(El.x,El.y)))return!0;if(e.effects&&e.effects.length)for(let i=0;i<e.effects.length;i++){let s=e.effects[i];if(s.containsPoint&&!s.containsPoint(r,this.hitTestFn))return!0}return!1}hitTestFn(e,r){return e.hitArea?!0:e?.containsPoint?(e.worldTransform.applyInverse(r,El),e.containsPoint(El)):!1}notifyTarget(e,r){if(!e.currentTarget.isInteractive())return;r??(r=e.type);let i=`on${r}`;e.currentTarget[i]?.(e);let s=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${r}capture`:r;this._notifyListeners(e,s),e.eventPhase===e.AT_TARGET&&this._notifyListeners(e,r)}mapPointerDown(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let r=this.createPointerEvent(e);if(this.dispatchEvent(r,"pointerdown"),r.pointerType==="touch")this.dispatchEvent(r,"touchstart");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let s=r.button===2;this.dispatchEvent(r,s?"rightdown":"mousedown")}let i=this.trackingData(e.pointerId);i.pressTargetsByButton[e.button]=r.composedPath(),this.freeEvent(r)}mapPointerMove(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let r=this.createPointerEvent(e);this._isPointerMoveEvent=!1;let i=r.pointerType==="mouse"||r.pointerType==="pen",s=this.trackingData(e.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==r.target){let l=e.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(e,l,o);if(this.dispatchEvent(c,"pointerout"),i&&this.dispatchEvent(c,"mouseout"),!r.composedPath().includes(o)){let u=this.createPointerEvent(e,"pointerleave",o);for(u.eventPhase=u.AT_TARGET;u.target&&!r.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),i&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(c)}if(o!==r.target){let l=e.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(r,l);this.dispatchEvent(c,"pointerover"),i&&this.dispatchEvent(c,"mouseover");let u=o?.parent;for(;u&&u!==this.rootTarget.parent&&u!==r.target;)u=u.parent;if(!u||u===this.rootTarget.parent){let d=this.clonePointerEvent(r,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(r,"pointermove"),a&&n.push("globalpointermove"),r.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(r,"touchmove"),a&&n.push("globaltouchmove")),i&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(r,"mousemove"),a&&n.push("globalmousemove"),this.cursor=r.target?.cursor),n.length>0&&this.all(r,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=r.composedPath(),this.freeEvent(r)}mapPointerOver(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let r=this.trackingData(e.pointerId),i=this.createPointerEvent(e),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let o=this.clonePointerEvent(i,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;r.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(o)}mapPointerOut(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let r=this.trackingData(e.pointerId);if(r.overTargets){let i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.findMountedTarget(r.overTargets),o=this.createPointerEvent(e,"pointerout",s);this.dispatchEvent(o),i&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(e,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;r.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let r=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let s=this.trackingData(e.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[e.button]),n=o;if(o&&!i.composedPath().includes(o)){let a=o;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[e.button],n=a}if(n){let a=this.clonePointerEvent(i,"click");a.target=n,a.path=null,s.clicksByButton[e.button]||(s.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:r});let l=s.clicksByButton[e.button];if(l.target===a.target&&r-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=r,a.detail=l.clickCount,a.pointerType==="mouse"){let c=a.button===2;this.dispatchEvent(a,c?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof Jt)){Z("EventBoundary cannot map a non-pointer event as a pointer event");return}let r=this.trackingData(e.pointerId),i=this.findMountedTarget(r.pressTargetsByButton[e.button]),s=this.createPointerEvent(e);if(i){let o=i;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete r.pressTargetsByButton[e.button]}this.freeEvent(s)}mapWheel(e){if(!(e instanceof fi)){Z("EventBoundary cannot map a non-wheel event as a wheel event");return}let r=this.createWheelEvent(e);this.dispatchEvent(r),this.freeEvent(r)}findMountedTarget(e){if(!e)return null;let r=e[0];for(let i=1;i<e.length&&e[i].parent===r;i++)r=e[i];return r}createPointerEvent(e,r,i){let s=this.allocateEvent(Jt);return this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.nativeEvent=e.nativeEvent,s.originalEvent=e,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof r=="string"&&(s.type=r),s}createWheelEvent(e){let r=this.allocateEvent(fi);return this.copyWheelData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.nativeEvent=e.nativeEvent,r.originalEvent=e,r.target=this.hitTest(r.global.x,r.global.y),r}clonePointerEvent(e,r){let i=this.allocateEvent(Jt);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=r??i.type,i}copyWheelData(e,r){r.deltaMode=e.deltaMode,r.deltaX=e.deltaX,r.deltaY=e.deltaY,r.deltaZ=e.deltaZ}copyPointerData(e,r){e instanceof Jt&&r instanceof Jt&&(r.pointerId=e.pointerId,r.width=e.width,r.height=e.height,r.isPrimary=e.isPrimary,r.pointerType=e.pointerType,r.pressure=e.pressure,r.tangentialPressure=e.tangentialPressure,r.tiltX=e.tiltX,r.tiltY=e.tiltY,r.twist=e.twist)}copyMouseData(e,r){e instanceof Di&&r instanceof Di&&(r.altKey=e.altKey,r.button=e.button,r.buttons=e.buttons,r.client.copyFrom(e.client),r.ctrlKey=e.ctrlKey,r.metaKey=e.metaKey,r.movement.copyFrom(e.movement),r.screen.copyFrom(e.screen),r.shiftKey=e.shiftKey,r.global.copyFrom(e.global))}copyData(e,r){r.isTrusted=e.isTrusted,r.srcElement=e.srcElement,r.timeStamp=performance.now(),r.type=e.type,r.detail=e.detail,r.view=e.view,r.which=e.which,r.layer.copyFrom(e.layer),r.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);let r=this.eventPool.get(e).pop()||new e(this);return r.eventPhase=r.NONE,r.currentTarget=null,r.defaultPrevented=!1,r.path=null,r.target=null,r}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let r=e.constructor;this.eventPool.has(r)||this.eventPool.set(r,[]),this.eventPool.get(r).push(e)}_notifyListeners(e,r){let i=e.currentTarget._events[r];if(i)if("fn"in i)i.once&&e.currentTarget.removeListener(r,i.fn,void 0,!0),i.fn.call(i.context,e);else for(let s=0,o=i.length;s<o&&!e.propagationImmediatelyStopped;s++)i[s].once&&e.currentTarget.removeListener(r,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,e)}}});var oG,nG,Ug,Qh,Og=T(()=>{O();mS();Ig();Bg();Fg();oG=1,nG={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ug=class kg{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new Zh(null),di.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Jt(null),this._rootWheelEvent=new fi(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...kg.defaultEventFeatures},{set:(r,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),r[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){let{canvas:r,resolution:i}=this.renderer;this.setTargetElement(r),this.resolution=i,kg._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||(e="default");let r=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(r=!1),this._currentCursor===e)return;this._currentCursor=e;let i=this.cursorStyles[e];if(i)switch(typeof i){case"string":r&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":r&&Object.assign(this.domElement.style,i);break}else r&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let r=this._normalizeToPointerData(e);this.autoPreventDefault&&r[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,s=r.length;i<s;i++){let o=r[i],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,di.pointerMoved();let r=this._normalizeToPointerData(e);for(let i=0,s=r.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,r[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let r=e.target;e.composedPath&&e.composedPath().length>0&&(r=e.composedPath()[0]);let i=r!==this.domElement?"outside":"",s=this._normalizeToPointerData(e);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let r=this._normalizeToPointerData(e);for(let i=0,s=r.length;i<s;i++){let o=this._bootstrapEvent(this._rootPointerEvent,r[i]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;let r=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(r)}setTargetElement(e){this._removeEvents(),this.domElement=e,di.domElement=e,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;di.addTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;di.removeTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(e,r,i){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;e.x=(r-s.left)*(this.domElement.width/s.width)*o,e.y=(i-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(e){let r=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let i=0,s=e.changedTouches.length;i<s;i++){let o=e.changedTouches[i];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=e.type,r.push(o)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){let i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=oG),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,r.push(i)}else r.push(e);return r}normalizeWheelEvent(e){let r=this._rootWheelEvent;return this._transferMouseData(r,e),r.deltaX=e.deltaX,r.deltaY=e.deltaY,r.deltaZ=e.deltaZ,r.deltaMode=e.deltaMode,this.mapPositionToPoint(r.screen,e.clientX,e.clientY),r.global.copyFrom(r.screen),r.offset.copyFrom(r.screen),r.nativeEvent=e,r.type=e.type,r}_bootstrapEvent(e,r){return e.originalEvent=null,e.nativeEvent=r,e.pointerId=r.pointerId,e.width=r.width,e.height=r.height,e.isPrimary=r.isPrimary,e.pointerType=r.pointerType,e.pressure=r.pressure,e.tangentialPressure=r.tangentialPressure,e.tiltX=r.tiltX,e.tiltY=r.tiltY,e.twist=r.twist,this._transferMouseData(e,r),this.mapPositionToPoint(e.screen,r.clientX,r.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=r.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=nG[e.type]||e.type),e}_transferMouseData(e,r){e.isTrusted=r.isTrusted,e.srcElement=r.srcElement,e.timeStamp=performance.now(),e.type=r.type,e.altKey=r.altKey,e.button=r.button,e.buttons=r.buttons,e.client.x=r.clientX,e.client.y=r.clientY,e.ctrlKey=r.ctrlKey,e.metaKey=r.metaKey,e.movement.x=r.movementX,e.movement.y=r.movementY,e.page.x=r.pageX,e.page.y=r.pageY,e.relatedTarget=null,e.shiftKey=r.shiftKey}};Ug.extension={name:"events",type:[w.WebGLSystem,w.CanvasSystem,w.WebGPUSystem],priority:-1};Ug.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};Qh=Ug});var gS,xS=T(()=>{Og();Yh();gS={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(t){this.eventMode=t?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Qh.defaultEventMode},set eventMode(t){this._internalEventMode=t},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(t,e,r){let i=typeof r=="boolean"&&r||typeof r=="object"&&r.capture,s=typeof r=="object"?r.signal:void 0,o=typeof r=="object"?r.once===!0:!1,n=typeof e=="function"?void 0:e;t=i?`${t}capture`:t;let a=typeof e=="function"?e:e.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(t,a,n)}),o?l.once(t,a,n):l.on(t,a,n)},removeEventListener(t,e,r){let i=typeof r=="boolean"&&r||typeof r=="object"&&r.capture,s=typeof e=="function"?void 0:e;t=i?`${t}capture`:t,e=typeof e=="function"?e:e.handleEvent,this.off(t,e,s)},dispatchEvent(t){if(!(t instanceof ls))throw new Error("Container cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}}});var yS=T(()=>{O();Yr();Og();xS();K.add(Qh);K.mixin(ie,gS)});var Al,_S=T(()=>{O();Al=class{constructor(e){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=e,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(e,r){this._attachedDomElements.includes(e)||(this._attachedDomElements.push(e),e.on("destroyed",this._destroyRenderableBound))}updateRenderable(e){}validateRenderable(e){return!0}destroyRenderable(e){let r=this._attachedDomElements.indexOf(e);r!==-1&&this._attachedDomElements.splice(r,1),e.off("destroyed",this._destroyRenderableBound)}postrender(){let e=this._attachedDomElements;if(e.length===0){this._domElement.remove();return}let r=this._renderer.view.canvas;this._domElement.parentNode!==r.parentNode&&r.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${r.offsetLeft}px, ${r.offsetTop}px)`;for(let i=0;i<e.length;i++){let s=e[i],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),e.splice(i,1),i--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,l=s.width*a.x,c=s.height*a.y;o.style.transformOrigin=`${l}px ${c}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-l}, ${n.ty-c})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let e=0;e<this._attachedDomElements.length;e++){let r=this._attachedDomElements[e];r.off("destroyed",this._destroyRenderableBound),r.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};Al.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"dom"}});var us,Jh=T(()=>{ar();Yr();us=class extends ie{constructor(e){super(e),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new De(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){let r=this.bounds,{x:i,y:s}=e;return i>=r.minX&&i<=r.maxX&&s>=r.minY&&s<=r.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}destroy(e){super.destroy(e),this._bounds=null}collectRenderablesSimple(e,r,i){let{renderPipes:s,renderableGC:o}=r;s.blendMode.setBlendMode(this,this.groupBlendMode,e),s[this.renderPipeId].addRenderable(this,e),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,l=a.length;for(let c=0;c<l;c++)a[c].collectRenderables(e,r,i)}}});var bS=T(()=>{O();_S();K.add(Al)});var er,hs=T(()=>{"use strict";er=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(er||{})});var vS,TS=T(()=>{"use strict";vS={createCanvas:(t,e)=>{let r=document.createElement("canvas");return r.width=t,r.height=e,r},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")}});var SS,re,ze=T(()=>{TS();SS=vS,re={get(){return SS},set(t){SS=t}}});function jr(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function Pl(t){return t.split("?")[0].split("#")[0]}function aG(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lG(t,e,r){return t.replace(new RegExp(aG(e),"g"),r)}function cG(t,e){let r="",i=0,s=-1,o=0,n=-1;for(let a=0;a<=t.length;++a){if(a<t.length)n=t.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){let l=r.lastIndexOf("/");if(l!==r.length-1){l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),s=a,o=0;continue}}else if(r.length===2||r.length===1){r="",i=0,s=a,o=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+=`/${t.slice(s+1,a)}`:r=t.slice(s+1,a),i=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return r}var St,to=T(()=>{ze();St={toPosix(t){return lG(t,"\\","/")},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl(t){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t)},isBlobUrl(t){return t.startsWith("blob:")},hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){jr(t),t=this.toPosix(t);let e=/^file:\/\/\//.exec(t);if(e)return e[0];let r=/^[^/:]+:\/{0,2}/.exec(t);return r?r[0]:""},toAbsolute(t,e,r){if(jr(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;let i=Pl(this.toPosix(e??re.get().getBaseUrl())),s=Pl(this.toPosix(r??this.rootname(i)));return t=this.toPosix(t),t.startsWith("/")?St.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(i,t)},normalize(t){if(jr(t),t.length===0)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="",r=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));let i=t.endsWith("/");return t=cG(t,!1),t.length>0&&i&&(t+="/"),r?`/${t}`:e+t},isAbsolute(t){return jr(t),t=this.toPosix(t),this.hasProtocol(t)?!0:t.startsWith("/")},join(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let i=t[r];if(jr(i),i.length>0)if(e===void 0)e=i;else{let s=t[r-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(t){if(jr(t),t.length===0)return".";t=this.toPosix(t);let e=t.charCodeAt(0),r=e===47,i=-1,s=!0,o=this.getProtocol(t),n=t;t=t.slice(o.length);for(let a=t.length-1;a>=1;--a)if(e=t.charCodeAt(a),e===47){if(!s){i=a;break}}else s=!1;return i===-1?r?"/":this.isUrl(n)?o+t:o:r&&i===1?"//":o+t.slice(0,i)},rootname(t){jr(t),t=this.toPosix(t);let e="";if(t.startsWith("/")?e="/":e=this.getProtocol(t),this.isUrl(t)){let r=t.indexOf("/",e.length);r!==-1?e=t.slice(0,r):e=t,e.endsWith("/")||(e+="/")}return e},basename(t,e){jr(t),e&&jr(e),t=Pl(this.toPosix(t));let r=0,i=-1,s=!0,o;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let n=e.length-1,a=-1;for(o=t.length-1;o>=0;--o){let l=t.charCodeAt(o);if(l===47){if(!s){r=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(l===e.charCodeAt(n)?--n===-1&&(i=o):(n=-1,i=a))}return r===i?i=a:i===-1&&(i=t.length),t.slice(r,i)}for(o=t.length-1;o>=0;--o)if(t.charCodeAt(o)===47){if(!s){r=o+1;break}}else i===-1&&(s=!1,i=o+1);return i===-1?"":t.slice(r,i)},extname(t){jr(t),t=Pl(this.toPosix(t));let e=-1,r=0,i=-1,s=!0,o=0;for(let n=t.length-1;n>=0;--n){let a=t.charCodeAt(n);if(a===47){if(!s){r=n+1;break}continue}i===-1&&(s=!1,i=n+1),a===46?e===-1?e=n:o!==1&&(o=1):e!==-1&&(o=-1)}return e===-1||i===-1||o===0||o===1&&e===i-1&&e===r+1?"":t.slice(e,i)},parse(t){jr(t);let e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=Pl(this.toPosix(t));let r=t.charCodeAt(0),i=this.isAbsolute(t),s,o="";e.root=this.rootname(t),i||this.hasProtocol(t)?s=1:s=0;let n=-1,a=0,l=-1,c=!0,u=t.length-1,h=0;for(;u>=s;--u){if(r=t.charCodeAt(u),r===47){if(!c){a=u+1;break}continue}l===-1&&(c=!1,l=u+1),r===46?n===-1?n=u:h!==1&&(h=1):n!==-1&&(h=-1)}return n===-1||l===-1||h===0||h===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&i?e.base=e.name=t.slice(1,l):e.base=e.name=t.slice(a,l)):(a===0&&i?(e.name=t.slice(1,n),e.base=t.slice(1,l)):(e.name=t.slice(a,n),e.base=t.slice(a,l)),e.ext=t.slice(n,l)),e.dir=this.dirname(t),o&&(e.dir=o+e.dir),e},sep:"/",delimiter:":",joinExtensions:[".html"]}});var tr,Cl=T(()=>{"use strict";tr=(t,e,r=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(i=>typeof i=="string"||r?e(i):i):t)});function wS(t,e,r,i,s){let o=e[r];for(let n=0;n<o.length;n++){let a=o[n];r<e.length-1?wS(t.replace(i[r],a),e,r+1,i,s):s.push(t.replace(i[r],a))}}function ES(t){let e=/\{(.*?)\}/g,r=t.match(e),i=[];if(r){let s=[];r.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),wS(t,s,0,r,i)}else i.push(t);return i}var AS=T(()=>{"use strict"});var ro,ed=T(()=>{"use strict";ro=t=>!Array.isArray(t)});function uG(t){return t.split(".").pop().split("?").shift().split("#").shift()}var _r,mn=T(()=>{Ne();to();Cl();AS();ed();_r=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,r)=>`${e}${this._bundleIdConnector}${r}`,extractAssetIdFromBundle:(e,r)=>r.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(r=>{this._preferredOrder.push(r),r.priority||(r.priority=Object.keys(r.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{let r=e;this._defaultSearchParams=Object.keys(r).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(r[i])}`).join("&")}}getAlias(e){let{alias:r,src:i}=e;return tr(r||i,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(e){this._manifest&&Z("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(r=>{this.addBundle(r.name,r.assets)})}addBundle(e,r){let i=[],s=r;Array.isArray(r)||(s=Object.entries(r).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let c=this._createBundleAssetId(e,a);i.push(c),l=[a,c]}else{let c=a.map(u=>this._createBundleAssetId(e,u));i.push(...c),l=[...a,...c]}this.add({...o,alias:l,src:n})}),this._bundles[e]=i}add(e){let r=[];Array.isArray(e)?r.push(...e):r.push(e);let i;i=o=>{this.hasKey(o)&&Z(`[Resolver] already has key: ${o} overwriting`)},tr(r).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:c}=o,u=tr(n).map(f=>typeof f=="string"?ES(f):Array.isArray(f)?f:[f]),h=this.getAlias(o);Array.isArray(h)?h.forEach(i):i(h);let d=[];u.forEach(f=>{f.forEach(p=>{let m={};if(typeof p!="object"){m.src=p;for(let x=0;x<this._parsers.length;x++){let v=this._parsers[x];if(v.test(p)){m=v.parse(p);break}}}else a=p.data??a,l=p.format??l,c=p.loadParser??c,m={...m,...p};if(!h)throw new Error(`[Resolver] alias is undefined for this asset: ${m.src}`);m=this._buildResolvedAsset(m,{aliases:h,data:a,format:l,loadParser:c}),d.push(m)})}),h.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(e){let r=ro(e);e=tr(e);let i={};return e.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let l in n){let c=n[l];a[this._extractAssetIdFromBundle(s,l)]=c}i[s]=a}}),r?i[e[0]]:i}resolveUrl(e){let r=this.resolve(e);if(typeof e!="string"){let i={};for(let s in r)i[s]=r[s].src;return i}return r.src}resolve(e){let r=ro(e);e=tr(e);let i={};return e.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let c=o.filter(u=>u[a]?u[a]===l:!1);c.length&&(o=c)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),r?i[e[0]]:i}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let r=0;r<e.length;r++){let i=e[r],s=this._preferredOrder.find(o=>o.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;let r=/\?/.test(e)?"&":"?";return`${e}${r}${this._defaultSearchParams}`}_buildResolvedAsset(e,r){let{aliases:i,data:s,loadParser:o,format:n}=r;return(this._basePath||this._rootPath)&&(e.src=St.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=i??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...s||{},...e.data},e.loadParser=o??e.loadParser,e.format=n??e.format??uG(e.src),e}};_r.RETINA_PREFIX=/@([0-9\.]+)x/});var Rl,Lg=T(()=>{"use strict";Rl=(t,e)=>{let r=e.split("?")[1];return r&&(t+=`?${r}`),t}});var PS,pi,Gg=T(()=>{vt();Fe();PS=class Ml{constructor(e,r){this.linkedSheets=[],this._texture=e instanceof B?e:null,this.textureSource=e.source,this.textures={},this.animations={},this.data=r;let i=parseFloat(r.meta.scale);i?(this.resolution=i,e.source.resolution=this.resolution):this.resolution=e.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=Ml.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let r=e,i=Ml.BATCH_SIZE;for(;r-e<i&&r<this._frameKeys.length;){let s=this._frameKeys[r],o=this._frames[s],n=o.frame;if(n){let a=null,l=null,c=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,u=new te(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);o.rotated?a=new te(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new te(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(l=new te(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new B({source:this.textureSource,frame:a,orig:u,trim:l,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}r++}}_processAnimations(){let e=this.data.animations||{};for(let r in e){this.animations[r]=[];for(let i=0;i<e[r].length;i++){let s=e[r][i];this.animations[r].push(this.textures[s])}}}_parseComplete(){let e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Ml.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ml.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){for(let r in this.textures)this.textures[r].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};PS.BATCH_SIZE=1e3;pi=PS});function CS(t,e,r){let i={};if(t.forEach(s=>{i[s]=e}),Object.keys(e.textures).forEach(s=>{i[s]=e.textures[s]}),!r){let s=St.dirname(t[0]);e.linkedSheets.forEach((o,n)=>{let a=CS([`${s}/${e.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(i,a)})}return i}var hG,RS,MS=T(()=>{hs();mn();Lg();O();Fe();to();Gg();hG=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];RS={extension:w.Asset,cache:{test:t=>t instanceof pi,getCacheableAssets:(t,e)=>CS(t,e,!1)},resolver:{extension:{type:w.ResolveParser,name:"resolveSpritesheet"},test:t=>{let r=t.split("?")[0].split("."),i=r.pop(),s=r.pop();return i==="json"&&hG.includes(s)},parse:t=>{let e=t.split(".");return{resolution:parseFloat(_r.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:w.LoadParser,priority:er.Normal,name:"spritesheetLoader"},async testParse(t,e){return St.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,r){let{texture:i,imageFilename:s,textureOptions:o}=e?.data??{},n=St.dirname(e.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof B)a=i;else{let u=Rl(n+(s??t.meta.image),e.src);a=(await r.load([{src:u,data:o}]))[u]}let l=new pi(a.source,t);await l.parse();let c=t?.meta?.related_multi_packs;if(Array.isArray(c)){let u=[];for(let d of c){if(typeof d!="string")continue;let f=n+d;e.data?.ignoreMultiPack||(f=Rl(f,e.src),u.push(r.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let h=await Promise.all(u);l.linkedSheets=h,h.forEach(d=>{d.linkedSheets=[l].concat(l.linkedSheets.filter(f=>f!==d))})}return l},async unload(t,e,r){await r.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}}});var td=T(()=>{O();MS();K.add(RS)});function rd(t,e,r){let{width:i,height:s}=r.orig,o=r.trim;if(o){let n=o.width,a=o.height;t.minX=o.x-e._x*i,t.maxX=t.minX+n,t.minY=o.y-e._y*s,t.maxY=t.minY+a}else t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*s,t.maxY=t.minY+s}var Dg=T(()=>{"use strict"});var ke,Il=T(()=>{Uh();Fe();Dg();tt();Jh();ke=class t extends us{constructor(e=B.EMPTY){e instanceof B&&(e={texture:e});let{texture:r=B.EMPTY,anchor:i,roundPixels:s,width:o,height:n,...a}=e;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Ft({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:r.defaultAnchor&&(this.anchor=r.defaultAnchor),this.texture=r,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(e,r=!1){return e instanceof B?new t(e):new t(B.from(e,r))}set texture(e){e||(e=B.EMPTY);let r=this._texture;r!==e&&(r&&r.dynamic&&r.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return rd(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return J("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let e=this._anchor,r=this._texture,i=this._bounds,{width:s,height:o}=r.orig;i.minX=-e._x*s,i.maxX=i.minX+s,i.minY=-e._y*o,i.maxY=i.minY+o}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,r){typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),r!==void 0&&this._setHeight(r,this._texture.orig.height)}}});function id(t,e,r){let i=dG;t.measurable=!0,nn(t,r,i),e.addBoundsMask(i),t.measurable=!1}var dG,Ng=T(()=>{ar();yl();dG=new De});function sd(t,e,r){let i=xr.get();t.measurable=!0;let s=mt.get().identity(),o=IS(t,r,s);ln(t,i,o),t.measurable=!1,e.addBoundsMask(i),mt.return(s),xr.return(i)}function IS(t,e,r){return t?(t!==e&&(IS(t.parent,e,r),t.updateLocalTransform(),r.append(t.localTransform)),r):(Z("Mask bounds, renderable is not inside the root container"),r)}var Vg=T(()=>{Hh();js();Ne()});var Bl,BS=T(()=>{O();Il();Ng();Vg();Bl=class{constructor(e){this.priority=0,this.inverse=!1,this.pipe="alphaMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof ke),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(e,r){this.inverse||id(this.mask,e,r)}addLocalBounds(e,r){sd(this.mask,e,r)}containsPoint(e,r){let i=this.mask;return r(i,e)}destroy(){this.reset()}static test(e){return e instanceof ke}};Bl.extension=w.MaskEffect});var Fl,FS=T(()=>{O();Fl=class{constructor(e){this.priority=0,this.pipe="colorMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}};Fl.extension=w.MaskEffect});var kl,kS=T(()=>{O();Yr();Ng();Vg();kl=class{constructor(e){this.priority=0,this.pipe="stencilMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(e,r){id(this.mask,e,r)}addLocalBounds(e,r){sd(this.mask,e,r)}containsPoint(e,r){let i=this.mask;return r(i,e)}destroy(){this.reset()}static test(e){return e instanceof ie}};kl.extension=w.MaskEffect});var Ht,gn=T(()=>{ze();O();Qt();Ht=class extends Re{constructor(e){e.resource||(e.resource=re.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(e=this.width,r=this.height,i=this._resolution){let s=super.resize(e,r,i);return s&&this.resizeCanvas(),s}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Ht.extension=w.TextureSource});var lr,xn=T(()=>{ze();O();Ne();Qt();lr=class extends Re{constructor(e){if(e.resource&&globalThis.HTMLImageElement&&e.resource instanceof HTMLImageElement){let r=re.get().createCanvas(e.resource.width,e.resource.height);r.getContext("2d").drawImage(e.resource,0,0,e.resource.width,e.resource.height),e.resource=r,Z("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}};lr.extension=w.TextureSource});async function od(){return Hg??(Hg=(async()=>{let e=document.createElement("canvas").getContext("webgl");if(!e)return"premultiply-alpha-on-upload";let r=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!r)return"premultiply-alpha-on-upload";let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);let s=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,s),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r);let o=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,o),e.deleteFramebuffer(s),e.deleteTexture(i),e.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Hg}var Hg,Wg=T(()=>{"use strict"});var nd,yn,$g=T(()=>{O();pn();Wg();Qt();nd=class US extends Re{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...US.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let e=Tt.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let e=this.resource,r=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(r.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.alphaMode=await od(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,r.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${r.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Tt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Tt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Tt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};nd.extension=w.TextureSource;nd.defaultOptions={...Re.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};nd.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};yn=nd});var zg,Ue,ds=T(()=>{Ne();Cl();zg=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){let r=this._cache.get(e);return r||Z(`[Assets] Asset id ${e} was not found in the Cache`),r}set(e,r){let i=tr(e),s;for(let l=0;l<this.parsers.length;l++){let c=this.parsers[l];if(c.test(r)){s=c.getCacheableAssets(i,r);break}}let o=new Map(Object.entries(s||{}));s||i.forEach(l=>{o.set(l,r)});let n=[...o.keys()],a={cacheKeys:n,keys:i};i.forEach(l=>{this._cacheMap.set(l,a)}),n.forEach(l=>{let c=s?s[l]:r;this._cache.has(l)&&this._cache.get(l)!==c&&Z("[Cache] already has key:",l),this._cache.set(l,o.get(l))})}remove(e){if(!this._cacheMap.has(e)){Z(`[Assets] Asset id ${e} was not found in the Cache`);return}let r=this._cacheMap.get(e);r.cacheKeys.forEach(s=>{this._cache.delete(s)}),r.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}},Ue=new zg});function OS(t={}){let e=t&&t.resource,r=e?t.resource:t,i=e?t:{resource:t};for(let s=0;s<Xg.length;s++){let o=Xg[s];if(o.test(r))return new o(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function LS(t={},e=!1){let r=t&&t.resource,i=r?t.resource:t,s=r?t:{resource:t};if(!e&&Ue.has(i))return Ue.get(i);let o=new B({source:OS(s)});return o.on("destroy",()=>{Ue.has(i)&&Ue.remove(i)}),e||Ue.set(i,o),o}function GS(t,e=!1){return typeof t=="string"?Ue.get(t):t instanceof Re?new B({source:t}):LS(t,e)}var Xg,Yg=T(()=>{ds();O();Qt();Fe();Xg=[];K.handleByList(w.TextureSource,Xg);B.from=GS;Re.from=OS});var ad=T(()=>{O();BS();FS();kS();yg();gn();xn();$g();Yg();K.add(Bl,Fl,kl,yn,lr,Ht,Js)});var Rt,fs=T(()=>{"use strict";Rt=class{constructor(e){this.resources=Object.create(null),this._dirty=!0;let r=0;for(let i in e){let s=e[i];this.setResource(s,r++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let e=[],r=0;for(let i in this.resources)e[r++]=this.resources[i]._resourceId;this._key=e.join("|")}setResource(e,r){let i=this.resources[r];e!==i&&(i&&e.off?.("change",this.onResourceChange,this),e.on?.("change",this.onResourceChange,this),this.resources[r]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e){let r=this.resources;for(let i in r)r[i]._touched=e}destroy(){let e=this.resources;for(let r in e)e[r].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(e){if(this._dirty=!0,e.destroyed){let r=this.resources;for(let i in r)r[i]===e&&(r[i]=null)}else this._updateKey()}}});function cd(){return(!ld||ld?.isContextLost())&&(ld=re.get().createCanvas().getContext("webgl",{})),ld}var ld,jg=T(()=>{ze()});function pG(t){let e="";for(let r=0;r<t;++r)r>0&&(e+=`
|
|
20
20
|
else `),r<t-1&&(e+=`if(test == ${r}.0){}`);return e}function DS(t,e){if(t===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let r=e.createShader(e.FRAGMENT_SHADER);try{for(;;){let i=fG.replace(/%forloop%/gi,pG(t));if(e.shaderSource(r,i),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))t=t/2|0;else break}}finally{e.deleteShader(r)}return t}var fG,NS=T(()=>{"use strict";fG=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
21
|
-
`)});function Ir(){if(_n)return _n;let t=cd();return _n=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),_n=DS(_n,t),t.getExtension("WEBGL_lose_context")?.loseContext(),_n}var _n,io=T(()=>{jg();NS();_n=null});function bn(t,e){let r=2166136261;for(let i=0;i<e;i++)r^=t[i].uid,r=Math.imul(r,16777619),r>>>=0;return VS[r]||mG(t,e,r)}function mG(t,e,r){let i={},s=0;qg||(qg=Ir());for(let n=0;n<qg;n++){let a=n<e?t[n]:B.EMPTY.source;i[s++]=a.source,i[s++]=a.style}let o=new Rt(i);return VS[r]=o,o}var VS,qg,ud=T(()=>{fs();Fe();io();VS={};qg=0});var mi,Kg=T(()=>{"use strict";mi=class{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(e){return this[`${e}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(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}});function Ul(t,e){let r=t.byteLength/8|0,i=new Float64Array(t,0,r);new Float64Array(e,0,r).set(i);let o=t.byteLength-r*8;if(o>0){let n=new Uint8Array(t,r*8,o);new Uint8Array(e,r*8,o).set(n)}}var Zg=T(()=>{"use strict"});var HS,Ke,so=T(()=>{"use strict";HS={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Ke=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",t[t.NONE=5]="NONE",t))(Ke||{})});function Ni(t,e){return e.alphaMode==="no-premultiply-alpha"&&HS[t]||t}var Ol=T(()=>{so()});var hd,WS=T(()=>{"use strict";hd=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e<this.count;e++){let r=this.textures[e];this.textures[e]=null,this.ids[r.uid]=null}this.count=0}}});function $S(){return Jg>0?XS[--Jg]:new Qg}function zS(t){XS[Jg++]=t}var Qg,XS,Jg,Ll,YS,jS,qS=T(()=>{kt();Kg();Zg();Ol();io();WS();Qg=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new hd,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},XS=[],Jg=0;Ll=0,YS=class dd{constructor(e={}){this.uid=Te("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],dd.defaultOptions.maxTextures=dd.defaultOptions.maxTextures??Ir(),e={...dd.defaultOptions,...e};let{maxTextures:r,attributesInitialSize:i,indicesInitialSize:s}=e;this.attributeBuffer=new mi(i*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=r}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)zS(this.batches[e]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(e){this._elements[this.elementSize++]=e,e._indexStart=this.indexSize,e._attributeStart=this.attributeSize,e._batcher=this,this.indexSize+=e.indexSize,this.attributeSize+=e.attributeSize*this.vertexSize}checkAndUpdateTexture(e,r){let i=e._batch.textures.ids[r._source.uid];return!i&&i!==0?!1:(e._textureId=i,e.texture=r,!0)}updateElement(e){this.dirty=!0;let r=this.attributeBuffer;e.packAsQuad?this.packQuadAttributes(e,r.float32View,r.uint32View,e._attributeStart,e._textureId):this.packAttributes(e,r.float32View,r.uint32View,e._attributeStart,e._textureId)}break(e){let r=this._elements;if(!r[this.elementStart])return;let i=$S(),s=i.textures;s.clear();let o=r[this.elementStart],n=Ni(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,c=this.attributeBuffer.uint32View,u=this.indexBuffer,h=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){let x=r[m];r[m]=null;let y=x.texture._source,g=Ni(x.blendMode,y),b=n!==g||a!==x.topology;if(y._batchTick===Ll&&!b){x._textureId=y._textureBindLocation,h+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(u,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,u,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=i;continue}y._batchTick=Ll,(s.count>=p||b)&&(this._finishBatch(i,d,h-d,s,n,a,e,f),f="renderBatch",d=h,n=g,a=x.topology,i=$S(),s=i.textures,s.clear(),++Ll),x._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,x._batch=i,h+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(u,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,u,x._indexStart,x._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,d,h-d,s,n,a,e,f),d=h,++Ll),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=h}_finishBatch(e,r,i,s,o,n,a,l){e.gpuBindGroup=null,e.bindGroup=null,e.action=l,e.batcher=this,e.textures=s,e.blendMode=o,e.topology=n,e.start=r,e.size=i,++Ll,this.batches[this.batchIndex++]=e,a.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){let r=Math.max(e,this.attributeBuffer.size*2),i=new mi(r);Ul(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(e){let r=this.indexBuffer,i=Math.max(e,r.length*1.5);i+=i%2;let s=i>65535?new Uint32Array(i):new Uint16Array(i);if(s.BYTES_PER_ELEMENT!==r.BYTES_PER_ELEMENT)for(let o=0;o<r.length;o++)s[o]=r[o];else Ul(r.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(e,r,i){e[r]=i+0,e[r+1]=i+1,e[r+2]=i+2,e[r+3]=i+0,e[r+4]=i+2,e[r+5]=i+3}packIndex(e,r,i,s){let o=e.indices,n=e.indexSize,a=e.indexOffset,l=e.attributeOffset;for(let c=0;c<n;c++)r[i++]=s+o[c+a]-l}destroy(){for(let e=0;e<this.batches.length;e++)zS(this.batches[e]);this.batches=null;for(let e=0;e<this._elements.length;e++)this._elements[e]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};YS.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};jS=YS});var xe,Vi=T(()=>{"use strict";xe=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(xe||{})});var lt,ps=T(()=>{Vt();kt();Vi();lt=class extends We{constructor(e){let{data:r,size:i}=e,{usage:s,label:o,shrinkToFit:n}=e;super(),this.uid=Te("buffer"),this._resourceType="buffer",this._resourceId=Te("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,r instanceof Array&&(r=new Float32Array(r)),this._data=r,i??(i=r?.byteLength);let a=!!r;this.descriptor={size:i,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&xe.STATIC)}set static(e){e?this.descriptor.usage|=xe.STATIC:this.descriptor.usage&=~xe.STATIC}setDataWithSize(e,r,i){if(this._updateID++,this._updateSize=r*e.BYTES_PER_ELEMENT,this._data===e){i&&this.emit("update",this);return}let s=this._data;if(this._data=e,this._dataInt32=null,!s||s.length!==e.length){!this.shrinkToFit&&s&&e.byteLength<s.byteLength?i&&this.emit("update",this):(this.descriptor.size=e.byteLength,this._resourceId=Te("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(e){this._updateSize=e??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function ex(t,e){if(!(t instanceof lt)){let r=e?xe.INDEX:xe.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),r=xe.INDEX|xe.COPY_DST):(t=new Float32Array(t),r=xe.VERTEX|xe.COPY_DST)),t=new lt({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:r})}return t}var KS=T(()=>{ps();Vi()});function ZS(t,e,r){let i=t.getAttribute(e);if(!i)return r.minX=0,r.minY=0,r.maxX=0,r.maxY=0,r;let s=i.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,c=s.BYTES_PER_ELEMENT,u=(i.offset||0)/c,h=(i.stride||2*4)/c;for(let d=u;d<s.length;d+=h){let f=s[d],p=s[d+1];f>a&&(a=f),p>l&&(l=p),f<o&&(o=f),p<n&&(n=p)}return r.minX=o,r.minY=n,r.maxX=a,r.maxY=l,r}var QS=T(()=>{"use strict"});function gG(t){return(t instanceof lt||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=ex(t.buffer,!1),t}var rr,oo=T(()=>{Vt();ar();kt();ps();KS();QS();rr=class extends We{constructor(e={}){super(),this.uid=Te("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new De,this._boundsDirty=!0;let{attributes:r,indexBuffer:i,topology:s}=e;if(this.buffers=[],this.attributes={},r)for(let o in r)this.addAttribute(o,r[o]);this.instanceCount=e.instanceCount??1,i&&this.addIndex(i),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}getSize(){for(let e in this.attributes){let r=this.attributes[e];return r.buffer.data.length/(r.stride/4||r.size)}return 0}addAttribute(e,r){let i=gG(r);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[e]=i}addIndex(e){this.indexBuffer=ex(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,ZS(this,"aPosition",this._bounds)):this._bounds}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(r=>r.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var xG,yG,fd,JS=T(()=>{ps();Vi();oo();xG=new Float32Array(1),yG=new Uint32Array(1),fd=class extends rr{constructor(){let r=new lt({data:xG,label:"attribute-batch-buffer",usage:xe.VERTEX|xe.COPY_DST,shrinkToFit:!1}),i=new lt({data:yG,label:"index-batch-buffer",usage:xe.INDEX|xe.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:r,format:"float32x2",stride:s,offset:0},aUV:{buffer:r,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:r,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:r,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:i})}}});function Hi(t,e){let r=ew[t];return r===void 0&&(tx[e]===void 0&&(tx[e]=1),ew[t]=r=tx[e]++),r}var tx,ew,Gl=T(()=>{"use strict";tx=Object.create(null),ew=Object.create(null)});function tw(){if(!pd){pd="mediump";let t=cd();t&&t.getShaderPrecisionFormat&&(pd=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return pd}var pd,rw=T(()=>{jg()});function iw(t,e,r){return e?t:r?(t=t.replace("out vec4 finalColor;",""),`
|
|
21
|
+
`)});function Ir(){if(_n)return _n;let t=cd();return _n=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),_n=DS(_n,t),t.getExtension("WEBGL_lose_context")?.loseContext(),_n}var _n,io=T(()=>{jg();NS();_n=null});function bn(t,e){let r=2166136261;for(let i=0;i<e;i++)r^=t[i].uid,r=Math.imul(r,16777619),r>>>=0;return VS[r]||mG(t,e,r)}function mG(t,e,r){let i={},s=0;qg||(qg=Ir());for(let n=0;n<qg;n++){let a=n<e?t[n]:B.EMPTY.source;i[s++]=a.source,i[s++]=a.style}let o=new Rt(i);return VS[r]=o,o}var VS,qg,ud=T(()=>{fs();Fe();io();VS={};qg=0});var mi,Kg=T(()=>{"use strict";mi=class{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(e){return this[`${e}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(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}});function Ul(t,e){let r=t.byteLength/8|0,i=new Float64Array(t,0,r);new Float64Array(e,0,r).set(i);let o=t.byteLength-r*8;if(o>0){let n=new Uint8Array(t,r*8,o);new Uint8Array(e,r*8,o).set(n)}}var Zg=T(()=>{"use strict"});var HS,Ke,so=T(()=>{"use strict";HS={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Ke=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",t[t.NONE=5]="NONE",t))(Ke||{})});function Ni(t,e){return e.alphaMode==="no-premultiply-alpha"&&HS[t]||t}var Ol=T(()=>{so()});var hd,WS=T(()=>{"use strict";hd=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e<this.count;e++){let r=this.textures[e];this.textures[e]=null,this.ids[r.uid]=null}this.count=0}}});function $S(){return Jg>0?XS[--Jg]:new Qg}function zS(t){XS[Jg++]=t}var Qg,XS,Jg,Ll,YS,jS,qS=T(()=>{kt();Kg();Zg();Ol();io();WS();Qg=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new hd,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},XS=[],Jg=0;Ll=0,YS=class dd{constructor(e={}){this.uid=Te("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],dd.defaultOptions.maxTextures=dd.defaultOptions.maxTextures??Ir(),e={...dd.defaultOptions,...e};let{maxTextures:r,attributesInitialSize:i,indicesInitialSize:s}=e;this.attributeBuffer=new mi(i*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=r}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)zS(this.batches[e]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(e){this._elements[this.elementSize++]=e,e._indexStart=this.indexSize,e._attributeStart=this.attributeSize,e._batcher=this,this.indexSize+=e.indexSize,this.attributeSize+=e.attributeSize*this.vertexSize}checkAndUpdateTexture(e,r){let i=e._batch.textures.ids[r._source.uid];return!i&&i!==0?!1:(e._textureId=i,e.texture=r,!0)}updateElement(e){this.dirty=!0;let r=this.attributeBuffer;e.packAsQuad?this.packQuadAttributes(e,r.float32View,r.uint32View,e._attributeStart,e._textureId):this.packAttributes(e,r.float32View,r.uint32View,e._attributeStart,e._textureId)}break(e){let r=this._elements;if(!r[this.elementStart])return;let i=$S(),s=i.textures;s.clear();let o=r[this.elementStart],n=Ni(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,c=this.attributeBuffer.uint32View,u=this.indexBuffer,h=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){let x=r[m];r[m]=null;let y=x.texture._source,g=Ni(x.blendMode,y),b=n!==g||a!==x.topology;if(y._batchTick===Ll&&!b){x._textureId=y._textureBindLocation,h+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(u,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,u,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=i;continue}y._batchTick=Ll,(s.count>=p||b)&&(this._finishBatch(i,d,h-d,s,n,a,e,f),f="renderBatch",d=h,n=g,a=x.topology,i=$S(),s=i.textures,s.clear(),++Ll),x._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,x._batch=i,h+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,l,c,x._attributeStart,x._textureId),this.packQuadIndex(u,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,l,c,x._attributeStart,x._textureId),this.packIndex(x,u,x._indexStart,x._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,d,h-d,s,n,a,e,f),d=h,++Ll),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=h}_finishBatch(e,r,i,s,o,n,a,l){e.gpuBindGroup=null,e.bindGroup=null,e.action=l,e.batcher=this,e.textures=s,e.blendMode=o,e.topology=n,e.start=r,e.size=i,++Ll,this.batches[this.batchIndex++]=e,a.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){let r=Math.max(e,this.attributeBuffer.size*2),i=new mi(r);Ul(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(e){let r=this.indexBuffer,i=Math.max(e,r.length*1.5);i+=i%2;let s=i>65535?new Uint32Array(i):new Uint16Array(i);if(s.BYTES_PER_ELEMENT!==r.BYTES_PER_ELEMENT)for(let o=0;o<r.length;o++)s[o]=r[o];else Ul(r.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(e,r,i){e[r]=i+0,e[r+1]=i+1,e[r+2]=i+2,e[r+3]=i+0,e[r+4]=i+2,e[r+5]=i+3}packIndex(e,r,i,s){let o=e.indices,n=e.indexSize,a=e.indexOffset,l=e.attributeOffset;for(let c=0;c<n;c++)r[i++]=s+o[c+a]-l}destroy(){for(let e=0;e<this.batches.length;e++)zS(this.batches[e]);this.batches=null;for(let e=0;e<this._elements.length;e++)this._elements[e]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};YS.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};jS=YS});var xe,Vi=T(()=>{"use strict";xe=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(xe||{})});var lt,ps=T(()=>{Vt();kt();Vi();lt=class extends $e{constructor(e){let{data:r,size:i}=e,{usage:s,label:o,shrinkToFit:n}=e;super(),this.uid=Te("buffer"),this._resourceType="buffer",this._resourceId=Te("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,r instanceof Array&&(r=new Float32Array(r)),this._data=r,i??(i=r?.byteLength);let a=!!r;this.descriptor={size:i,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&xe.STATIC)}set static(e){e?this.descriptor.usage|=xe.STATIC:this.descriptor.usage&=~xe.STATIC}setDataWithSize(e,r,i){if(this._updateID++,this._updateSize=r*e.BYTES_PER_ELEMENT,this._data===e){i&&this.emit("update",this);return}let s=this._data;if(this._data=e,this._dataInt32=null,!s||s.length!==e.length){!this.shrinkToFit&&s&&e.byteLength<s.byteLength?i&&this.emit("update",this):(this.descriptor.size=e.byteLength,this._resourceId=Te("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(e){this._updateSize=e??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function ex(t,e){if(!(t instanceof lt)){let r=e?xe.INDEX:xe.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),r=xe.INDEX|xe.COPY_DST):(t=new Float32Array(t),r=xe.VERTEX|xe.COPY_DST)),t=new lt({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:r})}return t}var KS=T(()=>{ps();Vi()});function ZS(t,e,r){let i=t.getAttribute(e);if(!i)return r.minX=0,r.minY=0,r.maxX=0,r.maxY=0,r;let s=i.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,c=s.BYTES_PER_ELEMENT,u=(i.offset||0)/c,h=(i.stride||2*4)/c;for(let d=u;d<s.length;d+=h){let f=s[d],p=s[d+1];f>a&&(a=f),p>l&&(l=p),f<o&&(o=f),p<n&&(n=p)}return r.minX=o,r.minY=n,r.maxX=a,r.maxY=l,r}var QS=T(()=>{"use strict"});function gG(t){return(t instanceof lt||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=ex(t.buffer,!1),t}var rr,oo=T(()=>{Vt();ar();kt();ps();KS();QS();rr=class extends $e{constructor(e={}){super(),this.uid=Te("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new De,this._boundsDirty=!0;let{attributes:r,indexBuffer:i,topology:s}=e;if(this.buffers=[],this.attributes={},r)for(let o in r)this.addAttribute(o,r[o]);this.instanceCount=e.instanceCount??1,i&&this.addIndex(i),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}getSize(){for(let e in this.attributes){let r=this.attributes[e];return r.buffer.data.length/(r.stride/4||r.size)}return 0}addAttribute(e,r){let i=gG(r);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[e]=i}addIndex(e){this.indexBuffer=ex(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,ZS(this,"aPosition",this._bounds)):this._bounds}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(r=>r.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var xG,yG,fd,JS=T(()=>{ps();Vi();oo();xG=new Float32Array(1),yG=new Uint32Array(1),fd=class extends rr{constructor(){let r=new lt({data:xG,label:"attribute-batch-buffer",usage:xe.VERTEX|xe.COPY_DST,shrinkToFit:!1}),i=new lt({data:yG,label:"index-batch-buffer",usage:xe.INDEX|xe.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:r,format:"float32x2",stride:s,offset:0},aUV:{buffer:r,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:r,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:r,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:i})}}});function Hi(t,e){let r=ew[t];return r===void 0&&(tx[e]===void 0&&(tx[e]=1),ew[t]=r=tx[e]++),r}var tx,ew,Gl=T(()=>{"use strict";tx=Object.create(null),ew=Object.create(null)});function tw(){if(!pd){pd="mediump";let t=cd();t&&t.getShaderPrecisionFormat&&(pd=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return pd}var pd,rw=T(()=>{jg()});function iw(t,e,r){return e?t:r?(t=t.replace("out vec4 finalColor;",""),`
|
|
22
22
|
|
|
23
23
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
24
24
|
#define in varying
|
|
@@ -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 fx,Xw,Yw=T(()=>{"use strict";fx=["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>"],Xw=fx.reduce((t,e)=>(t[e]=!0,t),{})});function jw(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);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 qw=T(()=>{"use strict"});var Kw,Ce,Wt=T(()=>{kt();Gl();Yw();qw();Kw=class Zw{constructor(e,r){this._touched=0,this.uid=Te("uniform"),this._resourceType="uniformGroup",this._resourceId=Te("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,r={...Zw.defaultOptions,...r},this.uniformStructures=e;let i={};for(let s in e){let o=e[s];if(o.name=s,o.size=o.size??1,!Xw[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${fx.join(", ")}`);o.value??(o.value=jw(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=r.ubo,this.isStatic=r.isStatic,this._signature=Hi(Object.keys(i).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Kw.defaultOptions={ubo:!1,isStatic:!1};Ce=Kw});function An(t){let e=Qw[t];if(e)return e;let r=new Int32Array(t);for(let i=0;i<t;i++)r[i]=i;return e=Qw[t]=new Ce({uTextures:{value:r,type:"i32",size:t}},{isStatic:!0}),e}var Qw,gd=T(()=>{Wt();Qw={}});var Xe,br=T(()=>{"use strict";Xe=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.BOTH=3]="BOTH",t))(Xe||{})});var ct,qr=T(()=>{Vt();kt();ms();fs();ao();br();Wt();ct=class t extends We{constructor(e){super(),this.uid=Te("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:r,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=e;this.gpuProgram=r,this.glProgram=i,n===void 0&&(n=0,r&&(n|=Xe.WEBGPU),i&&(n|=Xe.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!r&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!r&&s&&a)for(let c in a)for(let u in a[c]){let h=a[c][u];l[h]={group:c,binding:u,name:h}}else if(r&&s&&!a){let c=r.structsAndGroups.groups;a={},c.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u})}else if(o){s={},a={},r&&r.structsAndGroups.groups.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[h.name]=h});let c=0;for(let u in o)l[u]||(s[99]||(s[99]=new Rt,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:c,name:u},a[99]=a[99]||{},a[99][c]=u,c++);for(let u in o){let h=u,d=o[u];!d.source&&!d._resourceType&&(d=new Ce(d));let f=l[h];f&&(s[f.group]||(s[f.group]=new Rt,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(e,r,i){var s,o;(s=this._uniformBindMap)[r]||(s[r]={}),(o=this._uniformBindMap[r])[i]||(o[i]=e),this.groups[r]||(this.groups[r]=new Rt,this._ownedBindGroups.push(this.groups[r]))}_buildResourceAccessor(e,r){let i={};for(let s in r){let o=r[s];Object.defineProperty(i,o.name,{get(){return e[o.group].getResource(o.binding)},set(n){e[o.group].setResource(n,o.binding)}})}return i}destroy(e=!1){this.emit("destroy",this),e&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(e){let{gpu:r,gl:i,...s}=e,o,n;return r&&(o=hr.from(r)),i&&(n=cr.from(i)),new t({gpuProgram:o,glProgram:n,...s})}}});var xd,Jw=T(()=>{xs();Dl();Nl();ys();gd();qr();xd=class extends ct{constructor(e){let r=xi({name:"batch",bits:[Sn,En(e),_i]}),i=gi({name:"batch",bits:[Tn,wn(e),yi]});super({glProgram:r,gpuProgram:i,resources:{batchSamplers:An(e)}})}}});var eE,tE,Vl,px=T(()=>{O();qS();JS();Jw();eE=null,tE=class rE extends jS{constructor(){super(...arguments),this.geometry=new fd,this.shader=eE||(eE=new xd(this.maxTextures)),this.name=rE.extension.name,this.vertexSize=6}packAttributes(e,r,i,s,o){let n=o<<16|e.roundPixels&65535,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,d=a.tx,f=a.ty,{positions:p,uvs:m}=e,x=e.color,v=e.attributeOffset,y=v+e.attributeSize;for(let g=v;g<y;g++){let b=g*2,_=p[b],S=p[b+1];r[s++]=l*_+u*S+d,r[s++]=h*S+c*_+f,r[s++]=m[b],r[s++]=m[b+1],i[s++]=x,i[s++]=n}}packQuadAttributes(e,r,i,s,o){let n=e.texture,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,d=a.tx,f=a.ty,p=e.bounds,m=p.maxX,x=p.minX,v=p.maxY,y=p.minY,g=n.uvs,b=e.color,_=o<<16|e.roundPixels&65535;r[s+0]=l*x+u*y+d,r[s+1]=h*y+c*x+f,r[s+2]=g.x0,r[s+3]=g.y0,i[s+4]=b,i[s+5]=_,r[s+6]=l*m+u*y+d,r[s+7]=h*y+c*m+f,r[s+8]=g.x1,r[s+9]=g.y1,i[s+10]=b,i[s+11]=_,r[s+12]=l*m+u*v+d,r[s+13]=h*v+c*m+f,r[s+14]=g.x2,r[s+15]=g.y2,i[s+16]=b,i[s+17]=_,r[s+18]=l*x+u*v+d,r[s+19]=h*v+c*x+f,r[s+20]=g.x3,r[s+21]=g.y3,i[s+22]=b,i[s+23]=_}};tE.extension={type:[w.Batcher],name:"default"};Vl=tE});function iE(t,e,r,i,s,o,n,a=null){let l=0;r*=e,s*=o;let c=a.a,u=a.b,h=a.c,d=a.d,f=a.tx,p=a.ty;for(;l<n;){let m=t[r],x=t[r+1];i[s]=c*m+h*x+f,i[s+1]=u*m+d*x+p,s+=o,r+=e,l++}}function sE(t,e,r,i){let s=0;for(e*=r;s<i;)t[e]=0,t[e+1]=0,e+=r,s++}var oE=T(()=>{"use strict"});function mx(t,e,r,i,s){let o=e.a,n=e.b,a=e.c,l=e.d,c=e.tx,u=e.ty;r||(r=0),i||(i=2),s||(s=t.length/i-r);let h=r*i;for(let d=0;d<s;d++){let f=t[h],p=t[h+1];t[h]=o*f+a*p+c,t[h+1]=n*f+l*p+u,h+=i}}var nE=T(()=>{"use strict"});var MG,lo,gx=T(()=>{Ae();lg();MG=new V,lo=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 e=this.baseColor,r=e>>16|e&65280|(e&255)<<16,i=this.renderable;return i?Vh(r,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):r+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||MG}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var Pn,aE,lE,cE=T(()=>{O();Pn={extension:{type:w.ShapeBuilder,name:"circle"},build(t,e){let r,i,s,o,n,a;if(t.type==="circle"){let b=t;r=b.x,i=b.y,n=a=b.radius,s=o=0}else if(t.type==="ellipse"){let b=t;r=b.x,i=b.y,n=b.halfWidth,a=b.halfHeight,s=o=0}else{let b=t,_=b.width/2,S=b.height/2;r=b.x+_,i=b.y+S,n=a=Math.max(0,Math.min(b.radius,Math.min(_,S))),s=_-n,o=S-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return e;let l=Math.ceil(2.3*Math.sqrt(n+a)),c=l*8+(s?4:0)+(o?4:0);if(c===0)return e;if(l===0)return e[0]=e[6]=r+s,e[1]=e[3]=i+o,e[2]=e[4]=r-s,e[5]=e[7]=i-o,e;let u=0,h=l*4+(s?2:0)+2,d=h,f=c,p=s+n,m=o,x=r+p,v=r-p,y=i+m;if(e[u++]=x,e[u++]=y,e[--h]=y,e[--h]=v,o){let b=i-m;e[d++]=v,e[d++]=b,e[--f]=b,e[--f]=x}for(let b=1;b<l;b++){let _=Math.PI/2*(b/l),S=s+Math.cos(_)*n,E=o+Math.sin(_)*a,P=r+S,C=r-S,M=i+E,R=i-E;e[u++]=P,e[u++]=M,e[--h]=M,e[--h]=C,e[d++]=C,e[d++]=R,e[--f]=R,e[--f]=P}p=s,m=o+a,x=r+p,v=r-p,y=i+m;let g=i-m;return e[u++]=x,e[u++]=y,e[--f]=g,e[--f]=x,s&&(e[u++]=v,e[u++]=y,e[--f]=g,e[--f]=v),e},triangulate(t,e,r,i,s,o){if(t.length===0)return;let n=0,a=0;for(let u=0;u<t.length;u+=2)n+=t[u],a+=t[u+1];n/=t.length/2,a/=t.length/2;let l=i;e[l*r]=n,e[l*r+1]=a;let c=l++;for(let u=0;u<t.length;u+=2)e[l*r]=t[u],e[l*r+1]=t[u+1],u>0&&(s[o++]=l,s[o++]=c,s[o++]=l-1),l++;s[o++]=c+1,s[o++]=c,s[o++]=l-1}},aE={...Pn,extension:{...Pn.extension,name:"ellipse"}},lE={...Pn,extension:{...Pn.extension,name:"roundedRectangle"}}});function uE(t){let e=t.length;if(e<6)return 1;let r=0;for(let i=0,s=t[e-2],o=t[e-1];i<e;i+=2){let n=t[i],a=t[i+1];r+=(n-s)*(a+o),s=n,o=a}return r<0?-1:1}var hE=T(()=>{"use strict"});function dE(t,e,r,i,s,o,n,a){let l=t-r*s,c=e-i*s,u=t+r*o,h=e+i*o,d,f;n?(d=i,f=-r):(d=-i,f=r);let p=l+d,m=c+f,x=u+d,v=h+f;return a.push(p,m),a.push(x,v),2}function co(t,e,r,i,s,o,n,a){let l=r-t,c=i-e,u=Math.atan2(l,c),h=Math.atan2(s-t,o-e);a&&u<h?u+=Math.PI*2:!a&&u>h&&(h+=Math.PI*2);let d=u,f=h-u,p=Math.abs(f),m=Math.sqrt(l*l+c*c),x=(15*p*Math.sqrt(m)/Math.PI>>0)+1,v=f/x;if(d+=v,a){n.push(t,e),n.push(r,i);for(let y=1,g=d;y<x;y++,g+=v)n.push(t,e),n.push(t+Math.sin(g)*m,e+Math.cos(g)*m);n.push(t,e),n.push(s,o)}else{n.push(r,i),n.push(t,e);for(let y=1,g=d;y<x;y++,g+=v)n.push(t+Math.sin(g)*m,e+Math.cos(g)*m),n.push(t,e);n.push(s,o),n.push(t,e)}return x*2}function fE(t,e,r,i,s,o){let n=1e-4;if(t.length===0)return;let a=e,l=a.alignment;if(e.alignment!==.5){let D=uE(t);r&&(D*=-1),l=(l-.5)*D+.5}let c=new ve(t[0],t[1]),u=new ve(t[t.length-2],t[t.length-1]),h=i,d=Math.abs(c.x-u.x)<n&&Math.abs(c.y-u.y)<n;if(h){t=t.slice(),d&&(t.pop(),t.pop(),u.set(t[t.length-2],t[t.length-1]));let D=(c.x+u.x)*.5,z=(u.y+c.y)*.5;t.unshift(D,z),t.push(D,z)}let f=s,p=t.length/2,m=t.length,x=f.length/2,v=a.width/2,y=v*v,g=a.miterLimit*a.miterLimit,b=t[0],_=t[1],S=t[2],E=t[3],P=0,C=0,M=-(_-E),R=b-S,F=0,U=0,W=Math.sqrt(M*M+R*R);M/=W,R/=W,M*=v,R*=v;let N=l,G=(1-N)*2,X=N*2;h||(a.cap==="round"?m+=co(b-M*(G-X)*.5,_-R*(G-X)*.5,b-M*G,_-R*G,b+M*X,_+R*X,f,!0)+2:a.cap==="square"&&(m+=dE(b,_,M,R,G,X,!0,f))),f.push(b-M*G,_-R*G),f.push(b+M*X,_+R*X);for(let D=1;D<p-1;++D){b=t[(D-1)*2],_=t[(D-1)*2+1],S=t[D*2],E=t[D*2+1],P=t[(D+1)*2],C=t[(D+1)*2+1],M=-(_-E),R=b-S,W=Math.sqrt(M*M+R*R),M/=W,R/=W,M*=v,R*=v,F=-(E-C),U=S-P,W=Math.sqrt(F*F+U*U),F/=W,U/=W,F*=v,U*=v;let z=S-b,le=_-E,de=S-P,be=C-E,Se=z*de+le*be,et=le*de-be*z,I=et<0;if(Math.abs(et)<.001*Math.abs(Se)){f.push(S-M*G,E-R*G),f.push(S+M*X,E+R*X),Se>=0&&(a.join==="round"?m+=co(S,E,S-M*G,E-R*G,S-F*G,E-U*G,f,!1)+4:m+=2,f.push(S-F*X,E-U*X),f.push(S+F*G,E+U*G));continue}let A=(-M+b)*(-R+E)-(-M+S)*(-R+_),k=(-F+P)*(-U+E)-(-F+S)*(-U+C),L=(z*k-de*A)/et,q=(be*A-le*k)/et,H=(L-S)*(L-S)+(q-E)*(q-E),Y=S+(L-S)*G,pe=E+(q-E)*G,Le=S-(L-S)*X,Be=E-(q-E)*X,ci=Math.min(z*z+le*le,de*de+be*be),Xr=I?G:X,Dt=ci+Xr*Xr*y;H<=Dt?a.join==="bevel"||H/y>g?(I?(f.push(Y,pe),f.push(S+M*X,E+R*X),f.push(Y,pe),f.push(S+F*X,E+U*X)):(f.push(S-M*G,E-R*G),f.push(Le,Be),f.push(S-F*G,E-U*G),f.push(Le,Be)),m+=2):a.join==="round"?I?(f.push(Y,pe),f.push(S+M*X,E+R*X),m+=co(S,E,S+M*X,E+R*X,S+F*X,E+U*X,f,!0)+4,f.push(Y,pe),f.push(S+F*X,E+U*X)):(f.push(S-M*G,E-R*G),f.push(Le,Be),m+=co(S,E,S-M*G,E-R*G,S-F*G,E-U*G,f,!1)+4,f.push(S-F*G,E-U*G),f.push(Le,Be)):(f.push(Y,pe),f.push(Le,Be)):(f.push(S-M*G,E-R*G),f.push(S+M*X,E+R*X),a.join==="round"?I?m+=co(S,E,S+M*X,E+R*X,S+F*X,E+U*X,f,!0)+2:m+=co(S,E,S-M*G,E-R*G,S-F*G,E-U*G,f,!1)+2:a.join==="miter"&&H/y<=g&&(I?(f.push(Le,Be),f.push(Le,Be)):(f.push(Y,pe),f.push(Y,pe)),m+=2),f.push(S-F*G,E-U*G),f.push(S+F*X,E+U*X),m+=2)}b=t[(p-2)*2],_=t[(p-2)*2+1],S=t[(p-1)*2],E=t[(p-1)*2+1],M=-(_-E),R=b-S,W=Math.sqrt(M*M+R*R),M/=W,R/=W,M*=v,R*=v,f.push(S-M*G,E-R*G),f.push(S+M*X,E+R*X),h||(a.cap==="round"?m+=co(S-M*(G-X)*.5,E-R*(G-X)*.5,S-M*G,E-R*G,S+M*X,E+R*X,f,!1)+2:a.cap==="square"&&(m+=dE(S,E,M,R,G,X,!1,f)));let $=1e-4*1e-4;for(let D=x;D<m+x-2;++D)b=f[D*2],_=f[D*2+1],S=f[(D+1)*2],E=f[(D+1)*2+1],P=f[(D+2)*2],C=f[(D+2)*2+1],!(Math.abs(b*(E-C)+S*(C-_)+P*(_-E))<$)&&o.push(D,D+1,D+2)}var pE=T(()=>{gr();hE()});function mE(t,e,r,i){let s=1e-4;if(t.length===0)return;let o=t[0],n=t[1],a=t[t.length-2],l=t[t.length-1],c=e||Math.abs(o-a)<s&&Math.abs(n-l)<s,u=r,h=t.length/2,d=u.length/2;for(let f=0;f<h;f++)u.push(t[f*2]),u.push(t[f*2+1]);for(let f=0;f<h-1;f++)i.push(d+f,d+f+1);c&&i.push(d+h-1,d)}var gE=T(()=>{});var Td=ce((lZ,bx)=>{"use strict";bx.exports=bd;bx.exports.default=bd;function bd(t,e,r){r=r||2;var i=e&&e.length,s=i?e[0]*r:t.length,o=yE(t,0,s,r,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,c,u,h,d,f;if(i&&(o=LG(t,e,o,r)),t.length>80*r){a=c=t[0],l=u=t[1];for(var p=r;p<s;p+=r)h=t[p],d=t[p+1],h<a&&(a=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);f=Math.max(c-a,u-l),f=f!==0?32767/f:0}return Hl(o,n,r,a,l,f,0),n}function yE(t,e,r,i,s){var o,n;if(s===_x(t,e,r,i)>0)for(o=e;o<r;o+=i)n=xE(o,t[o],t[o+1],n);else for(o=r-i;o>=e;o-=i)n=xE(o,t[o],t[o+1],n);return n&&vd(n,n.next)&&($l(n),n=n.next),n}function uo(t,e){if(!t)return t;e||(e=t);var r=t,i;do if(i=!1,!r.steiner&&(vd(r,r.next)||nt(r.prev,r,r.next)===0)){if($l(r),r=e=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function Hl(t,e,r,i,s,o,n){if(t){!n&&o&&HG(t,i,s,o);for(var a=t,l,c;t.prev!==t.next;){if(l=t.prev,c=t.next,o?kG(t,i,s,o):FG(t)){e.push(l.i/r|0),e.push(t.i/r|0),e.push(c.i/r|0),$l(t),t=c.next,a=c.next;continue}if(t=c,t===a){n?n===1?(t=UG(uo(t),e,r),Hl(t,e,r,i,s,o,2)):n===2&&OG(t,e,r,i,s,o):Hl(uo(t),e,r,i,s,o,1);break}}}}function FG(t){var e=t.prev,r=t,i=t.next;if(nt(e,r,i)>=0)return!1;for(var s=e.x,o=r.x,n=i.x,a=e.y,l=r.y,c=i.y,u=s<o?s<n?s:n:o<n?o:n,h=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!==e;){if(p.x>=u&&p.x<=d&&p.y>=h&&p.y<=f&&Cn(s,a,o,l,n,c,p.x,p.y)&&nt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function kG(t,e,r,i){var s=t.prev,o=t,n=t.next;if(nt(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,c=n.x,u=s.y,h=o.y,d=n.y,f=a<l?a<c?a:c:l<c?l:c,p=u<h?u<d?u:d:h<d?h:d,m=a>l?a>c?a:c:l>c?l:c,x=u>h?u>d?u:d:h>d?h:d,v=xx(f,p,e,r,i),y=xx(m,x,e,r,i),g=t.prevZ,b=t.nextZ;g&&g.z>=v&&b&&b.z<=y;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=x&&g!==s&&g!==n&&Cn(a,u,l,h,c,d,g.x,g.y)&&nt(g.prev,g,g.next)>=0||(g=g.prevZ,b.x>=f&&b.x<=m&&b.y>=p&&b.y<=x&&b!==s&&b!==n&&Cn(a,u,l,h,c,d,b.x,b.y)&&nt(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;g&&g.z>=v;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=x&&g!==s&&g!==n&&Cn(a,u,l,h,c,d,g.x,g.y)&&nt(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;b&&b.z<=y;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=x&&b!==s&&b!==n&&Cn(a,u,l,h,c,d,b.x,b.y)&&nt(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function UG(t,e,r){var i=t;do{var s=i.prev,o=i.next.next;!vd(s,o)&&_E(s,i,i.next,o)&&Wl(s,o)&&Wl(o,s)&&(e.push(s.i/r|0),e.push(i.i/r|0),e.push(o.i/r|0),$l(i),$l(i.next),i=t=o),i=i.next}while(i!==t);return uo(i)}function OG(t,e,r,i,s,o){var n=t;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&zG(n,a)){var l=bE(n,a);n=uo(n,n.next),l=uo(l,l.next),Hl(n,e,r,i,s,o,0),Hl(l,e,r,i,s,o,0);return}a=a.next}n=n.next}while(n!==t)}function LG(t,e,r,i){var s=[],o,n,a,l,c;for(o=0,n=e.length;o<n;o++)a=e[o]*i,l=o<n-1?e[o+1]*i:t.length,c=yE(t,a,l,i,!1),c===c.next&&(c.steiner=!0),s.push($G(c));for(s.sort(GG),o=0;o<s.length;o++)r=DG(s[o],r);return r}function GG(t,e){return t.x-e.x}function DG(t,e){var r=NG(t,e);if(!r)return e;var i=bE(r,t);return uo(i,i.next),uo(r,r.next)}function NG(t,e){var r=e,i=t.x,s=t.y,o=-1/0,n;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>o&&(o=a,n=r.x<r.next.x?r:r.next,a===i))return n}r=r.next}while(r!==e);if(!n)return null;var l=n,c=n.x,u=n.y,h=1/0,d;r=n;do i>=r.x&&r.x>=c&&i!==r.x&&Cn(s<u?i:o,s,c,u,s<u?o:i,s,r.x,r.y)&&(d=Math.abs(s-r.y)/(i-r.x),Wl(r,t)&&(d<h||d===h&&(r.x>n.x||r.x===n.x&&VG(n,r)))&&(n=r,h=d)),r=r.next;while(r!==l);return n}function VG(t,e){return nt(t.prev,t,e.prev)<0&&nt(e.next,t,t.next)<0}function HG(t,e,r,i){var s=t;do s.z===0&&(s.z=xx(s.x,s.y,e,r,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,WG(s)}function WG(t){var e,r,i,s,o,n,a,l,c=1;do{for(r=t,t=null,o=null,n=0;r;){for(n++,i=r,a=0,e=0;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||r.z<=i.z)?(s=r,r=r.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:t=s,s.prevZ=o,o=s;r=i}o.nextZ=null,c*=2}while(n>1);return t}function xx(t,e,r,i,s){return t=(t-r)*s|0,e=(e-i)*s|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function $G(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function Cn(t,e,r,i,s,o,n,a){return(s-n)*(e-a)>=(t-n)*(o-a)&&(t-n)*(i-a)>=(r-n)*(e-a)&&(r-n)*(o-a)>=(s-n)*(i-a)}function zG(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!XG(t,e)&&(Wl(t,e)&&Wl(e,t)&&YG(t,e)&&(nt(t.prev,t,e.prev)||nt(t,e.prev,e))||vd(t,e)&&nt(t.prev,t,t.next)>0&&nt(e.prev,e,e.next)>0)}function nt(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function vd(t,e){return t.x===e.x&&t.y===e.y}function _E(t,e,r,i){var s=_d(nt(t,e,r)),o=_d(nt(t,e,i)),n=_d(nt(r,i,t)),a=_d(nt(r,i,e));return!!(s!==o&&n!==a||s===0&&yd(t,r,e)||o===0&&yd(t,i,e)||n===0&&yd(r,t,i)||a===0&&yd(r,e,i))}function yd(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function _d(t){return t>0?1:t<0?-1:0}function XG(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&_E(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Wl(t,e){return nt(t.prev,t,t.next)<0?nt(t,e,t.next)>=0&&nt(t,t.prev,e)>=0:nt(t,e,t.prev)<0||nt(t,t.next,e)<0}function YG(t,e){var r=t,i=!1,s=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&s<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}function bE(t,e){var r=new yx(t.i,t.x,t.y),i=new yx(e.i,e.x,e.y),s=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=s,s.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function xE(t,e,r,i){var s=new yx(t,e,r);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function $l(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function yx(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}bd.deviation=function(t,e,r,i){var s=e&&e.length,o=s?e[0]*r:t.length,n=Math.abs(_x(t,0,o,r));if(s)for(var a=0,l=e.length;a<l;a++){var c=e[a]*r,u=a<l-1?e[a+1]*r:t.length;n-=Math.abs(_x(t,c,u,r))}var h=0;for(a=0;a<i.length;a+=3){var d=i[a]*r,f=i[a+1]*r,p=i[a+2]*r;h+=Math.abs((t[d]-t[p])*(t[f+1]-t[d+1])-(t[d]-t[f])*(t[p+1]-t[d+1]))}return n===0&&h===0?0:Math.abs((h-n)/n)};function _x(t,e,r,i){for(var s=0,o=e,n=r-i;o<r;o+=i)s+=(t[n]-t[o])*(t[o+1]+t[n+1]),n=o;return s}bd.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},i=0,s=0;s<t.length;s++){for(var o=0;o<t[s].length;o++)for(var n=0;n<e;n++)r.vertices.push(t[s][o][n]);s>0&&(i+=t[s-1].length,r.holes.push(i))}return r}});function Sd(t,e,r,i,s,o,n){let a=(0,vE.default)(t,e,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<t.length;c+=2)r[l]=t[c],r[l+1]=t[c+1],l+=i}var vE,vx=T(()=>{vE=Xs(Td(),1)});var jG,TE,SE=T(()=>{O();vx();jG=[],TE={extension:{type:w.ShapeBuilder,name:"polygon"},build(t,e){for(let r=0;r<t.points.length;r++)e[r]=t.points[r];return e},triangulate(t,e,r,i,s,o){Sd(t,jG,e,r,i,s,o)}}});var wE,EE=T(()=>{O();wE={extension:{type:w.ShapeBuilder,name:"rectangle"},build(t,e){let r=t,i=r.x,s=r.y,o=r.width,n=r.height;return o>=0&&n>=0&&(e[0]=i,e[1]=s,e[2]=i+o,e[3]=s,e[4]=i+o,e[5]=s+n,e[6]=i,e[7]=s+n),e},triangulate(t,e,r,i,s,o){let n=0;i*=r,e[i+n]=t[0],e[i+n+1]=t[1],n+=r,e[i+n]=t[2],e[i+n+1]=t[3],n+=r,e[i+n]=t[6],e[i+n+1]=t[7],n+=r,e[i+n]=t[4],e[i+n+1]=t[5],n+=r;let a=i/r;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var AE,PE=T(()=>{O();AE={extension:{type:w.ShapeBuilder,name:"triangle"},build(t,e){return e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,e},triangulate(t,e,r,i,s,o){let n=0;i*=r,e[i+n]=t[0],e[i+n+1]=t[1],n+=r,e[i+n]=t[2],e[i+n+1]=t[3],n+=r,e[i+n]=t[4],e[i+n+1]=t[5];let a=i/r;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function RE(t,e){for(let r=0;r<e.length;r++){let i=e[r];t.addColorStop(i.offset,i.color)}}function ME(t,e){let r=re.get().createCanvas(t,e),i=r.getContext("2d");return{canvas:r,context:i}}function qG(t){let e=t[0]??{};return(typeof e=="number"||t[1])&&(J("8.5.2","use options object instead"),e={type:"linear",start:{x:t[0],y:t[1]},end:{x:t[2],y:t[3]},textureSpace:t[4],textureSize:t[5]??wt.defaultLinearOptions.textureSize}),e}var CE,Sx,wt,ho=T(()=>{Bt();ze();Ae();xn();Fe();kt();tt();pg();CE=[{offset:0,color:"white"},{offset:1,color:"black"}],Sx=class Tx{constructor(...e){this.uid=Te("fillGradient"),this.type="linear",this.colorStops=[];let r=qG(e);r={...r.type==="radial"?Tx.defaultRadialOptions:Tx.defaultLinearOptions,...Wh(r)},this._textureSize=r.textureSize,this._wrapMode=r.wrapMode,r.type==="radial"?(this.center=r.center,this.outerCenter=r.outerCenter??this.center,this.innerRadius=r.innerRadius,this.outerRadius=r.outerRadius,this.scale=r.scale,this.rotation=r.rotation):(this.start=r.start,this.end=r.end),this.textureSpace=r.textureSpace,this.type=r.type,r.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(e,r){return this.colorStops.push({offset:e,color:me.shared.setValue(r).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:r}=this.start,{x:i,y:s}=this.end,o=i-e,n=s-r,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let x=e;e=i,i=x,o*=-1}if(n<0){let x=r;r=s,s=x,n*=-1}}let l=this.colorStops.length?this.colorStops:CE,c=this._textureSize,{canvas:u,context:h}=ME(c,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);RE(d,l),h.fillStyle=d,h.fillRect(0,0,c,1),this.texture=new B({source:new lr({resource:u,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new V;m.scale(f/c,1),m.rotate(p),m.translate(e,r),this.textureSpace==="local"&&m.scale(c,c),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:CE,r=this._textureSize,{canvas:i,context:s}=ME(r,r),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,u=this.outerRadius,h=a-u,d=l-u,f=r/(u*2),p=(o-h)*f,m=(n-d)*f,x=s.createRadialGradient(p,m,c*f,(a-h)*f,(l-d)*f,u*f);RE(x,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,r,r),s.fillStyle=x,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,r,r),this.texture=new B({source:new lr({resource:i,addressMode:this._wrapMode})});let v=new V;v.scale(1/f,1/f),v.translate(h,d),this.textureSpace==="local"&&v.scale(r,r),this.transform=v}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Sx.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Sx.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};wt=Sx});function IE(t,e,r,i){let s=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){let n=r.getBounds(ZG);e.width&&n.pad(e.width);let{x:a,y:l}=n,c=1/n.width,u=1/n.height,h=-a*c,d=-l*u,f=s.a,p=s.b,m=s.c,x=s.d;s.a*=c,s.b*=c,s.c*=u,s.d*=u,s.tx=h*f+d*m+s.tx,s.ty=h*p+d*x+s.ty}else s.translate(e.texture.frame.x,e.texture.frame.y),s.scale(1/e.texture.source.width,1/e.texture.source.height);let o=e.texture.source.style;return!(e.fill instanceof wt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(KG.copyFrom(i).invert()),s}var KG,ZG,BE=T(()=>{Ae();vt();ho();KG=new V,ZG=new te});function kE(t,e){let{geometryData:r,batches:i}=e;i.length=0,r.indices.length=0,r.vertices.length=0,r.uvs.length=0;for(let s=0;s<t.instructions.length;s++){let o=t.instructions[s];if(o.action==="texture")eD(o.data,i,r);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&&FE(c.shapePath,l,!0,i,r),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),FE(a,l,n,i,r)}}}function eD(t,e,r){let{vertices:i,uvs:s,indices:o}=r,n=o.length,a=i.length/2,l=[],c=wd.rectangle,u=QG,h=t.image;u.x=t.dx,u.y=t.dy,u.width=t.dw,u.height=t.dh;let d=t.transform;c.build(u,l),d&&mx(l,d),c.triangulate(l,i,2,a,o,n);let f=h.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let p=fe.get(lo);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=i.length/2-a,p.baseColor=t.style,p.alpha=t.alpha,p.texture=h,p.geometryData=r,e.push(p)}function FE(t,e,r,i,s){let{vertices:o,uvs:n,indices:a}=s;t.shapePrimitives.forEach(({shape:l,transform:c,holes:u})=>{let h=a.length,d=o.length/2,f=[],p=wd[l.type],m="triangle-list";if(p.build(l,f),c&&mx(f,c),r){let g=l.closePath??!0,b=e;b.pixelLine?(mE(f,g,o,a),m="line-list"):fE(f,b,!1,g,o,a)}else if(u){let g=[],b=f.slice();tD(u).forEach(S=>{g.push(b.length/2),b.push(...S)}),Sd(b,g,o,2,d,a,h)}else p.triangulate(f,o,2,d,a,h);let x=n.length/2,v=e.texture;if(v!==B.WHITE){let g=IE(JG,e,l,c);iE(o,2,d,n,x,2,o.length/2-d,g)}else sE(n,x,2,o.length/2-d);let y=fe.get(lo);y.indexOffset=h,y.indexSize=a.length-h,y.attributeOffset=d,y.attributeSize=o.length/2-d,y.baseColor=e.color,y.alpha=e.alpha,y.texture=v,y.geometryData=s,y.topology=m,i.push(y)})}function tD(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r].shape,s=[];wd[i.type].build(i,s),e.push(s)}return e}var wd,QG,JG,UE=T(()=>{O();Ae();vt();oE();nE();Fe();Zt();gx();cE();pE();gE();SE();EE();PE();BE();vx();wd={};K.handleByMap(w.ShapeBuilder,wd);K.add(wE,TE,AE,Pn,aE,lE);QG=new te,JG=new V});var wx,Ex,Px,Rn,Ed=T(()=>{O();ud();px();dg();tt();Zt();UE();wx=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Ex=class{constructor(){this.batcher=new Vl,this.instructions=new cn}init(){this.instructions.reset()}get geometry(){return J(rT,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Px=class Ax{constructor(e){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),e.renderableGC.addManagedHash(this,"_gpuContextHash"),e.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){Ax.defaultOptions.bezierSmoothness=e?.bezierSmoothness??Ax.defaultOptions.bezierSmoothness}getContextRenderData(e){return this._graphicsDataContextHash[e.uid]||this._initContextRenderData(e)}updateGpuContext(e){let r=this._gpuContextHash[e.uid]||this._initContext(e);if(e.dirty){r?this._cleanGraphicsContextData(e):r=this._initContext(e),kE(e,r);let i=e.batchMode;e.customShader||i==="no-batch"?r.isBatchable=!1:i==="auto"&&(r.isBatchable=r.geometryData.vertices.length<400),e.dirty=!1}return r}getGpuContext(e){return this._gpuContextHash[e.uid]||this._initContext(e)}_initContextRenderData(e){let r=fe.get(Ex),{batches:i,geometryData:s}=this._gpuContextHash[e.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u<i.length;u++)i[u].applyTransform=!1;let a=r.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let u=0;u<i.length;u++){let h=i[u];a.add(h)}a.finish(r.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 u=0;u<c.length;u++){let h=c[u];h.bindGroup=bn(h.textures.textures,h.textures.count)}return this._graphicsDataContextHash[e.uid]=r,r}_initContext(e){let r=new wx;return r.context=e,this._gpuContextHash[e.uid]=r,e.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]}onGraphicsContextDestroy(e){this._cleanGraphicsContextData(e),e.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]=null}_cleanGraphicsContextData(e){let r=this._gpuContextHash[e.uid];r.isBatchable||this._graphicsDataContextHash[e.uid]&&(fe.return(this.getContextRenderData(e)),this._graphicsDataContextHash[e.uid]=null),r.batches&&r.batches.forEach(i=>{fe.return(i)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}};Px.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"graphicsContext"};Px.defaultOptions={bezierSmoothness:.5};Rn=Px});var rD,Cx,Rx,Mx,Ix,Bx,Fx,kx,ht,Kr=T(()=>{"use strict";rD={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},Cx=0,Rx=1,Mx=2,Ix=3,Bx=4,Fx=5,kx=class OE{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Cx)}set blend(e){!!(this.data&1<<Cx)!==e&&(this.data^=1<<Cx)}get offsets(){return!!(this.data&1<<Rx)}set offsets(e){!!(this.data&1<<Rx)!==e&&(this.data^=1<<Rx)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Mx)}set culling(e){!!(this.data&1<<Mx)!==e&&(this.data^=1<<Mx)}get depthTest(){return!!(this.data&1<<Ix)}set depthTest(e){!!(this.data&1<<Ix)!==e&&(this.data^=1<<Ix)}get depthMask(){return!!(this.data&1<<Fx)}set depthMask(e){!!(this.data&1<<Fx)!==e&&(this.data^=1<<Fx)}get clockwiseFrontFace(){return!!(this.data&1<<Bx)}set clockwiseFrontFace(e){!!(this.data&1<<Bx)!==e&&(this.data^=1<<Bx)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=rD[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let e=new OE;return e.depthTest=!1,e.blend=!0,e}};kx.default2d=kx.for2d();ht=kx});function bi(t,e,r){let i=(t>>24&255)/255;e[r++]=(t&255)/255*i,e[r++]=(t>>8&255)/255*i,e[r++]=(t>>16&255)/255*i,e[r++]=i}var Mn=T(()=>{"use strict"});var zl,LE=T(()=>{O();Kr();Zt();Mn();gx();zl=class{constructor(e,r){this.state=ht.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=r,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(e){let r=e.context,i=!!this._graphicsBatchesHash[e.uid],s=this.renderer.graphicsContext.updateGpuContext(r);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(e,r){let i=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),i.isBatchable?this._addToBatcher(e,r):(this.renderer.renderPipes.batch.break(r),r.add(e))}updateRenderable(e){let r=this._graphicsBatchesHash[e.uid];if(r)for(let i=0;i<r.length;i++){let s=r[i];s._batcher.updateElement(s)}}destroyRenderable(e){this._graphicsBatchesHash[e.uid]&&this._removeBatchForRenderable(e.uid),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;let r=this.renderer,i=e.context;if(!r.graphicsContext.getGpuContext(i).batches.length)return;let o=i.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=e.groupTransform,n.uRound=r._roundPixels|e._roundPixels,bi(e.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){let r=!!this._graphicsBatchesHash[e.uid],i=this.renderer.graphicsContext.updateGpuContext(e.context);r&&this._removeBatchForRenderable(e.uid),i.isBatchable&&this._initBatchesForRenderable(e),e.batched=i.isBatchable}_addToBatcher(e,r){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(e);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,r)}}_getBatchesForRenderable(e){return this._graphicsBatchesHash[e.uid]||this._initBatchesForRenderable(e)}_initBatchesForRenderable(e){let r=e.context,i=this.renderer.graphicsContext.getGpuContext(r),s=this.renderer._roundPixels|e._roundPixels,o=i.batches.map(n=>{let a=fe.get(lo);return n.copyTo(a),a.renderable=e,a.roundPixels=s,a});return this._graphicsBatchesHash[e.uid]===void 0&&e.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[e.uid]=o,o}_removeBatchForRenderable(e){this._graphicsBatchesHash[e].forEach(r=>{fe.return(r)}),this._graphicsBatchesHash[e]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let e in this._graphicsBatchesHash)this._removeBatchForRenderable(e);this._graphicsBatchesHash=null}};zl.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"graphics"}});var Ux=T(()=>{O();Ed();LE();K.add(zl);K.add(Rn)});var _s,Ad=T(()=>{"use strict";_s=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(e){this._topology=e}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(e){this.texture!==e&&(this.texture=e,this._textureMatrixUpdateId=-1)}get uvs(){let r=this.geometry.getBuffer("aUV"),i=r.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==r._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=r._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 Xl,GE=T(()=>{O();Ae();fs();Wt();Ol();Zt();Mn();Ad();Xl=class{constructor(e,r){this.localUniforms=new Ce({uTransformMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Rt({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=r,this._adaptor.init(),e.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),e.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(e){let r=this._getMeshData(e),i=r.batched,s=e.batched;if(r.batched=s,i!==s)return!0;if(s){let o=e._geometry;if(o.indices.length!==r.indexSize||o.positions.length!==r.vertexSize)return r.indexSize=o.indices.length,r.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(e);return n.texture.uid!==e._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,e._texture)}return!1}addRenderable(e,r){let i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(e);if(s){let o=this._getBatchableMesh(e);o.setTexture(e._texture),o.geometry=e._geometry,i.addToBatch(o,r)}else i.break(r),r.add(e)}updateRenderable(e){if(e.batched){let r=this._gpuBatchableMeshHash[e.uid];r.setTexture(e._texture),r.geometry=e._geometry,r._batcher.updateElement(r)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;let r=this._gpuBatchableMeshHash[e.uid];r&&(fe.return(r),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=Ni(e.groupBlendMode,e.texture._source);let r=this.localUniforms;r.uniforms.uTransformMatrix=e.groupTransform,r.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,r.update(),bi(e.groupColorAlpha,r.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){return this._meshDataHash[e.uid]||this._initMeshData(e)}_initMeshData(e){return this._meshDataHash[e.uid]={batched:e.batched,indexSize:e._geometry.indices?.length,vertexSize:e._geometry.positions?.length},e.on("destroyed",this._destroyRenderableBound),this._meshDataHash[e.uid]}_getBatchableMesh(e){return this._gpuBatchableMeshHash[e.uid]||this._initBatchableMesh(e)}_initBatchableMesh(e){let r=fe.get(_s);return r.renderable=e,r.setTexture(e._texture),r.transform=e.groupTransform,r.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=r,r}destroy(){for(let e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&fe.return(this._gpuBatchableMeshHash[e]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};Xl.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"mesh"}});var Ox=T(()=>{O();GE();K.add(Xl)});var Pd,DE=T(()=>{"use strict";Pd=class{execute(e,r){let i=e.state,s=e.renderer,o=r.shader||e.defaultShader;o.resources.uTexture=r.texture._source,o.resources.uniforms=e.localUniforms;let n=s.gl,a=e.getBuffers(r);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,r.particleChildren.length*6,c,0)}}});function Lx(t,e=null){let r=t*6;if(r>65535?e||(e=new Uint32Array(r)):e||(e=new Uint16Array(r)),e.length!==r)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${r}`);for(let i=0,s=0;i<r;i+=6,s+=4)e[i+0]=s+0,e[i+1]=s+1,e[i+2]=s+2,e[i+3]=s+0,e[i+4]=s+2,e[i+5]=s+3;return e}var NE=T(()=>{"use strict"});function HE(t){return{dynamicUpdate:VE(t,!0),staticUpdate:VE(t,!1)}}function VE(t,e){let r=[];r.push(`
|
|
253
|
+
`}}});var fx,Xw,Yw=T(()=>{"use strict";fx=["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>"],Xw=fx.reduce((t,e)=>(t[e]=!0,t),{})});function jw(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);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 qw=T(()=>{"use strict"});var Kw,Ce,Wt=T(()=>{kt();Gl();Yw();qw();Kw=class Zw{constructor(e,r){this._touched=0,this.uid=Te("uniform"),this._resourceType="uniformGroup",this._resourceId=Te("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,r={...Zw.defaultOptions,...r},this.uniformStructures=e;let i={};for(let s in e){let o=e[s];if(o.name=s,o.size=o.size??1,!Xw[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${fx.join(", ")}`);o.value??(o.value=jw(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=r.ubo,this.isStatic=r.isStatic,this._signature=Hi(Object.keys(i).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Kw.defaultOptions={ubo:!1,isStatic:!1};Ce=Kw});function An(t){let e=Qw[t];if(e)return e;let r=new Int32Array(t);for(let i=0;i<t;i++)r[i]=i;return e=Qw[t]=new Ce({uTextures:{value:r,type:"i32",size:t}},{isStatic:!0}),e}var Qw,gd=T(()=>{Wt();Qw={}});var Xe,br=T(()=>{"use strict";Xe=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.BOTH=3]="BOTH",t))(Xe||{})});var ct,qr=T(()=>{Vt();kt();ms();fs();ao();br();Wt();ct=class t extends $e{constructor(e){super(),this.uid=Te("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:r,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=e;this.gpuProgram=r,this.glProgram=i,n===void 0&&(n=0,r&&(n|=Xe.WEBGPU),i&&(n|=Xe.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!r&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!r&&s&&a)for(let c in a)for(let u in a[c]){let h=a[c][u];l[h]={group:c,binding:u,name:h}}else if(r&&s&&!a){let c=r.structsAndGroups.groups;a={},c.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u})}else if(o){s={},a={},r&&r.structsAndGroups.groups.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[h.name]=h});let c=0;for(let u in o)l[u]||(s[99]||(s[99]=new Rt,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:c,name:u},a[99]=a[99]||{},a[99][c]=u,c++);for(let u in o){let h=u,d=o[u];!d.source&&!d._resourceType&&(d=new Ce(d));let f=l[h];f&&(s[f.group]||(s[f.group]=new Rt,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(e,r,i){var s,o;(s=this._uniformBindMap)[r]||(s[r]={}),(o=this._uniformBindMap[r])[i]||(o[i]=e),this.groups[r]||(this.groups[r]=new Rt,this._ownedBindGroups.push(this.groups[r]))}_buildResourceAccessor(e,r){let i={};for(let s in r){let o=r[s];Object.defineProperty(i,o.name,{get(){return e[o.group].getResource(o.binding)},set(n){e[o.group].setResource(n,o.binding)}})}return i}destroy(e=!1){this.emit("destroy",this),e&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(e){let{gpu:r,gl:i,...s}=e,o,n;return r&&(o=hr.from(r)),i&&(n=cr.from(i)),new t({gpuProgram:o,glProgram:n,...s})}}});var xd,Jw=T(()=>{xs();Dl();Nl();ys();gd();qr();xd=class extends ct{constructor(e){let r=xi({name:"batch",bits:[Sn,En(e),_i]}),i=gi({name:"batch",bits:[Tn,wn(e),yi]});super({glProgram:r,gpuProgram:i,resources:{batchSamplers:An(e)}})}}});var eE,tE,Vl,px=T(()=>{O();qS();JS();Jw();eE=null,tE=class rE extends jS{constructor(){super(...arguments),this.geometry=new fd,this.shader=eE||(eE=new xd(this.maxTextures)),this.name=rE.extension.name,this.vertexSize=6}packAttributes(e,r,i,s,o){let n=o<<16|e.roundPixels&65535,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,d=a.tx,f=a.ty,{positions:p,uvs:m}=e,x=e.color,v=e.attributeOffset,y=v+e.attributeSize;for(let g=v;g<y;g++){let b=g*2,_=p[b],S=p[b+1];r[s++]=l*_+u*S+d,r[s++]=h*S+c*_+f,r[s++]=m[b],r[s++]=m[b+1],i[s++]=x,i[s++]=n}}packQuadAttributes(e,r,i,s,o){let n=e.texture,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,d=a.tx,f=a.ty,p=e.bounds,m=p.maxX,x=p.minX,v=p.maxY,y=p.minY,g=n.uvs,b=e.color,_=o<<16|e.roundPixels&65535;r[s+0]=l*x+u*y+d,r[s+1]=h*y+c*x+f,r[s+2]=g.x0,r[s+3]=g.y0,i[s+4]=b,i[s+5]=_,r[s+6]=l*m+u*y+d,r[s+7]=h*y+c*m+f,r[s+8]=g.x1,r[s+9]=g.y1,i[s+10]=b,i[s+11]=_,r[s+12]=l*m+u*v+d,r[s+13]=h*v+c*m+f,r[s+14]=g.x2,r[s+15]=g.y2,i[s+16]=b,i[s+17]=_,r[s+18]=l*x+u*v+d,r[s+19]=h*v+c*x+f,r[s+20]=g.x3,r[s+21]=g.y3,i[s+22]=b,i[s+23]=_}};tE.extension={type:[w.Batcher],name:"default"};Vl=tE});function iE(t,e,r,i,s,o,n,a=null){let l=0;r*=e,s*=o;let c=a.a,u=a.b,h=a.c,d=a.d,f=a.tx,p=a.ty;for(;l<n;){let m=t[r],x=t[r+1];i[s]=c*m+h*x+f,i[s+1]=u*m+d*x+p,s+=o,r+=e,l++}}function sE(t,e,r,i){let s=0;for(e*=r;s<i;)t[e]=0,t[e+1]=0,e+=r,s++}var oE=T(()=>{"use strict"});function mx(t,e,r,i,s){let o=e.a,n=e.b,a=e.c,l=e.d,c=e.tx,u=e.ty;r||(r=0),i||(i=2),s||(s=t.length/i-r);let h=r*i;for(let d=0;d<s;d++){let f=t[h],p=t[h+1];t[h]=o*f+a*p+c,t[h+1]=n*f+l*p+u,h+=i}}var nE=T(()=>{"use strict"});var MG,lo,gx=T(()=>{Ae();lg();MG=new V,lo=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 e=this.baseColor,r=e>>16|e&65280|(e&255)<<16,i=this.renderable;return i?Vh(r,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):r+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||MG}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var Pn,aE,lE,cE=T(()=>{O();Pn={extension:{type:w.ShapeBuilder,name:"circle"},build(t,e){let r,i,s,o,n,a;if(t.type==="circle"){let b=t;r=b.x,i=b.y,n=a=b.radius,s=o=0}else if(t.type==="ellipse"){let b=t;r=b.x,i=b.y,n=b.halfWidth,a=b.halfHeight,s=o=0}else{let b=t,_=b.width/2,S=b.height/2;r=b.x+_,i=b.y+S,n=a=Math.max(0,Math.min(b.radius,Math.min(_,S))),s=_-n,o=S-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return e;let l=Math.ceil(2.3*Math.sqrt(n+a)),c=l*8+(s?4:0)+(o?4:0);if(c===0)return e;if(l===0)return e[0]=e[6]=r+s,e[1]=e[3]=i+o,e[2]=e[4]=r-s,e[5]=e[7]=i-o,e;let u=0,h=l*4+(s?2:0)+2,d=h,f=c,p=s+n,m=o,x=r+p,v=r-p,y=i+m;if(e[u++]=x,e[u++]=y,e[--h]=y,e[--h]=v,o){let b=i-m;e[d++]=v,e[d++]=b,e[--f]=b,e[--f]=x}for(let b=1;b<l;b++){let _=Math.PI/2*(b/l),S=s+Math.cos(_)*n,E=o+Math.sin(_)*a,P=r+S,C=r-S,M=i+E,R=i-E;e[u++]=P,e[u++]=M,e[--h]=M,e[--h]=C,e[d++]=C,e[d++]=R,e[--f]=R,e[--f]=P}p=s,m=o+a,x=r+p,v=r-p,y=i+m;let g=i-m;return e[u++]=x,e[u++]=y,e[--f]=g,e[--f]=x,s&&(e[u++]=v,e[u++]=y,e[--f]=g,e[--f]=v),e},triangulate(t,e,r,i,s,o){if(t.length===0)return;let n=0,a=0;for(let u=0;u<t.length;u+=2)n+=t[u],a+=t[u+1];n/=t.length/2,a/=t.length/2;let l=i;e[l*r]=n,e[l*r+1]=a;let c=l++;for(let u=0;u<t.length;u+=2)e[l*r]=t[u],e[l*r+1]=t[u+1],u>0&&(s[o++]=l,s[o++]=c,s[o++]=l-1),l++;s[o++]=c+1,s[o++]=c,s[o++]=l-1}},aE={...Pn,extension:{...Pn.extension,name:"ellipse"}},lE={...Pn,extension:{...Pn.extension,name:"roundedRectangle"}}});function uE(t){let e=t.length;if(e<6)return 1;let r=0;for(let i=0,s=t[e-2],o=t[e-1];i<e;i+=2){let n=t[i],a=t[i+1];r+=(n-s)*(a+o),s=n,o=a}return r<0?-1:1}var hE=T(()=>{"use strict"});function dE(t,e,r,i,s,o,n,a){let l=t-r*s,c=e-i*s,u=t+r*o,h=e+i*o,d,f;n?(d=i,f=-r):(d=-i,f=r);let p=l+d,m=c+f,x=u+d,v=h+f;return a.push(p,m),a.push(x,v),2}function co(t,e,r,i,s,o,n,a){let l=r-t,c=i-e,u=Math.atan2(l,c),h=Math.atan2(s-t,o-e);a&&u<h?u+=Math.PI*2:!a&&u>h&&(h+=Math.PI*2);let d=u,f=h-u,p=Math.abs(f),m=Math.sqrt(l*l+c*c),x=(15*p*Math.sqrt(m)/Math.PI>>0)+1,v=f/x;if(d+=v,a){n.push(t,e),n.push(r,i);for(let y=1,g=d;y<x;y++,g+=v)n.push(t,e),n.push(t+Math.sin(g)*m,e+Math.cos(g)*m);n.push(t,e),n.push(s,o)}else{n.push(r,i),n.push(t,e);for(let y=1,g=d;y<x;y++,g+=v)n.push(t+Math.sin(g)*m,e+Math.cos(g)*m),n.push(t,e);n.push(s,o),n.push(t,e)}return x*2}function fE(t,e,r,i,s,o){let n=1e-4;if(t.length===0)return;let a=e,l=a.alignment;if(e.alignment!==.5){let D=uE(t);r&&(D*=-1),l=(l-.5)*D+.5}let c=new ve(t[0],t[1]),u=new ve(t[t.length-2],t[t.length-1]),h=i,d=Math.abs(c.x-u.x)<n&&Math.abs(c.y-u.y)<n;if(h){t=t.slice(),d&&(t.pop(),t.pop(),u.set(t[t.length-2],t[t.length-1]));let D=(c.x+u.x)*.5,z=(u.y+c.y)*.5;t.unshift(D,z),t.push(D,z)}let f=s,p=t.length/2,m=t.length,x=f.length/2,v=a.width/2,y=v*v,g=a.miterLimit*a.miterLimit,b=t[0],_=t[1],S=t[2],E=t[3],P=0,C=0,M=-(_-E),R=b-S,F=0,U=0,W=Math.sqrt(M*M+R*R);M/=W,R/=W,M*=v,R*=v;let N=l,G=(1-N)*2,X=N*2;h||(a.cap==="round"?m+=co(b-M*(G-X)*.5,_-R*(G-X)*.5,b-M*G,_-R*G,b+M*X,_+R*X,f,!0)+2:a.cap==="square"&&(m+=dE(b,_,M,R,G,X,!0,f))),f.push(b-M*G,_-R*G),f.push(b+M*X,_+R*X);for(let D=1;D<p-1;++D){b=t[(D-1)*2],_=t[(D-1)*2+1],S=t[D*2],E=t[D*2+1],P=t[(D+1)*2],C=t[(D+1)*2+1],M=-(_-E),R=b-S,W=Math.sqrt(M*M+R*R),M/=W,R/=W,M*=v,R*=v,F=-(E-C),U=S-P,W=Math.sqrt(F*F+U*U),F/=W,U/=W,F*=v,U*=v;let z=S-b,le=_-E,de=S-P,be=C-E,Se=z*de+le*be,et=le*de-be*z,I=et<0;if(Math.abs(et)<.001*Math.abs(Se)){f.push(S-M*G,E-R*G),f.push(S+M*X,E+R*X),Se>=0&&(a.join==="round"?m+=co(S,E,S-M*G,E-R*G,S-F*G,E-U*G,f,!1)+4:m+=2,f.push(S-F*X,E-U*X),f.push(S+F*G,E+U*G));continue}let A=(-M+b)*(-R+E)-(-M+S)*(-R+_),k=(-F+P)*(-U+E)-(-F+S)*(-U+C),L=(z*k-de*A)/et,q=(be*A-le*k)/et,H=(L-S)*(L-S)+(q-E)*(q-E),Y=S+(L-S)*G,pe=E+(q-E)*G,Le=S-(L-S)*X,Be=E-(q-E)*X,ci=Math.min(z*z+le*le,de*de+be*be),Xr=I?G:X,Dt=ci+Xr*Xr*y;H<=Dt?a.join==="bevel"||H/y>g?(I?(f.push(Y,pe),f.push(S+M*X,E+R*X),f.push(Y,pe),f.push(S+F*X,E+U*X)):(f.push(S-M*G,E-R*G),f.push(Le,Be),f.push(S-F*G,E-U*G),f.push(Le,Be)),m+=2):a.join==="round"?I?(f.push(Y,pe),f.push(S+M*X,E+R*X),m+=co(S,E,S+M*X,E+R*X,S+F*X,E+U*X,f,!0)+4,f.push(Y,pe),f.push(S+F*X,E+U*X)):(f.push(S-M*G,E-R*G),f.push(Le,Be),m+=co(S,E,S-M*G,E-R*G,S-F*G,E-U*G,f,!1)+4,f.push(S-F*G,E-U*G),f.push(Le,Be)):(f.push(Y,pe),f.push(Le,Be)):(f.push(S-M*G,E-R*G),f.push(S+M*X,E+R*X),a.join==="round"?I?m+=co(S,E,S+M*X,E+R*X,S+F*X,E+U*X,f,!0)+2:m+=co(S,E,S-M*G,E-R*G,S-F*G,E-U*G,f,!1)+2:a.join==="miter"&&H/y<=g&&(I?(f.push(Le,Be),f.push(Le,Be)):(f.push(Y,pe),f.push(Y,pe)),m+=2),f.push(S-F*G,E-U*G),f.push(S+F*X,E+U*X),m+=2)}b=t[(p-2)*2],_=t[(p-2)*2+1],S=t[(p-1)*2],E=t[(p-1)*2+1],M=-(_-E),R=b-S,W=Math.sqrt(M*M+R*R),M/=W,R/=W,M*=v,R*=v,f.push(S-M*G,E-R*G),f.push(S+M*X,E+R*X),h||(a.cap==="round"?m+=co(S-M*(G-X)*.5,E-R*(G-X)*.5,S-M*G,E-R*G,S+M*X,E+R*X,f,!1)+2:a.cap==="square"&&(m+=dE(S,E,M,R,G,X,!1,f)));let $=1e-4*1e-4;for(let D=x;D<m+x-2;++D)b=f[D*2],_=f[D*2+1],S=f[(D+1)*2],E=f[(D+1)*2+1],P=f[(D+2)*2],C=f[(D+2)*2+1],!(Math.abs(b*(E-C)+S*(C-_)+P*(_-E))<$)&&o.push(D,D+1,D+2)}var pE=T(()=>{gr();hE()});function mE(t,e,r,i){let s=1e-4;if(t.length===0)return;let o=t[0],n=t[1],a=t[t.length-2],l=t[t.length-1],c=e||Math.abs(o-a)<s&&Math.abs(n-l)<s,u=r,h=t.length/2,d=u.length/2;for(let f=0;f<h;f++)u.push(t[f*2]),u.push(t[f*2+1]);for(let f=0;f<h-1;f++)i.push(d+f,d+f+1);c&&i.push(d+h-1,d)}var gE=T(()=>{});var Td=ce((dZ,bx)=>{"use strict";bx.exports=bd;bx.exports.default=bd;function bd(t,e,r){r=r||2;var i=e&&e.length,s=i?e[0]*r:t.length,o=yE(t,0,s,r,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,c,u,h,d,f;if(i&&(o=LG(t,e,o,r)),t.length>80*r){a=c=t[0],l=u=t[1];for(var p=r;p<s;p+=r)h=t[p],d=t[p+1],h<a&&(a=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);f=Math.max(c-a,u-l),f=f!==0?32767/f:0}return Hl(o,n,r,a,l,f,0),n}function yE(t,e,r,i,s){var o,n;if(s===_x(t,e,r,i)>0)for(o=e;o<r;o+=i)n=xE(o,t[o],t[o+1],n);else for(o=r-i;o>=e;o-=i)n=xE(o,t[o],t[o+1],n);return n&&vd(n,n.next)&&($l(n),n=n.next),n}function uo(t,e){if(!t)return t;e||(e=t);var r=t,i;do if(i=!1,!r.steiner&&(vd(r,r.next)||nt(r.prev,r,r.next)===0)){if($l(r),r=e=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function Hl(t,e,r,i,s,o,n){if(t){!n&&o&&HG(t,i,s,o);for(var a=t,l,c;t.prev!==t.next;){if(l=t.prev,c=t.next,o?kG(t,i,s,o):FG(t)){e.push(l.i/r|0),e.push(t.i/r|0),e.push(c.i/r|0),$l(t),t=c.next,a=c.next;continue}if(t=c,t===a){n?n===1?(t=UG(uo(t),e,r),Hl(t,e,r,i,s,o,2)):n===2&&OG(t,e,r,i,s,o):Hl(uo(t),e,r,i,s,o,1);break}}}}function FG(t){var e=t.prev,r=t,i=t.next;if(nt(e,r,i)>=0)return!1;for(var s=e.x,o=r.x,n=i.x,a=e.y,l=r.y,c=i.y,u=s<o?s<n?s:n:o<n?o:n,h=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!==e;){if(p.x>=u&&p.x<=d&&p.y>=h&&p.y<=f&&Cn(s,a,o,l,n,c,p.x,p.y)&&nt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function kG(t,e,r,i){var s=t.prev,o=t,n=t.next;if(nt(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,c=n.x,u=s.y,h=o.y,d=n.y,f=a<l?a<c?a:c:l<c?l:c,p=u<h?u<d?u:d:h<d?h:d,m=a>l?a>c?a:c:l>c?l:c,x=u>h?u>d?u:d:h>d?h:d,v=xx(f,p,e,r,i),y=xx(m,x,e,r,i),g=t.prevZ,b=t.nextZ;g&&g.z>=v&&b&&b.z<=y;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=x&&g!==s&&g!==n&&Cn(a,u,l,h,c,d,g.x,g.y)&&nt(g.prev,g,g.next)>=0||(g=g.prevZ,b.x>=f&&b.x<=m&&b.y>=p&&b.y<=x&&b!==s&&b!==n&&Cn(a,u,l,h,c,d,b.x,b.y)&&nt(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;g&&g.z>=v;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=x&&g!==s&&g!==n&&Cn(a,u,l,h,c,d,g.x,g.y)&&nt(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;b&&b.z<=y;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=x&&b!==s&&b!==n&&Cn(a,u,l,h,c,d,b.x,b.y)&&nt(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function UG(t,e,r){var i=t;do{var s=i.prev,o=i.next.next;!vd(s,o)&&_E(s,i,i.next,o)&&Wl(s,o)&&Wl(o,s)&&(e.push(s.i/r|0),e.push(i.i/r|0),e.push(o.i/r|0),$l(i),$l(i.next),i=t=o),i=i.next}while(i!==t);return uo(i)}function OG(t,e,r,i,s,o){var n=t;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&zG(n,a)){var l=bE(n,a);n=uo(n,n.next),l=uo(l,l.next),Hl(n,e,r,i,s,o,0),Hl(l,e,r,i,s,o,0);return}a=a.next}n=n.next}while(n!==t)}function LG(t,e,r,i){var s=[],o,n,a,l,c;for(o=0,n=e.length;o<n;o++)a=e[o]*i,l=o<n-1?e[o+1]*i:t.length,c=yE(t,a,l,i,!1),c===c.next&&(c.steiner=!0),s.push($G(c));for(s.sort(GG),o=0;o<s.length;o++)r=DG(s[o],r);return r}function GG(t,e){return t.x-e.x}function DG(t,e){var r=NG(t,e);if(!r)return e;var i=bE(r,t);return uo(i,i.next),uo(r,r.next)}function NG(t,e){var r=e,i=t.x,s=t.y,o=-1/0,n;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>o&&(o=a,n=r.x<r.next.x?r:r.next,a===i))return n}r=r.next}while(r!==e);if(!n)return null;var l=n,c=n.x,u=n.y,h=1/0,d;r=n;do i>=r.x&&r.x>=c&&i!==r.x&&Cn(s<u?i:o,s,c,u,s<u?o:i,s,r.x,r.y)&&(d=Math.abs(s-r.y)/(i-r.x),Wl(r,t)&&(d<h||d===h&&(r.x>n.x||r.x===n.x&&VG(n,r)))&&(n=r,h=d)),r=r.next;while(r!==l);return n}function VG(t,e){return nt(t.prev,t,e.prev)<0&&nt(e.next,t,t.next)<0}function HG(t,e,r,i){var s=t;do s.z===0&&(s.z=xx(s.x,s.y,e,r,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,WG(s)}function WG(t){var e,r,i,s,o,n,a,l,c=1;do{for(r=t,t=null,o=null,n=0;r;){for(n++,i=r,a=0,e=0;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||r.z<=i.z)?(s=r,r=r.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:t=s,s.prevZ=o,o=s;r=i}o.nextZ=null,c*=2}while(n>1);return t}function xx(t,e,r,i,s){return t=(t-r)*s|0,e=(e-i)*s|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function $G(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function Cn(t,e,r,i,s,o,n,a){return(s-n)*(e-a)>=(t-n)*(o-a)&&(t-n)*(i-a)>=(r-n)*(e-a)&&(r-n)*(o-a)>=(s-n)*(i-a)}function zG(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!XG(t,e)&&(Wl(t,e)&&Wl(e,t)&&YG(t,e)&&(nt(t.prev,t,e.prev)||nt(t,e.prev,e))||vd(t,e)&&nt(t.prev,t,t.next)>0&&nt(e.prev,e,e.next)>0)}function nt(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function vd(t,e){return t.x===e.x&&t.y===e.y}function _E(t,e,r,i){var s=_d(nt(t,e,r)),o=_d(nt(t,e,i)),n=_d(nt(r,i,t)),a=_d(nt(r,i,e));return!!(s!==o&&n!==a||s===0&&yd(t,r,e)||o===0&&yd(t,i,e)||n===0&&yd(r,t,i)||a===0&&yd(r,e,i))}function yd(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function _d(t){return t>0?1:t<0?-1:0}function XG(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&_E(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Wl(t,e){return nt(t.prev,t,t.next)<0?nt(t,e,t.next)>=0&&nt(t,t.prev,e)>=0:nt(t,e,t.prev)<0||nt(t,t.next,e)<0}function YG(t,e){var r=t,i=!1,s=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&s<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}function bE(t,e){var r=new yx(t.i,t.x,t.y),i=new yx(e.i,e.x,e.y),s=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=s,s.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function xE(t,e,r,i){var s=new yx(t,e,r);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function $l(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function yx(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}bd.deviation=function(t,e,r,i){var s=e&&e.length,o=s?e[0]*r:t.length,n=Math.abs(_x(t,0,o,r));if(s)for(var a=0,l=e.length;a<l;a++){var c=e[a]*r,u=a<l-1?e[a+1]*r:t.length;n-=Math.abs(_x(t,c,u,r))}var h=0;for(a=0;a<i.length;a+=3){var d=i[a]*r,f=i[a+1]*r,p=i[a+2]*r;h+=Math.abs((t[d]-t[p])*(t[f+1]-t[d+1])-(t[d]-t[f])*(t[p+1]-t[d+1]))}return n===0&&h===0?0:Math.abs((h-n)/n)};function _x(t,e,r,i){for(var s=0,o=e,n=r-i;o<r;o+=i)s+=(t[n]-t[o])*(t[o+1]+t[n+1]),n=o;return s}bd.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},i=0,s=0;s<t.length;s++){for(var o=0;o<t[s].length;o++)for(var n=0;n<e;n++)r.vertices.push(t[s][o][n]);s>0&&(i+=t[s-1].length,r.holes.push(i))}return r}});function Sd(t,e,r,i,s,o,n){let a=(0,vE.default)(t,e,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<t.length;c+=2)r[l]=t[c],r[l+1]=t[c+1],l+=i}var vE,vx=T(()=>{vE=Xs(Td(),1)});var jG,TE,SE=T(()=>{O();vx();jG=[],TE={extension:{type:w.ShapeBuilder,name:"polygon"},build(t,e){for(let r=0;r<t.points.length;r++)e[r]=t.points[r];return e},triangulate(t,e,r,i,s,o){Sd(t,jG,e,r,i,s,o)}}});var wE,EE=T(()=>{O();wE={extension:{type:w.ShapeBuilder,name:"rectangle"},build(t,e){let r=t,i=r.x,s=r.y,o=r.width,n=r.height;return o>=0&&n>=0&&(e[0]=i,e[1]=s,e[2]=i+o,e[3]=s,e[4]=i+o,e[5]=s+n,e[6]=i,e[7]=s+n),e},triangulate(t,e,r,i,s,o){let n=0;i*=r,e[i+n]=t[0],e[i+n+1]=t[1],n+=r,e[i+n]=t[2],e[i+n+1]=t[3],n+=r,e[i+n]=t[6],e[i+n+1]=t[7],n+=r,e[i+n]=t[4],e[i+n+1]=t[5],n+=r;let a=i/r;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var AE,PE=T(()=>{O();AE={extension:{type:w.ShapeBuilder,name:"triangle"},build(t,e){return e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,e},triangulate(t,e,r,i,s,o){let n=0;i*=r,e[i+n]=t[0],e[i+n+1]=t[1],n+=r,e[i+n]=t[2],e[i+n+1]=t[3],n+=r,e[i+n]=t[4],e[i+n+1]=t[5];let a=i/r;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function RE(t,e){for(let r=0;r<e.length;r++){let i=e[r];t.addColorStop(i.offset,i.color)}}function ME(t,e){let r=re.get().createCanvas(t,e),i=r.getContext("2d");return{canvas:r,context:i}}function qG(t){let e=t[0]??{};return(typeof e=="number"||t[1])&&(J("8.5.2","use options object instead"),e={type:"linear",start:{x:t[0],y:t[1]},end:{x:t[2],y:t[3]},textureSpace:t[4],textureSize:t[5]??wt.defaultLinearOptions.textureSize}),e}var CE,Sx,wt,ho=T(()=>{Bt();ze();Ae();xn();Fe();kt();tt();pg();CE=[{offset:0,color:"white"},{offset:1,color:"black"}],Sx=class Tx{constructor(...e){this.uid=Te("fillGradient"),this.type="linear",this.colorStops=[];let r=qG(e);r={...r.type==="radial"?Tx.defaultRadialOptions:Tx.defaultLinearOptions,...Wh(r)},this._textureSize=r.textureSize,this._wrapMode=r.wrapMode,r.type==="radial"?(this.center=r.center,this.outerCenter=r.outerCenter??this.center,this.innerRadius=r.innerRadius,this.outerRadius=r.outerRadius,this.scale=r.scale,this.rotation=r.rotation):(this.start=r.start,this.end=r.end),this.textureSpace=r.textureSpace,this.type=r.type,r.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(e,r){return this.colorStops.push({offset:e,color:me.shared.setValue(r).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:r}=this.start,{x:i,y:s}=this.end,o=i-e,n=s-r,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let x=e;e=i,i=x,o*=-1}if(n<0){let x=r;r=s,s=x,n*=-1}}let l=this.colorStops.length?this.colorStops:CE,c=this._textureSize,{canvas:u,context:h}=ME(c,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);RE(d,l),h.fillStyle=d,h.fillRect(0,0,c,1),this.texture=new B({source:new lr({resource:u,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new V;m.scale(f/c,1),m.rotate(p),m.translate(e,r),this.textureSpace==="local"&&m.scale(c,c),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:CE,r=this._textureSize,{canvas:i,context:s}=ME(r,r),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,u=this.outerRadius,h=a-u,d=l-u,f=r/(u*2),p=(o-h)*f,m=(n-d)*f,x=s.createRadialGradient(p,m,c*f,(a-h)*f,(l-d)*f,u*f);RE(x,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,r,r),s.fillStyle=x,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,r,r),this.texture=new B({source:new lr({resource:i,addressMode:this._wrapMode})});let v=new V;v.scale(1/f,1/f),v.translate(h,d),this.textureSpace==="local"&&v.scale(r,r),this.transform=v}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Sx.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Sx.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};wt=Sx});function IE(t,e,r,i){let s=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){let n=r.getBounds(ZG);e.width&&n.pad(e.width);let{x:a,y:l}=n,c=1/n.width,u=1/n.height,h=-a*c,d=-l*u,f=s.a,p=s.b,m=s.c,x=s.d;s.a*=c,s.b*=c,s.c*=u,s.d*=u,s.tx=h*f+d*m+s.tx,s.ty=h*p+d*x+s.ty}else s.translate(e.texture.frame.x,e.texture.frame.y),s.scale(1/e.texture.source.width,1/e.texture.source.height);let o=e.texture.source.style;return!(e.fill instanceof wt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(KG.copyFrom(i).invert()),s}var KG,ZG,BE=T(()=>{Ae();vt();ho();KG=new V,ZG=new te});function kE(t,e){let{geometryData:r,batches:i}=e;i.length=0,r.indices.length=0,r.vertices.length=0,r.uvs.length=0;for(let s=0;s<t.instructions.length;s++){let o=t.instructions[s];if(o.action==="texture")eD(o.data,i,r);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&&FE(c.shapePath,l,!0,i,r),c&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=c.shapePath.shapePrimitives),FE(a,l,n,i,r)}}}function eD(t,e,r){let{vertices:i,uvs:s,indices:o}=r,n=o.length,a=i.length/2,l=[],c=wd.rectangle,u=QG,h=t.image;u.x=t.dx,u.y=t.dy,u.width=t.dw,u.height=t.dh;let d=t.transform;c.build(u,l),d&&mx(l,d),c.triangulate(l,i,2,a,o,n);let f=h.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let p=fe.get(lo);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=i.length/2-a,p.baseColor=t.style,p.alpha=t.alpha,p.texture=h,p.geometryData=r,e.push(p)}function FE(t,e,r,i,s){let{vertices:o,uvs:n,indices:a}=s;t.shapePrimitives.forEach(({shape:l,transform:c,holes:u})=>{let h=a.length,d=o.length/2,f=[],p=wd[l.type],m="triangle-list";if(p.build(l,f),c&&mx(f,c),r){let g=l.closePath??!0,b=e;b.pixelLine?(mE(f,g,o,a),m="line-list"):fE(f,b,!1,g,o,a)}else if(u){let g=[],b=f.slice();tD(u).forEach(S=>{g.push(b.length/2),b.push(...S)}),Sd(b,g,o,2,d,a,h)}else p.triangulate(f,o,2,d,a,h);let x=n.length/2,v=e.texture;if(v!==B.WHITE){let g=IE(JG,e,l,c);iE(o,2,d,n,x,2,o.length/2-d,g)}else sE(n,x,2,o.length/2-d);let y=fe.get(lo);y.indexOffset=h,y.indexSize=a.length-h,y.attributeOffset=d,y.attributeSize=o.length/2-d,y.baseColor=e.color,y.alpha=e.alpha,y.texture=v,y.geometryData=s,y.topology=m,i.push(y)})}function tD(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r].shape,s=[];wd[i.type].build(i,s),e.push(s)}return e}var wd,QG,JG,UE=T(()=>{O();Ae();vt();oE();nE();Fe();Zt();gx();cE();pE();gE();SE();EE();PE();BE();vx();wd={};K.handleByMap(w.ShapeBuilder,wd);K.add(wE,TE,AE,Pn,aE,lE);QG=new te,JG=new V});var wx,Ex,Px,Rn,Ed=T(()=>{O();ud();px();dg();tt();Zt();UE();wx=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Ex=class{constructor(){this.batcher=new Vl,this.instructions=new cn}init(){this.instructions.reset()}get geometry(){return J(rT,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Px=class Ax{constructor(e){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),e.renderableGC.addManagedHash(this,"_gpuContextHash"),e.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){Ax.defaultOptions.bezierSmoothness=e?.bezierSmoothness??Ax.defaultOptions.bezierSmoothness}getContextRenderData(e){return this._graphicsDataContextHash[e.uid]||this._initContextRenderData(e)}updateGpuContext(e){let r=this._gpuContextHash[e.uid]||this._initContext(e);if(e.dirty){r?this._cleanGraphicsContextData(e):r=this._initContext(e),kE(e,r);let i=e.batchMode;e.customShader||i==="no-batch"?r.isBatchable=!1:i==="auto"&&(r.isBatchable=r.geometryData.vertices.length<400),e.dirty=!1}return r}getGpuContext(e){return this._gpuContextHash[e.uid]||this._initContext(e)}_initContextRenderData(e){let r=fe.get(Ex),{batches:i,geometryData:s}=this._gpuContextHash[e.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u<i.length;u++)i[u].applyTransform=!1;let a=r.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let u=0;u<i.length;u++){let h=i[u];a.add(h)}a.finish(r.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 u=0;u<c.length;u++){let h=c[u];h.bindGroup=bn(h.textures.textures,h.textures.count)}return this._graphicsDataContextHash[e.uid]=r,r}_initContext(e){let r=new wx;return r.context=e,this._gpuContextHash[e.uid]=r,e.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]}onGraphicsContextDestroy(e){this._cleanGraphicsContextData(e),e.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]=null}_cleanGraphicsContextData(e){let r=this._gpuContextHash[e.uid];r.isBatchable||this._graphicsDataContextHash[e.uid]&&(fe.return(this.getContextRenderData(e)),this._graphicsDataContextHash[e.uid]=null),r.batches&&r.batches.forEach(i=>{fe.return(i)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}};Px.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"graphicsContext"};Px.defaultOptions={bezierSmoothness:.5};Rn=Px});var rD,Cx,Rx,Mx,Ix,Bx,Fx,kx,ht,Kr=T(()=>{"use strict";rD={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},Cx=0,Rx=1,Mx=2,Ix=3,Bx=4,Fx=5,kx=class OE{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Cx)}set blend(e){!!(this.data&1<<Cx)!==e&&(this.data^=1<<Cx)}get offsets(){return!!(this.data&1<<Rx)}set offsets(e){!!(this.data&1<<Rx)!==e&&(this.data^=1<<Rx)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Mx)}set culling(e){!!(this.data&1<<Mx)!==e&&(this.data^=1<<Mx)}get depthTest(){return!!(this.data&1<<Ix)}set depthTest(e){!!(this.data&1<<Ix)!==e&&(this.data^=1<<Ix)}get depthMask(){return!!(this.data&1<<Fx)}set depthMask(e){!!(this.data&1<<Fx)!==e&&(this.data^=1<<Fx)}get clockwiseFrontFace(){return!!(this.data&1<<Bx)}set clockwiseFrontFace(e){!!(this.data&1<<Bx)!==e&&(this.data^=1<<Bx)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=rD[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let e=new OE;return e.depthTest=!1,e.blend=!0,e}};kx.default2d=kx.for2d();ht=kx});function bi(t,e,r){let i=(t>>24&255)/255;e[r++]=(t&255)/255*i,e[r++]=(t>>8&255)/255*i,e[r++]=(t>>16&255)/255*i,e[r++]=i}var Mn=T(()=>{"use strict"});var zl,LE=T(()=>{O();Kr();Zt();Mn();gx();zl=class{constructor(e,r){this.state=ht.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=r,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(e){let r=e.context,i=!!this._graphicsBatchesHash[e.uid],s=this.renderer.graphicsContext.updateGpuContext(r);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(e,r){let i=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),i.isBatchable?this._addToBatcher(e,r):(this.renderer.renderPipes.batch.break(r),r.add(e))}updateRenderable(e){let r=this._graphicsBatchesHash[e.uid];if(r)for(let i=0;i<r.length;i++){let s=r[i];s._batcher.updateElement(s)}}destroyRenderable(e){this._graphicsBatchesHash[e.uid]&&this._removeBatchForRenderable(e.uid),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;let r=this.renderer,i=e.context;if(!r.graphicsContext.getGpuContext(i).batches.length)return;let o=i.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=e.groupTransform,n.uRound=r._roundPixels|e._roundPixels,bi(e.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){let r=!!this._graphicsBatchesHash[e.uid],i=this.renderer.graphicsContext.updateGpuContext(e.context);r&&this._removeBatchForRenderable(e.uid),i.isBatchable&&this._initBatchesForRenderable(e),e.batched=i.isBatchable}_addToBatcher(e,r){let i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(e);for(let o=0;o<s.length;o++){let n=s[o];i.addToBatch(n,r)}}_getBatchesForRenderable(e){return this._graphicsBatchesHash[e.uid]||this._initBatchesForRenderable(e)}_initBatchesForRenderable(e){let r=e.context,i=this.renderer.graphicsContext.getGpuContext(r),s=this.renderer._roundPixels|e._roundPixels,o=i.batches.map(n=>{let a=fe.get(lo);return n.copyTo(a),a.renderable=e,a.roundPixels=s,a});return this._graphicsBatchesHash[e.uid]===void 0&&e.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[e.uid]=o,o}_removeBatchForRenderable(e){this._graphicsBatchesHash[e].forEach(r=>{fe.return(r)}),this._graphicsBatchesHash[e]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let e in this._graphicsBatchesHash)this._removeBatchForRenderable(e);this._graphicsBatchesHash=null}};zl.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"graphics"}});var Ux=T(()=>{O();Ed();LE();K.add(zl);K.add(Rn)});var _s,Ad=T(()=>{"use strict";_s=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(e){this._topology=e}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(e){this.texture!==e&&(this.texture=e,this._textureMatrixUpdateId=-1)}get uvs(){let r=this.geometry.getBuffer("aUV"),i=r.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==r._updateID)&&((!s||s.length<i.length)&&(s=this._transformedUvs=new Float32Array(i.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=r._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 Xl,GE=T(()=>{O();Ae();fs();Wt();Ol();Zt();Mn();Ad();Xl=class{constructor(e,r){this.localUniforms=new Ce({uTransformMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Rt({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=r,this._adaptor.init(),e.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),e.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(e){let r=this._getMeshData(e),i=r.batched,s=e.batched;if(r.batched=s,i!==s)return!0;if(s){let o=e._geometry;if(o.indices.length!==r.indexSize||o.positions.length!==r.vertexSize)return r.indexSize=o.indices.length,r.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(e);return n.texture.uid!==e._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,e._texture)}return!1}addRenderable(e,r){let i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(e);if(s){let o=this._getBatchableMesh(e);o.setTexture(e._texture),o.geometry=e._geometry,i.addToBatch(o,r)}else i.break(r),r.add(e)}updateRenderable(e){if(e.batched){let r=this._gpuBatchableMeshHash[e.uid];r.setTexture(e._texture),r.geometry=e._geometry,r._batcher.updateElement(r)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;let r=this._gpuBatchableMeshHash[e.uid];r&&(fe.return(r),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=Ni(e.groupBlendMode,e.texture._source);let r=this.localUniforms;r.uniforms.uTransformMatrix=e.groupTransform,r.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,r.update(),bi(e.groupColorAlpha,r.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){return this._meshDataHash[e.uid]||this._initMeshData(e)}_initMeshData(e){return this._meshDataHash[e.uid]={batched:e.batched,indexSize:e._geometry.indices?.length,vertexSize:e._geometry.positions?.length},e.on("destroyed",this._destroyRenderableBound),this._meshDataHash[e.uid]}_getBatchableMesh(e){return this._gpuBatchableMeshHash[e.uid]||this._initBatchableMesh(e)}_initBatchableMesh(e){let r=fe.get(_s);return r.renderable=e,r.setTexture(e._texture),r.transform=e.groupTransform,r.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=r,r}destroy(){for(let e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&fe.return(this._gpuBatchableMeshHash[e]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};Xl.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"mesh"}});var Ox=T(()=>{O();GE();K.add(Xl)});var Pd,DE=T(()=>{"use strict";Pd=class{execute(e,r){let i=e.state,s=e.renderer,o=r.shader||e.defaultShader;o.resources.uTexture=r.texture._source,o.resources.uniforms=e.localUniforms;let n=s.gl,a=e.getBuffers(r);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,r.particleChildren.length*6,c,0)}}});function Lx(t,e=null){let r=t*6;if(r>65535?e||(e=new Uint32Array(r)):e||(e=new Uint16Array(r)),e.length!==r)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${r}`);for(let i=0,s=0;i<r;i+=6,s+=4)e[i+0]=s+0,e[i+1]=s+1,e[i+2]=s+2,e[i+3]=s+0,e[i+4]=s+2,e[i+5]=s+3;return e}var NE=T(()=>{"use strict"});function HE(t){return{dynamicUpdate:VE(t,!0),staticUpdate:VE(t,!1)}}function VE(t,e){let r=[];r.push(`
|
|
254
254
|
|
|
255
255
|
var index = 0;
|
|
256
256
|
|
|
@@ -364,7 +364,7 @@ fn mainFragment(
|
|
|
364
364
|
var sample = textureSample(uTexture, uSampler, uv) * color;
|
|
365
365
|
|
|
366
366
|
return sample;
|
|
367
|
-
}`});var Rd,KE=T(()=>{Bt();Ae();ms();ao();qr();Fe();mg();XE();jE();qE();Rd=class extends ct{constructor(){let e=cr.from({vertex:YE,fragment:zE}),r=hr.from({fragment:{source:Gx,entryPoint:"mainFragment"},vertex:{source:Gx,entryPoint:"mainVertex"}});super({glProgram:e,gpuProgram:r,resources:{uTexture:B.WHITE.source,uSampler:new $h({}),uniforms:{uTranslationMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new me(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var In,Dx=T(()=>{Ae();Wt();Ol();Kr();Mn();$E();KE();In=class{constructor(e,r){this.state=ht.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Ce({uTranslationMatrix:{value:new V,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=e,this.adaptor=r,this.defaultShader=new Rd,this.state=ht.for2d()}validateRenderable(e){return!1}addRenderable(e,r){this.renderer.renderPipes.batch.break(r),r.add(e)}getBuffers(e){return this._gpuBufferHash[e.uid]||this._initBuffer(e)}_initBuffer(e){return this._gpuBufferHash[e.uid]=new Cd({size:e.particleChildren.length,properties:e._properties}),e.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[e.uid]}updateRenderable(e){}destroyRenderable(e){this._gpuBufferHash[e.uid].destroy(),this._gpuBufferHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}execute(e){let r=e.particleChildren;if(r.length===0)return;let i=this.renderer,s=this.getBuffers(e);e.texture||(e.texture=r[0].texture);let o=this.state;s.update(r,e._childrenDirty),e._childrenDirty=!1,o.blendMode=Ni(e.blendMode,e.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;e.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|e._roundPixels,bi(e.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,e)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Yl,ZE=T(()=>{O();DE();Dx();Yl=class extends In{constructor(e){super(e,new Pd)}};Yl.extension={type:[w.WebGLPipes],name:"particle"}});var Md,QE=T(()=>{"use strict";Md=class{execute(e,r){let i=e.renderer,s=r.shader||e.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(e.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(r.texture);let o=e.state,n=e.getBuffers(r);i.encoder.draw({geometry:n.geometry,shader:r.shader||e.defaultShader,state:o,size:r.particleChildren.length*6})}}});var jl,JE=T(()=>{O();QE();Dx();jl=class extends In{constructor(e){super(e,new Md)}};jl.extension={type:[w.WebGPUPipes],name:"particle"}});var Nx=T(()=>{O();ZE();JE();K.add(Yl);K.add(jl)});var vi,ql=T(()=>{"use strict";vi=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 Kl(t,e){let{texture:r,bounds:i}=t;rd(i,e._anchor,r);let s=e._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var Vx=T(()=>{Dg()});var Zl,eA=T(()=>{O();Zt();ql();Vx();Zl=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let e in this._gpuText){let r=this._gpuText[e];if(!r)continue;let i=r.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(e){let r=this._getGpuText(e),i=e._getKey();return r.currentKey!==i}addRenderable(e,r){let s=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(s,r)}updateRenderable(e){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),i._batcher.updateElement(i)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let r=this._gpuText[e];this._renderer.canvasText.decreaseReferenceCount(r.currentKey),fe.return(r.batchableSprite),this._gpuText[e]=null}_updateText(e){let r=e._getKey(),i=this._getGpuText(e),s=i.batchableSprite;i.currentKey!==r&&this._updateGpuText(e),e._didTextUpdate=!1,Kl(s,e)}_updateGpuText(e){let r=this._getGpuText(e),i=r.batchableSprite;r.texture&&this._renderer.canvasText.decreaseReferenceCount(r.currentKey),r.texture=i.texture=this._renderer.canvasText.getManagedTexture(e),r.currentKey=e._getKey(),i.texture=r.texture}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let r={texture:null,currentKey:"--",batchableSprite:fe.get(vi)};return r.batchableSprite.renderable=e,r.batchableSprite.transform=e.groupTransform,r.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},r.batchableSprite.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuText[e.uid]=r,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._updateText(e),e.on("destroyed",this._destroyRenderableBound),r}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}};Zl.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"text"}});var Hx,dr,Bn=T(()=>{ze();bl();Hx=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,r){let i=re.get().createCanvas();i.width=e,i.height=r;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(e,r,i=1){e=Math.ceil(e*i-1e-6),r=Math.ceil(r*i-1e-6),e=Li(e),r=Li(r);let s=(e<<17)+(r<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(e,r)),o}returnCanvasAndContext(e){let r=e.canvas,{width:i,height:s}=r,o=(i<<17)+(s<<1);e.context.clearRect(0,0,i,s),this._canvasPool[o].push(e)}clear(){this._canvasPool={}}},dr=new Hx});function tA(t,e,r){for(let i=0,s=4*r*e;i<e;++i,s+=4)if(t[s+3]!==0)return!1;return!0}function rA(t,e,r,i,s){let o=4*e;for(let n=i,a=i*o+4*r;n<=s;++n,a+=o)if(t[a+3]!==0)return!1;return!0}function iA(t,e=1){let{width:r,height:i}=t,s=t.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,r,i).data,a=0,l=0,c=r-1,u=i-1;for(;l<i&&tA(n,r,l);)++l;if(l===i)return te.EMPTY;for(;tA(n,r,u);)--u;for(;rA(n,r,a,l,u);)++a;for(;rA(n,r,c,l,u);)--c;return++c,++u,new te(a/e,l/e,(c-a)/e,(u-l)/e)}var sA=T(()=>{vt()});var oA,Wi,Id=T(()=>{Ae();kt();oA={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"}},Wi=class{constructor(e,r){this.uid=Te("fillPattern"),this.transform=new V,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),r&&(e.source.style.addressModeU=oA[r].addressModeU,e.source.style.addressModeV=oA[r].addressModeV)}setTransform(e){let r=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/r.frame.width,1/r.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 aA=ce((BJ,nA)=>{nA.exports=oD;var Wx={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},sD=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function oD(t){var e=[];return t.replace(sD,function(r,i,s){var o=i.toLowerCase();for(s=aD(s),o=="m"&&s.length>2&&(e.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==Wx[o])return s.unshift(i),e.push(s);if(s.length<Wx[o])throw new Error("malformed path data");e.push([i].concat(s.splice(0,Wx[o])))}}),e}var nD=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function aD(t){var e=t.match(nD);return e?e.map(Number):[]}});function cA(t,e){let r=(0,lA.default)(t),i=[],s=null,o=0,n=0;for(let a=0;a<r.length;a++){let l=r[a],c=l[0],u=l;switch(c){case"M":o=u[1],n=u[2],e.moveTo(o,n);break;case"m":o+=u[1],n+=u[2],e.moveTo(o,n);break;case"H":o=u[1],e.lineTo(o,n);break;case"h":o+=u[1],e.lineTo(o,n);break;case"V":n=u[1],e.lineTo(o,n);break;case"v":n+=u[1],e.lineTo(o,n);break;case"L":o=u[1],n=u[2],e.lineTo(o,n);break;case"l":o+=u[1],n+=u[2],e.lineTo(o,n);break;case"C":o=u[5],n=u[6],e.bezierCurveTo(u[1],u[2],u[3],u[4],o,n);break;case"c":e.bezierCurveTo(o+u[1],n+u[2],o+u[3],n+u[4],o+u[5],n+u[6]),o+=u[5],n+=u[6];break;case"S":o=u[3],n=u[4],e.bezierCurveToShort(u[1],u[2],o,n);break;case"s":e.bezierCurveToShort(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case"Q":o=u[3],n=u[4],e.quadraticCurveTo(u[1],u[2],o,n);break;case"q":e.quadraticCurveTo(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case"T":o=u[1],n=u[2],e.quadraticCurveToShort(o,n);break;case"t":o+=u[1],n+=u[2],e.quadraticCurveToShort(o,n);break;case"A":o=u[6],n=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case"a":o+=u[6],n+=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case"Z":case"z":e.closePath(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:Z(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return e}var lA,uA=T(()=>{lA=Xs(aA(),1);Ne()});var Bd,hA=T(()=>{vt();Bd=class t{constructor(e=0,r=0,i=0){this.type="circle",this.x=e,this.y=r,this.radius=i}clone(){return new t(this.x,this.y,this.radius)}contains(e,r){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-r;return s*=s,o*=o,s+o<=i}strokeContains(e,r,i,s=.5){if(this.radius===0)return!1;let o=this.x-e,n=this.y-r,a=this.radius,l=(1-s)*i,c=Math.sqrt(o*o+n*n);return c<=a+l&&c>a-(i-l)}getBounds(e){return e||(e=new te),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var Fd,dA=T(()=>{vt();Fd=class t{constructor(e=0,r=0,i=0,s=0){this.type="ellipse",this.x=e,this.y=r,this.halfWidth=i,this.halfHeight=s}clone(){return new t(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,r){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(e-this.x)/this.halfWidth,s=(r-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(e,r,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,u=n-l,h=o+a,d=n+a,f=e-this.x,p=r-this.y,m=f*f/(c*c)+p*p/(u*u),x=f*f/(h*h)+p*p/(d*d);return m>1&&x<=1}getBounds(e){return e||(e=new te),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function fA(t,e,r,i,s,o){let n=t-r,a=e-i,l=s-r,c=o-i,u=n*l+a*c,h=l*l+c*c,d=-1;h!==0&&(d=u/h);let f,p;d<0?(f=r,p=i):d>1?(f=s,p=o):(f=r+d*l,p=i+d*c);let m=t-f,x=e-p;return m*m+x*x}var pA=T(()=>{"use strict"});var lD,cD,Fn,mA=T(()=>{pA();vt();Fn=class t{constructor(...e){this.type="polygon";let r=Array.isArray(e[0])?e[0]:e;if(typeof r[0]!="number"){let i=[];for(let s=0,o=r.length;s<o;s++)i.push(r[s].x,r[s].y);r=i}this.points=r,this.closePath=!0}isClockwise(){let e=0,r=this.points,i=r.length;for(let s=0;s<i;s+=2){let o=r[s],n=r[s+1],a=r[(s+2)%i],l=r[(s+3)%i];e+=(a-o)*(l+n)}return e<0}containsPolygon(e){let r=this.getBounds(lD),i=e.getBounds(cD);if(!r.containsRect(i))return!1;let s=e.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 e=this.points.slice(),r=new t(e);return r.closePath=this.closePath,r}contains(e,r){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],u=this.points[n*2+1];l>r!=u>r&&e<(c-a)*((r-l)/(u-l))+a&&(i=!i)}return i}strokeContains(e,r,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 u=0;u<c;u+=2){let h=l[u],d=l[u+1],f=l[(u+2)%l.length],p=l[(u+3)%l.length],m=fA(e,r,h,d,f,p),x=Math.sign((f-h)*(r-d)-(p-d)*(e-h));if(m<=(x<0?a:n))return!0}return!1}getBounds(e){e||(e=new te);let r=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=r.length;a<l;a+=2){let c=r[a],u=r[a+1];i=c<i?c:i,s=c>s?c:s,o=u<o?u:o,n=u>n?u:n}return e.x=i,e.width=s-i,e.y=o,e.height=n-o,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,r)=>`${e}, ${r}`,"")}]`}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 kd,Ud,gA=T(()=>{vt();kd=(t,e,r,i,s,o,n)=>{let a=t-r,l=e-i,c=Math.sqrt(a*a+l*l);return c>=s-o&&c<=s+n},Ud=class t{constructor(e=0,r=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=e,this.y=r,this.width=i,this.height=s,this.radius=o}getBounds(e){return e||(e=new te),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new t(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,r){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&r>=this.y&&r<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(r>=this.y+i&&r<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=r-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=e-(this.x+this.width-i),s*s+o*o<=n)||(o=r-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(e,r,i,s=.5){let{x:o,y:n,width:a,height:l,radius:c}=this,u=i*(1-s),h=i-u,d=o+c,f=n+c,p=a-c*2,m=l-c*2,x=o+a,v=n+l;return(e>=o-u&&e<=o+h||e>=x-h&&e<=x+u)&&r>=f&&r<=f+m||(r>=n-u&&r<=n+h||r>=v-h&&r<=v+u)&&e>=d&&e<=d+p?!0:e<d&&r<f&&kd(e,r,d,f,c,h,u)||e>x-c&&r<f&&kd(e,r,x-c,f,c,h,u)||e>x-c&&r>v-c&&kd(e,r,x-c,v-c,c,h,u)||e<d&&r>v-c&&kd(e,r,d,v-c,c,h,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Ld(t,e,r,i,s,o,n,a,l,c){let h=Math.min(.99,Math.max(0,c??Rn.defaultOptions.bezierSmoothness)),d=(hD-h)/1;return d*=d,dD(e,r,i,s,o,n,a,l,t,d),t}function dD(t,e,r,i,s,o,n,a,l,c){zx(t,e,r,i,s,o,n,a,l,c,0),l.push(n,a)}function zx(t,e,r,i,s,o,n,a,l,c,u){if(u>uD)return;let h=Math.PI,d=(t+r)/2,f=(e+i)/2,p=(r+s)/2,m=(i+o)/2,x=(s+n)/2,v=(o+a)/2,y=(d+p)/2,g=(f+m)/2,b=(p+x)/2,_=(m+v)/2,S=(y+b)/2,E=(g+_)/2;if(u>0){let P=n-t,C=a-e,M=Math.abs((r-n)*C-(i-a)*P),R=Math.abs((s-n)*C-(o-a)*P),F,U;if(M>Od&&R>Od){if((M+R)*(M+R)<=c*(P*P+C*C)){if(kn<$x){l.push(S,E);return}let W=Math.atan2(o-i,s-r);if(F=Math.abs(W-Math.atan2(i-e,r-t)),U=Math.abs(Math.atan2(a-o,n-s)-W),F>=h&&(F=2*h-F),U>=h&&(U=2*h-U),F+U<kn){l.push(S,E);return}if(fo!==0){if(F>fo){l.push(r,i);return}if(U>fo){l.push(s,o);return}}}}else if(M>Od){if(M*M<=c*(P*P+C*C)){if(kn<$x){l.push(S,E);return}if(F=Math.abs(Math.atan2(o-i,s-r)-Math.atan2(i-e,r-t)),F>=h&&(F=2*h-F),F<kn){l.push(r,i),l.push(s,o);return}if(fo!==0&&F>fo){l.push(r,i);return}}}else if(R>Od){if(R*R<=c*(P*P+C*C)){if(kn<$x){l.push(S,E);return}if(F=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-r)),F>=h&&(F=2*h-F),F<kn){l.push(r,i),l.push(s,o);return}if(fo!==0&&F>fo){l.push(s,o);return}}}else if(P=S-(t+n)/2,C=E-(e+a)/2,P*P+C*C<=c){l.push(S,E);return}}zx(t,e,d,f,y,g,S,E,l,c,u+1),zx(S,E,b,_,x,v,n,a,l,c,u+1)}var uD,Od,hD,$x,kn,fo,Xx=T(()=>{Ed();uD=8,Od=11920929e-14,hD=1,$x=.01,kn=0,fo=0});function yA(t,e,r,i,s,o,n,a){let c=Math.min(.99,Math.max(0,a??Rn.defaultOptions.bezierSmoothness)),u=(mD-c)/1;return u*=u,xD(e,r,i,s,o,n,t,u),t}function xD(t,e,r,i,s,o,n,a){Yx(n,t,e,r,i,s,o,a,0),n.push(s,o)}function Yx(t,e,r,i,s,o,n,a,l){if(l>fD)return;let c=Math.PI,u=(e+i)/2,h=(r+s)/2,d=(i+o)/2,f=(s+n)/2,p=(u+d)/2,m=(h+f)/2,x=o-e,v=n-r,y=Math.abs((i-o)*v-(s-n)*x);if(y>pD){if(y*y<=a*(x*x+v*v)){if(xA<gD){t.push(p,m);return}let g=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-r,i-e));if(g>=c&&(g=2*c-g),g<xA){t.push(p,m);return}}}else if(x=p-(e+o)/2,v=m-(r+n)/2,x*x+v*v<=a){t.push(p,m);return}Yx(t,e,r,u,h,p,m,a,l+1),Yx(t,p,m,d,f,o,n,a,l+1)}var fD,pD,mD,gD,xA,_A=T(()=>{Ed();fD=8,pD=11920929e-14,mD=1,gD=.01,xA=0});function Gd(t,e,r,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,u=s;c*=n?-1:1;for(let h=0;h<a+1;h++){let d=Math.cos(u),f=Math.sin(u),p=e+d*i,m=r+f*i;t.push(p,m),u+=c}}var jx=T(()=>{"use strict"});function bA(t,e,r,i,s,o){let n=t[t.length-2],l=t[t.length-1]-r,c=n-e,u=s-r,h=i-e,d=Math.abs(l*h-c*u);if(d<1e-8||o===0){(t[t.length-2]!==e||t[t.length-1]!==r)&&t.push(e,r);return}let f=l*l+c*c,p=u*u+h*h,m=l*u+c*h,x=o*Math.sqrt(f)/d,v=o*Math.sqrt(p)/d,y=x*m/f,g=v*m/p,b=x*h+v*c,_=x*u+v*l,S=c*(v+y),E=l*(v+y),P=h*(x+g),C=u*(x+g),M=Math.atan2(E-_,S-b),R=Math.atan2(C-_,P-b);Gd(t,b+e,_+r,o,M,R,c*u>h*l)}var vA=T(()=>{jx()});function yD(t,e){let r=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=e===1.5707963267948966?.551915024494:r,s=Math.cos(t),o=Math.sin(t),n=Math.cos(t+e),a=Math.sin(t+e);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function SA(t,e,r,i,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let u=Math.sin(a*Ql/360),h=Math.cos(a*Ql/360),d=h*(e-i)/2+u*(r-s)/2,f=-u*(e-i)/2+h*(r-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)),_D(e,r,i,s,o,n,l,c,u,h,d,f,qx);let{ang1:m,ang2:x}=qx,{centerX:v,centerY:y}=qx,g=Math.abs(x)/(Ql/4);Math.abs(1-g)<1e-7&&(g=1);let b=Math.max(Math.ceil(g),1);x/=b;let _=t[t.length-2],S=t[t.length-1],E={x:0,y:0};for(let P=0;P<b;P++){let C=yD(m,x),{x:M,y:R}=Kx(C[0],o,n,h,u,v,y,E),{x:F,y:U}=Kx(C[1],o,n,h,u,v,y,E),{x:W,y:N}=Kx(C[2],o,n,h,u,v,y,E);Ld(t,_,S,M,R,F,U,W,N),_=W,S=N,m+=x}}var Ql,qx,Kx,TA,_D,wA=T(()=>{Xx();Ql=Math.PI*2,qx={centerX:0,centerY:0,ang1:0,ang2:0},Kx=({x:t,y:e},r,i,s,o,n,a,l)=>{t*=r,e*=i;let c=s*t-o*e,u=o*t+s*e;return l.x=c+n,l.y=u+a,l};TA=(t,e,r,i)=>{let s=t*i-e*r<0?-1:1,o=t*r+e*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},_D=(t,e,r,i,s,o,n,a,l,c,u,h,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(u,2),x=Math.pow(h,2),v=f*p-f*x-p*m;v<0&&(v=0),v/=f*x+p*m,v=Math.sqrt(v)*(n===a?-1:1);let y=v*s/o*h,g=v*-o/s*u,b=c*y-l*g+(t+r)/2,_=l*y+c*g+(e+i)/2,S=(u-y)/s,E=(h-g)/o,P=(-u-y)/s,C=(-h-g)/o,M=TA(1,0,S,E),R=TA(S,E,P,C);a===0&&R>0&&(R-=Ql),a===1&&R<0&&(R+=Ql),d.centerX=b,d.centerY=_,d.ang1=M,d.ang2=R}});function EA(t,e,r){let i=(n,a)=>{let l=a.x-n.x,c=a.y-n.y,u=Math.sqrt(l*l+c*c),h=l/u,d=c/u;return{len:u,nx:h,ny:d}},s=(n,a)=>{n===0?t.moveTo(a.x,a.y):t.lineTo(a.x,a.y)},o=e[e.length-1];for(let n=0;n<e.length;n++){let a=e[n%e.length],l=a.radius??r;if(l<=0){s(n,a),o=a;continue}let c=e[(n+1)%e.length],u=i(a,o),h=i(a,c);if(u.len<1e-4||h.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(u.nx*h.ny-u.ny*h.nx),f=1,p=!1;u.nx*h.nx-u.ny*-h.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,v=Math.abs(Math.cos(m)*l/Math.sin(m));v>Math.min(u.len/2,h.len/2)?(v=Math.min(u.len/2,h.len/2),x=Math.abs(v*Math.sin(m)/Math.cos(m))):x=l;let y=a.x+h.nx*v+-h.ny*x*f,g=a.y+h.ny*v+h.nx*x*f,b=Math.atan2(u.ny,u.nx)+Math.PI/2*f,_=Math.atan2(h.ny,h.nx)-Math.PI/2*f;n===0&&t.moveTo(y+Math.cos(b)*x,g+Math.sin(b)*x),t.arc(y,g,x,b,_,p),o=a}}function AA(t,e,r,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=e.length;for(let a=0;a<n;a++){let l=e[(a+1)%n],c=l.radius??r;if(c<=0){a===0?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y);continue}let u=e[a],h=e[(a+2)%n],d=s(u,l),f;if(d<1e-4)f=l;else{let x=Math.min(d/2,c);f=o(l,u,x/d)}let p=s(h,l),m;if(p<1e-4)m=l;else{let x=Math.min(p/2,c);m=o(l,h,x/p)}a===0?t.moveTo(f.x,f.y):t.lineTo(f.x,f.y),t.quadraticCurveTo(l.x,l.y,m.x,m.y,i)}}var PA=T(()=>{"use strict"});var bD,Dd,CA=T(()=>{hA();dA();mA();vt();gA();ar();Xx();_A();jx();vA();wA();PA();bD=new te,Dd=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new De,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,r){return this.startPoly(e,r),this}lineTo(e,r){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==e||o!==r)&&i.push(e,r),this}arc(e,r,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Gd(a,e,r,i,s,o,n),this}arcTo(e,r,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return bA(n,e,r,i,s,o),this}arcToSvg(e,r,i,s,o,n,a){let l=this._currentPoly.points;return SA(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,e,r,i,s,o),this}bezierCurveTo(e,r,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return Ld(this._currentPoly.points,l.lastX,l.lastY,e,r,i,s,o,n,a),this}quadraticCurveTo(e,r,i,s,o){this._ensurePoly();let n=this._currentPoly;return yA(this._currentPoly.points,n.lastX,n.lastY,e,r,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(e,r){this.endPoly(),r&&!r.isIdentity()&&(e=e.clone(!0),e.transform(r));let i=this.shapePrimitives,s=i.length;for(let o=0;o<e.instructions.length;o++){let n=e.instructions[o];this[n.action](...n.data)}if(e.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(e=!1){this.endPoly(e)}rect(e,r,i,s,o){return this.drawShape(new te(e,r,i,s),o),this}circle(e,r,i,s){return this.drawShape(new Bd(e,r,i),s),this}poly(e,r,i){let s=new Fn(e);return s.closePath=r,this.drawShape(s,i),this}regularPoly(e,r,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 u=0;u<s;u++){let h=a-u*l;c.push(e+i*Math.cos(h),r+i*Math.sin(h))}return this.poly(c,!0,n),this}roundPoly(e,r,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(e,r,i,s,n);let l=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let c=-1*Math.PI/2+n,u=Math.PI*2/s,h=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*u+c,p=e+i*Math.cos(f),m=r+i*Math.sin(f),x=f+Math.PI+h,v=f-Math.PI-h,y=p+o*Math.cos(x),g=m+o*Math.sin(x),b=p+o*Math.cos(v),_=m+o*Math.sin(v);d===0?this.moveTo(y,g):this.lineTo(y,g),this.quadraticCurveTo(p,m,b,_,a)}return this.closePath()}roundShape(e,r,i=!1,s){return e.length<3?this:(i?AA(this,e,r,s):EA(this,e,r),this.closePath())}filletRect(e,r,i,s,o){if(o===0)return this.rect(e,r,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=e+i,c=r+s,u=a<0?-a:0,h=Math.abs(a);return this.moveTo(e,r+h).arcTo(e+u,r+u,e+h,r,h).lineTo(l-h,r).arcTo(l-u,r+u,l,r+h,h).lineTo(l,c-h).arcTo(l-u,c-u,e+i-h,c,h).lineTo(e+h,c).arcTo(e+u,c-u,e,c-h,h).closePath()}chamferRect(e,r,i,s,o,n){if(o<=0)return this.rect(e,r,i,s);let a=Math.min(o,Math.min(i,s)/2),l=e+i,c=r+s,u=[e+a,r,l-a,r,l,r+a,l,c-a,l-a,c,e+a,c,e,c-a,e,r+a];for(let h=u.length-1;h>=2;h-=2)u[h]===u[h-2]&&u[h-1]===u[h-3]&&u.splice(h-1,2);return this.poly(u,!0,n)}ellipse(e,r,i,s,o){return this.drawShape(new Fd(e,r,i,s),o),this}roundRect(e,r,i,s,o,n){return this.drawShape(new Ud(e,r,i,s,o),n),this}drawShape(e,r){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:r}),this}startPoly(e,r){let i=this._currentPoly;return i&&this.endPoly(),i=new Fn,i.points.push(e,r),this._currentPoly=i,this}endPoly(e=!1){let r=this._currentPoly;return r&&r.points.length>2&&(r.closePath=e,this.shapePrimitives.push({shape:r})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new Fn,e)){let r=this.shapePrimitives[this.shapePrimitives.length-1];if(r){let i=r.shape.x,s=r.shape.y;if(r.transform&&!r.transform.isIdentity()){let o=r.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 e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let r=0;r<e.instructions.length;r++){let i=e.instructions[r];this[i.action](...i.data)}this.finish()}get bounds(){let e=this._bounds;e.clear();let r=this.shapePrimitives;for(let i=0;i<r.length;i++){let s=r[i],o=s.shape.getBounds(bD);s.transform?e.addRect(o,s.transform):e.addRect(o)}return e}}});function Jl(t,e){return t?t.prepend(e):e.clone()}var bs,Zx=T(()=>{gr();kt();Ne();uA();CA();bs=class t{constructor(e,r=!1){this.instructions=[],this.uid=Te("graphicsPath"),this._dirty=!0,this.checkForHoles=r,typeof e=="string"?cA(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Dd(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,r){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,r]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,r,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(ve.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 u=a.x,h=a.y;l=u+(u-l),c=h+(h-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,e,r,i,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,r,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(ve.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,e,r,i]}),this._dirty=!0,this}rect(e,r,i,s,o){return this.instructions.push({action:"rect",data:[e,r,i,s,o]}),this._dirty=!0,this}circle(e,r,i,s){return this.instructions.push({action:"circle",data:[e,r,i,s]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,r,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,c=i*2,u=Math.PI*2/c,h=[];for(let d=0;d<c;d++){let f=d%2?o:s,p=d*u+l;h.push(e+f*Math.cos(p),r+f*Math.sin(p))}return this.poly(h,!0,a),this}clone(e=!1){let r=new t;if(r.checkForHoles=this.checkForHoles,!e)r.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];r.instructions.push({action:s.action,data:s.data.slice()})}return r}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;let r=e.a,i=e.b,s=e.c,o=e.d,n=e.tx,a=e.ty,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0;for(let x=0;x<this.instructions.length;x++){let v=this.instructions[x],y=v.data;switch(v.action){case"moveTo":case"lineTo":l=y[0],c=y[1],y[0]=r*l+s*c+n,y[1]=i*l+o*c+a;break;case"bezierCurveTo":u=y[0],h=y[1],d=y[2],f=y[3],l=y[4],c=y[5],y[0]=r*u+s*h+n,y[1]=i*u+o*h+a,y[2]=r*d+s*f+n,y[3]=i*d+o*f+a,y[4]=r*l+s*c+n,y[5]=i*l+o*c+a;break;case"quadraticCurveTo":u=y[0],h=y[1],l=y[2],c=y[3],y[0]=r*u+s*h+n,y[1]=i*u+o*h+a,y[2]=r*l+s*c+n,y[3]=i*l+o*c+a;break;case"arcToSvg":l=y[5],c=y[6],p=y[0],m=y[1],y[0]=r*p+s*m,y[1]=i*p+o*m,y[5]=r*l+s*c+n,y[6]=i*l+o*c+a;break;case"circle":y[4]=Jl(y[3],e);break;case"rect":y[4]=Jl(y[4],e);break;case"ellipse":y[8]=Jl(y[8],e);break;case"roundRect":y[5]=Jl(y[5],e);break;case"addPath":y[0].transform(e);break;case"poly":y[2]=Jl(y[2],e);break;default:Z("unknown transform action",v.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let r=this.instructions.length-1,i=this.instructions[r];if(!i)return e.x=0,e.y=0,e;for(;i.action==="closePath";){if(r--,r<0)return e.x=0,e.y=0,e;i=this.instructions[r]}switch(i.action){case"moveTo":case"lineTo":e.x=i.data[0],e.y=i.data[1];break;case"quadraticCurveTo":e.x=i.data[2],e.y=i.data[3];break;case"bezierCurveTo":e.x=i.data[4],e.y=i.data[5];break;case"arc":case"arcToSvg":e.x=i.data[5],e.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(e);break}return e}}});function it(t,e,r){let i=t.getAttribute(e);return i?Number(i):r}var Qx=T(()=>{"use strict"});function RA(t,e){let r=t.querySelectorAll("defs");for(let i=0;i<r.length;i++){let s=r[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":e.defs[n.id]=vD(n);break;case"radialgradient":e.defs[n.id]=TD(n);break;default:break}}}}function vD(t){let e=it(t,"x1",0),r=it(t,"y1",0),i=it(t,"x2",1),s=it(t,"y2",0),o=t.getAttribute("gradientUnits")||"objectBoundingBox",n=new wt(e,r,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<t.children.length;a++){let l=t.children[a],c=it(l,"offset",0),u=me.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(c,u)}return n}function TD(t){return Z("[SVG Parser] Radial gradients are not yet supported"),new wt(0,0,1,0)}var MA=T(()=>{Bt();Ne();ho();Qx()});function Jx(t){let e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var IA=T(()=>{"use strict"});function ey(t,e){let r=t.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in BA){let a=t.getAttribute(n);a&&FA(e,o,n,a.trim())}if(r){let n=r.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[c,u]=l.split(":");BA[c]&&FA(e,o,c,u.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function FA(t,e,r,i){switch(r){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=Jx(i);e.strokeStyle.fill=t.defs[s]}else e.strokeStyle.color=me.shared.setValue(i).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=Jx(i);e.fillStyle.fill=t.defs[s]}else e.fillStyle.color=me.shared.setValue(i).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(i);break;case"stroke-opacity":e.strokeStyle.alpha=Number(i);break;case"opacity":e.fillStyle.alpha=Number(i),e.strokeStyle.alpha=Number(i);break}}var BA,kA=T(()=>{Bt();IA();BA={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 UA(t,e){if(typeof t=="string"){let n=document.createElement("div");n.innerHTML=t.trim(),t=n.querySelector("svg")}let r={context:e,defs:{},path:new bs};RA(t,r);let i=t.children,{fillStyle:s,strokeStyle:o}=ey(t,r);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&OA(a,r,s,o)}return e}function OA(t,e,r,i){let s=t.children,{fillStyle:o,strokeStyle:n}=ey(t,e);o&&r?r={...r,...o}:o&&(r=o),n&&i?i={...i,...n}:n&&(i=n);let a=!r&&!i;a&&(r={color:0});let l,c,u,h,d,f,p,m,x,v,y,g,b,_,S,E,P;switch(t.nodeName.toLowerCase()){case"path":_=t.getAttribute("d"),t.getAttribute("fill-rule")==="evenodd"&&Z("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new bs(_,!0),e.context.path(S),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"circle":p=it(t,"cx",0),m=it(t,"cy",0),x=it(t,"r",0),e.context.ellipse(p,m,x,x),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"rect":l=it(t,"x",0),c=it(t,"y",0),E=it(t,"width",0),P=it(t,"height",0),v=it(t,"rx",0),y=it(t,"ry",0),v||y?e.context.roundRect(l,c,E,P,v||y):e.context.rect(l,c,E,P),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"ellipse":p=it(t,"cx",0),m=it(t,"cy",0),v=it(t,"rx",0),y=it(t,"ry",0),e.context.beginPath(),e.context.ellipse(p,m,v,y),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"line":u=it(t,"x1",0),h=it(t,"y1",0),d=it(t,"x2",0),f=it(t,"y2",0),e.context.beginPath(),e.context.moveTo(u,h),e.context.lineTo(d,f),i&&e.context.stroke(i);break;case"polygon":b=t.getAttribute("points"),g=b.match(/\d+/g).map(C=>parseInt(C,10)),e.context.poly(g,!0),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"polyline":b=t.getAttribute("points"),g=b.match(/\d+/g).map(C=>parseInt(C,10)),e.context.poly(g,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{Z(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}a&&(r=null);for(let C=0;C<s.length;C++)OA(s[C],e,r,i)}var LA=T(()=>{Ne();Zx();MA();Qx();kA()});function SD(t){return me.isColorLike(t)}function GA(t){return t instanceof Wi}function DA(t){return t instanceof wt}function wD(t){return t instanceof B}function ED(t,e,r){let i=me.shared.setValue(e??0);return t.color=i.toNumber(),t.alpha=i.alpha===1?r.alpha:i.alpha,t.texture=B.WHITE,{...r,...t}}function AD(t,e,r){return t.texture=e,{...r,...t}}function NA(t,e,r){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...r,...t}}function VA(t,e,r){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...r,...t}}function PD(t,e){let r={...e,...t},i=me.shared.setValue(r.color);return r.alpha*=i.alpha,r.color=i.toNumber(),r}function $i(t,e){if(t==null)return null;let r={},i=t;return SD(t)?ED(r,t,e):wD(t)?AD(r,t,e):GA(t)?NA(r,t,e):DA(t)?VA(r,t,e):i.fill&&GA(i.fill)?NA(i,i.fill,e):i.fill&&DA(i.fill)?VA(i,i.fill,e):PD(i,e)}function Un(t,e){let{width:r,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=e,c=$i(t,l);return c?{width:r,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var ty=T(()=>{Bt();Fe();ho();Id()});var CD,HA,ry,ir,Nd=T(()=>{Vt();Bt();Ae();gr();Fe();kt();tt();ar();Zx();LA();ty();CD=new ve,HA=new V,ry=class Ti extends We{constructor(){super(...arguments),this.uid=Te("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new bs,this._transform=new V,this._fillStyle={...Ti.defaultFillStyle},this._strokeStyle={...Ti.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new De,this._boundsDirty=!0}clone(){let e=new Ti;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=$i(e,Ti.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Un(e,Ti.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=$i(e,Ti.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=$i(e,Ti.defaultStrokeStyle),this}texture(e,r,i,s,o,n){return this.instructions.push({action:"texture",data:{image:e,dx:i||0,dy:s||0,dw:o||e.frame.width,dh:n||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:r?me.shared.setValue(r).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new bs,this}fill(e,r){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?(e!=null&&(r!==void 0&&typeof e=="number"&&(J(ue,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:r}),this._fillStyle=$i(e,Ti.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:r}=this._activePath.getLastPoint(ve.shared);this._activePath.clear(),this._activePath.moveTo(e,r)}stroke(e){let r,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?r=i.data.path:r=this._activePath.clone(),r?(e!=null&&(this._strokeStyle=Un(e,Ti.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let r=this.instructions[this.instructions.length-1-e],i=this._activePath.clone();if(r&&(r.action==="stroke"||r.action==="fill"))if(r.data.hole)r.data.hole.addPath(i);else{r.data.hole=i;break}}return this._initNextPathLocation(),this}arc(e,r,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*e+a.c*r+a.tx,a.b*e+a.d*r+a.ty,i,s,o,n),this}arcTo(e,r,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*e+n.c*r+n.tx,n.b*e+n.d*r+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(e,r,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,r,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(e,r,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*r+l.tx,l.b*e+l.d*r+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(e,r,i,s){return this._tick++,this._activePath.ellipse(e,r,i,s,this._transform.clone()),this}circle(e,r,i){return this._tick++,this._activePath.circle(e,r,i,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,r){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*e+i.c*r+i.tx,i.b*e+i.d*r+i.ty),this}moveTo(e,r){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*e+i.c*r+i.tx,n=i.b*e+i.d*r+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(e,r,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*e+n.c*r+n.tx,n.b*e+n.d*r+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(e,r,i,s){return this._tick++,this._activePath.rect(e,r,i,s,this._transform.clone()),this}roundRect(e,r,i,s,o){return this._tick++,this._activePath.roundRect(e,r,i,s,o,this._transform.clone()),this}poly(e,r){return this._tick++,this._activePath.poly(e,r,this._transform.clone()),this}regularPoly(e,r,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(e,r,i,s,o,n),this}roundPoly(e,r,i,s,o,n){return this._tick++,this._activePath.roundPoly(e,r,i,s,o,n),this}roundShape(e,r,i,s){return this._tick++,this._activePath.roundShape(e,r,i,s),this}filletRect(e,r,i,s,o){return this._tick++,this._activePath.filletRect(e,r,i,s,o),this}chamferRect(e,r,i,s,o,n){return this._tick++,this._activePath.chamferRect(e,r,i,s,o,n),this}star(e,r,i,s,o=0,n=0){return this._tick++,this._activePath.star(e,r,i,s,o,n,this._transform.clone()),this}svg(e){return this._tick++,UA(e,this),this}restore(){let e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.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(e){return this._transform.rotate(e),this}scale(e,r=e){return this._transform.scale(e,r),this}setTransform(e,r,i,s,o,n){return e instanceof V?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,r,i,s,o,n),this)}transform(e,r,i,s,o,n){return e instanceof V?(this._transform.append(e),this):(HA.set(e,r,i,s,o,n),this._transform.append(HA),this)}translate(e,r=e){return this._transform.translate(e,r),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 e=this._bounds;e.clear();for(let r=0;r<this.instructions.length;r++){let i=this.instructions[r],s=i.action;if(s==="fill"){let o=i.data;e.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;e.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;e.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return e}containsPoint(e){if(!this.bounds.containsPoint(e.x,e.y))return!1;let r=this.instructions,i=!1;for(let s=0;s<r.length;s++){let o=r[s],n=o.data,a=n.path;if(!o.action||!a)continue;let l=n.style,c=a.shapePath.shapePrimitives;for(let u=0;u<c.length;u++){let h=c[u].shape;if(!l||!h)continue;let d=c[u].transform,f=d?d.applyInverse(e,CD):e;if(o.action==="fill")i=h.contains(f.x,f.y);else{let m=l;i=h.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(e=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.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}};ry.defaultFillStyle={color:16777215,alpha:1,texture:B.WHITE,matrix:null,fill:null,textureSpace:"local"};ry.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};ir=ry});function Vd(t){let e=[],r=0;for(let i=0;i<WA.length;i++){let s=`_${WA[i]}`;e[r++]=t[s]}return r=$A(t._fill,e,r),r=RD(t._stroke,e,r),r=MD(t.dropShadow,e,r),e.join("-")}function $A(t,e,r){return t&&(e[r++]=t.color,e[r++]=t.alpha,e[r++]=t.fill?.styleKey),r}function RD(t,e,r){return t&&(r=$A(t,e,r),e[r++]=t.width,e[r++]=t.alignment,e[r++]=t.cap,e[r++]=t.join,e[r++]=t.miterLimit),r}function MD(t,e,r){return t&&(e[r++]=t.alpha,e[r++]=t.angle,e[r++]=t.blur,e[r++]=t.distance,e[r++]=me.shared.setValue(t.color).toNumber()),r}var WA,iy=T(()=>{Bt();WA=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function ID(t){let e=t;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let r=Ge.defaultDropShadow;t.dropShadow={alpha:e.dropShadowAlpha??r.alpha,angle:e.dropShadowAngle??r.angle,blur:e.dropShadowBlur??r.blur,color:e.dropShadowColor??r.color,distance:e.dropShadowDistance??r.distance}}if(e.strokeThickness!==void 0){J(ue,"strokeThickness is now a part of stroke");let r=e.stroke,i={};if(me.isColorLike(r))i.color=r;else if(r instanceof wt||r instanceof Wi)i.fill=r;else if(Object.hasOwnProperty.call(r,"color")||Object.hasOwnProperty.call(r,"fill"))i=r;else throw new Error("Invalid stroke value.");t.stroke={...i,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){J(ue,"gradient fill is now a fill pattern: `new FillGradient(...)`");let r;t.fontSize==null?t.fontSize=Ge.defaultTextStyle.fontSize:typeof t.fontSize=="string"?r=parseInt(t.fontSize,10):r=t.fontSize;let i=new wt({start:{x:0,y:0},end:{x:0,y:(r||0)*1.7}}),s=e.fillGradientStops.map(o=>me.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),t.fill={fill:i}}}var sy,Ge,po=T(()=>{Vt();Bt();tt();ho();Id();Nd();ty();iy();sy=class On extends We{constructor(e={}){super(),ID(e);let r={...On.defaultTextStyle,...e};for(let i in r){let s=i;this[s]=r[i]}this.update()}get align(){return this._align}set align(e){this._align=e,this.update()}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords=e,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(e){e!==null&&typeof e=="object"?this._dropShadow=this._createProxy({...On.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...On.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily=e,this.update()}get fontSize(){return this._fontSize}set fontSize(e){typeof e=="string"?this._fontSize=parseInt(e,10):this._fontSize=e,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle=e.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant=e,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight=e,this.update()}get leading(){return this._leading}set leading(e){this._leading=e,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing=e,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight=e,this.update()}get padding(){return this._padding}set padding(e){this._padding=e,this.update()}get trim(){return this._trim}set trim(e){this._trim=e,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline=e,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace=e,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap=e,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth=e,this.update()}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...ir.defaultFillStyle,...e},()=>{this._fill=$i({...this._originalFill},ir.defaultFillStyle)})),this._fill=$i(e===0?"black":e,ir.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...ir.defaultStrokeStyle,...e},()=>{this._stroke=Un({...this._originalStroke},ir.defaultStrokeStyle)})),this._stroke=Un(e,ir.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Vd(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=On.defaultTextStyle;for(let r in e)this[r]=e[r]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new On({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(e=!1){if(this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.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(e,r){return new Proxy(e,{set:(i,s,o)=>(i[s]=o,r?.(s,o),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(me.isColorLike(e)||e instanceof wt||e instanceof Wi)}};sy.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};sy.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};Ge=sy});function Hd(t,e,r,i){let s=BD;s.minX=0,s.minY=0,s.maxX=t.width/i|0,s.maxY=t.height/i|0;let o=Ve.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=t,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=e/i,o.frame.height=r/i,o.source.emit("update",o.source),o.updateUvs(),o}var BD,oy=T(()=>{ui();ar();BD=new De});function mo(t){let e=typeof t.fontSize=="number"?`${t.fontSize}px`:t.fontSize,r=t.fontFamily;Array.isArray(t.fontFamily)||(r=t.fontFamily.split(","));for(let i=r.length-1;i>=0;i--){let s=r[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!FD.includes(s)&&(s=`"${s}"`),r[i]=s}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${r.join(",")}`}var FD,Wd=T(()=>{"use strict";FD=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var ny,Zr,Ye,ec=T(()=>{ze();Wd();ny={willReadFrequently:!0},Zr=class se{static get experimentalLetterSpacingSupported(){let e=se._experimentalLetterSpacingSupported;if(e!==void 0){let r=re.get().getCanvasRenderingContext2D().prototype;e=se._experimentalLetterSpacingSupported="letterSpacing"in r||"textLetterSpacing"in r}return e}constructor(e,r,i,s,o,n,a,l,c){this.text=e,this.style=r,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=c}static measureText(e=" ",r,i=se._canvas,s=r.wordWrap){let o=`${e}:${r.styleKey}`;if(se._measurementCache[o])return se._measurementCache[o];let n=mo(r),a=se.measureFont(n);a.fontSize===0&&(a.fontSize=r.fontSize,a.ascent=r.fontSize);let l=se.__context;l.font=n;let u=(s?se._wordWrap(e,r,i):e).split(/(?:\r\n|\r|\n)/),h=new Array(u.length),d=0;for(let y=0;y<u.length;y++){let g=se._measureText(u[y],r.letterSpacing,l);h[y]=g,d=Math.max(d,g)}let f=r._stroke?.width||0,p=d+f;r.dropShadow&&(p+=r.dropShadow.distance);let m=r.lineHeight||a.fontSize,x=Math.max(m,a.fontSize+f)+(u.length-1)*(m+r.leading);return r.dropShadow&&(x+=r.dropShadow.distance),new se(e,r,p,x,u,h,m+r.leading,d,a)}static _measureText(e,r,i){let s=!1;se.experimentalLetterSpacingSupported&&(se.experimentalLetterSpacing?(i.letterSpacing=`${r}px`,i.textLetterSpacing=`${r}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(e),n=o.width,a=-o.actualBoundingBoxLeft,c=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=r,c-=r;else{let u=(se.graphemeSegmenter(e).length-1)*r;n+=u,c+=u}return Math.max(n,c)}static _wordWrap(e,r,i=se._canvas){let s=i.getContext("2d",ny),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:u}=r,h=se._collapseSpaces(u),d=se._collapseNewlines(u),f=!h,p=r.wordWrapWidth+c,m=se._tokenize(e);for(let x=0;x<m.length;x++){let v=m[x];if(se._isNewline(v)){if(!d){a+=se._addLine(n),f=!h,n="",o=0;continue}v=" "}if(h){let g=se.isBreakingSpace(v),b=se.isBreakingSpace(n[n.length-1]);if(g&&b)continue}let y=se._getFromCache(v,c,l,s);if(y>p)if(n!==""&&(a+=se._addLine(n),n="",o=0),se.canBreakWords(v,r.breakWords)){let g=se.wordWrapSplit(v);for(let b=0;b<g.length;b++){let _=g[b],S=_,E=1;for(;g[b+E];){let C=g[b+E];if(!se.canBreakChars(S,C,v,b,r.breakWords))_+=C;else break;S=C,E++}b+=E-1;let P=se._getFromCache(_,c,l,s);P+o>p&&(a+=se._addLine(n),f=!1,n="",o=0),n+=_,o+=P}}else{n.length>0&&(a+=se._addLine(n),n="",o=0);let g=x===m.length-1;a+=se._addLine(v,!g),f=!1,n="",o=0}else y+o>p&&(f=!1,a+=se._addLine(n),n="",o=0),(n.length>0||!se.isBreakingSpace(v)||f)&&(n+=v,o+=y)}return a+=se._addLine(n,!1),a}static _addLine(e,r=!0){return e=se._trimRight(e),e=r?`${e}
|
|
367
|
+
}`});var Rd,KE=T(()=>{Bt();Ae();ms();ao();qr();Fe();mg();XE();jE();qE();Rd=class extends ct{constructor(){let e=cr.from({vertex:YE,fragment:zE}),r=hr.from({fragment:{source:Gx,entryPoint:"mainFragment"},vertex:{source:Gx,entryPoint:"mainVertex"}});super({glProgram:e,gpuProgram:r,resources:{uTexture:B.WHITE.source,uSampler:new $h({}),uniforms:{uTranslationMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new me(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var In,Dx=T(()=>{Ae();Wt();Ol();Kr();Mn();$E();KE();In=class{constructor(e,r){this.state=ht.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Ce({uTranslationMatrix:{value:new V,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=e,this.adaptor=r,this.defaultShader=new Rd,this.state=ht.for2d()}validateRenderable(e){return!1}addRenderable(e,r){this.renderer.renderPipes.batch.break(r),r.add(e)}getBuffers(e){return this._gpuBufferHash[e.uid]||this._initBuffer(e)}_initBuffer(e){return this._gpuBufferHash[e.uid]=new Cd({size:e.particleChildren.length,properties:e._properties}),e.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[e.uid]}updateRenderable(e){}destroyRenderable(e){this._gpuBufferHash[e.uid].destroy(),this._gpuBufferHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}execute(e){let r=e.particleChildren;if(r.length===0)return;let i=this.renderer,s=this.getBuffers(e);e.texture||(e.texture=r[0].texture);let o=this.state;s.update(r,e._childrenDirty),e._childrenDirty=!1,o.blendMode=Ni(e.blendMode,e.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;e.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|e._roundPixels,bi(e.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,e)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Yl,ZE=T(()=>{O();DE();Dx();Yl=class extends In{constructor(e){super(e,new Pd)}};Yl.extension={type:[w.WebGLPipes],name:"particle"}});var Md,QE=T(()=>{"use strict";Md=class{execute(e,r){let i=e.renderer,s=r.shader||e.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(e.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(r.texture);let o=e.state,n=e.getBuffers(r);i.encoder.draw({geometry:n.geometry,shader:r.shader||e.defaultShader,state:o,size:r.particleChildren.length*6})}}});var jl,JE=T(()=>{O();QE();Dx();jl=class extends In{constructor(e){super(e,new Md)}};jl.extension={type:[w.WebGPUPipes],name:"particle"}});var Nx=T(()=>{O();ZE();JE();K.add(Yl);K.add(jl)});var vi,ql=T(()=>{"use strict";vi=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 Kl(t,e){let{texture:r,bounds:i}=t;rd(i,e._anchor,r);let s=e._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var Vx=T(()=>{Dg()});var Zl,eA=T(()=>{O();Zt();ql();Vx();Zl=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let e in this._gpuText){let r=this._gpuText[e];if(!r)continue;let i=r.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(e){let r=this._getGpuText(e),i=e._getKey();return r.currentKey!==i}addRenderable(e,r){let s=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(s,r)}updateRenderable(e){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),i._batcher.updateElement(i)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let r=this._gpuText[e];this._renderer.canvasText.decreaseReferenceCount(r.currentKey),fe.return(r.batchableSprite),this._gpuText[e]=null}_updateText(e){let r=e._getKey(),i=this._getGpuText(e),s=i.batchableSprite;i.currentKey!==r&&this._updateGpuText(e),e._didTextUpdate=!1,Kl(s,e)}_updateGpuText(e){let r=this._getGpuText(e),i=r.batchableSprite;r.texture&&this._renderer.canvasText.decreaseReferenceCount(r.currentKey),r.texture=i.texture=this._renderer.canvasText.getManagedTexture(e),r.currentKey=e._getKey(),i.texture=r.texture}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let r={texture:null,currentKey:"--",batchableSprite:fe.get(vi)};return r.batchableSprite.renderable=e,r.batchableSprite.transform=e.groupTransform,r.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},r.batchableSprite.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuText[e.uid]=r,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._updateText(e),e.on("destroyed",this._destroyRenderableBound),r}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}};Zl.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"text"}});var Hx,dr,Bn=T(()=>{ze();bl();Hx=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,r){let i=re.get().createCanvas();i.width=e,i.height=r;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(e,r,i=1){e=Math.ceil(e*i-1e-6),r=Math.ceil(r*i-1e-6),e=Li(e),r=Li(r);let s=(e<<17)+(r<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(e,r)),o}returnCanvasAndContext(e){let r=e.canvas,{width:i,height:s}=r,o=(i<<17)+(s<<1);e.context.clearRect(0,0,i,s),this._canvasPool[o].push(e)}clear(){this._canvasPool={}}},dr=new Hx});function tA(t,e,r){for(let i=0,s=4*r*e;i<e;++i,s+=4)if(t[s+3]!==0)return!1;return!0}function rA(t,e,r,i,s){let o=4*e;for(let n=i,a=i*o+4*r;n<=s;++n,a+=o)if(t[a+3]!==0)return!1;return!0}function iA(t,e=1){let{width:r,height:i}=t,s=t.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,r,i).data,a=0,l=0,c=r-1,u=i-1;for(;l<i&&tA(n,r,l);)++l;if(l===i)return te.EMPTY;for(;tA(n,r,u);)--u;for(;rA(n,r,a,l,u);)++a;for(;rA(n,r,c,l,u);)--c;return++c,++u,new te(a/e,l/e,(c-a)/e,(u-l)/e)}var sA=T(()=>{vt()});var oA,Wi,Id=T(()=>{Ae();kt();oA={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"}},Wi=class{constructor(e,r){this.uid=Te("fillPattern"),this.transform=new V,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),r&&(e.source.style.addressModeU=oA[r].addressModeU,e.source.style.addressModeV=oA[r].addressModeV)}setTransform(e){let r=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/r.frame.width,1/r.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 aA=ce((OJ,nA)=>{nA.exports=oD;var Wx={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},sD=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function oD(t){var e=[];return t.replace(sD,function(r,i,s){var o=i.toLowerCase();for(s=aD(s),o=="m"&&s.length>2&&(e.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==Wx[o])return s.unshift(i),e.push(s);if(s.length<Wx[o])throw new Error("malformed path data");e.push([i].concat(s.splice(0,Wx[o])))}}),e}var nD=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function aD(t){var e=t.match(nD);return e?e.map(Number):[]}});function cA(t,e){let r=(0,lA.default)(t),i=[],s=null,o=0,n=0;for(let a=0;a<r.length;a++){let l=r[a],c=l[0],u=l;switch(c){case"M":o=u[1],n=u[2],e.moveTo(o,n);break;case"m":o+=u[1],n+=u[2],e.moveTo(o,n);break;case"H":o=u[1],e.lineTo(o,n);break;case"h":o+=u[1],e.lineTo(o,n);break;case"V":n=u[1],e.lineTo(o,n);break;case"v":n+=u[1],e.lineTo(o,n);break;case"L":o=u[1],n=u[2],e.lineTo(o,n);break;case"l":o+=u[1],n+=u[2],e.lineTo(o,n);break;case"C":o=u[5],n=u[6],e.bezierCurveTo(u[1],u[2],u[3],u[4],o,n);break;case"c":e.bezierCurveTo(o+u[1],n+u[2],o+u[3],n+u[4],o+u[5],n+u[6]),o+=u[5],n+=u[6];break;case"S":o=u[3],n=u[4],e.bezierCurveToShort(u[1],u[2],o,n);break;case"s":e.bezierCurveToShort(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case"Q":o=u[3],n=u[4],e.quadraticCurveTo(u[1],u[2],o,n);break;case"q":e.quadraticCurveTo(o+u[1],n+u[2],o+u[3],n+u[4]),o+=u[3],n+=u[4];break;case"T":o=u[1],n=u[2],e.quadraticCurveToShort(o,n);break;case"t":o+=u[1],n+=u[2],e.quadraticCurveToShort(o,n);break;case"A":o=u[6],n=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case"a":o+=u[6],n+=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],o,n);break;case"Z":case"z":e.closePath(),i.length>0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:Z(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return e}var lA,uA=T(()=>{lA=Xs(aA(),1);Ne()});var Bd,hA=T(()=>{vt();Bd=class t{constructor(e=0,r=0,i=0){this.type="circle",this.x=e,this.y=r,this.radius=i}clone(){return new t(this.x,this.y,this.radius)}contains(e,r){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-r;return s*=s,o*=o,s+o<=i}strokeContains(e,r,i,s=.5){if(this.radius===0)return!1;let o=this.x-e,n=this.y-r,a=this.radius,l=(1-s)*i,c=Math.sqrt(o*o+n*n);return c<=a+l&&c>a-(i-l)}getBounds(e){return e||(e=new te),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var Fd,dA=T(()=>{vt();Fd=class t{constructor(e=0,r=0,i=0,s=0){this.type="ellipse",this.x=e,this.y=r,this.halfWidth=i,this.halfHeight=s}clone(){return new t(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,r){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(e-this.x)/this.halfWidth,s=(r-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(e,r,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,u=n-l,h=o+a,d=n+a,f=e-this.x,p=r-this.y,m=f*f/(c*c)+p*p/(u*u),x=f*f/(h*h)+p*p/(d*d);return m>1&&x<=1}getBounds(e){return e||(e=new te),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function fA(t,e,r,i,s,o){let n=t-r,a=e-i,l=s-r,c=o-i,u=n*l+a*c,h=l*l+c*c,d=-1;h!==0&&(d=u/h);let f,p;d<0?(f=r,p=i):d>1?(f=s,p=o):(f=r+d*l,p=i+d*c);let m=t-f,x=e-p;return m*m+x*x}var pA=T(()=>{"use strict"});var lD,cD,Fn,mA=T(()=>{pA();vt();Fn=class t{constructor(...e){this.type="polygon";let r=Array.isArray(e[0])?e[0]:e;if(typeof r[0]!="number"){let i=[];for(let s=0,o=r.length;s<o;s++)i.push(r[s].x,r[s].y);r=i}this.points=r,this.closePath=!0}isClockwise(){let e=0,r=this.points,i=r.length;for(let s=0;s<i;s+=2){let o=r[s],n=r[s+1],a=r[(s+2)%i],l=r[(s+3)%i];e+=(a-o)*(l+n)}return e<0}containsPolygon(e){let r=this.getBounds(lD),i=e.getBounds(cD);if(!r.containsRect(i))return!1;let s=e.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 e=this.points.slice(),r=new t(e);return r.closePath=this.closePath,r}contains(e,r){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],u=this.points[n*2+1];l>r!=u>r&&e<(c-a)*((r-l)/(u-l))+a&&(i=!i)}return i}strokeContains(e,r,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 u=0;u<c;u+=2){let h=l[u],d=l[u+1],f=l[(u+2)%l.length],p=l[(u+3)%l.length],m=fA(e,r,h,d,f,p),x=Math.sign((f-h)*(r-d)-(p-d)*(e-h));if(m<=(x<0?a:n))return!0}return!1}getBounds(e){e||(e=new te);let r=this.points,i=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,l=r.length;a<l;a+=2){let c=r[a],u=r[a+1];i=c<i?c:i,s=c>s?c:s,o=u<o?u:o,n=u>n?u:n}return e.x=i,e.width=s-i,e.y=o,e.height=n-o,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,r)=>`${e}, ${r}`,"")}]`}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 kd,Ud,gA=T(()=>{vt();kd=(t,e,r,i,s,o,n)=>{let a=t-r,l=e-i,c=Math.sqrt(a*a+l*l);return c>=s-o&&c<=s+n},Ud=class t{constructor(e=0,r=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=e,this.y=r,this.width=i,this.height=s,this.radius=o}getBounds(e){return e||(e=new te),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new t(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,r){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&r>=this.y&&r<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(r>=this.y+i&&r<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=r-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=e-(this.x+this.width-i),s*s+o*o<=n)||(o=r-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(e,r,i,s=.5){let{x:o,y:n,width:a,height:l,radius:c}=this,u=i*(1-s),h=i-u,d=o+c,f=n+c,p=a-c*2,m=l-c*2,x=o+a,v=n+l;return(e>=o-u&&e<=o+h||e>=x-h&&e<=x+u)&&r>=f&&r<=f+m||(r>=n-u&&r<=n+h||r>=v-h&&r<=v+u)&&e>=d&&e<=d+p?!0:e<d&&r<f&&kd(e,r,d,f,c,h,u)||e>x-c&&r<f&&kd(e,r,x-c,f,c,h,u)||e>x-c&&r>v-c&&kd(e,r,x-c,v-c,c,h,u)||e<d&&r>v-c&&kd(e,r,d,v-c,c,h,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Ld(t,e,r,i,s,o,n,a,l,c){let h=Math.min(.99,Math.max(0,c??Rn.defaultOptions.bezierSmoothness)),d=(hD-h)/1;return d*=d,dD(e,r,i,s,o,n,a,l,t,d),t}function dD(t,e,r,i,s,o,n,a,l,c){zx(t,e,r,i,s,o,n,a,l,c,0),l.push(n,a)}function zx(t,e,r,i,s,o,n,a,l,c,u){if(u>uD)return;let h=Math.PI,d=(t+r)/2,f=(e+i)/2,p=(r+s)/2,m=(i+o)/2,x=(s+n)/2,v=(o+a)/2,y=(d+p)/2,g=(f+m)/2,b=(p+x)/2,_=(m+v)/2,S=(y+b)/2,E=(g+_)/2;if(u>0){let P=n-t,C=a-e,M=Math.abs((r-n)*C-(i-a)*P),R=Math.abs((s-n)*C-(o-a)*P),F,U;if(M>Od&&R>Od){if((M+R)*(M+R)<=c*(P*P+C*C)){if(kn<$x){l.push(S,E);return}let W=Math.atan2(o-i,s-r);if(F=Math.abs(W-Math.atan2(i-e,r-t)),U=Math.abs(Math.atan2(a-o,n-s)-W),F>=h&&(F=2*h-F),U>=h&&(U=2*h-U),F+U<kn){l.push(S,E);return}if(fo!==0){if(F>fo){l.push(r,i);return}if(U>fo){l.push(s,o);return}}}}else if(M>Od){if(M*M<=c*(P*P+C*C)){if(kn<$x){l.push(S,E);return}if(F=Math.abs(Math.atan2(o-i,s-r)-Math.atan2(i-e,r-t)),F>=h&&(F=2*h-F),F<kn){l.push(r,i),l.push(s,o);return}if(fo!==0&&F>fo){l.push(r,i);return}}}else if(R>Od){if(R*R<=c*(P*P+C*C)){if(kn<$x){l.push(S,E);return}if(F=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-i,s-r)),F>=h&&(F=2*h-F),F<kn){l.push(r,i),l.push(s,o);return}if(fo!==0&&F>fo){l.push(s,o);return}}}else if(P=S-(t+n)/2,C=E-(e+a)/2,P*P+C*C<=c){l.push(S,E);return}}zx(t,e,d,f,y,g,S,E,l,c,u+1),zx(S,E,b,_,x,v,n,a,l,c,u+1)}var uD,Od,hD,$x,kn,fo,Xx=T(()=>{Ed();uD=8,Od=11920929e-14,hD=1,$x=.01,kn=0,fo=0});function yA(t,e,r,i,s,o,n,a){let c=Math.min(.99,Math.max(0,a??Rn.defaultOptions.bezierSmoothness)),u=(mD-c)/1;return u*=u,xD(e,r,i,s,o,n,t,u),t}function xD(t,e,r,i,s,o,n,a){Yx(n,t,e,r,i,s,o,a,0),n.push(s,o)}function Yx(t,e,r,i,s,o,n,a,l){if(l>fD)return;let c=Math.PI,u=(e+i)/2,h=(r+s)/2,d=(i+o)/2,f=(s+n)/2,p=(u+d)/2,m=(h+f)/2,x=o-e,v=n-r,y=Math.abs((i-o)*v-(s-n)*x);if(y>pD){if(y*y<=a*(x*x+v*v)){if(xA<gD){t.push(p,m);return}let g=Math.abs(Math.atan2(n-s,o-i)-Math.atan2(s-r,i-e));if(g>=c&&(g=2*c-g),g<xA){t.push(p,m);return}}}else if(x=p-(e+o)/2,v=m-(r+n)/2,x*x+v*v<=a){t.push(p,m);return}Yx(t,e,r,u,h,p,m,a,l+1),Yx(t,p,m,d,f,o,n,a,l+1)}var fD,pD,mD,gD,xA,_A=T(()=>{Ed();fD=8,pD=11920929e-14,mD=1,gD=.01,xA=0});function Gd(t,e,r,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,u=s;c*=n?-1:1;for(let h=0;h<a+1;h++){let d=Math.cos(u),f=Math.sin(u),p=e+d*i,m=r+f*i;t.push(p,m),u+=c}}var jx=T(()=>{"use strict"});function bA(t,e,r,i,s,o){let n=t[t.length-2],l=t[t.length-1]-r,c=n-e,u=s-r,h=i-e,d=Math.abs(l*h-c*u);if(d<1e-8||o===0){(t[t.length-2]!==e||t[t.length-1]!==r)&&t.push(e,r);return}let f=l*l+c*c,p=u*u+h*h,m=l*u+c*h,x=o*Math.sqrt(f)/d,v=o*Math.sqrt(p)/d,y=x*m/f,g=v*m/p,b=x*h+v*c,_=x*u+v*l,S=c*(v+y),E=l*(v+y),P=h*(x+g),C=u*(x+g),M=Math.atan2(E-_,S-b),R=Math.atan2(C-_,P-b);Gd(t,b+e,_+r,o,M,R,c*u>h*l)}var vA=T(()=>{jx()});function yD(t,e){let r=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=e===1.5707963267948966?.551915024494:r,s=Math.cos(t),o=Math.sin(t),n=Math.cos(t+e),a=Math.sin(t+e);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function SA(t,e,r,i,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let u=Math.sin(a*Ql/360),h=Math.cos(a*Ql/360),d=h*(e-i)/2+u*(r-s)/2,f=-u*(e-i)/2+h*(r-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)),_D(e,r,i,s,o,n,l,c,u,h,d,f,qx);let{ang1:m,ang2:x}=qx,{centerX:v,centerY:y}=qx,g=Math.abs(x)/(Ql/4);Math.abs(1-g)<1e-7&&(g=1);let b=Math.max(Math.ceil(g),1);x/=b;let _=t[t.length-2],S=t[t.length-1],E={x:0,y:0};for(let P=0;P<b;P++){let C=yD(m,x),{x:M,y:R}=Kx(C[0],o,n,h,u,v,y,E),{x:F,y:U}=Kx(C[1],o,n,h,u,v,y,E),{x:W,y:N}=Kx(C[2],o,n,h,u,v,y,E);Ld(t,_,S,M,R,F,U,W,N),_=W,S=N,m+=x}}var Ql,qx,Kx,TA,_D,wA=T(()=>{Xx();Ql=Math.PI*2,qx={centerX:0,centerY:0,ang1:0,ang2:0},Kx=({x:t,y:e},r,i,s,o,n,a,l)=>{t*=r,e*=i;let c=s*t-o*e,u=o*t+s*e;return l.x=c+n,l.y=u+a,l};TA=(t,e,r,i)=>{let s=t*i-e*r<0?-1:1,o=t*r+e*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},_D=(t,e,r,i,s,o,n,a,l,c,u,h,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(u,2),x=Math.pow(h,2),v=f*p-f*x-p*m;v<0&&(v=0),v/=f*x+p*m,v=Math.sqrt(v)*(n===a?-1:1);let y=v*s/o*h,g=v*-o/s*u,b=c*y-l*g+(t+r)/2,_=l*y+c*g+(e+i)/2,S=(u-y)/s,E=(h-g)/o,P=(-u-y)/s,C=(-h-g)/o,M=TA(1,0,S,E),R=TA(S,E,P,C);a===0&&R>0&&(R-=Ql),a===1&&R<0&&(R+=Ql),d.centerX=b,d.centerY=_,d.ang1=M,d.ang2=R}});function EA(t,e,r){let i=(n,a)=>{let l=a.x-n.x,c=a.y-n.y,u=Math.sqrt(l*l+c*c),h=l/u,d=c/u;return{len:u,nx:h,ny:d}},s=(n,a)=>{n===0?t.moveTo(a.x,a.y):t.lineTo(a.x,a.y)},o=e[e.length-1];for(let n=0;n<e.length;n++){let a=e[n%e.length],l=a.radius??r;if(l<=0){s(n,a),o=a;continue}let c=e[(n+1)%e.length],u=i(a,o),h=i(a,c);if(u.len<1e-4||h.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(u.nx*h.ny-u.ny*h.nx),f=1,p=!1;u.nx*h.nx-u.ny*-h.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,v=Math.abs(Math.cos(m)*l/Math.sin(m));v>Math.min(u.len/2,h.len/2)?(v=Math.min(u.len/2,h.len/2),x=Math.abs(v*Math.sin(m)/Math.cos(m))):x=l;let y=a.x+h.nx*v+-h.ny*x*f,g=a.y+h.ny*v+h.nx*x*f,b=Math.atan2(u.ny,u.nx)+Math.PI/2*f,_=Math.atan2(h.ny,h.nx)-Math.PI/2*f;n===0&&t.moveTo(y+Math.cos(b)*x,g+Math.sin(b)*x),t.arc(y,g,x,b,_,p),o=a}}function AA(t,e,r,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=e.length;for(let a=0;a<n;a++){let l=e[(a+1)%n],c=l.radius??r;if(c<=0){a===0?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y);continue}let u=e[a],h=e[(a+2)%n],d=s(u,l),f;if(d<1e-4)f=l;else{let x=Math.min(d/2,c);f=o(l,u,x/d)}let p=s(h,l),m;if(p<1e-4)m=l;else{let x=Math.min(p/2,c);m=o(l,h,x/p)}a===0?t.moveTo(f.x,f.y):t.lineTo(f.x,f.y),t.quadraticCurveTo(l.x,l.y,m.x,m.y,i)}}var PA=T(()=>{"use strict"});var bD,Dd,CA=T(()=>{hA();dA();mA();vt();gA();ar();Xx();_A();jx();vA();wA();PA();bD=new te,Dd=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new De,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,r){return this.startPoly(e,r),this}lineTo(e,r){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==e||o!==r)&&i.push(e,r),this}arc(e,r,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Gd(a,e,r,i,s,o,n),this}arcTo(e,r,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return bA(n,e,r,i,s,o),this}arcToSvg(e,r,i,s,o,n,a){let l=this._currentPoly.points;return SA(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,e,r,i,s,o),this}bezierCurveTo(e,r,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return Ld(this._currentPoly.points,l.lastX,l.lastY,e,r,i,s,o,n,a),this}quadraticCurveTo(e,r,i,s,o){this._ensurePoly();let n=this._currentPoly;return yA(this._currentPoly.points,n.lastX,n.lastY,e,r,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(e,r){this.endPoly(),r&&!r.isIdentity()&&(e=e.clone(!0),e.transform(r));let i=this.shapePrimitives,s=i.length;for(let o=0;o<e.instructions.length;o++){let n=e.instructions[o];this[n.action](...n.data)}if(e.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(e=!1){this.endPoly(e)}rect(e,r,i,s,o){return this.drawShape(new te(e,r,i,s),o),this}circle(e,r,i,s){return this.drawShape(new Bd(e,r,i),s),this}poly(e,r,i){let s=new Fn(e);return s.closePath=r,this.drawShape(s,i),this}regularPoly(e,r,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 u=0;u<s;u++){let h=a-u*l;c.push(e+i*Math.cos(h),r+i*Math.sin(h))}return this.poly(c,!0,n),this}roundPoly(e,r,i,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(e,r,i,s,n);let l=i*Math.sin(Math.PI/s)-.001;o=Math.min(o,l);let c=-1*Math.PI/2+n,u=Math.PI*2/s,h=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*u+c,p=e+i*Math.cos(f),m=r+i*Math.sin(f),x=f+Math.PI+h,v=f-Math.PI-h,y=p+o*Math.cos(x),g=m+o*Math.sin(x),b=p+o*Math.cos(v),_=m+o*Math.sin(v);d===0?this.moveTo(y,g):this.lineTo(y,g),this.quadraticCurveTo(p,m,b,_,a)}return this.closePath()}roundShape(e,r,i=!1,s){return e.length<3?this:(i?AA(this,e,r,s):EA(this,e,r),this.closePath())}filletRect(e,r,i,s,o){if(o===0)return this.rect(e,r,i,s);let n=Math.min(i,s)/2,a=Math.min(n,Math.max(-n,o)),l=e+i,c=r+s,u=a<0?-a:0,h=Math.abs(a);return this.moveTo(e,r+h).arcTo(e+u,r+u,e+h,r,h).lineTo(l-h,r).arcTo(l-u,r+u,l,r+h,h).lineTo(l,c-h).arcTo(l-u,c-u,e+i-h,c,h).lineTo(e+h,c).arcTo(e+u,c-u,e,c-h,h).closePath()}chamferRect(e,r,i,s,o,n){if(o<=0)return this.rect(e,r,i,s);let a=Math.min(o,Math.min(i,s)/2),l=e+i,c=r+s,u=[e+a,r,l-a,r,l,r+a,l,c-a,l-a,c,e+a,c,e,c-a,e,r+a];for(let h=u.length-1;h>=2;h-=2)u[h]===u[h-2]&&u[h-1]===u[h-3]&&u.splice(h-1,2);return this.poly(u,!0,n)}ellipse(e,r,i,s,o){return this.drawShape(new Fd(e,r,i,s),o),this}roundRect(e,r,i,s,o,n){return this.drawShape(new Ud(e,r,i,s,o),n),this}drawShape(e,r){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:r}),this}startPoly(e,r){let i=this._currentPoly;return i&&this.endPoly(),i=new Fn,i.points.push(e,r),this._currentPoly=i,this}endPoly(e=!1){let r=this._currentPoly;return r&&r.points.length>2&&(r.closePath=e,this.shapePrimitives.push({shape:r})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new Fn,e)){let r=this.shapePrimitives[this.shapePrimitives.length-1];if(r){let i=r.shape.x,s=r.shape.y;if(r.transform&&!r.transform.isIdentity()){let o=r.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 e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let r=0;r<e.instructions.length;r++){let i=e.instructions[r];this[i.action](...i.data)}this.finish()}get bounds(){let e=this._bounds;e.clear();let r=this.shapePrimitives;for(let i=0;i<r.length;i++){let s=r[i],o=s.shape.getBounds(bD);s.transform?e.addRect(o,s.transform):e.addRect(o)}return e}}});function Jl(t,e){return t?t.prepend(e):e.clone()}var bs,Zx=T(()=>{gr();kt();Ne();uA();CA();bs=class t{constructor(e,r=!1){this.instructions=[],this.uid=Te("graphicsPath"),this._dirty=!0,this.checkForHoles=r,typeof e=="string"?cA(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Dd(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,r){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,r]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,r,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(ve.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 u=a.x,h=a.y;l=u+(u-l),c=h+(h-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,e,r,i,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,r,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(ve.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,e,r,i]}),this._dirty=!0,this}rect(e,r,i,s,o){return this.instructions.push({action:"rect",data:[e,r,i,s,o]}),this._dirty=!0,this}circle(e,r,i,s){return this.instructions.push({action:"circle",data:[e,r,i,s]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,r,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,c=i*2,u=Math.PI*2/c,h=[];for(let d=0;d<c;d++){let f=d%2?o:s,p=d*u+l;h.push(e+f*Math.cos(p),r+f*Math.sin(p))}return this.poly(h,!0,a),this}clone(e=!1){let r=new t;if(r.checkForHoles=this.checkForHoles,!e)r.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let s=this.instructions[i];r.instructions.push({action:s.action,data:s.data.slice()})}return r}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;let r=e.a,i=e.b,s=e.c,o=e.d,n=e.tx,a=e.ty,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0;for(let x=0;x<this.instructions.length;x++){let v=this.instructions[x],y=v.data;switch(v.action){case"moveTo":case"lineTo":l=y[0],c=y[1],y[0]=r*l+s*c+n,y[1]=i*l+o*c+a;break;case"bezierCurveTo":u=y[0],h=y[1],d=y[2],f=y[3],l=y[4],c=y[5],y[0]=r*u+s*h+n,y[1]=i*u+o*h+a,y[2]=r*d+s*f+n,y[3]=i*d+o*f+a,y[4]=r*l+s*c+n,y[5]=i*l+o*c+a;break;case"quadraticCurveTo":u=y[0],h=y[1],l=y[2],c=y[3],y[0]=r*u+s*h+n,y[1]=i*u+o*h+a,y[2]=r*l+s*c+n,y[3]=i*l+o*c+a;break;case"arcToSvg":l=y[5],c=y[6],p=y[0],m=y[1],y[0]=r*p+s*m,y[1]=i*p+o*m,y[5]=r*l+s*c+n,y[6]=i*l+o*c+a;break;case"circle":y[4]=Jl(y[3],e);break;case"rect":y[4]=Jl(y[4],e);break;case"ellipse":y[8]=Jl(y[8],e);break;case"roundRect":y[5]=Jl(y[5],e);break;case"addPath":y[0].transform(e);break;case"poly":y[2]=Jl(y[2],e);break;default:Z("unknown transform action",v.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let r=this.instructions.length-1,i=this.instructions[r];if(!i)return e.x=0,e.y=0,e;for(;i.action==="closePath";){if(r--,r<0)return e.x=0,e.y=0,e;i=this.instructions[r]}switch(i.action){case"moveTo":case"lineTo":e.x=i.data[0],e.y=i.data[1];break;case"quadraticCurveTo":e.x=i.data[2],e.y=i.data[3];break;case"bezierCurveTo":e.x=i.data[4],e.y=i.data[5];break;case"arc":case"arcToSvg":e.x=i.data[5],e.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(e);break}return e}}});function it(t,e,r){let i=t.getAttribute(e);return i?Number(i):r}var Qx=T(()=>{"use strict"});function RA(t,e){let r=t.querySelectorAll("defs");for(let i=0;i<r.length;i++){let s=r[i];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":e.defs[n.id]=vD(n);break;case"radialgradient":e.defs[n.id]=TD(n);break;default:break}}}}function vD(t){let e=it(t,"x1",0),r=it(t,"y1",0),i=it(t,"x2",1),s=it(t,"y2",0),o=t.getAttribute("gradientUnits")||"objectBoundingBox",n=new wt(e,r,i,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<t.children.length;a++){let l=t.children[a],c=it(l,"offset",0),u=me.shared.setValue(l.getAttribute("stop-color")).toNumber();n.addColorStop(c,u)}return n}function TD(t){return Z("[SVG Parser] Radial gradients are not yet supported"),new wt(0,0,1,0)}var MA=T(()=>{Bt();Ne();ho();Qx()});function Jx(t){let e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var IA=T(()=>{"use strict"});function ey(t,e){let r=t.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in BA){let a=t.getAttribute(n);a&&FA(e,o,n,a.trim())}if(r){let n=r.split(";");for(let a=0;a<n.length;a++){let l=n[a].trim(),[c,u]=l.split(":");BA[c]&&FA(e,o,c,u.trim())}}return{strokeStyle:o.useStroke?i:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function FA(t,e,r,i){switch(r){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let s=Jx(i);e.strokeStyle.fill=t.defs[s]}else e.strokeStyle.color=me.shared.setValue(i).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let s=Jx(i);e.fillStyle.fill=t.defs[s]}else e.fillStyle.color=me.shared.setValue(i).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(i);break;case"stroke-opacity":e.strokeStyle.alpha=Number(i);break;case"opacity":e.fillStyle.alpha=Number(i),e.strokeStyle.alpha=Number(i);break}}var BA,kA=T(()=>{Bt();IA();BA={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 UA(t,e){if(typeof t=="string"){let n=document.createElement("div");n.innerHTML=t.trim(),t=n.querySelector("svg")}let r={context:e,defs:{},path:new bs};RA(t,r);let i=t.children,{fillStyle:s,strokeStyle:o}=ey(t,r);for(let n=0;n<i.length;n++){let a=i[n];a.nodeName.toLowerCase()!=="defs"&&OA(a,r,s,o)}return e}function OA(t,e,r,i){let s=t.children,{fillStyle:o,strokeStyle:n}=ey(t,e);o&&r?r={...r,...o}:o&&(r=o),n&&i?i={...i,...n}:n&&(i=n);let a=!r&&!i;a&&(r={color:0});let l,c,u,h,d,f,p,m,x,v,y,g,b,_,S,E,P;switch(t.nodeName.toLowerCase()){case"path":_=t.getAttribute("d"),t.getAttribute("fill-rule")==="evenodd"&&Z("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new bs(_,!0),e.context.path(S),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"circle":p=it(t,"cx",0),m=it(t,"cy",0),x=it(t,"r",0),e.context.ellipse(p,m,x,x),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"rect":l=it(t,"x",0),c=it(t,"y",0),E=it(t,"width",0),P=it(t,"height",0),v=it(t,"rx",0),y=it(t,"ry",0),v||y?e.context.roundRect(l,c,E,P,v||y):e.context.rect(l,c,E,P),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"ellipse":p=it(t,"cx",0),m=it(t,"cy",0),v=it(t,"rx",0),y=it(t,"ry",0),e.context.beginPath(),e.context.ellipse(p,m,v,y),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"line":u=it(t,"x1",0),h=it(t,"y1",0),d=it(t,"x2",0),f=it(t,"y2",0),e.context.beginPath(),e.context.moveTo(u,h),e.context.lineTo(d,f),i&&e.context.stroke(i);break;case"polygon":b=t.getAttribute("points"),g=b.match(/\d+/g).map(C=>parseInt(C,10)),e.context.poly(g,!0),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"polyline":b=t.getAttribute("points"),g=b.match(/\d+/g).map(C=>parseInt(C,10)),e.context.poly(g,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{Z(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}a&&(r=null);for(let C=0;C<s.length;C++)OA(s[C],e,r,i)}var LA=T(()=>{Ne();Zx();MA();Qx();kA()});function SD(t){return me.isColorLike(t)}function GA(t){return t instanceof Wi}function DA(t){return t instanceof wt}function wD(t){return t instanceof B}function ED(t,e,r){let i=me.shared.setValue(e??0);return t.color=i.toNumber(),t.alpha=i.alpha===1?r.alpha:i.alpha,t.texture=B.WHITE,{...r,...t}}function AD(t,e,r){return t.texture=e,{...r,...t}}function NA(t,e,r){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...r,...t}}function VA(t,e,r){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...r,...t}}function PD(t,e){let r={...e,...t},i=me.shared.setValue(r.color);return r.alpha*=i.alpha,r.color=i.toNumber(),r}function $i(t,e){if(t==null)return null;let r={},i=t;return SD(t)?ED(r,t,e):wD(t)?AD(r,t,e):GA(t)?NA(r,t,e):DA(t)?VA(r,t,e):i.fill&&GA(i.fill)?NA(i,i.fill,e):i.fill&&DA(i.fill)?VA(i,i.fill,e):PD(i,e)}function Un(t,e){let{width:r,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=e,c=$i(t,l);return c?{width:r,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var ty=T(()=>{Bt();Fe();ho();Id()});var CD,HA,ry,ir,Nd=T(()=>{Vt();Bt();Ae();gr();Fe();kt();tt();ar();Zx();LA();ty();CD=new ve,HA=new V,ry=class Ti extends $e{constructor(){super(...arguments),this.uid=Te("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new bs,this._transform=new V,this._fillStyle={...Ti.defaultFillStyle},this._strokeStyle={...Ti.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new De,this._boundsDirty=!0}clone(){let e=new Ti;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=$i(e,Ti.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Un(e,Ti.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=$i(e,Ti.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=$i(e,Ti.defaultStrokeStyle),this}texture(e,r,i,s,o,n){return this.instructions.push({action:"texture",data:{image:e,dx:i||0,dy:s||0,dw:o||e.frame.width,dh:n||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:r?me.shared.setValue(r).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new bs,this}fill(e,r){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?(e!=null&&(r!==void 0&&typeof e=="number"&&(J(ue,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:r}),this._fillStyle=$i(e,Ti.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:r}=this._activePath.getLastPoint(ve.shared);this._activePath.clear(),this._activePath.moveTo(e,r)}stroke(e){let r,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?r=i.data.path:r=this._activePath.clone(),r?(e!=null&&(this._strokeStyle=Un(e,Ti.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let r=this.instructions[this.instructions.length-1-e],i=this._activePath.clone();if(r&&(r.action==="stroke"||r.action==="fill"))if(r.data.hole)r.data.hole.addPath(i);else{r.data.hole=i;break}}return this._initNextPathLocation(),this}arc(e,r,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*e+a.c*r+a.tx,a.b*e+a.d*r+a.ty,i,s,o,n),this}arcTo(e,r,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*e+n.c*r+n.tx,n.b*e+n.d*r+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(e,r,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,r,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(e,r,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*r+l.tx,l.b*e+l.d*r+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(e,r,i,s){return this._tick++,this._activePath.ellipse(e,r,i,s,this._transform.clone()),this}circle(e,r,i){return this._tick++,this._activePath.circle(e,r,i,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,r){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*e+i.c*r+i.tx,i.b*e+i.d*r+i.ty),this}moveTo(e,r){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*e+i.c*r+i.tx,n=i.b*e+i.d*r+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(e,r,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*e+n.c*r+n.tx,n.b*e+n.d*r+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(e,r,i,s){return this._tick++,this._activePath.rect(e,r,i,s,this._transform.clone()),this}roundRect(e,r,i,s,o){return this._tick++,this._activePath.roundRect(e,r,i,s,o,this._transform.clone()),this}poly(e,r){return this._tick++,this._activePath.poly(e,r,this._transform.clone()),this}regularPoly(e,r,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(e,r,i,s,o,n),this}roundPoly(e,r,i,s,o,n){return this._tick++,this._activePath.roundPoly(e,r,i,s,o,n),this}roundShape(e,r,i,s){return this._tick++,this._activePath.roundShape(e,r,i,s),this}filletRect(e,r,i,s,o){return this._tick++,this._activePath.filletRect(e,r,i,s,o),this}chamferRect(e,r,i,s,o,n){return this._tick++,this._activePath.chamferRect(e,r,i,s,o,n),this}star(e,r,i,s,o=0,n=0){return this._tick++,this._activePath.star(e,r,i,s,o,n,this._transform.clone()),this}svg(e){return this._tick++,UA(e,this),this}restore(){let e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.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(e){return this._transform.rotate(e),this}scale(e,r=e){return this._transform.scale(e,r),this}setTransform(e,r,i,s,o,n){return e instanceof V?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,r,i,s,o,n),this)}transform(e,r,i,s,o,n){return e instanceof V?(this._transform.append(e),this):(HA.set(e,r,i,s,o,n),this._transform.append(HA),this)}translate(e,r=e){return this._transform.translate(e,r),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 e=this._bounds;e.clear();for(let r=0;r<this.instructions.length;r++){let i=this.instructions[r],s=i.action;if(s==="fill"){let o=i.data;e.addBounds(o.path.bounds)}else if(s==="texture"){let o=i.data;e.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;e.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return e}containsPoint(e){if(!this.bounds.containsPoint(e.x,e.y))return!1;let r=this.instructions,i=!1;for(let s=0;s<r.length;s++){let o=r[s],n=o.data,a=n.path;if(!o.action||!a)continue;let l=n.style,c=a.shapePath.shapePrimitives;for(let u=0;u<c.length;u++){let h=c[u].shape;if(!l||!h)continue;let d=c[u].transform,f=d?d.applyInverse(e,CD):e;if(o.action==="fill")i=h.contains(f.x,f.y);else{let m=l;i=h.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(e=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.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}};ry.defaultFillStyle={color:16777215,alpha:1,texture:B.WHITE,matrix:null,fill:null,textureSpace:"local"};ry.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};ir=ry});function Vd(t){let e=[],r=0;for(let i=0;i<WA.length;i++){let s=`_${WA[i]}`;e[r++]=t[s]}return r=$A(t._fill,e,r),r=RD(t._stroke,e,r),r=MD(t.dropShadow,e,r),e.join("-")}function $A(t,e,r){return t&&(e[r++]=t.color,e[r++]=t.alpha,e[r++]=t.fill?.styleKey),r}function RD(t,e,r){return t&&(r=$A(t,e,r),e[r++]=t.width,e[r++]=t.alignment,e[r++]=t.cap,e[r++]=t.join,e[r++]=t.miterLimit),r}function MD(t,e,r){return t&&(e[r++]=t.alpha,e[r++]=t.angle,e[r++]=t.blur,e[r++]=t.distance,e[r++]=me.shared.setValue(t.color).toNumber()),r}var WA,iy=T(()=>{Bt();WA=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function ID(t){let e=t;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let r=Ge.defaultDropShadow;t.dropShadow={alpha:e.dropShadowAlpha??r.alpha,angle:e.dropShadowAngle??r.angle,blur:e.dropShadowBlur??r.blur,color:e.dropShadowColor??r.color,distance:e.dropShadowDistance??r.distance}}if(e.strokeThickness!==void 0){J(ue,"strokeThickness is now a part of stroke");let r=e.stroke,i={};if(me.isColorLike(r))i.color=r;else if(r instanceof wt||r instanceof Wi)i.fill=r;else if(Object.hasOwnProperty.call(r,"color")||Object.hasOwnProperty.call(r,"fill"))i=r;else throw new Error("Invalid stroke value.");t.stroke={...i,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){J(ue,"gradient fill is now a fill pattern: `new FillGradient(...)`");let r;t.fontSize==null?t.fontSize=Ge.defaultTextStyle.fontSize:typeof t.fontSize=="string"?r=parseInt(t.fontSize,10):r=t.fontSize;let i=new wt({start:{x:0,y:0},end:{x:0,y:(r||0)*1.7}}),s=e.fillGradientStops.map(o=>me.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),t.fill={fill:i}}}var sy,Ge,po=T(()=>{Vt();Bt();tt();ho();Id();Nd();ty();iy();sy=class On extends $e{constructor(e={}){super(),ID(e);let r={...On.defaultTextStyle,...e};for(let i in r){let s=i;this[s]=r[i]}this.update()}get align(){return this._align}set align(e){this._align=e,this.update()}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords=e,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(e){e!==null&&typeof e=="object"?this._dropShadow=this._createProxy({...On.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...On.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily=e,this.update()}get fontSize(){return this._fontSize}set fontSize(e){typeof e=="string"?this._fontSize=parseInt(e,10):this._fontSize=e,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle=e.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant=e,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight=e,this.update()}get leading(){return this._leading}set leading(e){this._leading=e,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing=e,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight=e,this.update()}get padding(){return this._padding}set padding(e){this._padding=e,this.update()}get trim(){return this._trim}set trim(e){this._trim=e,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline=e,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace=e,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap=e,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth=e,this.update()}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...ir.defaultFillStyle,...e},()=>{this._fill=$i({...this._originalFill},ir.defaultFillStyle)})),this._fill=$i(e===0?"black":e,ir.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...ir.defaultStrokeStyle,...e},()=>{this._stroke=Un({...this._originalStroke},ir.defaultStrokeStyle)})),this._stroke=Un(e,ir.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Vd(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=On.defaultTextStyle;for(let r in e)this[r]=e[r]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new On({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(e=!1){if(this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.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(e,r){return new Proxy(e,{set:(i,s,o)=>(i[s]=o,r?.(s,o),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(me.isColorLike(e)||e instanceof wt||e instanceof Wi)}};sy.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};sy.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};Ge=sy});function Hd(t,e,r,i){let s=BD;s.minX=0,s.minY=0,s.maxX=t.width/i|0,s.maxY=t.height/i|0;let o=Ve.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=t,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=e/i,o.frame.height=r/i,o.source.emit("update",o.source),o.updateUvs(),o}var BD,oy=T(()=>{ui();ar();BD=new De});function mo(t){let e=typeof t.fontSize=="number"?`${t.fontSize}px`:t.fontSize,r=t.fontFamily;Array.isArray(t.fontFamily)||(r=t.fontFamily.split(","));for(let i=r.length-1;i>=0;i--){let s=r[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!FD.includes(s)&&(s=`"${s}"`),r[i]=s}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${r.join(",")}`}var FD,Wd=T(()=>{"use strict";FD=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var ny,Zr,Ye,ec=T(()=>{ze();Wd();ny={willReadFrequently:!0},Zr=class se{static get experimentalLetterSpacingSupported(){let e=se._experimentalLetterSpacingSupported;if(e!==void 0){let r=re.get().getCanvasRenderingContext2D().prototype;e=se._experimentalLetterSpacingSupported="letterSpacing"in r||"textLetterSpacing"in r}return e}constructor(e,r,i,s,o,n,a,l,c){this.text=e,this.style=r,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=c}static measureText(e=" ",r,i=se._canvas,s=r.wordWrap){let o=`${e}:${r.styleKey}`;if(se._measurementCache[o])return se._measurementCache[o];let n=mo(r),a=se.measureFont(n);a.fontSize===0&&(a.fontSize=r.fontSize,a.ascent=r.fontSize);let l=se.__context;l.font=n;let u=(s?se._wordWrap(e,r,i):e).split(/(?:\r\n|\r|\n)/),h=new Array(u.length),d=0;for(let y=0;y<u.length;y++){let g=se._measureText(u[y],r.letterSpacing,l);h[y]=g,d=Math.max(d,g)}let f=r._stroke?.width||0,p=d+f;r.dropShadow&&(p+=r.dropShadow.distance);let m=r.lineHeight||a.fontSize,x=Math.max(m,a.fontSize+f)+(u.length-1)*(m+r.leading);return r.dropShadow&&(x+=r.dropShadow.distance),new se(e,r,p,x,u,h,m+r.leading,d,a)}static _measureText(e,r,i){let s=!1;se.experimentalLetterSpacingSupported&&(se.experimentalLetterSpacing?(i.letterSpacing=`${r}px`,i.textLetterSpacing=`${r}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let o=i.measureText(e),n=o.width,a=-o.actualBoundingBoxLeft,c=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=r,c-=r;else{let u=(se.graphemeSegmenter(e).length-1)*r;n+=u,c+=u}return Math.max(n,c)}static _wordWrap(e,r,i=se._canvas){let s=i.getContext("2d",ny),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:u}=r,h=se._collapseSpaces(u),d=se._collapseNewlines(u),f=!h,p=r.wordWrapWidth+c,m=se._tokenize(e);for(let x=0;x<m.length;x++){let v=m[x];if(se._isNewline(v)){if(!d){a+=se._addLine(n),f=!h,n="",o=0;continue}v=" "}if(h){let g=se.isBreakingSpace(v),b=se.isBreakingSpace(n[n.length-1]);if(g&&b)continue}let y=se._getFromCache(v,c,l,s);if(y>p)if(n!==""&&(a+=se._addLine(n),n="",o=0),se.canBreakWords(v,r.breakWords)){let g=se.wordWrapSplit(v);for(let b=0;b<g.length;b++){let _=g[b],S=_,E=1;for(;g[b+E];){let C=g[b+E];if(!se.canBreakChars(S,C,v,b,r.breakWords))_+=C;else break;S=C,E++}b+=E-1;let P=se._getFromCache(_,c,l,s);P+o>p&&(a+=se._addLine(n),f=!1,n="",o=0),n+=_,o+=P}}else{n.length>0&&(a+=se._addLine(n),n="",o=0);let g=x===m.length-1;a+=se._addLine(v,!g),f=!1,n="",o=0}else y+o>p&&(f=!1,a+=se._addLine(n),n="",o=0),(n.length>0||!se.isBreakingSpace(v)||f)&&(n+=v,o+=y)}return a+=se._addLine(n,!1),a}static _addLine(e,r=!0){return e=se._trimRight(e),e=r?`${e}
|
|
368
368
|
`:e,e}static _getFromCache(e,r,i,s){let o=i[e];return typeof o!="number"&&(o=se._measureText(e,r,s)+r,i[e]=o),o}static _collapseSpaces(e){return e==="normal"||e==="pre-line"}static _collapseNewlines(e){return e==="normal"}static _trimRight(e){if(typeof e!="string")return"";for(let r=e.length-1;r>=0;r--){let i=e[r];if(!se.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static _isNewline(e){return typeof e!="string"?!1:se._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,r){return typeof e!="string"?!1:se._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){let r=[],i="";if(typeof e!="string")return r;for(let s=0;s<e.length;s++){let o=e[s],n=e[s+1];if(se.isBreakingSpace(o,n)||se._isNewline(o)){i!==""&&(r.push(i),i=""),r.push(o);continue}i+=o}return i!==""&&r.push(i),r}static canBreakWords(e,r){return r}static canBreakChars(e,r,i,s,o){return!0}static wordWrapSplit(e){return se.graphemeSegmenter(e)}static measureFont(e){if(se._fonts[e])return se._fonts[e];let r=se._context;r.font=e;let i=r.measureText(se.METRICS_STRING+se.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return se._fonts[e]=s,s}static clearMetrics(e=""){e?delete se._fonts[e]:se._fonts={}}static get _canvas(){if(!se.__canvas){let e;try{let r=new OffscreenCanvas(0,0);if(r.getContext("2d",ny)?.measureText)return se.__canvas=r,r;e=re.get().createCanvas()}catch{e=re.get().createCanvas()}e.width=e.height=10,se.__canvas=e}return se.__canvas}static get _context(){return se.__context||(se.__context=se._canvas.getContext("2d",ny)),se.__context}};Zr.METRICS_STRING="|\xC9q\xC5";Zr.BASELINE_SYMBOL="M";Zr.BASELINE_MULTIPLIER=1.4;Zr.HEIGHT_MULTIPLIER=2;Zr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let t=new Intl.Segmenter;return e=>[...t.segment(e)].map(r=>r.segment)}return t=>[...t]})();Zr.experimentalLetterSpacing=!1;Zr._fonts={};Zr._newlines=[10,13];Zr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Zr._measurementCache={};Ye=Zr});function Ln(t,e,r,i=0){if(t.texture===B.WHITE&&!t.fill)return me.shared.setValue(t.color).setAlpha(t.alpha??1).toHexa();if(t.fill){if(t.fill instanceof Wi){let s=t.fill,o=e.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(V.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(t.fill instanceof wt){let s=t.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&r&&(a=r.width+i,l=r.height+i);let c,u=!1;if(o){let{start:h,end:d}=s;c=e.createLinearGradient(h.x*a,h.y*l,d.x*a,d.y*l),u=Math.abs(d.x-h.x)<Math.abs((d.y-h.y)*.1)}else{let{center:h,innerRadius:d,outerCenter:f,outerRadius:p}=s;c=e.createRadialGradient(h.x*a,h.y*l,d*a,f.x*a,f.y*l,p*a)}if(u&&n&&r){let h=r.lineHeight/l;for(let d=0;d<r.lines.length;d++){let f=(d*r.lineHeight+i/2)/l;s.colorStops.forEach(p=>{let m=f+p.offset*h;c.addColorStop(Math.floor(m*zA)/zA,me.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(h=>{c.addColorStop(h.offset,me.shared.setValue(h.color).toHex())});return c}}else{let s=e.createPattern(t.texture.source.resource,"repeat"),o=t.matrix.copyTo(V.shared);return o.scale(t.texture.frame.width,t.texture.frame.height),s.setTransform(o),s}return Z("FillStyle not recognised",t),"red"}var zA,ay=T(()=>{Bt();Ae();Fe();Ne();ho();Id();zA=1e5});var tc,XA=T(()=>{Bt();O();bl();Bn();ui();sA();tt();po();oy();ec();Wd();ay();tc=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,r,i){let s=Ye.measureText(e||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*r),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*r);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=Li(o),n=Li(n),{width:o,height:n}}getTexture(e,r,i,s){typeof e=="string"&&(J("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:i,resolution:r}),e.style instanceof Ge||(e.style=new Ge(e.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(o._source),dr.returnCanvasAndContext(n),o}createTextureAndCanvas(e){let{text:r,style:i}=e,s=e.resolution??this._renderer.resolution,o=Ye.measureText(r||" ",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=dr.getOptimalCanvasAndContext(n,a),{canvas:c}=l;this.renderTextToCanvas(r,i,s,l);let u=Hd(c,n,a,s);if(i.trim){let h=iA(c,s);u.frame.copyFrom(h),u.updateUvs()}return{texture:u,canvasAndContext:l}}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;let r=e._getKey();if(this._activeTextures[r])return this._increaseReferenceCount(r),this._activeTextures[r].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(e);return this._activeTextures[r]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}returnTexture(e){let r=e.source;r.resource=null,r.uploadMethodId="unknown",r.alphaMode="no-premultiply-alpha",Ve.returnTexture(e)}decreaseReferenceCount(e){let r=this._activeTextures[e];r.usageCount--,r.usageCount===0&&(dr.returnCanvasAndContext(r.canvasAndContext),this.returnTexture(r.texture),this._activeTextures[e]=null)}getReferenceCount(e){return this._activeTextures[e].usageCount}renderTextToCanvas(e,r,i,s){let{canvas:o,context:n}=s,a=mo(r),l=Ye.measureText(e||" ",r),c=l.lines,u=l.lineHeight,h=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,p=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=r.textBaseline,r._stroke?.width){let y=r._stroke;n.lineWidth=y.width,n.miterLimit=y.miterLimit,n.lineJoin=y.join,n.lineCap=y.cap}n.font=a;let m,x,v=r.dropShadow?2:1;for(let y=0;y<v;++y){let g=r.dropShadow&&y===0,b=g?Math.ceil(Math.max(1,p)+r.padding*2):0,_=b*i;if(g){n.fillStyle="black",n.strokeStyle="black";let P=r.dropShadow,C=P.color,M=P.alpha;n.shadowColor=me.shared.setValue(C).setAlpha(M).toRgbaString();let R=P.blur*i,F=P.distance*i;n.shadowBlur=R,n.shadowOffsetX=Math.cos(P.angle)*F,n.shadowOffsetY=Math.sin(P.angle)*F+_}else{if(n.fillStyle=r._fill?Ln(r._fill,n,l):null,r._stroke?.width){let P=r._stroke.width*r._stroke.alignment;n.strokeStyle=Ln(r._stroke,n,l,P)}n.shadowColor="black"}let S=(u-f.fontSize)/2;u-f.fontSize<0&&(S=0);let E=r._stroke?.width??0;for(let P=0;P<c.length;P++)m=E/2,x=E/2+P*u+f.ascent+S,r.align==="right"?m+=d-h[P]:r.align==="center"&&(m+=(d-h[P])/2),r._stroke?.width&&this._drawLetterSpacing(c[P],r,s,m+r.padding,x+r.padding-b,!0),r._fill!==void 0&&this._drawLetterSpacing(c[P],r,s,m+r.padding,x+r.padding-b)}}_drawLetterSpacing(e,r,i,s,o,n=!1){let{context:a}=i,l=r.letterSpacing,c=!1;if(Ye.experimentalLetterSpacingSupported&&(Ye.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,c=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||c){n?a.strokeText(e,s,o):a.fillText(e,s,o);return}let u=s,h=Ye.graphemeSegmenter(e),d=a.measureText(e).width,f=0;for(let p=0;p<h.length;++p){let m=h[p];n?a.strokeText(m,u,o):a.fillText(m,u,o);let x="";for(let v=p+1;v<h.length;++v)x+=h[v];f=a.measureText(x).width,u+=d-f+l,d=f}}destroy(){this._activeTextures=null}};tc.extension={type:[w.WebGLSystem,w.WebGPUSystem,w.CanvasSystem],name:"canvasText"}});var ly=T(()=>{O();eA();XA();K.add(tc);K.add(Zl)});var Ze,cy=T(()=>{tt();Jh();Nd();Ze=class t extends us{constructor(e){e instanceof ir&&(e={context:e});let{context:r,roundPixels:i,...s}=e||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",r?this._context=r:this._context=this._ownedContext=new ir,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(e){e!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=e,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(e){return this._context.containsPoint(e)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||e?.context===!0)&&this._context.destroy(e),this._ownedContext=null,this._context=null,super.destroy(e)}_callContextMethod(e,r){return this.context[e](...r),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new t(this._context.clone()):(this._ownedContext=null,new t(this._context))}lineStyle(e,r,i){J(ue,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return e&&(s.width=e),r&&(s.color=r),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(e,r){J(ue,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return e!==void 0&&(i.color=e),r!==void 0&&(i.alpha=r),this.context.fillStyle=i,this}endFill(){J(ue,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let e=this.context.strokeStyle;return(e.width!==ir.defaultStrokeStyle.width||e.color!==ir.defaultStrokeStyle.color||e.alpha!==ir.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return J(ue,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return J(ue,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return J(ue,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return J(ue,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return J(ue,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return J(ue,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}});var YA,jA,qA=T(()=>{"use strict";YA={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
369
369
|
struct LocalUniforms {
|
|
370
370
|
uColor:vec4<f32>,
|
|
@@ -462,7 +462,7 @@ fn mainFragment(
|
|
|
462
462
|
|
|
463
463
|
return coverage;
|
|
464
464
|
}
|
|
465
|
-
`}}});var uy,hy,$d,JA=T(()=>{Ae();io();xs();Dl();Nl();ys();gd();qr();Wt();qA();QA();$d=class extends ct{constructor(){let e=new Ce({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new V,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),r=Ir();uy??(uy=gi({name:"sdf-shader",bits:[Tn,wn(r),YA,KA,yi]})),hy??(hy=xi({name:"sdf-shader",bits:[Sn,En(r),jA,ZA,_i]})),super({glProgram:hy,gpuProgram:uy,resources:{localUniforms:e,batchSamplers:An(r)}})}}});var Gn,dy=T(()=>{Vt();tt();Gn=class extends
|
|
465
|
+
`}}});var uy,hy,$d,JA=T(()=>{Ae();io();xs();Dl();Nl();ys();gd();qr();Wt();qA();QA();$d=class extends ct{constructor(){let e=new Ce({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new V,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),r=Ir();uy??(uy=gi({name:"sdf-shader",bits:[Tn,wn(r),YA,KA,yi]})),hy??(hy=xi({name:"sdf-shader",bits:[Sn,En(r),jA,ZA,_i]})),super({glProgram:hy,gpuProgram:uy,resources:{localUniforms:e,batchSamplers:An(r)}})}}});var Gn,dy=T(()=>{Vt();tt();Gn=class extends $e{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 J(ue,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return J(ue,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return J(ue,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return J(ue,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return J(ue,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners();for(let r in this.chars)this.chars[r].texture?.destroy();this.chars=null,e&&(this.pages.forEach(r=>r.texture.destroy(!0)),this.pages=null)}}});function zd(t){if(t==="")return[];typeof t=="string"&&(t=[t]);let e=[];for(let r=0,i=t.length;r<i;r++){let s=t[r];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++)e.push(String.fromCharCode(a))}else e.push(...Array.from(s))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}var fy=T(()=>{"use strict"});var e1,py,r1=T(()=>{Bt();vt();Bn();xn();Fe();tt();ec();Wd();ay();po();dy();fy();e1=class t1 extends Gn{constructor(e){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 r={...t1.defaultOptions,...e};this._textureSize=r.textureSize,this._mipmap=r.mipmap;let i=r.style.clone();r.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=B.WHITE,i._fill.fill=null),this.applyFillAsTint=r.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=mo(i);r.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=r.skipKerning??!1,this.resolution=r.resolution??1,this._padding=r.padding??4,this.fontMetrics=Ye.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(e){let r=zd(e).filter(x=>!this._currentChars.includes(x)).filter((x,v,y)=>y.indexOf(x)===v);if(!r.length)return;this._currentChars=[...this._currentChars,...r];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,u=this.baseRenderedFontSize/this.baseMeasurementFontSize,h=this._padding*u,d=0,f=!1,p=s.width/this.resolution,m=s.height/this.resolution;for(let x=0;x<r.length;x++){let v=r[x],y=Ye.measureText(v,a,s,!1);y.lineHeight=y.height;let g=y.width*u,b=Math.ceil((a.fontStyle==="italic"?2:1)*g),_=y.height*u,S=b+h*2,E=_+h*2;if(f=!1,v!==`
|
|
466
466
|
`&&v!=="\r"&&v!==" "&&v!==" "&&(f=!0,d=Math.ceil(Math.max(E,d))),l+S>p&&(c+=d,d=E,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/u-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[v]={id:v.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:P,kerning:{}},f){this._drawGlyph(o,y,l+h,c+h,u,a);let C=n.width*u,M=n.height*u,R=new te(l/C*n.width,c/M*n.height,S/C*n.width,E/M*n.height);this.chars[v].texture=new B({source:n,frame:R}),l+=Math.ceil(S)}}n.update(),this._currentX=l,this._currentY=c,this._skipKerning&&this._applyKerning(r,o)}get pageTextures(){return J(ue,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,r){let i=this._measureCache;for(let s=0;s<e.length;s++){let o=e[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],l=i[o];l||(l=i[o]=r.measureText(o).width);let c=i[a];c||(c=i[a]=r.measureText(a).width);let u=r.measureText(o+a).width,h=u-(l+c);h&&(this.chars[o].kerning[a]=h),u=r.measureText(o+a).width,h=u-(l+c),h&&(this.chars[a].kerning[o]=h)}}}_nextPage(){this._currentPageIndex++;let e=this.resolution,r=dr.getOptimalCanvasAndContext(this._textureSize,this._textureSize,e);this._setupContext(r.context,this._style,e);let i=e*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new B({source:new lr({resource:r.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:r,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(e,r,i){r.fontSize=this.baseRenderedFontSize,e.scale(i,i),e.font=mo(r),r.fontSize=this.baseMeasurementFontSize,e.textBaseline=r.textBaseline;let s=r._stroke,o=s?.width??0;if(s&&(e.lineWidth=o,e.lineJoin=s.join,e.miterLimit=s.miterLimit,e.strokeStyle=Ln(s,e)),r._fill&&(e.fillStyle=Ln(r._fill,e)),r.dropShadow){let n=r.dropShadow,a=me.shared.setValue(n.color).toArray(),l=n.blur*i,c=n.distance*i;e.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,e.shadowBlur=l,e.shadowOffsetX=Math.cos(n.angle)*c,e.shadowOffsetY=Math.sin(n.angle)*c}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0}_drawGlyph(e,r,i,s,o,n){let a=r.text,l=r.fontProperties,u=(n._stroke?.width??0)*o,h=i+u/2,d=s-u/2,f=l.descent*o,p=r.lineHeight*o;n.stroke&&u&&e.strokeText(a,h,d+p-f),n._fill&&e.fillText(a,h,d+p-f)}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){let{canvasAndContext:r,texture:i}=this.pages[e];dr.returnCanvasAndContext(r),i.destroy(!0)}this.pages=null}};e1.defaultOptions={textureSize:512,style:new Ge,mipmap:!0};py=e1});function Xd(t,e,r,i){let s={width:0,height:0,offsetY:0,scale:e.fontSize/r.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=r.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 v=p.positions[x];o.chars.push(p.chars[x]),o.charPositions.push(v+m)}o.width+=p.width,a=!1,l.width=0,l.index=0,l.chars.length=0},u=()=>{let p=o.chars.length-1;if(i){let m=o.chars[p];for(;m===" ";)o.width-=r.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+=r.lineHeight},h=r.baseMeasurementFontSize/e.fontSize,d=e.letterSpacing*h,f=e.wordWrapWidth*h;for(let p=0;p<t.length+1;p++){let m,x=p===t.length;x||(m=t[p]);let v=r.chars[m]||r.chars[" "];if(/(?:\s)/.test(m)||m==="\r"||m===`
|
|
467
467
|
`||x){if(!a&&e.wordWrap&&o.width+l.width-d>f?(u(),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&&u();else if(!x){let _=v.xAdvance+(v.kerning[n]||0)+d;o.width+=_,o.spaceWidth=_,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let b=v.kerning[n]||0,_=v.xAdvance+b+d;l.positions[l.index++]=l.width+b,l.chars.push(m),l.width+=_}n=m}return u(),e.align==="center"?kD(s):e.align==="right"?UD(s):e.align==="justify"&&OD(s),s}function kD(t){for(let e=0;e<t.lines.length;e++){let r=t.lines[e],i=t.width/2-r.width/2;for(let s=0;s<r.charPositions.length;s++)r.charPositions[s]+=i}}function UD(t){for(let e=0;e<t.lines.length;e++){let r=t.lines[e],i=t.width-r.width;for(let s=0;s<r.charPositions.length;s++)r.charPositions[s]+=i}}function OD(t){let e=t.width;for(let r=0;r<t.lines.length;r++){let i=t.lines[r],s=0,o=i.spacesIndex[s++],n=0,a=i.spacesIndex.length,c=(e-i.width)/a;for(let u=0;u<i.charPositions.length;u++)u===o&&(o=i.spacesIndex[s++],n+=c),i.charPositions[u]+=n}}var my=T(()=>{"use strict"});var Yd,gy,rc,xy=T(()=>{ds();tt();Ne();po();r1();my();fy();Yd=0,gy=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(e,r){let i=`${r.fontFamily}-bitmap`,s=!0;if(r._fill.fill&&!r._stroke)i+=r._fill.fill.styleKey,s=!1;else if(r._stroke||r.dropShadow){let n=r.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!Ue.has(i)){let n=new py({style:r,overrideFill:s,overrideSize:!0,...this.defaultOptions});Yd++,Yd>50&&Z("BitmapText",`You have dynamically created ${Yd} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Yd--,Ue.remove(i)}),Ue.set(i,n)}let o=Ue.get(i);return o.ensureCharacters?.(e),o}getLayout(e,r,i=!0){let s=this.getFont(e,r);return Xd([...e],r,s,i)}measureText(e,r,i=!0){return this.getLayout(e,r,i)}install(...e){let r=e[0];typeof r=="string"&&(r={name:r,style:e[1],chars:e[2]?.chars,resolution:e[2]?.resolution,padding:e[2]?.padding,skipKerning:e[2]?.skipKerning},J(ue,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=r?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");r={...this.defaultOptions,...r};let s=r.style,o=s instanceof Ge?s:new Ge(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new py({style:o,overrideFill:n,skipKerning:r.skipKerning,padding:r.padding,resolution:r.resolution,overrideSize:!1}),l=zd(r.chars);return a.ensureCharacters(l.join("")),Ue.set(`${i}-bitmap`,a),a.once("destroy",()=>Ue.remove(`${i}-bitmap`)),a}uninstall(e){let r=`${e}-bitmap`,i=Ue.get(r);i&&i.destroy()}},rc=new gy});function i1(t,e){e.groupTransform=t.groupTransform,e.groupColorAlpha=t.groupColorAlpha,e.groupColor=t.groupColor,e.groupBlendMode=t.groupBlendMode,e.globalDisplayStatus=t.globalDisplayStatus,e.groupTransform=t.groupTransform,e.localDisplayStatus=t.localDisplayStatus,e.groupAlpha=t.groupAlpha,e._roundPixels=t._roundPixels}var ic,s1=T(()=>{ds();O();Zt();cy();JA();xy();my();ic=class{constructor(e){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(e){let r=this._getGpuBitmapText(e);return e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,r)),this._renderer.renderPipes.graphics.validateRenderable(r)}addRenderable(e,r){let i=this._getGpuBitmapText(e);i1(e,i),e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,i)),this._renderer.renderPipes.graphics.addRenderable(i,r),i.context.customShader&&this._updateDistanceField(e)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(e.uid)}_destroyRenderableByUid(e){let r=this._gpuBitmapText[e].context;r.customShader&&(fe.return(r.customShader),r.customShader=null),fe.return(this._gpuBitmapText[e]),this._gpuBitmapText[e]=null}updateRenderable(e){let r=this._getGpuBitmapText(e);i1(e,r),this._renderer.renderPipes.graphics.updateRenderable(r),r.context.customShader&&this._updateDistanceField(e)}_updateContext(e,r){let{context:i}=r,s=rc.getFont(e.text,e._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=fe.get($d)));let o=Array.from(e.text),n=e._style,a=s.baseLineOffset,l=Xd(o,n,s,!0),c=0,u=n.padding,h=l.scale,d=l.width,f=l.height+l.offsetY;n._stroke&&(d+=n._stroke.width/h,f+=n._stroke.width/h),i.translate(-e._anchor._x*d-u,-e._anchor._y*f-u).scale(h,h);let p=s.applyFillAsTint?n._fill.color:16777215;for(let m=0;m<l.lines.length;m++){let x=l.lines[m];for(let v=0;v<x.charPositions.length;v++){let y=o[c++],g=s.chars[y];g?.texture&&i.texture(g.texture,p||"black",Math.round(x.charPositions[v]+g.xOffset),Math.round(a+g.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(e){return this._gpuBitmapText[e.uid]||this.initGpuText(e)}initGpuText(e){let r=fe.get(Ze);return this._gpuBitmapText[e.uid]=r,this._updateContext(e,r),e.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[e.uid]}_updateDistanceField(e){let r=this._getGpuBitmapText(e).context,i=e._style.fontFamily,s=Ue.get(`${i}-bitmap`),{a:o,b:n,c:a,d:l}=e.groupTransform,c=Math.sqrt(o*o+n*n),u=Math.sqrt(a*a+l*l),h=(Math.abs(c)+Math.abs(u))/2,d=s.baseRenderedFontSize/e._style.fontSize,f=h*s.distanceField.range*(1/d);r.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let e in this._gpuBitmapText)this._destroyRenderableByUid(e);this._gpuBitmapText=null,this._renderer=null}};ic.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"bitmapText"}});var yy=T(()=>{O();s1();K.add(ic)});var sc,o1=T(()=>{O();Fe();Zt();ql();Vx();sc=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let e in this._gpuText){let r=this._gpuText[e];if(!r)continue;let i=r.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(e){let r=this._getGpuText(e),i=e._getKey();return r.textureNeedsUploading?(r.textureNeedsUploading=!1,!0):r.currentKey!==i}addRenderable(e,r){let s=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(s,r)}updateRenderable(e){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),i._batcher.updateElement(i)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let r=this._gpuText[e];this._renderer.htmlText.decreaseReferenceCount(r.currentKey),fe.return(r.batchableSprite),this._gpuText[e]=null}_updateText(e){let r=e._getKey(),i=this._getGpuText(e),s=i.batchableSprite;i.currentKey!==r&&this._updateGpuText(e).catch(o=>{console.error(o)}),e._didTextUpdate=!1,Kl(s,e)}async _updateGpuText(e){e._didTextUpdate=!1;let r=this._getGpuText(e);if(r.generatingTexture)return;let i=e._getKey();this._renderer.htmlText.decreaseReferenceCount(r.currentKey),r.generatingTexture=!0,r.currentKey=i;let s=e.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(e.text,s,e._style,e._getKey()),n=r.batchableSprite;n.texture=r.texture=o,r.generatingTexture=!1,r.textureNeedsUploading=!0,e.onViewUpdate(),Kl(n,e)}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let r={texture:B.EMPTY,currentKey:"--",batchableSprite:fe.get(vi),textureNeedsUploading:!1,generatingTexture:!1},i=r.batchableSprite;return i.renderable=e,i.transform=e.groupTransform,i.texture=B.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|e._roundPixels,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._gpuText[e.uid]=r,e.on("destroyed",this._destroyRenderableBound),r}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}};sc.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"htmlText"}});function n1(){let{userAgent:t}=re.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}var a1=T(()=>{ze()});var l1,c1,Dn,_y=T(()=>{"use strict";l1="http://www.w3.org/2000/svg",c1="http://www.w3.org/1999/xhtml",Dn=class{constructor(){this.svgRoot=document.createElementNS(l1,"svg"),this.foreignObject=document.createElementNS(l1,"foreignObject"),this.domElement=document.createElementNS(c1,"div"),this.styleElement=document.createElementNS(c1,"style"),this.image=new Image;let{foreignObject:e,svgRoot:r,styleElement:i,domElement:s}=this;e.setAttribute("width","10000"),e.setAttribute("height","10000"),e.style.overflow="hidden",r.appendChild(e),e.appendChild(i),e.appendChild(s)}}});function d1(t){let e=t._stroke,r=t._fill,s=[`div { ${[`color: ${me.shared.setValue(r.color).toHex()}`,`font-size: ${t.fontSize}px`,`font-family: ${t.fontFamily}`,`font-weight: ${t.fontWeight}`,`font-style: ${t.fontStyle}`,`font-variant: ${t.fontVariant}`,`letter-spacing: ${t.letterSpacing}px`,`text-align: ${t.align}`,`padding: ${t.padding}px`,`white-space: ${t.whiteSpace==="pre"&&t.wordWrap?"pre-wrap":t.whiteSpace}`,...t.lineHeight?[`line-height: ${t.lineHeight}px`]:[],...t.wordWrap?[`word-wrap: ${t.breakWords?"break-all":"break-word"}`,`max-width: ${t.wordWrapWidth}px`]:[],...e?[p1(e)]:[],...t.dropShadow?[f1(t.dropShadow)]:[],...t.cssOverrides].join(";")} }`];return LD(t.tagStyles,s),s.join(" ")}function f1(t){let e=me.shared.setValue(t.color).setAlpha(t.alpha).toHexa(),r=Math.round(Math.cos(t.angle)*t.distance),i=Math.round(Math.sin(t.angle)*t.distance),s=`${r}px ${i}px`;return t.blur>0?`text-shadow: ${s} ${t.blur}px ${e}`:`text-shadow: ${s} ${e}`}function p1(t){return[`-webkit-text-stroke-width: ${t.width}px`,`-webkit-text-stroke-color: ${me.shared.setValue(t.color).toHex()}`,`text-stroke-width: ${t.width}px`,`text-stroke-color: ${me.shared.setValue(t.color).toHex()}`,"paint-order: stroke"].join(";")}function LD(t,e){for(let r in t){let i=t[r],s=[];for(let o in i)h1[o]?s.push(h1[o](i[o])):u1[o]&&s.push(u1[o].replace("{{VALUE}}",i[o]));e.push(`${r} { ${s.join(";")} }`)}}var u1,h1,m1=T(()=>{Bt();u1={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"},h1={fill:t=>`color: ${me.shared.setValue(t).toHex()}`,breakWords:t=>`word-wrap: ${t?"break-all":"break-word"}`,stroke:p1,dropShadow:f1}});var jd,g1=T(()=>{Ne();po();iy();m1();jd=class t extends Ge{constructor(e={}){super(e),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=e.cssOverrides),this.tagStyles=e.tagStyles??{}}set cssOverrides(e){this._cssOverrides=e instanceof Array?e:[e],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Vd(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new t({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=d1(this)),this._cssStyle}addOverride(...e){let r=e.filter(i=>!this.cssOverrides.includes(i));r.length>0&&(this.cssOverrides.push(...r),this.update())}removeOverride(...e){let r=e.filter(i=>this.cssOverrides.includes(i));r.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!r.includes(i)),this.update())}set fill(e){typeof e!="string"&&typeof e!="number"&&Z("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&typeof e!="string"&&typeof e!="number"&&Z("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}});function x1(t,e){let r=e.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=t.match(o);function a(l){s[l]||(i.push(l),s[l]=!0)}if(Array.isArray(r))for(let l=0;l<r.length;l++)a(r[l]);else a(r);n&&n.forEach(l=>{let c=l.split(":")[1].trim();a(c)});for(let l in e.tagStyles){let c=e.tagStyles[l].fontFamily;a(c)}return i}var y1=T(()=>{"use strict"});async function _1(t){let r=await(await re.get().fetch(t)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(r)})}var b1=T(()=>{ze()});async function by(t,e){let r=await _1(e);return`@font-face {
|
|
@@ -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 Ty,Sy,Zd,N1=T(()=>{Ae();xs();Wn();ys();qr();Wt();Fe();D1();Zd=class extends ct{constructor(){Ty??(Ty=gi({name:"tiling-sprite-shader",bits:[go,L1,yi]})),Sy??(Sy=xi({name:"tiling-sprite-shader",bits:[Hn,G1,_i]}));let e=new Ce({uMapCoord:{value:new V,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 V,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Sy,gpuProgram:Ty,resources:{localUniforms:new Ce({uTransformMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:B.EMPTY.source,uSampler:B.EMPTY.source.style}})}updateUniforms(e,r,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,c=n.height,u=n.textureMatrix,h=a.uniforms.uTextureTransform;h.set(i.a*l/e,i.b*l/r,i.c*c/e,i.d*c/r,i.tx/e,i.ty/r),h.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=h,a.uniforms.uSizeAnchor[0]=e,a.uniforms.uSizeAnchor[1]=r,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var Qd,V1=T(()=>{Kd();Qd=class extends Vn{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 H1(t,e){let r=t.anchor.x,i=t.anchor.y;e[0]=-r*t.width,e[1]=-i*t.height,e[2]=(1-r)*t.width,e[3]=-i*t.height,e[4]=(1-r)*t.width,e[5]=(1-i)*t.height,e[6]=-r*t.width,e[7]=(1-i)*t.height}var W1=T(()=>{"use strict"});function $1(t,e,r,i){let s=0,o=t.length/(e||2),n=i.a,a=i.b,l=i.c,c=i.d,u=i.tx,h=i.ty;for(r*=e;s<o;){let d=t[r],f=t[r+1];t[r]=n*d+l*f+u,t[r+1]=a*d+c*f+h,r+=e,s++}}var z1=T(()=>{"use strict"});function X1(t,e){let r=t.texture,i=r.frame.width,s=r.frame.height,o=0,n=0;t.applyAnchorToTexture&&(o=t.anchor.x,n=t.anchor.y),e[0]=e[6]=-o,e[2]=e[4]=1-o,e[1]=e[3]=-n,e[5]=e[7]=1-n;let a=V.shared;a.copyFrom(t._tileTransform.matrix),a.tx/=t.width,a.ty/=t.height,a.invert(),a.scale(t.width/i,t.height/s),$1(e,2,0,a)}var Y1=T(()=>{Ae();z1()});var Jd,oc,j1=T(()=>{O();Ol();Kr();br();Mn();Ad();Kd();N1();V1();W1();Y1();Jd=new Qd,oc=class{constructor(e){this._state=ht.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(e){let r=this._getTilingSpriteData(e),i=r.canBatch;this._updateCanBatch(e);let s=r.canBatch;if(s&&s===i){let{batchableMesh:o}=r;return!o._batcher.checkAndUpdateTexture(o,e.texture)}return i!==s}addRenderable(e,r){let i=this._renderer.renderPipes.batch;this._updateCanBatch(e);let s=this._getTilingSpriteData(e),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new _s);let a=s.batchableMesh;e.didViewUpdate&&(this._updateBatchableMesh(e),a.geometry=o,a.renderable=e,a.transform=e.groupTransform,a.setTexture(e._texture)),a.roundPixels=this._renderer._roundPixels|e._roundPixels,i.addToBatch(a,r)}else i.break(r),s.shader||(s.shader=new Zd),this.updateRenderable(e),r.add(e)}execute(e){let{shader:r}=this._tilingSpriteDataHash[e.uid];r.groups[0]=this._renderer.globalUniforms.bindGroup;let i=r.resources.localUniforms.uniforms;i.uTransformMatrix=e.groupTransform,i.uRound=this._renderer._roundPixels|e._roundPixels,bi(e.groupColorAlpha,i.uColor,0),this._state.blendMode=Ni(e.groupBlendMode,e.texture._source),this._renderer.encoder.draw({geometry:Jd,shader:r,state:this._state})}updateRenderable(e){let r=this._getTilingSpriteData(e),{canBatch:i}=r;if(i){let{batchableMesh:s}=r;e.didViewUpdate&&this._updateBatchableMesh(e),s._batcher.updateElement(s)}else if(e.didViewUpdate){let{shader:s}=r;s.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}}destroyRenderable(e){let r=this._getTilingSpriteData(e);r.batchableMesh=null,r.shader?.destroy(),this._tilingSpriteDataHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(e){return this._tilingSpriteDataHash[e.uid]||this._initTilingSpriteData(e)}_initTilingSpriteData(e){let r=new Vn({indices:Jd.indices,positions:Jd.positions.slice(),uvs:Jd.uvs.slice()});return this._tilingSpriteDataHash[e.uid]={canBatch:!0,renderable:e,geometry:r},e.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[e.uid]}_updateBatchableMesh(e){let r=this._getTilingSpriteData(e),{geometry:i}=r,s=e.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),X1(e,i.uvs),H1(e,i.positions)}destroy(){for(let e in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[e].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(e){let r=this._getTilingSpriteData(e),i=e.texture,s=!0;return this._renderer.type===Xe.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),r.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),r.canBatch}};oc.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"tilingSprite"}});var wy=T(()=>{O();j1();K.add(oc)});var q1,Z1,Q1=T(()=>{tt();Kd();q1=class K1 extends Vn{constructor(...e){super({});let r=e[0]??{};typeof r=="number"&&(J(ue,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),r={width:r,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(r)}build(e){e={...K1.defaultOptions,...e},this.verticesX=this.verticesX??e.verticesX,this.verticesY=this.verticesY??e.verticesY,this.width=this.width??e.width,this.height=this.height??e.height;let r=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 h=0;h<r;h++){let d=h%this.verticesX,f=h/this.verticesX|0;i.push(d*l,f*c),s.push(d/n,f/a)}let u=n*a;for(let h=0;h<u;h++){let d=h%n,f=h/n|0,p=f*this.verticesX+d,m=f*this.verticesX+d+1,x=(f+1)*this.verticesX+d,v=(f+1)*this.verticesX+d+1;o.push(p,m,x,m,v,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()}};q1.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};Z1=q1});var J1,tP,rP=T(()=>{Q1();J1=class eP extends Z1{constructor(e={}){e={...eP.defaultOptions,...e},super({width:e.width,height:e.height,verticesX:4,verticesY:4}),this.update(e)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let e=this.positions,{width:r,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:c}=this,u=s+o,h=r>u?1:r/u,d=n+a,f=i>d?1:i/d,p=Math.min(h,f),m=l*r,x=c*i;e[0]=e[8]=e[16]=e[24]=-m,e[2]=e[10]=e[18]=e[26]=s*p-m,e[4]=e[12]=e[20]=e[28]=r-o*p-m,e[6]=e[14]=e[22]=e[30]=r-m,e[1]=e[3]=e[5]=e[7]=-x,e[9]=e[11]=e[13]=e[15]=n*p-x,e[17]=e[19]=e[21]=e[23]=i-a*p-x,e[25]=e[27]=e[29]=e[31]=i-x,this.getBuffer("aPosition").update()}updateUvs(){let e=this.uvs;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1;let r=1/this._originalWidth,i=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};J1.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};tP=J1});var nc,iP=T(()=>{O();Zt();Ad();rP();nc=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(e,r){let i=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i,r)}updateRenderable(e){let r=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,r),r._batcher.updateElement(r)}validateRenderable(e){let r=this._getGpuSprite(e);return!r._batcher.checkAndUpdateTexture(r,e._texture)}destroyRenderable(e){let r=this._gpuSpriteHash[e.uid];fe.return(r.geometry),fe.return(r),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,r){r.geometry.update(e),r.setTexture(e._texture)}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let r=fe.get(_s);return r.geometry=fe.get(tP),r.renderable=e,r.transform=e.groupTransform,r.texture=e._texture,r.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=r,e.didViewUpdate||this._updateBatchableSprite(e,r),e.on("destroyed",this._destroyRenderableBound),r}destroy(){for(let e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};nc.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"nineSliceSprite"}});var Ey=T(()=>{O();iP();K.add(nc)});var ac,sP=T(()=>{O();ac=class{constructor(e){this._renderer=e}push(e,r,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:r,filterEffect:e})}pop(e,r,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};ac.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"filter"}});function oP(t,e){e.clear();let r=e.matrix;for(let i=0;i<t.length;i++){let s=t[i];s.globalDisplayStatus<7||(e.matrix=s.worldTransform,e.addBounds(s.bounds))}return e.matrix=r,e}var nP=T(()=>{"use strict"});var GD,lc,aP=T(()=>{O();Ae();gr();fs();oo();Wt();Fe();ui();br();ar();nP();Ne();GD=new rr({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])}),lc=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Ce({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 Rt({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let r=this.renderer,i=e.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(e.renderables?oP(e.renderables,o):e.filterEffect.filterArea?(o.clear(),o.addRect(e.filterEffect.filterArea),o.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,o),e.container){let p=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=r.renderTarget.renderTarget.colorTexture.source,a=1/0,l=0,c=!0,u=!1,h=!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&r.type)){h=!1;break}if(p.blendRequired&&!(r.backBuffer?.useBackBuffer??!0)){Z("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),h=!1;break}h=p.enabled||h,u||(u=p.blendRequired)}if(!h){s.skip=!0;return}if(d){let f=r.renderTarget.rootViewPort,p=r.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=u,s.container=e.container,s.filterEffect=e.filterEffect,s.previousRenderSurface=r.renderTarget.renderSurface,s.inputTexture=Ve.getOptimalTexture(o.width,o.height,a,c),r.renderTarget.bind(s.inputTexture,!0),r.globalUniforms.push({offset:o})}pop(){let e=this.renderer;this._filterStackIndex--;let r=this._filterStack[this._filterStackIndex];if(r.skip)return;this._activeFilterData=r;let i=r.inputTexture,s=r.bounds,o=B.EMPTY;if(e.renderTarget.finishRenderPass(),r.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,l=e.renderTarget.getRenderTarget(r.previousRenderSurface);o=this.getBackTexture(l,s,a)}r.backTexture=o;let n=r.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),e.globalUniforms.pop(),n.length===1)n[0].apply(this,i,r.previousRenderSurface,!1),Ve.returnTexture(i);else{let a=r.inputTexture,l=Ve.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 h=a;a=l,l=h}n[c].apply(this,a,r.previousRenderSurface,!1),Ve.returnTexture(a),Ve.returnTexture(l)}r.blendRequired&&Ve.returnTexture(o)}getBackTexture(e,r,i){let s=e.colorTexture.source._resolution,o=Ve.getOptimalTexture(r.width,r.height,s,!1),n=r.minX,a=r.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(r.width*s),c=Math.ceil(r.height*s);return this.renderer.renderTarget.copyToTexture(e,o,{x:n,y:a},{width:l,height:c},{x:0,y:0}),o}applyFilter(e,r,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,l=ve.shared,u=n.previousRenderSurface===i,h=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(h=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,m=p.uOutputFrame,x=p.uInputSize,v=p.uInputPixel,y=p.uInputClamp,g=p.uGlobalFrame,b=p.uOutputTexture;if(u){let E=this._filterStackIndex;for(;E>0;){E--;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]=r.frame.width,m[3]=r.frame.height,x[0]=r.source.width,x[1]=r.source.height,x[2]=1/x[0],x[3]=1/x[1],v[0]=r.source.pixelWidth,v[1]=r.source.pixelHeight,v[2]=1/v[0],v[3]=1/v[1],y[0]=.5*v[2],y[1]=.5*v[3],y[2]=r.frame.width*x[2]-.5*v[2],y[3]=r.frame.height*x[3]-.5*v[3];let _=this.renderer.renderTarget.rootRenderTarget.colorTexture;g[0]=l.x*h,g[1]=l.y*h,g[2]=_.source.width*h,g[3]=_.source.height*h;let S=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof B?(b[0]=i.frame.width,b[1]=i.frame.height):(b[0]=S.width,b[1]=S.height),b[2]=S.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let E=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(E,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(r.source,1),this._globalFilterBindGroup.setResource(r.source.style,2),e.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:GD,shader:e,state:e._state,topology:"triangle-list"}),o.type===Xe.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new De,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,r){let i=this._activeFilterData,s=e.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=r.worldTransform.copyTo(V.shared),n=r.renderGroup||r.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/r.texture.frame.width,1/r.texture.frame.height),s.translate(r.anchor.x,r.anchor.y),s}};lc.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"filter"}});var Ay=T(()=>{O();sP();aP();K.add(lc);K.add(ac)});var DD={};var lP=T(()=>{uS();Rg();yS();bS();td();ad();Ux();Ox();Nx();ly();yy();vy();wy();Ey();Ay()});var ND={};var uP=T(()=>{Rg();td();ad();Ux();Ox();Nx();ly();yy();vy();wy();Ey();Ay()});var dP,Br,cc=T(()=>{ms();ao();qr();Kr();dP=class Py extends ct{constructor(e){e={...Py.defaultOptions,...e},super(e),this.enabled=!0,this._state=ht.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1)}apply(e,r,i,s){e.applyFilter(this,r,i,s)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:r,gl:i,...s}=e,o,n;return r&&(o=hr.from(r)),i&&(n=cr.from(i)),new Py({gpuProgram:o,glProgram:n,...s})}};dP.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};Br=dP});async function fP(t){if(!t)for(let e=0;e<Cy.length;e++){let r=Cy[e];if(r.value.test()){await r.value.load();return}}}var Cy,pP=T(()=>{O();Cy=[];K.handleByNamedList(w.Environment,Cy)});function ef(){if(typeof uc=="boolean")return uc;try{uc=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{uc=!1}return uc}var uc,Ry=T(()=>{"use strict"});var Mt,$n=T(()=>{"use strict";Mt=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(Mt||{})});var zn,My=T(()=>{"use strict";zn=class{constructor(e){this.items=[],this._name=e}emit(e,r,i,s,o,n,a,l){let{name:c,items:u}=this;for(let h=0,d=u.length;h<d;h++)u[h][c](e,r,i,s,o,n,a,l);return this}add(e){return e[this._name]&&(this.remove(e),this.items.push(e)),this}remove(e){let r=this.items.indexOf(e);return r!==-1&&this.items.splice(r,1),this}contains(e){return this.items.indexOf(e)!==-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 VD,mP,vs,hc=T(()=>{Bt();pP();Yr();Ry();tt();$n();My();Vt();VD=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],mP=class gP extends We{constructor(e){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;let r=[...VD,...this.config.runners??[]];this._addRunners(...r),this._unsafeEvalCheck()}async init(e={}){let r=e.skipExtensionImports===!0?!0:e.manageImports===!1;await fP(r),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)e={...this._systemsHash[i].constructor.defaultOptions,...e};e={...gP.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(e);this._initOptions=e}render(e,r){let i=e;if(i instanceof ie&&(i={container:i},r&&(J(ue,"passing a second argument is deprecated, please use render options instead"),i.target=r.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:me.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(e,r,i){let s=this.view.resolution;this.view.resize(e,r,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(e={}){let r=this;e.target||(e.target=r.renderTarget.renderTarget),e.clearColor||(e.clearColor=this.background.colorRgba),e.clear??(e.clear=Mt.ALL);let{clear:i,clearColor:s,target:o}=e;me.shared.setValue(s??this.background.colorRgba),r.renderTarget.clear(o,i,me.shared.toArray())}get resolution(){return this.view.resolution}set resolution(e){this.view.resolution=e,this.runners.resolutionChange.emit(e)}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(...e){e.forEach(r=>{this.runners[r]=new zn(r)})}_addSystems(e){let r;for(r in e){let i=e[r];this._addSystem(i.value,i.name)}}_addSystem(e,r){let i=new e(this);if(this[r])throw new Error(`Whoops! The name "${r}" is already in use`);this[r]=i,this._systemsHash[r]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(e,r){let i=r.reduce((s,o)=>(s[o.name]=o.value,s),{});e.forEach(s=>{let o=s.value,n=s.name,a=i[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),Object.values(this.runners).forEach(r=>{r.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!ef())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()}};mP.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};vs=mP});var dc,_P=T(()=>{O();Ae();io();ud();xs();Dl();Nl();Wn();ys();qr();Wt();dc=class{init(){let e=new Ce({uTransformMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),r=gi({name:"graphics",bits:[Tn,wn(Ir()),O1,yi]});this.shader=new ct({gpuProgram:r,resources:{localUniforms:e}})}execute(e,r){let i=r.context,s=i.customShader||this.shader,o=e.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),c=o.encoder;c.setGeometry(a.geometry,s.gpuProgram);let u=o.globalUniforms.bindGroup;c.setBindGroup(0,u,s.gpuProgram);let h=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,h,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,e.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){let x=m.textures;m.bindGroup=bn(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}};dc.extension={type:[w.WebGPUPipesAdaptor],name:"graphics"}});var bP,vP,Iy=T(()=>{"use strict";bP={name:"texture-bit",vertex:{header:`
|
|
569
|
+
`}}});var Ty,Sy,Zd,N1=T(()=>{Ae();xs();Wn();ys();qr();Wt();Fe();D1();Zd=class extends ct{constructor(){Ty??(Ty=gi({name:"tiling-sprite-shader",bits:[go,L1,yi]})),Sy??(Sy=xi({name:"tiling-sprite-shader",bits:[Hn,G1,_i]}));let e=new Ce({uMapCoord:{value:new V,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 V,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Sy,gpuProgram:Ty,resources:{localUniforms:new Ce({uTransformMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:B.EMPTY.source,uSampler:B.EMPTY.source.style}})}updateUniforms(e,r,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,c=n.height,u=n.textureMatrix,h=a.uniforms.uTextureTransform;h.set(i.a*l/e,i.b*l/r,i.c*c/e,i.d*c/r,i.tx/e,i.ty/r),h.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=h,a.uniforms.uSizeAnchor[0]=e,a.uniforms.uSizeAnchor[1]=r,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var Qd,V1=T(()=>{Kd();Qd=class extends Vn{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 H1(t,e){let r=t.anchor.x,i=t.anchor.y;e[0]=-r*t.width,e[1]=-i*t.height,e[2]=(1-r)*t.width,e[3]=-i*t.height,e[4]=(1-r)*t.width,e[5]=(1-i)*t.height,e[6]=-r*t.width,e[7]=(1-i)*t.height}var W1=T(()=>{"use strict"});function $1(t,e,r,i){let s=0,o=t.length/(e||2),n=i.a,a=i.b,l=i.c,c=i.d,u=i.tx,h=i.ty;for(r*=e;s<o;){let d=t[r],f=t[r+1];t[r]=n*d+l*f+u,t[r+1]=a*d+c*f+h,r+=e,s++}}var z1=T(()=>{"use strict"});function X1(t,e){let r=t.texture,i=r.frame.width,s=r.frame.height,o=0,n=0;t.applyAnchorToTexture&&(o=t.anchor.x,n=t.anchor.y),e[0]=e[6]=-o,e[2]=e[4]=1-o,e[1]=e[3]=-n,e[5]=e[7]=1-n;let a=V.shared;a.copyFrom(t._tileTransform.matrix),a.tx/=t.width,a.ty/=t.height,a.invert(),a.scale(t.width/i,t.height/s),$1(e,2,0,a)}var Y1=T(()=>{Ae();z1()});var Jd,oc,j1=T(()=>{O();Ol();Kr();br();Mn();Ad();Kd();N1();V1();W1();Y1();Jd=new Qd,oc=class{constructor(e){this._state=ht.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(e){let r=this._getTilingSpriteData(e),i=r.canBatch;this._updateCanBatch(e);let s=r.canBatch;if(s&&s===i){let{batchableMesh:o}=r;return!o._batcher.checkAndUpdateTexture(o,e.texture)}return i!==s}addRenderable(e,r){let i=this._renderer.renderPipes.batch;this._updateCanBatch(e);let s=this._getTilingSpriteData(e),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new _s);let a=s.batchableMesh;e.didViewUpdate&&(this._updateBatchableMesh(e),a.geometry=o,a.renderable=e,a.transform=e.groupTransform,a.setTexture(e._texture)),a.roundPixels=this._renderer._roundPixels|e._roundPixels,i.addToBatch(a,r)}else i.break(r),s.shader||(s.shader=new Zd),this.updateRenderable(e),r.add(e)}execute(e){let{shader:r}=this._tilingSpriteDataHash[e.uid];r.groups[0]=this._renderer.globalUniforms.bindGroup;let i=r.resources.localUniforms.uniforms;i.uTransformMatrix=e.groupTransform,i.uRound=this._renderer._roundPixels|e._roundPixels,bi(e.groupColorAlpha,i.uColor,0),this._state.blendMode=Ni(e.groupBlendMode,e.texture._source),this._renderer.encoder.draw({geometry:Jd,shader:r,state:this._state})}updateRenderable(e){let r=this._getTilingSpriteData(e),{canBatch:i}=r;if(i){let{batchableMesh:s}=r;e.didViewUpdate&&this._updateBatchableMesh(e),s._batcher.updateElement(s)}else if(e.didViewUpdate){let{shader:s}=r;s.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}}destroyRenderable(e){let r=this._getTilingSpriteData(e);r.batchableMesh=null,r.shader?.destroy(),this._tilingSpriteDataHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(e){return this._tilingSpriteDataHash[e.uid]||this._initTilingSpriteData(e)}_initTilingSpriteData(e){let r=new Vn({indices:Jd.indices,positions:Jd.positions.slice(),uvs:Jd.uvs.slice()});return this._tilingSpriteDataHash[e.uid]={canBatch:!0,renderable:e,geometry:r},e.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[e.uid]}_updateBatchableMesh(e){let r=this._getTilingSpriteData(e),{geometry:i}=r,s=e.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),X1(e,i.uvs),H1(e,i.positions)}destroy(){for(let e in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[e].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(e){let r=this._getTilingSpriteData(e),i=e.texture,s=!0;return this._renderer.type===Xe.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),r.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),r.canBatch}};oc.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"tilingSprite"}});var wy=T(()=>{O();j1();K.add(oc)});var q1,Z1,Q1=T(()=>{tt();Kd();q1=class K1 extends Vn{constructor(...e){super({});let r=e[0]??{};typeof r=="number"&&(J(ue,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),r={width:r,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(r)}build(e){e={...K1.defaultOptions,...e},this.verticesX=this.verticesX??e.verticesX,this.verticesY=this.verticesY??e.verticesY,this.width=this.width??e.width,this.height=this.height??e.height;let r=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 h=0;h<r;h++){let d=h%this.verticesX,f=h/this.verticesX|0;i.push(d*l,f*c),s.push(d/n,f/a)}let u=n*a;for(let h=0;h<u;h++){let d=h%n,f=h/n|0,p=f*this.verticesX+d,m=f*this.verticesX+d+1,x=(f+1)*this.verticesX+d,v=(f+1)*this.verticesX+d+1;o.push(p,m,x,m,v,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()}};q1.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};Z1=q1});var J1,tP,rP=T(()=>{Q1();J1=class eP extends Z1{constructor(e={}){e={...eP.defaultOptions,...e},super({width:e.width,height:e.height,verticesX:4,verticesY:4}),this.update(e)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let e=this.positions,{width:r,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:c}=this,u=s+o,h=r>u?1:r/u,d=n+a,f=i>d?1:i/d,p=Math.min(h,f),m=l*r,x=c*i;e[0]=e[8]=e[16]=e[24]=-m,e[2]=e[10]=e[18]=e[26]=s*p-m,e[4]=e[12]=e[20]=e[28]=r-o*p-m,e[6]=e[14]=e[22]=e[30]=r-m,e[1]=e[3]=e[5]=e[7]=-x,e[9]=e[11]=e[13]=e[15]=n*p-x,e[17]=e[19]=e[21]=e[23]=i-a*p-x,e[25]=e[27]=e[29]=e[31]=i-x,this.getBuffer("aPosition").update()}updateUvs(){let e=this.uvs;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1;let r=1/this._originalWidth,i=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};J1.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};tP=J1});var nc,iP=T(()=>{O();Zt();Ad();rP();nc=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(e,r){let i=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i,r)}updateRenderable(e){let r=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,r),r._batcher.updateElement(r)}validateRenderable(e){let r=this._getGpuSprite(e);return!r._batcher.checkAndUpdateTexture(r,e._texture)}destroyRenderable(e){let r=this._gpuSpriteHash[e.uid];fe.return(r.geometry),fe.return(r),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,r){r.geometry.update(e),r.setTexture(e._texture)}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let r=fe.get(_s);return r.geometry=fe.get(tP),r.renderable=e,r.transform=e.groupTransform,r.texture=e._texture,r.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=r,e.didViewUpdate||this._updateBatchableSprite(e,r),e.on("destroyed",this._destroyRenderableBound),r}destroy(){for(let e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};nc.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"nineSliceSprite"}});var Ey=T(()=>{O();iP();K.add(nc)});var ac,sP=T(()=>{O();ac=class{constructor(e){this._renderer=e}push(e,r,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:r,filterEffect:e})}pop(e,r,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};ac.extension={type:[w.WebGLPipes,w.WebGPUPipes,w.CanvasPipes],name:"filter"}});function oP(t,e){e.clear();let r=e.matrix;for(let i=0;i<t.length;i++){let s=t[i];s.globalDisplayStatus<7||(e.matrix=s.worldTransform,e.addBounds(s.bounds))}return e.matrix=r,e}var nP=T(()=>{"use strict"});var GD,lc,aP=T(()=>{O();Ae();gr();fs();oo();Wt();Fe();ui();br();ar();nP();Ne();GD=new rr({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])}),lc=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Ce({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 Rt({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let r=this.renderer,i=e.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(e.renderables?oP(e.renderables,o):e.filterEffect.filterArea?(o.clear(),o.addRect(e.filterEffect.filterArea),o.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,o),e.container){let p=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=r.renderTarget.renderTarget.colorTexture.source,a=1/0,l=0,c=!0,u=!1,h=!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&r.type)){h=!1;break}if(p.blendRequired&&!(r.backBuffer?.useBackBuffer??!0)){Z("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),h=!1;break}h=p.enabled||h,u||(u=p.blendRequired)}if(!h){s.skip=!0;return}if(d){let f=r.renderTarget.rootViewPort,p=r.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=u,s.container=e.container,s.filterEffect=e.filterEffect,s.previousRenderSurface=r.renderTarget.renderSurface,s.inputTexture=Ve.getOptimalTexture(o.width,o.height,a,c),r.renderTarget.bind(s.inputTexture,!0),r.globalUniforms.push({offset:o})}pop(){let e=this.renderer;this._filterStackIndex--;let r=this._filterStack[this._filterStackIndex];if(r.skip)return;this._activeFilterData=r;let i=r.inputTexture,s=r.bounds,o=B.EMPTY;if(e.renderTarget.finishRenderPass(),r.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,l=e.renderTarget.getRenderTarget(r.previousRenderSurface);o=this.getBackTexture(l,s,a)}r.backTexture=o;let n=r.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),e.globalUniforms.pop(),n.length===1)n[0].apply(this,i,r.previousRenderSurface,!1),Ve.returnTexture(i);else{let a=r.inputTexture,l=Ve.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 h=a;a=l,l=h}n[c].apply(this,a,r.previousRenderSurface,!1),Ve.returnTexture(a),Ve.returnTexture(l)}r.blendRequired&&Ve.returnTexture(o)}getBackTexture(e,r,i){let s=e.colorTexture.source._resolution,o=Ve.getOptimalTexture(r.width,r.height,s,!1),n=r.minX,a=r.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(r.width*s),c=Math.ceil(r.height*s);return this.renderer.renderTarget.copyToTexture(e,o,{x:n,y:a},{width:l,height:c},{x:0,y:0}),o}applyFilter(e,r,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,l=ve.shared,u=n.previousRenderSurface===i,h=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(h=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,m=p.uOutputFrame,x=p.uInputSize,v=p.uInputPixel,y=p.uInputClamp,g=p.uGlobalFrame,b=p.uOutputTexture;if(u){let E=this._filterStackIndex;for(;E>0;){E--;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]=r.frame.width,m[3]=r.frame.height,x[0]=r.source.width,x[1]=r.source.height,x[2]=1/x[0],x[3]=1/x[1],v[0]=r.source.pixelWidth,v[1]=r.source.pixelHeight,v[2]=1/v[0],v[3]=1/v[1],y[0]=.5*v[2],y[1]=.5*v[3],y[2]=r.frame.width*x[2]-.5*v[2],y[3]=r.frame.height*x[3]-.5*v[3];let _=this.renderer.renderTarget.rootRenderTarget.colorTexture;g[0]=l.x*h,g[1]=l.y*h,g[2]=_.source.width*h,g[3]=_.source.height*h;let S=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof B?(b[0]=i.frame.width,b[1]=i.frame.height):(b[0]=S.width,b[1]=S.height),b[2]=S.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let E=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(E,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(r.source,1),this._globalFilterBindGroup.setResource(r.source.style,2),e.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:GD,shader:e,state:e._state,topology:"triangle-list"}),o.type===Xe.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new De,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,r){let i=this._activeFilterData,s=e.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=r.worldTransform.copyTo(V.shared),n=r.renderGroup||r.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/r.texture.frame.width,1/r.texture.frame.height),s.translate(r.anchor.x,r.anchor.y),s}};lc.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"filter"}});var Ay=T(()=>{O();sP();aP();K.add(lc);K.add(ac)});var DD={};var lP=T(()=>{uS();Rg();yS();bS();td();ad();Ux();Ox();Nx();ly();yy();vy();wy();Ey();Ay()});var ND={};var uP=T(()=>{Rg();td();ad();Ux();Ox();Nx();ly();yy();vy();wy();Ey();Ay()});var dP,Br,cc=T(()=>{ms();ao();qr();Kr();dP=class Py extends ct{constructor(e){e={...Py.defaultOptions,...e},super(e),this.enabled=!0,this._state=ht.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1)}apply(e,r,i,s){e.applyFilter(this,r,i,s)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:r,gl:i,...s}=e,o,n;return r&&(o=hr.from(r)),i&&(n=cr.from(i)),new Py({gpuProgram:o,glProgram:n,...s})}};dP.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};Br=dP});async function fP(t){if(!t)for(let e=0;e<Cy.length;e++){let r=Cy[e];if(r.value.test()){await r.value.load();return}}}var Cy,pP=T(()=>{O();Cy=[];K.handleByNamedList(w.Environment,Cy)});function ef(){if(typeof uc=="boolean")return uc;try{uc=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{uc=!1}return uc}var uc,Ry=T(()=>{"use strict"});var Mt,$n=T(()=>{"use strict";Mt=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(Mt||{})});var zn,My=T(()=>{"use strict";zn=class{constructor(e){this.items=[],this._name=e}emit(e,r,i,s,o,n,a,l){let{name:c,items:u}=this;for(let h=0,d=u.length;h<d;h++)u[h][c](e,r,i,s,o,n,a,l);return this}add(e){return e[this._name]&&(this.remove(e),this.items.push(e)),this}remove(e){let r=this.items.indexOf(e);return r!==-1&&this.items.splice(r,1),this}contains(e){return this.items.indexOf(e)!==-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 VD,mP,vs,hc=T(()=>{Bt();pP();Yr();Ry();tt();$n();My();Vt();VD=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],mP=class gP extends $e{constructor(e){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;let r=[...VD,...this.config.runners??[]];this._addRunners(...r),this._unsafeEvalCheck()}async init(e={}){let r=e.skipExtensionImports===!0?!0:e.manageImports===!1;await fP(r),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)e={...this._systemsHash[i].constructor.defaultOptions,...e};e={...gP.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(e);this._initOptions=e}render(e,r){let i=e;if(i instanceof ie&&(i={container:i},r&&(J(ue,"passing a second argument is deprecated, please use render options instead"),i.target=r.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:me.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(e,r,i){let s=this.view.resolution;this.view.resize(e,r,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(e={}){let r=this;e.target||(e.target=r.renderTarget.renderTarget),e.clearColor||(e.clearColor=this.background.colorRgba),e.clear??(e.clear=Mt.ALL);let{clear:i,clearColor:s,target:o}=e;me.shared.setValue(s??this.background.colorRgba),r.renderTarget.clear(o,i,me.shared.toArray())}get resolution(){return this.view.resolution}set resolution(e){this.view.resolution=e,this.runners.resolutionChange.emit(e)}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(...e){e.forEach(r=>{this.runners[r]=new zn(r)})}_addSystems(e){let r;for(r in e){let i=e[r];this._addSystem(i.value,i.name)}}_addSystem(e,r){let i=new e(this);if(this[r])throw new Error(`Whoops! The name "${r}" is already in use`);this[r]=i,this._systemsHash[r]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(e,r){let i=r.reduce((s,o)=>(s[o.name]=o.value,s),{});e.forEach(s=>{let o=s.value,n=s.name,a=i[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),Object.values(this.runners).forEach(r=>{r.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!ef())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()}};mP.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};vs=mP});var dc,_P=T(()=>{O();Ae();io();ud();xs();Dl();Nl();Wn();ys();qr();Wt();dc=class{init(){let e=new Ce({uTransformMatrix:{value:new V,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),r=gi({name:"graphics",bits:[Tn,wn(Ir()),O1,yi]});this.shader=new ct({gpuProgram:r,resources:{localUniforms:e}})}execute(e,r){let i=r.context,s=i.customShader||this.shader,o=e.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),c=o.encoder;c.setGeometry(a.geometry,s.gpuProgram);let u=o.globalUniforms.bindGroup;c.setBindGroup(0,u,s.gpuProgram);let h=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,h,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,e.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){let x=m.textures;m.bindGroup=bn(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}};dc.extension={type:[w.WebGPUPipesAdaptor],name:"graphics"}});var bP,vP,Iy=T(()=>{"use strict";bP={name:"texture-bit",vertex:{header:`
|
|
570
570
|
|
|
571
571
|
struct TextureUniforms {
|
|
572
572
|
uTextureMatrix:mat3x3<f32>,
|
|
@@ -907,7 +907,7 @@ fn mainFragment(
|
|
|
907
907
|
}
|
|
908
908
|
${s!==0?`arrayOffset += ${s};`:""}
|
|
909
909
|
}
|
|
910
|
-
`}var CC=T(()=>{Zy()});function RC(t){return cf(t,"uboWgsl",PC,AC)}var MC=T(()=>{Jy();t_();CC()});var Dc,IC=T(()=>{O();Ky();Zy();MC();Dc=class extends qn{constructor(){super({createUboElements:EC,generateUboSync:RC})}};Dc.extension={type:[w.WebGPUSystem],name:"ubo"}});var Ts,uf=T(()=>{Vt();kt();Ts=class extends We{constructor({buffer:e,offset:r,size:i}){super(),this.uid=Te("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=Te("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=r|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=Te("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var hf,BC=T(()=>{"use strict";hf=class{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);let r=this.byteIndex,i=r+e*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,r}addGroup(e){let r=this.addEmptyGroup(e.length);for(let i=0;i<e.length;i++)this.data[r/4+i]=e[i];return r}destroy(){this.data=null}}});var Ss,Nc,FC=T(()=>{O();ps();uf();Vi();BC();fs();Ss=128,Nc=class{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new hf({minUniformOffsetAlignment:Ss});let r=256/Ss;for(let i=0;i<r;i++){let s=xe.UNIFORM|xe.COPY_DST;i===0&&(s|=xe.COPY_SRC),this._buffers.push(new lt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let e in this._bindGroupHash)this._bindGroupHash[e]=null;this._batchBuffer.clear()}getUniformBindGroup(e,r){if(!r&&this._bindGroupHash[e.uid])return this._bindGroupHash[e.uid];this._renderer.ubo.ensureUniformGroup(e);let i=e.buffer.data,s=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(e,this._batchBuffer.data,s/4),this._bindGroupHash[e.uid]=this._getBindGroup(s/Ss),this._bindGroupHash[e.uid]}getUboResource(e){this._renderer.ubo.updateUniformGroup(e);let r=e.buffer.data,i=this._batchBuffer.addGroup(r);return this._getBufferResource(i/Ss)}getArrayBindGroup(e){let r=this._batchBuffer.addGroup(e);return this._getBindGroup(r/Ss)}getArrayBufferResource(e){let i=this._batchBuffer.addGroup(e)/Ss;return this._getBufferResource(i)}_getBufferResource(e){if(!this._bufferResources[e]){let r=this._buffers[e%2];this._bufferResources[e]=new Ts({buffer:r,offset:(e/2|0)*256,size:Ss})}return this._bufferResources[e]}_getBindGroup(e){if(!this._bindGroups[e]){let r=new Rt({0:this._getBufferResource(e)});this._bindGroups[e]=r}return this._bindGroups[e]}_uploadBindGroups(){let e=this._renderer.buffer,r=this._buffers[0];r.update(this._batchBuffer.byteIndex),e.updateBuffer(r);let i=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];i.copyBufferToBuffer(e.getGPUBuffer(r),Ss,e.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.finish()])}destroy(){for(let e=0;e<this._bindGroups.length;e++)this._bindGroups[e].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let e=0;e<this._buffers.length;e++)this._buffers[e].destroy();this._buffers=null;for(let e=0;e<this._bufferResources.length;e++)this._bufferResources[e].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};Nc.extension={type:[w.WebGPUPipes],name:"uniformBatch"}});function df(t,e){for(let r in t.attributes){let i=t.attributes[r],s=e[r];s?(i.format??(i.format=s.format),i.offset??(i.offset=s.offset),i.instance??(i.instance=s.instance)):Z(`Attribute ${r} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}QD(t)}function QD(t){let{buffers:e,attributes:r}=t,i={},s={};for(let o in e){let n=e[o];i[n.uid]=0,s[n.uid]=0}for(let o in r){let n=r[o];i[n.buffer.uid]+=ur(n.format).stride}for(let o in r){let n=r[o];n.stride??(n.stride=i[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=ur(n.format).stride}}var r_=T(()=>{Ne();no()});var Si,i_=T(()=>{so();Si=[];Si[Ke.NONE]=void 0;Si[Ke.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Si[Ke.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Si[Ke.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Si[Ke.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Si[Ke.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function eN(t,e,r,i,s){return t<<24|e<<16|r<<10|i<<5|s}function tN(t,e,r,i){return r<<6|t<<3|i<<1|e}var JD,Vc,kC=T(()=>{O();Ne();r_();so();Gl();i_();JD={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Vc=class{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=e}contextChange(e){this._gpu=e,this.setStencilMode(Ke.DISABLED),this._updatePipeHash()}setMultisampleCount(e){this._multisampleCount!==e&&(this._multisampleCount=e,this._updatePipeHash())}setRenderTarget(e){this._multisampleCount=e.msaaSamples,this._depthStencilAttachment=e.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=Si[e],this._updatePipeHash())}setPipeline(e,r,i,s){let o=this.getPipeline(e,r,i);s.setPipeline(o)}getPipeline(e,r,i,s){e._layoutKey||(df(e,r.attributeData),this._generateBufferKey(e)),s||(s=e.topology);let o=eN(e._layoutKey,r._layoutKey,i.data,i._blendModeId,JD[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(e,r,i,s),this._pipeCache[o])}_createPipeline(e,r,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(e,r),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Ke.RENDERING_MASK_ADD?0:this._colorMask;let l=this._renderer.shader.getProgramData(r).pipeline,c={vertex:{module:this._getModule(r.vertex.source),entryPoint:r.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(r.fragment.source),entryPoint:r.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:i.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(c.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"}),o.createRenderPipeline(c)}_getModule(e){return this._moduleCache[e]||this._createModule(e)}_createModule(e){let r=this._gpu.device;return this._moduleCache[e]=r.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){let r=[],i=0,s=Object.keys(e.attributes).sort();for(let n=0;n<s.length;n++){let a=e.attributes[s[n]];r[i++]=a.offset,r[i++]=a.format,r[i++]=a.stride,r[i++]=a.instance}let o=r.join("|");return e._layoutKey=Hi(o,"geometry"),e._layoutKey}_generateAttributeLocationsKey(e){let r=[],i=0,s=Object.keys(e.attributeData).sort();for(let n=0;n<s.length;n++){let a=e.attributeData[s[n]];r[i++]=a.location}let o=r.join("|");return e._attributeLocationsKey=Hi(o,"programAttributes"),e._attributeLocationsKey}getBufferNamesToBind(e,r){let i=e._layoutKey<<16|r._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];let s=this._createVertexBufferLayouts(e,r),o=Object.create(null),n=r.attributeData;for(let a=0;a<s.length;a++){let c=Object.values(s[a].attributes)[0].shaderLocation;for(let u in n)if(n[u].location===c){o[a]=u;break}}return this._bindingNamesCache[i]=o,o}_createVertexBufferLayouts(e,r){r._attributeLocationsKey||this._generateAttributeLocationsKey(r);let i=e._layoutKey<<16|r._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];let s=[];return e.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let l in r.attributeData){let c=e.attributes[l];(c.divisor??1)!==1&&Z(`Attribute ${l} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===o&&(n.arrayStride=c.stride,n.stepMode=c.instance?"instance":"vertex",a.push({shaderLocation:r.attributeData[l].location,offset:c.offset,format:c.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){let e=tN(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[e]||(this._pipeStateCaches[e]=Object.create(null)),this._pipeCache=this._pipeStateCaches[e]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};Vc.extension={type:[w.WebGPUSystem],name:"pipeline"}});function UC(t,e,r,i,s,o){let n=o?1:-1;return t.identity(),t.a=1/i*2,t.d=n*(1/s*2),t.tx=-1-e*t.a,t.ty=-n-r*t.d,t}var OC=T(()=>{"use strict"});function LC(t){let e=t.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}var GC=T(()=>{"use strict"});var Zn,s_=T(()=>{Ae();vt();$n();OC();My();gn();Qt();Fe();nf();GC();Yy();Zn=class{constructor(e){this.rootViewPort=new te,this.viewport=new te,this.onRenderTargetChange=new zn("onRenderTargetChange"),this.projectionMatrix=new V,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e,e.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:r,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(e,r,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=LC(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(e,r=!0,i,s){let o=this.getRenderTarget(e),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=e;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let l=o.colorTexture,c=this.viewport,u=l.pixelWidth,h=l.pixelHeight;if(!s&&e instanceof B&&(s=e.frame),s){let d=l._resolution;c.x=s.x*d+.5|0,c.y=s.y*d+.5|0,c.width=s.width*d+.5|0,c.height=s.height*d+.5|0}else c.x=0,c.y=0,c.width=u,c.height=h;return UC(this.projectionMatrix,0,0,c.width/l.resolution,c.height/l.resolution,!o.isRoot),this.adaptor.startRenderPass(o,r,i,c),n&&this.onRenderTargetChange.emit(o),o}clear(e,r=Mt.ALL,i){r&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,r,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,r=Mt.ALL,i,s){let o=this.bind(e,r,i,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,r,i,s,o){i.x<0&&(s.width+=i.x,o.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,o.y-=i.y,i.y=0);let{pixelWidth:n,pixelHeight:a}=e;return s.width=Math.min(s.width,n-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(e,r,i,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,r)=>{e!==r&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let r=null;return Ht.test(e)&&(e=yo(e).source),e instanceof Ic?r=e:e instanceof Re&&(r=new Ic({colorTextures:[e]}),Ht.test(e.source.resource)&&(r.isRoot=!0),e.once("destroy",()=>{r.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);let i=this._gpuRenderTargetHash[r.uid];i&&(this._gpuRenderTargetHash[r.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(e,r),r}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var ff,DC=T(()=>{"use strict";ff=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var pf,NC=T(()=>{$n();gn();Qt();DC();pf=class{init(e,r){this._renderer=e,this._renderTargetSystem=r}copyToTexture(e,r,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(e),l=n.texture.getGpuSource(r.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:o},s),r}startRenderPass(e,r=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(e),a=this.getDescriptor(e,r,i);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(e){let r=this._renderTargetSystem.getGpuRenderTarget(e);return r.contexts[0]?r.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,r,i){typeof r=="boolean"&&(r=r?Mt.ALL:Mt.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(e),n=e.colorTextures.map((c,u)=>{let h=o.contexts[u],d,f;h?d=h.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(c).createView({mipLevelCount:1}),o.msaaTextures[u]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[u]));let p=r&Mt.COLOR?"clear":"load";return i??(i=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:i,storeOp:"store",loadOp:p}}),a;if((e.stencil||e.depth)&&!e.depthStencilTexture&&(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=o.msaa?4:1),e.depthStencilTexture){let c=r&Mt.STENCIL?"clear":"load",u=r&Mt.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:c,depthClearValue:1,depthLoadOp:u,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(e,r=!0,i,s){if(!r)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let c=a.createCommandEncoder(),u=this.getDescriptor(e,r,i),h=c.beginRenderPass(u);h.setViewport(s.x,s.y,s.width,s.height,0,1),h.end();let d=c.finish();a.queue.submit([d])}else this.startRenderPass(e,r,i,s)}initGpuRenderTarget(e){e.isRoot=!0;let r=new ff;return e.colorTextures.forEach((i,s)=>{if(Ht.test(i.resource)){let o=i.resource.getContext("webgpu"),n=i.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}r.contexts[s]=o}if(r.msaa=i.source.antialias,i.source.antialias){let o=new Re({width:0,height:0,sampleCount:4});r.msaaTextures[s]=o}}),r.msaa&&(r.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),r}destroyGpuRenderTarget(e){e.contexts.forEach(r=>{r.unconfigure()}),e.msaaTextures.forEach(r=>{r.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){let r=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&r.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){let r=this._renderTargetSystem.getGpuRenderTarget(e);r.width=e.width,r.height=e.height,r.msaa&&e.colorTextures.forEach((i,s)=>{r.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var Hc,VC=T(()=>{O();s_();NC();Hc=class extends Zn{constructor(e){super(e),this.adaptor=new pf,this.adaptor.init(e,this)}};Hc.extension={type:[w.WebGPUSystem],name:"renderTarget"}});var Wc,HC=T(()=>{O();Wc=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e,this.maxTextures=e.device.limits.maxSampledTexturesPerShaderStage}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){let r=this._gpu.device,i=e.gpuLayout.map(o=>r.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[e._layoutKey]={bindGroups:i,pipeline:r.createPipelineLayout(s)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Wc.extension={type:[w.WebGPUSystem],name:"shader"}});var sr,WC=T(()=>{"use strict";sr={};sr.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};sr.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};sr.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};sr.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};sr.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};sr.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};sr["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};sr["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};sr["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};sr.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};sr.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};sr.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var $c,$C=T(()=>{O();Kr();WC();$c=class{constructor(){this.defaultState=new ht,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e){return[{format:"bgra8unorm",writeMask:0,blend:sr[e.blendMode]||sr.normal}]}destroy(){this.gpu=null}};$c.extension={type:[w.WebGPUSystem],name:"state"}});var zC,XC=T(()=>{"use strict";zC={type:"image",upload(t,e,r){let i=t.resource,s=(t.pixelWidth|0)*(t.pixelHeight|0),o=i.byteLength/s;r.device.queue.writeTexture({texture:e},i,{offset:0,rowsPerImage:t.pixelHeight,bytesPerRow:t.pixelHeight*o},{width:t.pixelWidth,height:t.pixelHeight,depthOrArrayLayers:1})}}});var o_,rN,YC,jC=T(()=>{"use strict";o_={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},rN={blockBytes:4,blockWidth:1,blockHeight:1},YC={type:"compressed",upload(t,e,r){let i=t.pixelWidth,s=t.pixelHeight,o=o_[t.format]||rN;for(let n=0;n<t.resource.length;n++){let a=t.resource[n],l=Math.ceil(i/o.blockWidth)*o.blockBytes;r.device.queue.writeTexture({texture:e,mipLevel:n},a,{offset:0,bytesPerRow:l},{width:Math.ceil(i/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var mf,n_=T(()=>{"use strict";mf={type:"image",upload(t,e,r){let i=t.resource;if(!i)return;let s=Math.min(e.width,t.resourceWidth||t.pixelWidth),o=Math.min(e.height,t.resourceHeight||t.pixelHeight),n=t.alphaMode==="premultiply-alpha-on-upload";r.device.queue.copyExternalImageToTexture({source:i},{texture:e,premultipliedAlpha:n},{width:s,height:o})}}});var qC,KC=T(()=>{n_();qC={type:"video",upload(t,e,r){mf.upload(t,e,r)}}});var gf,ZC=T(()=>{"use strict";gf=class{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let r=this.pipelines[e];return r||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
910
|
+
`}var CC=T(()=>{Zy()});function RC(t){return cf(t,"uboWgsl",PC,AC)}var MC=T(()=>{Jy();t_();CC()});var Dc,IC=T(()=>{O();Ky();Zy();MC();Dc=class extends qn{constructor(){super({createUboElements:EC,generateUboSync:RC})}};Dc.extension={type:[w.WebGPUSystem],name:"ubo"}});var Ts,uf=T(()=>{Vt();kt();Ts=class extends $e{constructor({buffer:e,offset:r,size:i}){super(),this.uid=Te("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=Te("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=r|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=Te("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var hf,BC=T(()=>{"use strict";hf=class{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);let r=this.byteIndex,i=r+e*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,r}addGroup(e){let r=this.addEmptyGroup(e.length);for(let i=0;i<e.length;i++)this.data[r/4+i]=e[i];return r}destroy(){this.data=null}}});var Ss,Nc,FC=T(()=>{O();ps();uf();Vi();BC();fs();Ss=128,Nc=class{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new hf({minUniformOffsetAlignment:Ss});let r=256/Ss;for(let i=0;i<r;i++){let s=xe.UNIFORM|xe.COPY_DST;i===0&&(s|=xe.COPY_SRC),this._buffers.push(new lt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let e in this._bindGroupHash)this._bindGroupHash[e]=null;this._batchBuffer.clear()}getUniformBindGroup(e,r){if(!r&&this._bindGroupHash[e.uid])return this._bindGroupHash[e.uid];this._renderer.ubo.ensureUniformGroup(e);let i=e.buffer.data,s=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(e,this._batchBuffer.data,s/4),this._bindGroupHash[e.uid]=this._getBindGroup(s/Ss),this._bindGroupHash[e.uid]}getUboResource(e){this._renderer.ubo.updateUniformGroup(e);let r=e.buffer.data,i=this._batchBuffer.addGroup(r);return this._getBufferResource(i/Ss)}getArrayBindGroup(e){let r=this._batchBuffer.addGroup(e);return this._getBindGroup(r/Ss)}getArrayBufferResource(e){let i=this._batchBuffer.addGroup(e)/Ss;return this._getBufferResource(i)}_getBufferResource(e){if(!this._bufferResources[e]){let r=this._buffers[e%2];this._bufferResources[e]=new Ts({buffer:r,offset:(e/2|0)*256,size:Ss})}return this._bufferResources[e]}_getBindGroup(e){if(!this._bindGroups[e]){let r=new Rt({0:this._getBufferResource(e)});this._bindGroups[e]=r}return this._bindGroups[e]}_uploadBindGroups(){let e=this._renderer.buffer,r=this._buffers[0];r.update(this._batchBuffer.byteIndex),e.updateBuffer(r);let i=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];i.copyBufferToBuffer(e.getGPUBuffer(r),Ss,e.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.finish()])}destroy(){for(let e=0;e<this._bindGroups.length;e++)this._bindGroups[e].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let e=0;e<this._buffers.length;e++)this._buffers[e].destroy();this._buffers=null;for(let e=0;e<this._bufferResources.length;e++)this._bufferResources[e].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};Nc.extension={type:[w.WebGPUPipes],name:"uniformBatch"}});function df(t,e){for(let r in t.attributes){let i=t.attributes[r],s=e[r];s?(i.format??(i.format=s.format),i.offset??(i.offset=s.offset),i.instance??(i.instance=s.instance)):Z(`Attribute ${r} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}QD(t)}function QD(t){let{buffers:e,attributes:r}=t,i={},s={};for(let o in e){let n=e[o];i[n.uid]=0,s[n.uid]=0}for(let o in r){let n=r[o];i[n.buffer.uid]+=ur(n.format).stride}for(let o in r){let n=r[o];n.stride??(n.stride=i[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=ur(n.format).stride}}var r_=T(()=>{Ne();no()});var Si,i_=T(()=>{so();Si=[];Si[Ke.NONE]=void 0;Si[Ke.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Si[Ke.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Si[Ke.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Si[Ke.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Si[Ke.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function eN(t,e,r,i,s){return t<<24|e<<16|r<<10|i<<5|s}function tN(t,e,r,i){return r<<6|t<<3|i<<1|e}var JD,Vc,kC=T(()=>{O();Ne();r_();so();Gl();i_();JD={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Vc=class{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=e}contextChange(e){this._gpu=e,this.setStencilMode(Ke.DISABLED),this._updatePipeHash()}setMultisampleCount(e){this._multisampleCount!==e&&(this._multisampleCount=e,this._updatePipeHash())}setRenderTarget(e){this._multisampleCount=e.msaaSamples,this._depthStencilAttachment=e.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=Si[e],this._updatePipeHash())}setPipeline(e,r,i,s){let o=this.getPipeline(e,r,i);s.setPipeline(o)}getPipeline(e,r,i,s){e._layoutKey||(df(e,r.attributeData),this._generateBufferKey(e)),s||(s=e.topology);let o=eN(e._layoutKey,r._layoutKey,i.data,i._blendModeId,JD[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(e,r,i,s),this._pipeCache[o])}_createPipeline(e,r,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(e,r),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Ke.RENDERING_MASK_ADD?0:this._colorMask;let l=this._renderer.shader.getProgramData(r).pipeline,c={vertex:{module:this._getModule(r.vertex.source),entryPoint:r.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(r.fragment.source),entryPoint:r.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:i.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(c.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"}),o.createRenderPipeline(c)}_getModule(e){return this._moduleCache[e]||this._createModule(e)}_createModule(e){let r=this._gpu.device;return this._moduleCache[e]=r.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){let r=[],i=0,s=Object.keys(e.attributes).sort();for(let n=0;n<s.length;n++){let a=e.attributes[s[n]];r[i++]=a.offset,r[i++]=a.format,r[i++]=a.stride,r[i++]=a.instance}let o=r.join("|");return e._layoutKey=Hi(o,"geometry"),e._layoutKey}_generateAttributeLocationsKey(e){let r=[],i=0,s=Object.keys(e.attributeData).sort();for(let n=0;n<s.length;n++){let a=e.attributeData[s[n]];r[i++]=a.location}let o=r.join("|");return e._attributeLocationsKey=Hi(o,"programAttributes"),e._attributeLocationsKey}getBufferNamesToBind(e,r){let i=e._layoutKey<<16|r._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];let s=this._createVertexBufferLayouts(e,r),o=Object.create(null),n=r.attributeData;for(let a=0;a<s.length;a++){let c=Object.values(s[a].attributes)[0].shaderLocation;for(let u in n)if(n[u].location===c){o[a]=u;break}}return this._bindingNamesCache[i]=o,o}_createVertexBufferLayouts(e,r){r._attributeLocationsKey||this._generateAttributeLocationsKey(r);let i=e._layoutKey<<16|r._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];let s=[];return e.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let l in r.attributeData){let c=e.attributes[l];(c.divisor??1)!==1&&Z(`Attribute ${l} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===o&&(n.arrayStride=c.stride,n.stepMode=c.instance?"instance":"vertex",a.push({shaderLocation:r.attributeData[l].location,offset:c.offset,format:c.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){let e=tN(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[e]||(this._pipeStateCaches[e]=Object.create(null)),this._pipeCache=this._pipeStateCaches[e]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};Vc.extension={type:[w.WebGPUSystem],name:"pipeline"}});function UC(t,e,r,i,s,o){let n=o?1:-1;return t.identity(),t.a=1/i*2,t.d=n*(1/s*2),t.tx=-1-e*t.a,t.ty=-n-r*t.d,t}var OC=T(()=>{"use strict"});function LC(t){let e=t.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}var GC=T(()=>{"use strict"});var Zn,s_=T(()=>{Ae();vt();$n();OC();My();gn();Qt();Fe();nf();GC();Yy();Zn=class{constructor(e){this.rootViewPort=new te,this.viewport=new te,this.onRenderTargetChange=new zn("onRenderTargetChange"),this.projectionMatrix=new V,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e,e.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:r,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(e,r,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=LC(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(e,r=!0,i,s){let o=this.getRenderTarget(e),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=e;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let l=o.colorTexture,c=this.viewport,u=l.pixelWidth,h=l.pixelHeight;if(!s&&e instanceof B&&(s=e.frame),s){let d=l._resolution;c.x=s.x*d+.5|0,c.y=s.y*d+.5|0,c.width=s.width*d+.5|0,c.height=s.height*d+.5|0}else c.x=0,c.y=0,c.width=u,c.height=h;return UC(this.projectionMatrix,0,0,c.width/l.resolution,c.height/l.resolution,!o.isRoot),this.adaptor.startRenderPass(o,r,i,c),n&&this.onRenderTargetChange.emit(o),o}clear(e,r=Mt.ALL,i){r&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,r,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,r=Mt.ALL,i,s){let o=this.bind(e,r,i,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,r,i,s,o){i.x<0&&(s.width+=i.x,o.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,o.y-=i.y,i.y=0);let{pixelWidth:n,pixelHeight:a}=e;return s.width=Math.min(s.width,n-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(e,r,i,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,r)=>{e!==r&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let r=null;return Ht.test(e)&&(e=yo(e).source),e instanceof Ic?r=e:e instanceof Re&&(r=new Ic({colorTextures:[e]}),Ht.test(e.source.resource)&&(r.isRoot=!0),e.once("destroy",()=>{r.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);let i=this._gpuRenderTargetHash[r.uid];i&&(this._gpuRenderTargetHash[r.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(e,r),r}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var ff,DC=T(()=>{"use strict";ff=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var pf,NC=T(()=>{$n();gn();Qt();DC();pf=class{init(e,r){this._renderer=e,this._renderTargetSystem=r}copyToTexture(e,r,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(e),l=n.texture.getGpuSource(r.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:o},s),r}startRenderPass(e,r=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(e),a=this.getDescriptor(e,r,i);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(e){let r=this._renderTargetSystem.getGpuRenderTarget(e);return r.contexts[0]?r.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,r,i){typeof r=="boolean"&&(r=r?Mt.ALL:Mt.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(e),n=e.colorTextures.map((c,u)=>{let h=o.contexts[u],d,f;h?d=h.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(c).createView({mipLevelCount:1}),o.msaaTextures[u]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[u]));let p=r&Mt.COLOR?"clear":"load";return i??(i=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:i,storeOp:"store",loadOp:p}}),a;if((e.stencil||e.depth)&&!e.depthStencilTexture&&(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=o.msaa?4:1),e.depthStencilTexture){let c=r&Mt.STENCIL?"clear":"load",u=r&Mt.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:c,depthClearValue:1,depthLoadOp:u,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(e,r=!0,i,s){if(!r)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let c=a.createCommandEncoder(),u=this.getDescriptor(e,r,i),h=c.beginRenderPass(u);h.setViewport(s.x,s.y,s.width,s.height,0,1),h.end();let d=c.finish();a.queue.submit([d])}else this.startRenderPass(e,r,i,s)}initGpuRenderTarget(e){e.isRoot=!0;let r=new ff;return e.colorTextures.forEach((i,s)=>{if(Ht.test(i.resource)){let o=i.resource.getContext("webgpu"),n=i.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}r.contexts[s]=o}if(r.msaa=i.source.antialias,i.source.antialias){let o=new Re({width:0,height:0,sampleCount:4});r.msaaTextures[s]=o}}),r.msaa&&(r.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),r}destroyGpuRenderTarget(e){e.contexts.forEach(r=>{r.unconfigure()}),e.msaaTextures.forEach(r=>{r.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){let r=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&r.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){let r=this._renderTargetSystem.getGpuRenderTarget(e);r.width=e.width,r.height=e.height,r.msaa&&e.colorTextures.forEach((i,s)=>{r.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var Hc,VC=T(()=>{O();s_();NC();Hc=class extends Zn{constructor(e){super(e),this.adaptor=new pf,this.adaptor.init(e,this)}};Hc.extension={type:[w.WebGPUSystem],name:"renderTarget"}});var Wc,HC=T(()=>{O();Wc=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e,this.maxTextures=e.device.limits.maxSampledTexturesPerShaderStage}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){let r=this._gpu.device,i=e.gpuLayout.map(o=>r.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[e._layoutKey]={bindGroups:i,pipeline:r.createPipelineLayout(s)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Wc.extension={type:[w.WebGPUSystem],name:"shader"}});var sr,WC=T(()=>{"use strict";sr={};sr.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};sr.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};sr.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};sr.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};sr.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};sr.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};sr["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};sr["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};sr["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};sr.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};sr.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};sr.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var $c,$C=T(()=>{O();Kr();WC();$c=class{constructor(){this.defaultState=new ht,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e){return[{format:"bgra8unorm",writeMask:0,blend:sr[e.blendMode]||sr.normal}]}destroy(){this.gpu=null}};$c.extension={type:[w.WebGPUSystem],name:"state"}});var zC,XC=T(()=>{"use strict";zC={type:"image",upload(t,e,r){let i=t.resource,s=(t.pixelWidth|0)*(t.pixelHeight|0),o=i.byteLength/s;r.device.queue.writeTexture({texture:e},i,{offset:0,rowsPerImage:t.pixelHeight,bytesPerRow:t.pixelHeight*o},{width:t.pixelWidth,height:t.pixelHeight,depthOrArrayLayers:1})}}});var o_,rN,YC,jC=T(()=>{"use strict";o_={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},rN={blockBytes:4,blockWidth:1,blockHeight:1},YC={type:"compressed",upload(t,e,r){let i=t.pixelWidth,s=t.pixelHeight,o=o_[t.format]||rN;for(let n=0;n<t.resource.length;n++){let a=t.resource[n],l=Math.ceil(i/o.blockWidth)*o.blockBytes;r.device.queue.writeTexture({texture:e,mipLevel:n},a,{offset:0,bytesPerRow:l},{width:Math.ceil(i/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var mf,n_=T(()=>{"use strict";mf={type:"image",upload(t,e,r){let i=t.resource;if(!i)return;let s=Math.min(e.width,t.resourceWidth||t.pixelWidth),o=Math.min(e.height,t.resourceHeight||t.pixelHeight),n=t.alphaMode==="premultiply-alpha-on-upload";r.device.queue.copyExternalImageToTexture({source:i},{texture:e,premultipliedAlpha:n},{width:s,height:o})}}});var qC,KC=T(()=>{n_();qC={type:"video",upload(t,e,r){mf.upload(t,e,r)}}});var gf,ZC=T(()=>{"use strict";gf=class{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let r=this.pipelines[e];return r||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
911
911
|
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
912
912
|
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
913
913
|
|
|
@@ -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",r.join(`
|
|
1089
|
-
`))}var eM=T(()=>{uf();Wt();Qy();QR()});var su,tM=T(()=>{O();eM();su=class{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,r,i){let s=this._renderer.shader._getProgramData(r);(!e.isStatic||e._dirtyId!==s.uniformDirtyGroups[e.uid])&&(s.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,r)(s.uniformData,e.uniforms,this._renderer,i))}_getUniformSyncFunction(e,r){return this._uniformGroupSyncHash[e._signature]?.[r._key]||this._createUniformSyncFunction(e,r)}_createUniformSyncFunction(e,r){let i=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),s=this._getSignature(e,r._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(e,r._uniformData)),i[r._key]=this._cache[s],i[r._key]}_generateUniformsSync(e,r){return JR(e,r)}_getSignature(e,r,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),r[n]&&o.push(r[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};su.extension={type:[w.WebGLSystem],name:"uniformGroup"}});function rM(t){let e={};if(e.normal=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.add=[t.ONE,t.ONE],e.multiply=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.screen=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e["screen-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.erase=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],!(t instanceof re.get().getWebGLRenderingContext()))e.min=[t.ONE,t.ONE,t.ONE,t.ONE,t.MIN,t.MIN],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,t.MAX,t.MAX];else{let i=t.getExtension("EXT_blend_minmax");i&&(e.min=[t.ONE,t.ONE,t.ONE,t.ONE,i.MIN_EXT,i.MIN_EXT],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,i.MAX_EXT,i.MAX_EXT])}return e}var iM=T(()=>{ze()});var cN,uN,hN,dN,fN,pN,sM,oM,nM=T(()=>{O();Kr();iM();cN=0,uN=1,hN=2,dN=3,fN=4,pN=5,sM=class __{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[cN]=this.setBlend,this.map[uN]=this.setOffset,this.map[hN]=this.setCullFace,this.map[dN]=this.setDepthTest,this.map[fN]=this.setFrontFace,this.map[pN]=this.setDepthMask,this.checks=[],this.defaultState=ht.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=rM(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let r=this.stateId^e.data,i=0;for(;r;)r&1&&this.map[i].call(this,!!(e.data&1<<i)),r>>=1,i++;this.stateId=e.data}for(let r=0;r<this.checks.length;r++)this.checks[r](this,e)}forceState(e){e||(e=this.defaultState);for(let r=0;r<this.map.length;r++)this.map[r].call(this,!!(e.data&1<<r));for(let r=0;r<this.checks.length;r++)this.checks[r](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(__._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(__._checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this._cullFace=e,this.gl[e?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(e){this._frontFace=e,this._frontFaceDirty=!1;let r=this._invertFrontFace?!e:e;this._glFrontFace!==r&&(this._glFrontFace=r,this.gl.frontFace(this.gl[r?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;let r=this.blendModesMap[e],i=this.gl;r.length===2?i.blendFunc(r[0],r[1]):i.blendFuncSeparate(r[0],r[1],r[2],r[3]),r.length===6?(this._blendEq=!0,i.blendEquationSeparate(r[4],r[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,r){this.gl.polygonOffset(e,r)}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(e,r){let i=this.checks.indexOf(e);r&&i===-1?this.checks.push(e):!r&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(e,r){e.setBlendMode(r.blendMode)}static _checkPolygonOffset(e,r){e.setPolygonOffset(1,r.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};sM.extension={type:[w.WebGLSystem],name:"state"};oM=sM});var Ef,aM=T(()=>{u_();Ef=class{constructor(e){this.target=c_.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=Me.UNSIGNED_BYTE,this.internalFormat=yf.RGBA,this.format=yf.RGBA,this.samplerType=0}}});var lM,cM=T(()=>{"use strict";lM={id:"buffer",upload(t,e,r){e.width===t.width||e.height===t.height?r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.width,t.height,e.format,e.type,t.resource):r.texImage2D(e.target,0,e.internalFormat,t.width,t.height,0,e.format,e.type,t.resource),e.width=t.width,e.height=t.height}}});var mN,uM,hM=T(()=>{"use strict";mN={"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},uM={id:"compressed",upload(t,e,r){r.pixelStorei(r.UNPACK_ALIGNMENT,4);let i=t.pixelWidth,s=t.pixelHeight,o=!!mN[t.format];for(let n=0;n<t.resource.length;n++){let a=t.resource[n];o?r.compressedTexImage2D(r.TEXTURE_2D,n,e.internalFormat,i,s,0,a):r.texImage2D(r.TEXTURE_2D,n,e.internalFormat,i,s,0,e.format,e.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var Af,b_=T(()=>{"use strict";Af={id:"image",upload(t,e,r,i){let s=e.width,o=e.height,n=t.pixelWidth,a=t.pixelHeight,l=t.resourceWidth,c=t.resourceHeight;l<n||c<a?((s!==n||o!==a)&&r.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,null),i===2?r.texSubImage2D(r.TEXTURE_2D,0,0,0,l,c,e.format,e.type,t.resource):r.texSubImage2D(r.TEXTURE_2D,0,0,0,e.format,e.type,t.resource)):s===n&&o===a?r.texSubImage2D(r.TEXTURE_2D,0,0,0,e.format,e.type,t.resource):i===2?r.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,t.resource):r.texImage2D(e.target,0,e.internalFormat,e.format,e.type,t.resource),e.width=n,e.height=a}}});var dM,fM=T(()=>{b_();dM={id:"video",upload(t,e,r,i){if(!t.isValid){r.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null);return}Af.upload(t,e,r,i)}}});var v_,pM,Pf,mM,gM=T(()=>{"use strict";v_={linear:9729,nearest:9728},pM={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Pf={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},mM={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function T_(t,e,r,i,s,o,n,a){let l=o;if(!a||t.addressModeU!=="repeat"||t.addressModeV!=="repeat"||t.addressModeW!=="repeat"){let c=Pf[n?"clamp-to-edge":t.addressModeU],u=Pf[n?"clamp-to-edge":t.addressModeV],h=Pf[n?"clamp-to-edge":t.addressModeW];e[s](l,e.TEXTURE_WRAP_S,c),e[s](l,e.TEXTURE_WRAP_T,u),e.TEXTURE_WRAP_R&&e[s](l,e.TEXTURE_WRAP_R,h)}if((!a||t.magFilter!=="linear")&&e[s](l,e.TEXTURE_MAG_FILTER,v_[t.magFilter]),r){if(!a||t.mipmapFilter!=="linear"){let c=pM[t.minFilter][t.mipmapFilter];e[s](l,e.TEXTURE_MIN_FILTER,c)}}else e[s](l,e.TEXTURE_MIN_FILTER,v_[t.minFilter]);if(i&&t.maxAnisotropy>1){let c=Math.min(t.maxAnisotropy,e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,c)}t.compare&&e[s](l,e.TEXTURE_COMPARE_FUNC,mM[t.compare])}var xM=T(()=>{gM()});function yM(t){return{r8unorm:t.RED,r8snorm:t.RED,r8uint:t.RED,r8sint:t.RED,r16uint:t.RED,r16sint:t.RED,r16float:t.RED,rg8unorm:t.RG,rg8snorm:t.RG,rg8uint:t.RG,rg8sint:t.RG,r32uint:t.RED,r32sint:t.RED,r32float:t.RED,rg16uint:t.RG,rg16sint:t.RG,rg16float:t.RG,rgba8unorm:t.RGBA,"rgba8unorm-srgb":t.RGBA,rgba8snorm:t.RGBA,rgba8uint:t.RGBA,rgba8sint:t.RGBA,bgra8unorm:t.RGBA,"bgra8unorm-srgb":t.RGBA,rgb9e5ufloat:t.RGB,rgb10a2unorm:t.RGBA,rg11b10ufloat:t.RGB,rg32uint:t.RG,rg32sint:t.RG,rg32float:t.RG,rgba16uint:t.RGBA,rgba16sint:t.RGBA,rgba16float:t.RGBA,rgba32uint:t.RGBA,rgba32sint:t.RGBA,rgba32float:t.RGBA,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT,depth24plus:t.DEPTH_COMPONENT,"depth24plus-stencil8":t.DEPTH_STENCIL,depth32float:t.DEPTH_COMPONENT,"depth32float-stencil8":t.DEPTH_STENCIL}}var _M=T(()=>{"use strict"});function bM(t,e){let r={},i=t.RGBA;return t instanceof re.get().getWebGLRenderingContext()?e.srgb&&(r={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},i=t.RGBA8),{r8unorm:t.R8,r8snorm:t.R8_SNORM,r8uint:t.R8UI,r8sint:t.R8I,r16uint:t.R16UI,r16sint:t.R16I,r16float:t.R16F,rg8unorm:t.RG8,rg8snorm:t.RG8_SNORM,rg8uint:t.RG8UI,rg8sint:t.RG8I,r32uint:t.R32UI,r32sint:t.R32I,r32float:t.R32F,rg16uint:t.RG16UI,rg16sint:t.RG16I,rg16float:t.RG16F,rgba8unorm:t.RGBA,...r,rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:i,rgb9e5ufloat:t.RGB9_E5,rgb10a2unorm:t.RGB10_A2,rg11b10ufloat:t.R11F_G11F_B10F,rg32uint:t.RG32UI,rg32sint:t.RG32I,rg32float:t.RG32F,rgba16uint:t.RGBA16UI,rgba16sint:t.RGBA16I,rgba16float:t.RGBA16F,rgba32uint:t.RGBA32UI,rgba32sint:t.RGBA32I,rgba32float:t.RGBA32F,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT16,depth24plus:t.DEPTH_COMPONENT24,"depth24plus-stencil8":t.DEPTH24_STENCIL8,depth32float:t.DEPTH_COMPONENT32F,"depth32float-stencil8":t.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var vM=T(()=>{ze()});function TM(t){return{r8unorm:t.UNSIGNED_BYTE,r8snorm:t.BYTE,r8uint:t.UNSIGNED_BYTE,r8sint:t.BYTE,r16uint:t.UNSIGNED_SHORT,r16sint:t.SHORT,r16float:t.HALF_FLOAT,rg8unorm:t.UNSIGNED_BYTE,rg8snorm:t.BYTE,rg8uint:t.UNSIGNED_BYTE,rg8sint:t.BYTE,r32uint:t.UNSIGNED_INT,r32sint:t.INT,r32float:t.FLOAT,rg16uint:t.UNSIGNED_SHORT,rg16sint:t.SHORT,rg16float:t.HALF_FLOAT,rgba8unorm:t.UNSIGNED_BYTE,"rgba8unorm-srgb":t.UNSIGNED_BYTE,rgba8snorm:t.BYTE,rgba8uint:t.UNSIGNED_BYTE,rgba8sint:t.BYTE,bgra8unorm:t.UNSIGNED_BYTE,"bgra8unorm-srgb":t.UNSIGNED_BYTE,rgb9e5ufloat:t.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:t.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:t.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:t.UNSIGNED_INT,rg32sint:t.INT,rg32float:t.FLOAT,rgba16uint:t.UNSIGNED_SHORT,rgba16sint:t.SHORT,rgba16float:t.HALF_FLOAT,rgba32uint:t.UNSIGNED_INT,rgba32sint:t.INT,rgba32float:t.FLOAT,stencil8:t.UNSIGNED_BYTE,depth16unorm:t.UNSIGNED_SHORT,depth24plus:t.UNSIGNED_INT,"depth24plus-stencil8":t.UNSIGNED_INT_24_8,depth32float:t.FLOAT,"depth32float-stencil8":t.FLOAT_32_UNSIGNED_INT_24_8_REV}}var SM=T(()=>{"use strict"});var gN,ou,wM=T(()=>{ze();O();Fe();aM();cM();hM();b_();fM();xM();_M();vM();SM();gN=4,ou=class{constructor(e){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:Af,buffer:lM,video:dM,compressed:uM},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=bM(e,this._renderer.context.extensions),this._mapFormatToType=TM(e),this._mapFormatToFormat=yM(e)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let r=0;r<16;r++)this.bind(B.EMPTY,r)}initSource(e){this.bind(e)}bind(e,r=0){let i=e.source;e?(this.bindSource(i,r),this._useSeparateSamplers&&this._bindSampler(i.style,r)):(this.bindSource(null,r),this._useSeparateSamplers&&this._bindSampler(null,r))}bindSource(e,r=0){let i=this._gl;if(e._touched=this._renderer.textureGC.count,this._boundTextures[r]!==e){this._boundTextures[r]=e,this._activateLocation(r),e||(e=B.EMPTY.source);let s=this.getGlSource(e);i.bindTexture(s.target,s.texture)}}_bindSampler(e,r=0){let i=this._gl;if(!e){this._boundSamplers[r]=null,i.bindSampler(r,null);return}let s=this._getGlSampler(e);this._boundSamplers[r]!==s&&(this._boundSamplers[r]=s,i.bindSampler(r,s))}unbind(e){let r=e.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===r){this._activateLocation(o);let n=this.getGlSource(r);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(e){this._activeTextureLocation!==e&&(this._activeTextureLocation=e,this._gl.activeTexture(this._gl.TEXTURE0+e))}_initSource(e){let r=this._gl,i=new Ef(r.createTexture());if(i.type=this._mapFormatToType[e.format],i.internalFormat=this._mapFormatToInternalFormat[e.format],i.format=this._mapFormatToFormat[e.format],e.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||e.isPowerOfTwo)){let s=Math.max(e.width,e.height);e.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[e.uid]=i,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceUpdate,this),e.on("styleChange",this.onStyleChange,this),e.on("destroy",this.onSourceDestroy,this),e.on("unload",this.onSourceUnload,this),e.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(e)),this.onSourceUpdate(e),this.updateStyle(e,!1),i}onStyleChange(e){this.updateStyle(e,!1)}updateStyle(e,r){let i=this._gl,s=this.getGlSource(e);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=e,T_(e.style,i,e.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,r)}onSourceUnload(e){let r=this._glTextures[e.uid];r&&(this.unbind(e),this._glTextures[e.uid]=null,this._gl.deleteTexture(r.texture))}onSourceUpdate(e){let r=this._gl,i=this.getGlSource(e);r.bindTexture(r.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=e;let s=e.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,i,r,this._renderer.context.webGLVersion):r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e.pixelWidth,e.pixelHeight,0,r.RGBA,r.UNSIGNED_BYTE,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,r=!0){r&&this.bindSource(e,0);let i=this.getGlSource(e);this._gl.generateMipmap(i.target)}onSourceDestroy(e){e.off("destroy",this.onSourceDestroy,this),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}_initSampler(e){let r=this._gl,i=this._gl.createSampler();return this._glSamplers[e._resourceId]=i,T_(e,r,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return this._glTextures[e.uid]||this._initSource(e)}generateCanvas(e){let{pixels:r,width:i,height:s}=this.getPixels(e),o=re.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(r),n.putImageData(a,0,0)}return o}getPixels(e){let r=e.source.resolution,i=e.frame,s=Math.max(Math.round(i.width*r),1),o=Math.max(Math.round(i.height*r),1),n=new Uint8Array(gN*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(e),c=a.renderTarget.getGpuRenderTarget(l),u=a.gl;return u.bindFramebuffer(u.FRAMEBUFFER,c.resolveTargetFramebuffer),u.readPixels(Math.round(i.x*r),Math.round(i.y*r),s,o,u.RGBA,u.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(B.EMPTY.source),this._boundSamplers=Object.create(null);let e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};ou.extension={type:[w.WebGLSystem],name:"texture"}});var CM={};O0(CM,{WebGLRenderer:()=>S_});var xN,yN,_N,EM,AM,PM,S_,RM=T(()=>{O();sR();oR();nR();hc();qy();br();cR();dR();gR();_R();bR();vR();TR();CR();IR();qR();tM();nM();wM();xN=[...af,tu,yR,hR,Kc,ou,ru,Zc,su,iu,Jc,oM,eu,Qc],yN=[...lf],_N=[jc,Yc,Xc],EM=[],AM=[],PM=[];K.handleByNamedList(w.WebGLSystem,EM);K.handleByNamedList(w.WebGLPipes,AM);K.handleByNamedList(w.WebGLPipesAdaptor,PM);K.add(...xN,...yN,..._N);S_=class extends vs{constructor(){let e={name:"webgl",type:Xe.WEBGL,systems:EM,renderPipes:AM,renderPipeAdaptors:PM};super(e)}}});var Ok=ce((qAe,sv)=>{"use strict";var LW=Object.prototype.hasOwnProperty,nr="~";function Iu(){}Object.create&&(Iu.prototype=Object.create(null),new Iu().__proto__||(nr=!1));function GW(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function Uk(t,e,r,i,s){if(typeof r!="function")throw new TypeError("The listener must be a function");var o=new GW(r,i||t,s),n=nr?nr+e:e;return t._events[n]?t._events[n].fn?t._events[n]=[t._events[n],o]:t._events[n].push(o):(t._events[n]=o,t._eventsCount++),t}function Kp(t,e){--t._eventsCount===0?t._events=new Iu:delete t._events[e]}function qt(){this._events=new Iu,this._eventsCount=0}qt.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)LW.call(r,i)&&e.push(nr?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};qt.prototype.listeners=function(e){var r=nr?nr+e:e,i=this._events[r];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};qt.prototype.listenerCount=function(e){var r=nr?nr+e:e,i=this._events[r];return i?i.fn?1:i.length:0};qt.prototype.emit=function(e,r,i,s,o,n){var a=nr?nr+e:e;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,u,h;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,r),!0;case 3:return l.fn.call(l.context,r,i),!0;case 4:return l.fn.call(l.context,r,i,s),!0;case 5:return l.fn.call(l.context,r,i,s,o),!0;case 6:return l.fn.call(l.context,r,i,s,o,n),!0}for(h=1,u=new Array(c-1);h<c;h++)u[h-1]=arguments[h];l.fn.apply(l.context,u)}else{var d=l.length,f;for(h=0;h<d;h++)switch(l[h].once&&this.removeListener(e,l[h].fn,void 0,!0),c){case 1:l[h].fn.call(l[h].context);break;case 2:l[h].fn.call(l[h].context,r);break;case 3:l[h].fn.call(l[h].context,r,i);break;case 4:l[h].fn.call(l[h].context,r,i,s);break;default:if(!u)for(f=1,u=new Array(c-1);f<c;f++)u[f-1]=arguments[f];l[h].fn.apply(l[h].context,u)}}return!0};qt.prototype.on=function(e,r,i){return Uk(this,e,r,i,!1)};qt.prototype.once=function(e,r,i){return Uk(this,e,r,i,!0)};qt.prototype.removeListener=function(e,r,i,s){var o=nr?nr+e:e;if(!this._events[o])return this;if(!r)return Kp(this,o),this;var n=this._events[o];if(n.fn)n.fn===r&&(!s||n.once)&&(!i||n.context===i)&&Kp(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==r||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Kp(this,o)}return this};qt.prototype.removeAllListeners=function(e){var r;return e?(r=nr?nr+e:e,this._events[r]&&Kp(this,r)):(this._events=new Iu,this._eventsCount=0),this};qt.prototype.off=qt.prototype.removeListener;qt.prototype.addListener=qt.prototype.on;qt.prefixed=nr;qt.EventEmitter=qt;typeof sv<"u"&&(sv.exports=qt)});var Lk=ce((Ba,Fa)=>{(function(t){var e=typeof Ba=="object"&&Ba&&!Ba.nodeType&&Ba,r=typeof Fa=="object"&&Fa&&!Fa.nodeType&&Fa,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(t=i);var s,o=2147483647,n=36,a=1,l=26,c=38,u=700,h=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=n-a,g=Math.floor,b=String.fromCharCode,_;function S($){throw new RangeError(v[$])}function E($,D){for(var z=$.length,le=[];z--;)le[z]=D($[z]);return le}function P($,D){var z=$.split("@"),le="";z.length>1&&(le=z[0]+"@",$=z[1]),$=$.replace(x,".");var de=$.split("."),be=E(de,D).join(".");return le+be}function C($){for(var D=[],z=0,le=$.length,de,be;z<le;)de=$.charCodeAt(z++),de>=55296&&de<=56319&&z<le?(be=$.charCodeAt(z++),(be&64512)==56320?D.push(((de&1023)<<10)+(be&1023)+65536):(D.push(de),z--)):D.push(de);return D}function M($){return E($,function(D){var z="";return D>65535&&(D-=65536,z+=b(D>>>10&1023|55296),D=56320|D&1023),z+=b(D),z}).join("")}function R($){return $-48<10?$-22:$-65<26?$-65:$-97<26?$-97:n}function F($,D){return $+22+75*($<26)-((D!=0)<<5)}function U($,D,z){var le=0;for($=z?g($/u):$>>1,$+=g($/D);$>y*l>>1;le+=n)$=g($/y);return g(le+(y+1)*$/($+c))}function W($){var D=[],z=$.length,le,de=0,be=d,Se=h,et,I,A,k,L,q,H,Y,pe;for(et=$.lastIndexOf(f),et<0&&(et=0),I=0;I<et;++I)$.charCodeAt(I)>=128&&S("not-basic"),D.push($.charCodeAt(I));for(A=et>0?et+1:0;A<z;){for(k=de,L=1,q=n;A>=z&&S("invalid-input"),H=R($.charCodeAt(A++)),(H>=n||H>g((o-de)/L))&&S("overflow"),de+=H*L,Y=q<=Se?a:q>=Se+l?l:q-Se,!(H<Y);q+=n)pe=n-Y,L>g(o/pe)&&S("overflow"),L*=pe;le=D.length+1,Se=U(de-k,le,k==0),g(de/le)>o-be&&S("overflow"),be+=g(de/le),de%=le,D.splice(de++,0,be)}return M(D)}function N($){var D,z,le,de,be,Se,et,I,A,k,L,q=[],H,Y,pe,Le;for($=C($),H=$.length,D=d,z=0,be=h,Se=0;Se<H;++Se)L=$[Se],L<128&&q.push(b(L));for(le=de=q.length,de&&q.push(f);le<H;){for(et=o,Se=0;Se<H;++Se)L=$[Se],L>=D&&L<et&&(et=L);for(Y=le+1,et-D>g((o-z)/Y)&&S("overflow"),z+=(et-D)*Y,D=et,Se=0;Se<H;++Se)if(L=$[Se],L<D&&++z>o&&S("overflow"),L==D){for(I=z,A=n;k=A<=be?a:A>=be+l?l:A-be,!(I<k);A+=n)Le=I-k,pe=n-k,q.push(b(F(k+Le%pe,0))),I=g(Le/pe);q.push(b(F(I,0))),be=U(z,Y,le==de),z=0,++le}++z,++D}return q.join("")}function G($){return P($,function(D){return p.test(D)?W(D.slice(4).toLowerCase()):D})}function X($){return P($,function(D){return m.test(D)?"xn--"+N(D):D})}if(s={version:"1.4.1",ucs2:{decode:C,encode:M},decode:W,encode:N,toASCII:X,toUnicode:G},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(e&&r)if(Fa.exports==e)r.exports=s;else for(_ in s)s.hasOwnProperty(_)&&(e[_]=s[_]);else t.punycode=s})(Ba)});var Uo=ce((KAe,Gk)=>{"use strict";Gk.exports=TypeError});var Dk=ce(()=>{});var Ou=ce((JAe,o2)=>{var pv=typeof Map=="function"&&Map.prototype,ov=Object.getOwnPropertyDescriptor&&pv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Qp=pv&&ov&&typeof ov.get=="function"?ov.get:null,Nk=pv&&Map.prototype.forEach,mv=typeof Set=="function"&&Set.prototype,nv=Object.getOwnPropertyDescriptor&&mv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Jp=mv&&nv&&typeof nv.get=="function"?nv.get:null,Vk=mv&&Set.prototype.forEach,DW=typeof WeakMap=="function"&&WeakMap.prototype,Fu=DW?WeakMap.prototype.has:null,NW=typeof WeakSet=="function"&&WeakSet.prototype,ku=NW?WeakSet.prototype.has:null,VW=typeof WeakRef=="function"&&WeakRef.prototype,Hk=VW?WeakRef.prototype.deref:null,HW=Boolean.prototype.valueOf,WW=Object.prototype.toString,$W=Function.prototype.toString,zW=String.prototype.match,gv=String.prototype.slice,Ns=String.prototype.replace,XW=String.prototype.toUpperCase,Wk=String.prototype.toLowerCase,Qk=RegExp.prototype.test,$k=Array.prototype.concat,Pi=Array.prototype.join,YW=Array.prototype.slice,zk=Math.floor,cv=typeof BigInt=="function"?BigInt.prototype.valueOf:null,av=Object.getOwnPropertySymbols,uv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ka=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Uu=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ka||!0)?Symbol.toStringTag:null,Jk=Object.prototype.propertyIsEnumerable,Xk=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Yk(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Qk.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var i=t<0?-zk(-t):zk(t);if(i!==t){var s=String(i),o=gv.call(e,s.length+1);return Ns.call(s,r,"$&_")+"."+Ns.call(Ns.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ns.call(e,r,"$&_")}var hv=Dk(),jk=hv.custom,qk=r2(jk)?jk:null,e2={__proto__:null,double:'"',single:"'"},jW={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};o2.exports=function t(e,r,i,s){var o=r||{};if(Zi(o,"quoteStyle")&&!Zi(e2,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Zi(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=Zi(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(Zi(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(Zi(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return s2(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return a?Yk(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return a?Yk(e,c):c}var u=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=u&&u>0&&typeof e=="object")return dv(e)?"[Array]":"[Object]";var h=d$(o,i);if(typeof s>"u")s=[];else if(i2(s,e)>=0)return"[Circular]";function d(U,W,N){if(W&&(s=YW.call(s),s.push(W)),N){var G={depth:o.depth};return Zi(o,"quoteStyle")&&(G.quoteStyle=o.quoteStyle),t(U,G,i+1,s)}return t(U,o,i+1,s)}if(typeof e=="function"&&!Kk(e)){var f=i$(e),p=Zp(e,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Pi.call(p,", ")+" }":"")}if(r2(e)){var m=ka?Ns.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):uv.call(e);return typeof e=="object"&&!ka?Bu(m):m}if(c$(e)){for(var x="<"+Wk.call(String(e.nodeName)),v=e.attributes||[],y=0;y<v.length;y++)x+=" "+v[y].name+"="+t2(qW(v[y].value),"double",o);return x+=">",e.childNodes&&e.childNodes.length&&(x+="..."),x+="</"+Wk.call(String(e.nodeName))+">",x}if(dv(e)){if(e.length===0)return"[]";var g=Zp(e,d);return h&&!h$(g)?"["+fv(g,h)+"]":"[ "+Pi.call(g,", ")+" ]"}if(ZW(e)){var b=Zp(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!Jk.call(e,"cause")?"{ ["+String(e)+"] "+Pi.call($k.call("[cause]: "+d(e.cause),b),", ")+" }":b.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Pi.call(b,", ")+" }"}if(typeof e=="object"&&n){if(qk&&typeof e[qk]=="function"&&hv)return hv(e,{depth:u-i});if(n!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(s$(e)){var _=[];return Nk&&Nk.call(e,function(U,W){_.push(d(W,e,!0)+" => "+d(U,e))}),Zk("Map",Qp.call(e),_,h)}if(a$(e)){var S=[];return Vk&&Vk.call(e,function(U){S.push(d(U,e))}),Zk("Set",Jp.call(e),S,h)}if(o$(e))return lv("WeakMap");if(l$(e))return lv("WeakSet");if(n$(e))return lv("WeakRef");if(JW(e))return Bu(d(Number(e)));if(t$(e))return Bu(d(cv.call(e)));if(e$(e))return Bu(HW.call(e));if(QW(e))return Bu(d(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof global<"u"&&e===global)return"{ [object globalThis] }";if(!KW(e)&&!Kk(e)){var E=Zp(e,d),P=Xk?Xk(e)===Object.prototype:e instanceof Object||e.constructor===Object,C=e instanceof Object?"":"null prototype",M=!P&&Uu&&Object(e)===e&&Uu in e?gv.call(Vs(e),8,-1):C?"Object":"",R=P||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",F=R+(M||C?"["+Pi.call($k.call([],M||[],C||[]),": ")+"] ":"");return E.length===0?F+"{}":h?F+"{"+fv(E,h)+"}":F+"{ "+Pi.call(E,", ")+" }"}return String(e)};function t2(t,e,r){var i=r.quoteStyle||e,s=e2[i];return s+t+s}function qW(t){return Ns.call(String(t),/"/g,""")}function Oo(t){return!Uu||!(typeof t=="object"&&(Uu in t||typeof t[Uu]<"u"))}function dv(t){return Vs(t)==="[object Array]"&&Oo(t)}function KW(t){return Vs(t)==="[object Date]"&&Oo(t)}function Kk(t){return Vs(t)==="[object RegExp]"&&Oo(t)}function ZW(t){return Vs(t)==="[object Error]"&&Oo(t)}function QW(t){return Vs(t)==="[object String]"&&Oo(t)}function JW(t){return Vs(t)==="[object Number]"&&Oo(t)}function e$(t){return Vs(t)==="[object Boolean]"&&Oo(t)}function r2(t){if(ka)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!uv)return!1;try{return uv.call(t),!0}catch{}return!1}function t$(t){if(!t||typeof t!="object"||!cv)return!1;try{return cv.call(t),!0}catch{}return!1}var r$=Object.prototype.hasOwnProperty||function(t){return t in this};function Zi(t,e){return r$.call(t,e)}function Vs(t){return WW.call(t)}function i$(t){if(t.name)return t.name;var e=zW.call($W.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function i2(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}function s$(t){if(!Qp||!t||typeof t!="object")return!1;try{Qp.call(t);try{Jp.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function o$(t){if(!Fu||!t||typeof t!="object")return!1;try{Fu.call(t,Fu);try{ku.call(t,ku)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function n$(t){if(!Hk||!t||typeof t!="object")return!1;try{return Hk.call(t),!0}catch{}return!1}function a$(t){if(!Jp||!t||typeof t!="object")return!1;try{Jp.call(t);try{Qp.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function l$(t){if(!ku||!t||typeof t!="object")return!1;try{ku.call(t,ku);try{Fu.call(t,Fu)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function c$(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function s2(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return s2(gv.call(t,0,e.maxStringLength),e)+i}var s=jW[e.quoteStyle||"single"];s.lastIndex=0;var o=Ns.call(Ns.call(t,s,"\\$1"),/[\x00-\x1f]/g,u$);return t2(o,"single",e)}function u$(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+XW.call(e.toString(16))}function Bu(t){return"Object("+t+")"}function lv(t){return t+" { ? }"}function Zk(t,e,r,i){var s=i?fv(r,i):Pi.call(r,", ");return t+" ("+e+") {"+s+"}"}function h$(t){for(var e=0;e<t.length;e++)if(i2(t[e],`
|
|
1090
|
-
`)>=0)return!1;return!0}function
|
|
1089
|
+
`))}var eM=T(()=>{uf();Wt();Qy();QR()});var su,tM=T(()=>{O();eM();su=class{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,r,i){let s=this._renderer.shader._getProgramData(r);(!e.isStatic||e._dirtyId!==s.uniformDirtyGroups[e.uid])&&(s.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,r)(s.uniformData,e.uniforms,this._renderer,i))}_getUniformSyncFunction(e,r){return this._uniformGroupSyncHash[e._signature]?.[r._key]||this._createUniformSyncFunction(e,r)}_createUniformSyncFunction(e,r){let i=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),s=this._getSignature(e,r._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(e,r._uniformData)),i[r._key]=this._cache[s],i[r._key]}_generateUniformsSync(e,r){return JR(e,r)}_getSignature(e,r,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),r[n]&&o.push(r[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};su.extension={type:[w.WebGLSystem],name:"uniformGroup"}});function rM(t){let e={};if(e.normal=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.add=[t.ONE,t.ONE],e.multiply=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.screen=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e["screen-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.erase=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],!(t instanceof re.get().getWebGLRenderingContext()))e.min=[t.ONE,t.ONE,t.ONE,t.ONE,t.MIN,t.MIN],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,t.MAX,t.MAX];else{let i=t.getExtension("EXT_blend_minmax");i&&(e.min=[t.ONE,t.ONE,t.ONE,t.ONE,i.MIN_EXT,i.MIN_EXT],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,i.MAX_EXT,i.MAX_EXT])}return e}var iM=T(()=>{ze()});var cN,uN,hN,dN,fN,pN,sM,oM,nM=T(()=>{O();Kr();iM();cN=0,uN=1,hN=2,dN=3,fN=4,pN=5,sM=class __{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[cN]=this.setBlend,this.map[uN]=this.setOffset,this.map[hN]=this.setCullFace,this.map[dN]=this.setDepthTest,this.map[fN]=this.setFrontFace,this.map[pN]=this.setDepthMask,this.checks=[],this.defaultState=ht.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=rM(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let r=this.stateId^e.data,i=0;for(;r;)r&1&&this.map[i].call(this,!!(e.data&1<<i)),r>>=1,i++;this.stateId=e.data}for(let r=0;r<this.checks.length;r++)this.checks[r](this,e)}forceState(e){e||(e=this.defaultState);for(let r=0;r<this.map.length;r++)this.map[r].call(this,!!(e.data&1<<r));for(let r=0;r<this.checks.length;r++)this.checks[r](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(__._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(__._checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this._cullFace=e,this.gl[e?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(e){this._frontFace=e,this._frontFaceDirty=!1;let r=this._invertFrontFace?!e:e;this._glFrontFace!==r&&(this._glFrontFace=r,this.gl.frontFace(this.gl[r?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;let r=this.blendModesMap[e],i=this.gl;r.length===2?i.blendFunc(r[0],r[1]):i.blendFuncSeparate(r[0],r[1],r[2],r[3]),r.length===6?(this._blendEq=!0,i.blendEquationSeparate(r[4],r[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,r){this.gl.polygonOffset(e,r)}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(e,r){let i=this.checks.indexOf(e);r&&i===-1?this.checks.push(e):!r&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(e,r){e.setBlendMode(r.blendMode)}static _checkPolygonOffset(e,r){e.setPolygonOffset(1,r.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};sM.extension={type:[w.WebGLSystem],name:"state"};oM=sM});var Ef,aM=T(()=>{u_();Ef=class{constructor(e){this.target=c_.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=Me.UNSIGNED_BYTE,this.internalFormat=yf.RGBA,this.format=yf.RGBA,this.samplerType=0}}});var lM,cM=T(()=>{"use strict";lM={id:"buffer",upload(t,e,r){e.width===t.width||e.height===t.height?r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.width,t.height,e.format,e.type,t.resource):r.texImage2D(e.target,0,e.internalFormat,t.width,t.height,0,e.format,e.type,t.resource),e.width=t.width,e.height=t.height}}});var mN,uM,hM=T(()=>{"use strict";mN={"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},uM={id:"compressed",upload(t,e,r){r.pixelStorei(r.UNPACK_ALIGNMENT,4);let i=t.pixelWidth,s=t.pixelHeight,o=!!mN[t.format];for(let n=0;n<t.resource.length;n++){let a=t.resource[n];o?r.compressedTexImage2D(r.TEXTURE_2D,n,e.internalFormat,i,s,0,a):r.texImage2D(r.TEXTURE_2D,n,e.internalFormat,i,s,0,e.format,e.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}}});var Af,b_=T(()=>{"use strict";Af={id:"image",upload(t,e,r,i){let s=e.width,o=e.height,n=t.pixelWidth,a=t.pixelHeight,l=t.resourceWidth,c=t.resourceHeight;l<n||c<a?((s!==n||o!==a)&&r.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,null),i===2?r.texSubImage2D(r.TEXTURE_2D,0,0,0,l,c,e.format,e.type,t.resource):r.texSubImage2D(r.TEXTURE_2D,0,0,0,e.format,e.type,t.resource)):s===n&&o===a?r.texSubImage2D(r.TEXTURE_2D,0,0,0,e.format,e.type,t.resource):i===2?r.texImage2D(e.target,0,e.internalFormat,n,a,0,e.format,e.type,t.resource):r.texImage2D(e.target,0,e.internalFormat,e.format,e.type,t.resource),e.width=n,e.height=a}}});var dM,fM=T(()=>{b_();dM={id:"video",upload(t,e,r,i){if(!t.isValid){r.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null);return}Af.upload(t,e,r,i)}}});var v_,pM,Pf,mM,gM=T(()=>{"use strict";v_={linear:9729,nearest:9728},pM={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Pf={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},mM={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function T_(t,e,r,i,s,o,n,a){let l=o;if(!a||t.addressModeU!=="repeat"||t.addressModeV!=="repeat"||t.addressModeW!=="repeat"){let c=Pf[n?"clamp-to-edge":t.addressModeU],u=Pf[n?"clamp-to-edge":t.addressModeV],h=Pf[n?"clamp-to-edge":t.addressModeW];e[s](l,e.TEXTURE_WRAP_S,c),e[s](l,e.TEXTURE_WRAP_T,u),e.TEXTURE_WRAP_R&&e[s](l,e.TEXTURE_WRAP_R,h)}if((!a||t.magFilter!=="linear")&&e[s](l,e.TEXTURE_MAG_FILTER,v_[t.magFilter]),r){if(!a||t.mipmapFilter!=="linear"){let c=pM[t.minFilter][t.mipmapFilter];e[s](l,e.TEXTURE_MIN_FILTER,c)}}else e[s](l,e.TEXTURE_MIN_FILTER,v_[t.minFilter]);if(i&&t.maxAnisotropy>1){let c=Math.min(t.maxAnisotropy,e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,c)}t.compare&&e[s](l,e.TEXTURE_COMPARE_FUNC,mM[t.compare])}var xM=T(()=>{gM()});function yM(t){return{r8unorm:t.RED,r8snorm:t.RED,r8uint:t.RED,r8sint:t.RED,r16uint:t.RED,r16sint:t.RED,r16float:t.RED,rg8unorm:t.RG,rg8snorm:t.RG,rg8uint:t.RG,rg8sint:t.RG,r32uint:t.RED,r32sint:t.RED,r32float:t.RED,rg16uint:t.RG,rg16sint:t.RG,rg16float:t.RG,rgba8unorm:t.RGBA,"rgba8unorm-srgb":t.RGBA,rgba8snorm:t.RGBA,rgba8uint:t.RGBA,rgba8sint:t.RGBA,bgra8unorm:t.RGBA,"bgra8unorm-srgb":t.RGBA,rgb9e5ufloat:t.RGB,rgb10a2unorm:t.RGBA,rg11b10ufloat:t.RGB,rg32uint:t.RG,rg32sint:t.RG,rg32float:t.RG,rgba16uint:t.RGBA,rgba16sint:t.RGBA,rgba16float:t.RGBA,rgba32uint:t.RGBA,rgba32sint:t.RGBA,rgba32float:t.RGBA,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT,depth24plus:t.DEPTH_COMPONENT,"depth24plus-stencil8":t.DEPTH_STENCIL,depth32float:t.DEPTH_COMPONENT,"depth32float-stencil8":t.DEPTH_STENCIL}}var _M=T(()=>{"use strict"});function bM(t,e){let r={},i=t.RGBA;return t instanceof re.get().getWebGLRenderingContext()?e.srgb&&(r={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},i=t.RGBA8),{r8unorm:t.R8,r8snorm:t.R8_SNORM,r8uint:t.R8UI,r8sint:t.R8I,r16uint:t.R16UI,r16sint:t.R16I,r16float:t.R16F,rg8unorm:t.RG8,rg8snorm:t.RG8_SNORM,rg8uint:t.RG8UI,rg8sint:t.RG8I,r32uint:t.R32UI,r32sint:t.R32I,r32float:t.R32F,rg16uint:t.RG16UI,rg16sint:t.RG16I,rg16float:t.RG16F,rgba8unorm:t.RGBA,...r,rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:i,rgb9e5ufloat:t.RGB9_E5,rgb10a2unorm:t.RGB10_A2,rg11b10ufloat:t.R11F_G11F_B10F,rg32uint:t.RG32UI,rg32sint:t.RG32I,rg32float:t.RG32F,rgba16uint:t.RGBA16UI,rgba16sint:t.RGBA16I,rgba16float:t.RGBA16F,rgba32uint:t.RGBA32UI,rgba32sint:t.RGBA32I,rgba32float:t.RGBA32F,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT16,depth24plus:t.DEPTH_COMPONENT24,"depth24plus-stencil8":t.DEPTH24_STENCIL8,depth32float:t.DEPTH_COMPONENT32F,"depth32float-stencil8":t.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var vM=T(()=>{ze()});function TM(t){return{r8unorm:t.UNSIGNED_BYTE,r8snorm:t.BYTE,r8uint:t.UNSIGNED_BYTE,r8sint:t.BYTE,r16uint:t.UNSIGNED_SHORT,r16sint:t.SHORT,r16float:t.HALF_FLOAT,rg8unorm:t.UNSIGNED_BYTE,rg8snorm:t.BYTE,rg8uint:t.UNSIGNED_BYTE,rg8sint:t.BYTE,r32uint:t.UNSIGNED_INT,r32sint:t.INT,r32float:t.FLOAT,rg16uint:t.UNSIGNED_SHORT,rg16sint:t.SHORT,rg16float:t.HALF_FLOAT,rgba8unorm:t.UNSIGNED_BYTE,"rgba8unorm-srgb":t.UNSIGNED_BYTE,rgba8snorm:t.BYTE,rgba8uint:t.UNSIGNED_BYTE,rgba8sint:t.BYTE,bgra8unorm:t.UNSIGNED_BYTE,"bgra8unorm-srgb":t.UNSIGNED_BYTE,rgb9e5ufloat:t.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:t.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:t.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:t.UNSIGNED_INT,rg32sint:t.INT,rg32float:t.FLOAT,rgba16uint:t.UNSIGNED_SHORT,rgba16sint:t.SHORT,rgba16float:t.HALF_FLOAT,rgba32uint:t.UNSIGNED_INT,rgba32sint:t.INT,rgba32float:t.FLOAT,stencil8:t.UNSIGNED_BYTE,depth16unorm:t.UNSIGNED_SHORT,depth24plus:t.UNSIGNED_INT,"depth24plus-stencil8":t.UNSIGNED_INT_24_8,depth32float:t.FLOAT,"depth32float-stencil8":t.FLOAT_32_UNSIGNED_INT_24_8_REV}}var SM=T(()=>{"use strict"});var gN,ou,wM=T(()=>{ze();O();Fe();aM();cM();hM();b_();fM();xM();_M();vM();SM();gN=4,ou=class{constructor(e){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:Af,buffer:lM,video:dM,compressed:uM},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=bM(e,this._renderer.context.extensions),this._mapFormatToType=TM(e),this._mapFormatToFormat=yM(e)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let r=0;r<16;r++)this.bind(B.EMPTY,r)}initSource(e){this.bind(e)}bind(e,r=0){let i=e.source;e?(this.bindSource(i,r),this._useSeparateSamplers&&this._bindSampler(i.style,r)):(this.bindSource(null,r),this._useSeparateSamplers&&this._bindSampler(null,r))}bindSource(e,r=0){let i=this._gl;if(e._touched=this._renderer.textureGC.count,this._boundTextures[r]!==e){this._boundTextures[r]=e,this._activateLocation(r),e||(e=B.EMPTY.source);let s=this.getGlSource(e);i.bindTexture(s.target,s.texture)}}_bindSampler(e,r=0){let i=this._gl;if(!e){this._boundSamplers[r]=null,i.bindSampler(r,null);return}let s=this._getGlSampler(e);this._boundSamplers[r]!==s&&(this._boundSamplers[r]=s,i.bindSampler(r,s))}unbind(e){let r=e.source,i=this._boundTextures,s=this._gl;for(let o=0;o<i.length;o++)if(i[o]===r){this._activateLocation(o);let n=this.getGlSource(r);s.bindTexture(n.target,null),i[o]=null}}_activateLocation(e){this._activeTextureLocation!==e&&(this._activeTextureLocation=e,this._gl.activeTexture(this._gl.TEXTURE0+e))}_initSource(e){let r=this._gl,i=new Ef(r.createTexture());if(i.type=this._mapFormatToType[e.format],i.internalFormat=this._mapFormatToInternalFormat[e.format],i.format=this._mapFormatToFormat[e.format],e.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||e.isPowerOfTwo)){let s=Math.max(e.width,e.height);e.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[e.uid]=i,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceUpdate,this),e.on("styleChange",this.onStyleChange,this),e.on("destroy",this.onSourceDestroy,this),e.on("unload",this.onSourceUnload,this),e.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(e)),this.onSourceUpdate(e),this.updateStyle(e,!1),i}onStyleChange(e){this.updateStyle(e,!1)}updateStyle(e,r){let i=this._gl,s=this.getGlSource(e);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=e,T_(e.style,i,e.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,r)}onSourceUnload(e){let r=this._glTextures[e.uid];r&&(this.unbind(e),this._glTextures[e.uid]=null,this._gl.deleteTexture(r.texture))}onSourceUpdate(e){let r=this._gl,i=this.getGlSource(e);r.bindTexture(r.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=e;let s=e.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,i,r,this._renderer.context.webGLVersion):r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e.pixelWidth,e.pixelHeight,0,r.RGBA,r.UNSIGNED_BYTE,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,r=!0){r&&this.bindSource(e,0);let i=this.getGlSource(e);this._gl.generateMipmap(i.target)}onSourceDestroy(e){e.off("destroy",this.onSourceDestroy,this),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}_initSampler(e){let r=this._gl,i=this._gl.createSampler();return this._glSamplers[e._resourceId]=i,T_(e,r,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return this._glTextures[e.uid]||this._initSource(e)}generateCanvas(e){let{pixels:r,width:i,height:s}=this.getPixels(e),o=re.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(r),n.putImageData(a,0,0)}return o}getPixels(e){let r=e.source.resolution,i=e.frame,s=Math.max(Math.round(i.width*r),1),o=Math.max(Math.round(i.height*r),1),n=new Uint8Array(gN*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(e),c=a.renderTarget.getGpuRenderTarget(l),u=a.gl;return u.bindFramebuffer(u.FRAMEBUFFER,c.resolveTargetFramebuffer),u.readPixels(Math.round(i.x*r),Math.round(i.y*r),s,o,u.RGBA,u.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(B.EMPTY.source),this._boundSamplers=Object.create(null);let e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};ou.extension={type:[w.WebGLSystem],name:"texture"}});var CM={};O0(CM,{WebGLRenderer:()=>S_});var xN,yN,_N,EM,AM,PM,S_,RM=T(()=>{O();sR();oR();nR();hc();qy();br();cR();dR();gR();_R();bR();vR();TR();CR();IR();qR();tM();nM();wM();xN=[...af,tu,yR,hR,Kc,ou,ru,Zc,su,iu,Jc,oM,eu,Qc],yN=[...lf],_N=[jc,Yc,Xc],EM=[],AM=[],PM=[];K.handleByNamedList(w.WebGLSystem,EM);K.handleByNamedList(w.WebGLPipes,AM);K.handleByNamedList(w.WebGLPipesAdaptor,PM);K.add(...xN,...yN,..._N);S_=class extends vs{constructor(){let e={name:"webgl",type:Xe.WEBGL,systems:EM,renderPipes:AM,renderPipeAdaptors:PM};super(e)}}});var Ok=ce((JAe,sv)=>{"use strict";var VW=Object.prototype.hasOwnProperty,nr="~";function Iu(){}Object.create&&(Iu.prototype=Object.create(null),new Iu().__proto__||(nr=!1));function HW(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function Uk(t,e,r,i,s){if(typeof r!="function")throw new TypeError("The listener must be a function");var o=new HW(r,i||t,s),n=nr?nr+e:e;return t._events[n]?t._events[n].fn?t._events[n]=[t._events[n],o]:t._events[n].push(o):(t._events[n]=o,t._eventsCount++),t}function Kp(t,e){--t._eventsCount===0?t._events=new Iu:delete t._events[e]}function qt(){this._events=new Iu,this._eventsCount=0}qt.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)VW.call(r,i)&&e.push(nr?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};qt.prototype.listeners=function(e){var r=nr?nr+e:e,i=this._events[r];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};qt.prototype.listenerCount=function(e){var r=nr?nr+e:e,i=this._events[r];return i?i.fn?1:i.length:0};qt.prototype.emit=function(e,r,i,s,o,n){var a=nr?nr+e:e;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,u,h;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,r),!0;case 3:return l.fn.call(l.context,r,i),!0;case 4:return l.fn.call(l.context,r,i,s),!0;case 5:return l.fn.call(l.context,r,i,s,o),!0;case 6:return l.fn.call(l.context,r,i,s,o,n),!0}for(h=1,u=new Array(c-1);h<c;h++)u[h-1]=arguments[h];l.fn.apply(l.context,u)}else{var d=l.length,f;for(h=0;h<d;h++)switch(l[h].once&&this.removeListener(e,l[h].fn,void 0,!0),c){case 1:l[h].fn.call(l[h].context);break;case 2:l[h].fn.call(l[h].context,r);break;case 3:l[h].fn.call(l[h].context,r,i);break;case 4:l[h].fn.call(l[h].context,r,i,s);break;default:if(!u)for(f=1,u=new Array(c-1);f<c;f++)u[f-1]=arguments[f];l[h].fn.apply(l[h].context,u)}}return!0};qt.prototype.on=function(e,r,i){return Uk(this,e,r,i,!1)};qt.prototype.once=function(e,r,i){return Uk(this,e,r,i,!0)};qt.prototype.removeListener=function(e,r,i,s){var o=nr?nr+e:e;if(!this._events[o])return this;if(!r)return Kp(this,o),this;var n=this._events[o];if(n.fn)n.fn===r&&(!s||n.once)&&(!i||n.context===i)&&Kp(this,o);else{for(var a=0,l=[],c=n.length;a<c;a++)(n[a].fn!==r||s&&!n[a].once||i&&n[a].context!==i)&&l.push(n[a]);l.length?this._events[o]=l.length===1?l[0]:l:Kp(this,o)}return this};qt.prototype.removeAllListeners=function(e){var r;return e?(r=nr?nr+e:e,this._events[r]&&Kp(this,r)):(this._events=new Iu,this._eventsCount=0),this};qt.prototype.off=qt.prototype.removeListener;qt.prototype.addListener=qt.prototype.on;qt.prefixed=nr;qt.EventEmitter=qt;typeof sv<"u"&&(sv.exports=qt)});var Lk=ce((Ba,Fa)=>{(function(t){var e=typeof Ba=="object"&&Ba&&!Ba.nodeType&&Ba,r=typeof Fa=="object"&&Fa&&!Fa.nodeType&&Fa,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(t=i);var s,o=2147483647,n=36,a=1,l=26,c=38,u=700,h=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=n-a,g=Math.floor,b=String.fromCharCode,_;function S($){throw new RangeError(v[$])}function E($,D){for(var z=$.length,le=[];z--;)le[z]=D($[z]);return le}function P($,D){var z=$.split("@"),le="";z.length>1&&(le=z[0]+"@",$=z[1]),$=$.replace(x,".");var de=$.split("."),be=E(de,D).join(".");return le+be}function C($){for(var D=[],z=0,le=$.length,de,be;z<le;)de=$.charCodeAt(z++),de>=55296&&de<=56319&&z<le?(be=$.charCodeAt(z++),(be&64512)==56320?D.push(((de&1023)<<10)+(be&1023)+65536):(D.push(de),z--)):D.push(de);return D}function M($){return E($,function(D){var z="";return D>65535&&(D-=65536,z+=b(D>>>10&1023|55296),D=56320|D&1023),z+=b(D),z}).join("")}function R($){return $-48<10?$-22:$-65<26?$-65:$-97<26?$-97:n}function F($,D){return $+22+75*($<26)-((D!=0)<<5)}function U($,D,z){var le=0;for($=z?g($/u):$>>1,$+=g($/D);$>y*l>>1;le+=n)$=g($/y);return g(le+(y+1)*$/($+c))}function W($){var D=[],z=$.length,le,de=0,be=d,Se=h,et,I,A,k,L,q,H,Y,pe;for(et=$.lastIndexOf(f),et<0&&(et=0),I=0;I<et;++I)$.charCodeAt(I)>=128&&S("not-basic"),D.push($.charCodeAt(I));for(A=et>0?et+1:0;A<z;){for(k=de,L=1,q=n;A>=z&&S("invalid-input"),H=R($.charCodeAt(A++)),(H>=n||H>g((o-de)/L))&&S("overflow"),de+=H*L,Y=q<=Se?a:q>=Se+l?l:q-Se,!(H<Y);q+=n)pe=n-Y,L>g(o/pe)&&S("overflow"),L*=pe;le=D.length+1,Se=U(de-k,le,k==0),g(de/le)>o-be&&S("overflow"),be+=g(de/le),de%=le,D.splice(de++,0,be)}return M(D)}function N($){var D,z,le,de,be,Se,et,I,A,k,L,q=[],H,Y,pe,Le;for($=C($),H=$.length,D=d,z=0,be=h,Se=0;Se<H;++Se)L=$[Se],L<128&&q.push(b(L));for(le=de=q.length,de&&q.push(f);le<H;){for(et=o,Se=0;Se<H;++Se)L=$[Se],L>=D&&L<et&&(et=L);for(Y=le+1,et-D>g((o-z)/Y)&&S("overflow"),z+=(et-D)*Y,D=et,Se=0;Se<H;++Se)if(L=$[Se],L<D&&++z>o&&S("overflow"),L==D){for(I=z,A=n;k=A<=be?a:A>=be+l?l:A-be,!(I<k);A+=n)Le=I-k,pe=n-k,q.push(b(F(k+Le%pe,0))),I=g(Le/pe);q.push(b(F(I,0))),be=U(z,Y,le==de),z=0,++le}++z,++D}return q.join("")}function G($){return P($,function(D){return p.test(D)?W(D.slice(4).toLowerCase()):D})}function X($){return P($,function(D){return m.test(D)?"xn--"+N(D):D})}if(s={version:"1.4.1",ucs2:{decode:C,encode:M},decode:W,encode:N,toASCII:X,toUnicode:G},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(e&&r)if(Fa.exports==e)r.exports=s;else for(_ in s)s.hasOwnProperty(_)&&(e[_]=s[_]);else t.punycode=s})(Ba)});var Uo=ce((e1e,Gk)=>{"use strict";Gk.exports=TypeError});var Dk=ce(()=>{});var Ou=ce((i1e,o2)=>{var pv=typeof Map=="function"&&Map.prototype,ov=Object.getOwnPropertyDescriptor&&pv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Qp=pv&&ov&&typeof ov.get=="function"?ov.get:null,Nk=pv&&Map.prototype.forEach,mv=typeof Set=="function"&&Set.prototype,nv=Object.getOwnPropertyDescriptor&&mv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Jp=mv&&nv&&typeof nv.get=="function"?nv.get:null,Vk=mv&&Set.prototype.forEach,WW=typeof WeakMap=="function"&&WeakMap.prototype,Fu=WW?WeakMap.prototype.has:null,$W=typeof WeakSet=="function"&&WeakSet.prototype,ku=$W?WeakSet.prototype.has:null,zW=typeof WeakRef=="function"&&WeakRef.prototype,Hk=zW?WeakRef.prototype.deref:null,XW=Boolean.prototype.valueOf,YW=Object.prototype.toString,jW=Function.prototype.toString,qW=String.prototype.match,gv=String.prototype.slice,Ns=String.prototype.replace,KW=String.prototype.toUpperCase,Wk=String.prototype.toLowerCase,Qk=RegExp.prototype.test,$k=Array.prototype.concat,Pi=Array.prototype.join,ZW=Array.prototype.slice,zk=Math.floor,cv=typeof BigInt=="function"?BigInt.prototype.valueOf:null,av=Object.getOwnPropertySymbols,uv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ka=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Uu=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ka||!0)?Symbol.toStringTag:null,Jk=Object.prototype.propertyIsEnumerable,Xk=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Yk(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Qk.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var i=t<0?-zk(-t):zk(t);if(i!==t){var s=String(i),o=gv.call(e,s.length+1);return Ns.call(s,r,"$&_")+"."+Ns.call(Ns.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ns.call(e,r,"$&_")}var hv=Dk(),jk=hv.custom,qk=r2(jk)?jk:null,e2={__proto__:null,double:'"',single:"'"},QW={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};o2.exports=function t(e,r,i,s){var o=r||{};if(Zi(o,"quoteStyle")&&!Zi(e2,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Zi(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=Zi(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(Zi(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(Zi(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return s2(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return a?Yk(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return a?Yk(e,c):c}var u=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=u&&u>0&&typeof e=="object")return dv(e)?"[Array]":"[Object]";var h=g$(o,i);if(typeof s>"u")s=[];else if(i2(s,e)>=0)return"[Circular]";function d(U,W,N){if(W&&(s=ZW.call(s),s.push(W)),N){var G={depth:o.depth};return Zi(o,"quoteStyle")&&(G.quoteStyle=o.quoteStyle),t(U,G,i+1,s)}return t(U,o,i+1,s)}if(typeof e=="function"&&!Kk(e)){var f=a$(e),p=Zp(e,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Pi.call(p,", ")+" }":"")}if(r2(e)){var m=ka?Ns.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):uv.call(e);return typeof e=="object"&&!ka?Bu(m):m}if(f$(e)){for(var x="<"+Wk.call(String(e.nodeName)),v=e.attributes||[],y=0;y<v.length;y++)x+=" "+v[y].name+"="+t2(JW(v[y].value),"double",o);return x+=">",e.childNodes&&e.childNodes.length&&(x+="..."),x+="</"+Wk.call(String(e.nodeName))+">",x}if(dv(e)){if(e.length===0)return"[]";var g=Zp(e,d);return h&&!m$(g)?"["+fv(g,h)+"]":"[ "+Pi.call(g,", ")+" ]"}if(t$(e)){var b=Zp(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!Jk.call(e,"cause")?"{ ["+String(e)+"] "+Pi.call($k.call("[cause]: "+d(e.cause),b),", ")+" }":b.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Pi.call(b,", ")+" }"}if(typeof e=="object"&&n){if(qk&&typeof e[qk]=="function"&&hv)return hv(e,{depth:u-i});if(n!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(l$(e)){var _=[];return Nk&&Nk.call(e,function(U,W){_.push(d(W,e,!0)+" => "+d(U,e))}),Zk("Map",Qp.call(e),_,h)}if(h$(e)){var S=[];return Vk&&Vk.call(e,function(U){S.push(d(U,e))}),Zk("Set",Jp.call(e),S,h)}if(c$(e))return lv("WeakMap");if(d$(e))return lv("WeakSet");if(u$(e))return lv("WeakRef");if(i$(e))return Bu(d(Number(e)));if(o$(e))return Bu(d(cv.call(e)));if(s$(e))return Bu(XW.call(e));if(r$(e))return Bu(d(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof global<"u"&&e===global)return"{ [object globalThis] }";if(!e$(e)&&!Kk(e)){var E=Zp(e,d),P=Xk?Xk(e)===Object.prototype:e instanceof Object||e.constructor===Object,C=e instanceof Object?"":"null prototype",M=!P&&Uu&&Object(e)===e&&Uu in e?gv.call(Vs(e),8,-1):C?"Object":"",R=P||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",F=R+(M||C?"["+Pi.call($k.call([],M||[],C||[]),": ")+"] ":"");return E.length===0?F+"{}":h?F+"{"+fv(E,h)+"}":F+"{ "+Pi.call(E,", ")+" }"}return String(e)};function t2(t,e,r){var i=r.quoteStyle||e,s=e2[i];return s+t+s}function JW(t){return Ns.call(String(t),/"/g,""")}function Oo(t){return!Uu||!(typeof t=="object"&&(Uu in t||typeof t[Uu]<"u"))}function dv(t){return Vs(t)==="[object Array]"&&Oo(t)}function e$(t){return Vs(t)==="[object Date]"&&Oo(t)}function Kk(t){return Vs(t)==="[object RegExp]"&&Oo(t)}function t$(t){return Vs(t)==="[object Error]"&&Oo(t)}function r$(t){return Vs(t)==="[object String]"&&Oo(t)}function i$(t){return Vs(t)==="[object Number]"&&Oo(t)}function s$(t){return Vs(t)==="[object Boolean]"&&Oo(t)}function r2(t){if(ka)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!uv)return!1;try{return uv.call(t),!0}catch{}return!1}function o$(t){if(!t||typeof t!="object"||!cv)return!1;try{return cv.call(t),!0}catch{}return!1}var n$=Object.prototype.hasOwnProperty||function(t){return t in this};function Zi(t,e){return n$.call(t,e)}function Vs(t){return YW.call(t)}function a$(t){if(t.name)return t.name;var e=qW.call(jW.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function i2(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}function l$(t){if(!Qp||!t||typeof t!="object")return!1;try{Qp.call(t);try{Jp.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function c$(t){if(!Fu||!t||typeof t!="object")return!1;try{Fu.call(t,Fu);try{ku.call(t,ku)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function u$(t){if(!Hk||!t||typeof t!="object")return!1;try{return Hk.call(t),!0}catch{}return!1}function h$(t){if(!Jp||!t||typeof t!="object")return!1;try{Jp.call(t);try{Qp.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function d$(t){if(!ku||!t||typeof t!="object")return!1;try{ku.call(t,ku);try{Fu.call(t,Fu)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function f$(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function s2(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return s2(gv.call(t,0,e.maxStringLength),e)+i}var s=QW[e.quoteStyle||"single"];s.lastIndex=0;var o=Ns.call(Ns.call(t,s,"\\$1"),/[\x00-\x1f]/g,p$);return t2(o,"single",e)}function p$(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+KW.call(e.toString(16))}function Bu(t){return"Object("+t+")"}function lv(t){return t+" { ? }"}function Zk(t,e,r,i){var s=i?fv(r,i):Pi.call(r,", ");return t+" ("+e+") {"+s+"}"}function m$(t){for(var e=0;e<t.length;e++)if(i2(t[e],`
|
|
1090
|
+
`)>=0)return!1;return!0}function g$(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Pi.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Pi.call(Array(e+1),r)}}function fv(t,e){if(t.length===0)return"";var r=`
|
|
1091
1091
|
`+e.prev+e.base;return r+Pi.call(t,","+r)+`
|
|
1092
|
-
`+e.prev}function Zp(t,e){var r=dv(t),i=[];if(r){i.length=t.length;for(var s=0;s<t.length;s++)i[s]=Zi(t,s)?e(t[s],t):""}var o=typeof av=="function"?av(t):[],n;if(ka){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in t)Zi(t,l)&&(r&&String(Number(l))===l&&l<t.length||ka&&n["$"+l]instanceof Symbol||(Qk.call(/[^\w$]/,l)?i.push(e(l,t)+": "+e(t[l],t)):i.push(l+": "+e(t[l],t))));if(typeof av=="function")for(var c=0;c<o.length;c++)Jk.call(t,o[c])&&i.push("["+e(o[c])+"]: "+e(t[o[c]],t));return i}});var a2=ce((e1e,n2)=>{"use strict";var f$=Ou(),p$=Uo(),em=function(t,e,r){for(var i=t,s;(s=i.next)!=null;i=s)if(s.key===e)return i.next=s.next,r||(s.next=t.next,t.next=s),s},m$=function(t,e){if(t){var r=em(t,e);return r&&r.value}},g$=function(t,e,r){var i=em(t,e);i?i.value=r:t.next={key:e,next:t.next,value:r}},x$=function(t,e){return t?!!em(t,e):!1},y$=function(t,e){if(t)return em(t,e,!0)};n2.exports=function(){var e,r={assert:function(i){if(!r.has(i))throw new p$("Side channel does not contain "+f$(i))},delete:function(i){var s=e&&e.next,o=y$(e,i);return o&&s&&s===o&&(e=void 0),!!o},get:function(i){return m$(e,i)},has:function(i){return x$(e,i)},set:function(i,s){e||(e={next:void 0}),g$(e,i,s)}};return r}});var xv=ce((t1e,l2)=>{"use strict";l2.exports=Object});var u2=ce((r1e,c2)=>{"use strict";c2.exports=Error});var d2=ce((i1e,h2)=>{"use strict";h2.exports=EvalError});var p2=ce((s1e,f2)=>{"use strict";f2.exports=RangeError});var g2=ce((o1e,m2)=>{"use strict";m2.exports=ReferenceError});var y2=ce((n1e,x2)=>{"use strict";x2.exports=SyntaxError});var b2=ce((a1e,_2)=>{"use strict";_2.exports=URIError});var T2=ce((l1e,v2)=>{"use strict";v2.exports=Math.abs});var w2=ce((c1e,S2)=>{"use strict";S2.exports=Math.floor});var A2=ce((u1e,E2)=>{"use strict";E2.exports=Math.max});var C2=ce((h1e,P2)=>{"use strict";P2.exports=Math.min});var M2=ce((d1e,R2)=>{"use strict";R2.exports=Math.pow});var B2=ce((f1e,I2)=>{"use strict";I2.exports=Math.round});var k2=ce((p1e,F2)=>{"use strict";F2.exports=Number.isNaN||function(e){return e!==e}});var O2=ce((m1e,U2)=>{"use strict";var _$=k2();U2.exports=function(e){return _$(e)||e===0?e:e<0?-1:1}});var G2=ce((g1e,L2)=>{"use strict";L2.exports=Object.getOwnPropertyDescriptor});var yv=ce((x1e,D2)=>{"use strict";var tm=G2();if(tm)try{tm([],"length")}catch{tm=null}D2.exports=tm});var V2=ce((y1e,N2)=>{"use strict";var rm=Object.defineProperty||!1;if(rm)try{rm({},"a",{value:1})}catch{rm=!1}N2.exports=rm});var W2=ce((_1e,H2)=>{"use strict";H2.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;e[r]=s;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var n=Object.getOwnPropertySymbols(e);if(n.length!==1||n[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,r);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var X2=ce((b1e,z2)=>{"use strict";var $2=typeof Symbol<"u"&&Symbol,b$=W2();z2.exports=function(){return typeof $2!="function"||typeof Symbol!="function"||typeof $2("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:b$()}});var _v=ce((v1e,Y2)=>{"use strict";Y2.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var bv=ce((T1e,j2)=>{"use strict";var v$=xv();j2.exports=v$.getPrototypeOf||null});var Z2=ce((S1e,K2)=>{"use strict";var T$="Function.prototype.bind called on incompatible ",S$=Object.prototype.toString,w$=Math.max,E$="[object Function]",q2=function(e,r){for(var i=[],s=0;s<e.length;s+=1)i[s]=e[s];for(var o=0;o<r.length;o+=1)i[o+e.length]=r[o];return i},A$=function(e,r){for(var i=[],s=r||0,o=0;s<e.length;s+=1,o+=1)i[o]=e[s];return i},P$=function(t,e){for(var r="",i=0;i<t.length;i+=1)r+=t[i],i+1<t.length&&(r+=e);return r};K2.exports=function(e){var r=this;if(typeof r!="function"||S$.apply(r)!==E$)throw new TypeError(T$+r);for(var i=A$(arguments,1),s,o=function(){if(this instanceof s){var u=r.apply(this,q2(i,arguments));return Object(u)===u?u:this}return r.apply(e,q2(i,arguments))},n=w$(0,r.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+P$(a,",")+"){ return binder.apply(this,arguments); }")(o),r.prototype){var c=function(){};c.prototype=r.prototype,s.prototype=new c,c.prototype=null}return s}});var Lu=ce((w1e,Q2)=>{"use strict";var C$=Z2();Q2.exports=Function.prototype.bind||C$});var im=ce((E1e,J2)=>{"use strict";J2.exports=Function.prototype.call});var vv=ce((A1e,eU)=>{"use strict";eU.exports=Function.prototype.apply});var rU=ce((P1e,tU)=>{"use strict";tU.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var sU=ce((C1e,iU)=>{"use strict";var R$=Lu(),M$=vv(),I$=im(),B$=rU();iU.exports=B$||R$.call(I$,M$)});var Tv=ce((R1e,oU)=>{"use strict";var F$=Lu(),k$=Uo(),U$=im(),O$=sU();oU.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new k$("a function is required");return O$(F$,U$,e)}});var hU=ce((M1e,uU)=>{"use strict";var L$=Tv(),nU=yv(),lU;try{lU=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var Sv=!!lU&&nU&&nU(Object.prototype,"__proto__"),cU=Object,aU=cU.getPrototypeOf;uU.exports=Sv&&typeof Sv.get=="function"?L$([Sv.get]):typeof aU=="function"?function(e){return aU(e==null?e:cU(e))}:!1});var gU=ce((I1e,mU)=>{"use strict";var dU=_v(),fU=bv(),pU=hU();mU.exports=dU?function(e){return dU(e)}:fU?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return fU(e)}:pU?function(e){return pU(e)}:null});var yU=ce((B1e,xU)=>{"use strict";var G$=Function.prototype.call,D$=Object.prototype.hasOwnProperty,N$=Lu();xU.exports=N$.call(G$,D$)});var nm=ce((F1e,wU)=>{"use strict";var Ee,V$=xv(),H$=u2(),W$=d2(),$$=p2(),z$=g2(),Ga=y2(),La=Uo(),X$=b2(),Y$=T2(),j$=w2(),q$=A2(),K$=C2(),Z$=M2(),Q$=B2(),J$=O2(),TU=Function,wv=function(t){try{return TU('"use strict"; return ('+t+").constructor;")()}catch{}},Gu=yv(),ez=V2(),Ev=function(){throw new La},tz=Gu?function(){try{return arguments.callee,Ev}catch{try{return Gu(arguments,"callee").get}catch{return Ev}}}():Ev,Ua=X2()(),It=gU(),rz=bv(),iz=_v(),SU=vv(),Du=im(),Oa={},sz=typeof Uint8Array>"u"||!It?Ee:It(Uint8Array),Lo={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Ee:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Ee:ArrayBuffer,"%ArrayIteratorPrototype%":Ua&&It?It([][Symbol.iterator]()):Ee,"%AsyncFromSyncIteratorPrototype%":Ee,"%AsyncFunction%":Oa,"%AsyncGenerator%":Oa,"%AsyncGeneratorFunction%":Oa,"%AsyncIteratorPrototype%":Oa,"%Atomics%":typeof Atomics>"u"?Ee:Atomics,"%BigInt%":typeof BigInt>"u"?Ee:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Ee:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Ee:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Ee:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":H$,"%eval%":eval,"%EvalError%":W$,"%Float16Array%":typeof Float16Array>"u"?Ee:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Ee:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Ee:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Ee:FinalizationRegistry,"%Function%":TU,"%GeneratorFunction%":Oa,"%Int8Array%":typeof Int8Array>"u"?Ee:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Ee:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Ee:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ua&&It?It(It([][Symbol.iterator]())):Ee,"%JSON%":typeof JSON=="object"?JSON:Ee,"%Map%":typeof Map>"u"?Ee:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ua||!It?Ee:It(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":V$,"%Object.getOwnPropertyDescriptor%":Gu,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Ee:Promise,"%Proxy%":typeof Proxy>"u"?Ee:Proxy,"%RangeError%":$$,"%ReferenceError%":z$,"%Reflect%":typeof Reflect>"u"?Ee:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Ee:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ua||!It?Ee:It(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Ee:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ua&&It?It(""[Symbol.iterator]()):Ee,"%Symbol%":Ua?Symbol:Ee,"%SyntaxError%":Ga,"%ThrowTypeError%":tz,"%TypedArray%":sz,"%TypeError%":La,"%Uint8Array%":typeof Uint8Array>"u"?Ee:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Ee:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Ee:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Ee:Uint32Array,"%URIError%":X$,"%WeakMap%":typeof WeakMap>"u"?Ee:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Ee:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Ee:WeakSet,"%Function.prototype.call%":Du,"%Function.prototype.apply%":SU,"%Object.defineProperty%":ez,"%Object.getPrototypeOf%":rz,"%Math.abs%":Y$,"%Math.floor%":j$,"%Math.max%":q$,"%Math.min%":K$,"%Math.pow%":Z$,"%Math.round%":Q$,"%Math.sign%":J$,"%Reflect.getPrototypeOf%":iz};if(It)try{null.error}catch(t){_U=It(It(t)),Lo["%Error.prototype%"]=_U}var _U,oz=function t(e){var r;if(e==="%AsyncFunction%")r=wv("async function () {}");else if(e==="%GeneratorFunction%")r=wv("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=wv("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=t("%AsyncGenerator%");s&&It&&(r=It(s.prototype))}return Lo[e]=r,r},bU={__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"]},Nu=Lu(),sm=yU(),nz=Nu.call(Du,Array.prototype.concat),az=Nu.call(SU,Array.prototype.splice),vU=Nu.call(Du,String.prototype.replace),om=Nu.call(Du,String.prototype.slice),lz=Nu.call(Du,RegExp.prototype.exec),cz=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,uz=/\\(\\)?/g,hz=function(e){var r=om(e,0,1),i=om(e,-1);if(r==="%"&&i!=="%")throw new Ga("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new Ga("invalid intrinsic syntax, expected opening `%`");var s=[];return vU(e,cz,function(o,n,a,l){s[s.length]=a?vU(l,uz,"$1"):n||o}),s},dz=function(e,r){var i=e,s;if(sm(bU,i)&&(s=bU[i],i="%"+s[0]+"%"),sm(Lo,i)){var o=Lo[i];if(o===Oa&&(o=oz(i)),typeof o>"u"&&!r)throw new La("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new Ga("intrinsic "+e+" does not exist!")};wU.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new La("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new La('"allowMissing" argument must be a boolean');if(lz(/^%?[^%]*%?$/,e)===null)throw new Ga("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=hz(e),s=i.length>0?i[0]:"",o=dz("%"+s+"%",r),n=o.name,a=o.value,l=!1,c=o.alias;c&&(s=c[0],az(i,nz([0,1],c)));for(var u=1,h=!0;u<i.length;u+=1){var d=i[u],f=om(d,0,1),p=om(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Ga("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(l=!0),s+="."+d,n="%"+s+"%",sm(Lo,n))a=Lo[n];else if(a!=null){if(!(d in a)){if(!r)throw new La("base intrinsic for "+e+" exists, but the property is not available.");return}if(Gu&&u+1>=i.length){var m=Gu(a,d);h=!!m,h&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else h=sm(a,d),a=a[d];h&&!l&&(Lo[n]=a)}}return a}});var Av=ce((k1e,PU)=>{"use strict";var EU=nm(),AU=Tv(),fz=AU([EU("%String.prototype.indexOf%")]);PU.exports=function(e,r){var i=EU(e,!!r);return typeof i=="function"&&fz(e,".prototype.")>-1?AU([i]):i}});var Pv=ce((U1e,RU)=>{"use strict";var pz=nm(),Vu=Av(),mz=Ou(),gz=Uo(),CU=pz("%Map%",!0),xz=Vu("Map.prototype.get",!0),yz=Vu("Map.prototype.set",!0),_z=Vu("Map.prototype.has",!0),bz=Vu("Map.prototype.delete",!0),vz=Vu("Map.prototype.size",!0);RU.exports=!!CU&&function(){var e,r={assert:function(i){if(!r.has(i))throw new gz("Side channel does not contain "+mz(i))},delete:function(i){if(e){var s=bz(e,i);return vz(e)===0&&(e=void 0),s}return!1},get:function(i){if(e)return xz(e,i)},has:function(i){return e?_z(e,i):!1},set:function(i,s){e||(e=new CU),yz(e,i,s)}};return r}});var IU=ce((O1e,MU)=>{"use strict";var Tz=nm(),lm=Av(),Sz=Ou(),am=Pv(),wz=Uo(),Da=Tz("%WeakMap%",!0),Ez=lm("WeakMap.prototype.get",!0),Az=lm("WeakMap.prototype.set",!0),Pz=lm("WeakMap.prototype.has",!0),Cz=lm("WeakMap.prototype.delete",!0);MU.exports=Da?function(){var e,r,i={assert:function(s){if(!i.has(s))throw new wz("Side channel does not contain "+Sz(s))},delete:function(s){if(Da&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Cz(e,s)}else if(am&&r)return r.delete(s);return!1},get:function(s){return Da&&s&&(typeof s=="object"||typeof s=="function")&&e?Ez(e,s):r&&r.get(s)},has:function(s){return Da&&s&&(typeof s=="object"||typeof s=="function")&&e?Pz(e,s):!!r&&r.has(s)},set:function(s,o){Da&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Da),Az(e,s,o)):am&&(r||(r=am()),r.set(s,o))}};return i}:am});var FU=ce((L1e,BU)=>{"use strict";var Rz=Uo(),Mz=Ou(),Iz=a2(),Bz=Pv(),Fz=IU(),kz=Fz||Bz||Iz;BU.exports=function(){var e,r={assert:function(i){if(!r.has(i))throw new Rz("Side channel does not contain "+Mz(i))},delete:function(i){return!!e&&e.delete(i)},get:function(i){return e&&e.get(i)},has:function(i){return!!e&&e.has(i)},set:function(i,s){e||(e=kz()),e.set(i,s)}};return r}});var cm=ce((G1e,kU)=>{"use strict";var Uz=String.prototype.replace,Oz=/%20/g,Cv={RFC1738:"RFC1738",RFC3986:"RFC3986"};kU.exports={default:Cv.RFC3986,formatters:{RFC1738:function(t){return Uz.call(t,Oz,"+")},RFC3986:function(t){return String(t)}},RFC1738:Cv.RFC1738,RFC3986:Cv.RFC3986}});var Iv=ce((D1e,OU)=>{"use strict";var Lz=cm(),Rv=Object.prototype.hasOwnProperty,Go=Array.isArray,Ci=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Gz=function(e){for(;e.length>1;){var r=e.pop(),i=r.obj[r.prop];if(Go(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);r.obj[r.prop]=s}}},UU=function(e,r){for(var i=r&&r.plainObjects?{__proto__:null}:{},s=0;s<e.length;++s)typeof e[s]<"u"&&(i[s]=e[s]);return i},Dz=function t(e,r,i){if(!r)return e;if(typeof r!="object"&&typeof r!="function"){if(Go(e))e.push(r);else if(e&&typeof e=="object")(i&&(i.plainObjects||i.allowPrototypes)||!Rv.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var s=e;return Go(e)&&!Go(r)&&(s=UU(e,i)),Go(e)&&Go(r)?(r.forEach(function(o,n){if(Rv.call(e,n)){var a=e[n];a&&typeof a=="object"&&o&&typeof o=="object"?e[n]=t(a,o,i):e.push(o)}else e[n]=o}),e):Object.keys(r).reduce(function(o,n){var a=r[n];return Rv.call(o,n)?o[n]=t(o[n],a,i):o[n]=a,o},s)},Nz=function(e,r){return Object.keys(r).reduce(function(i,s){return i[s]=r[s],i},e)},Vz=function(t,e,r){var i=t.replace(/\+/g," ");if(r==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},Mv=1024,Hz=function(e,r,i,s,o){if(e.length===0)return e;var n=e;if(typeof e=="symbol"?n=Symbol.prototype.toString.call(e):typeof e!="string"&&(n=String(e)),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+=Mv){for(var c=n.length>=Mv?n.slice(l,l+Mv):n,u=[],h=0;h<c.length;++h){var d=c.charCodeAt(h);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===Lz.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(h);continue}if(d<128){u[u.length]=Ci[d];continue}if(d<2048){u[u.length]=Ci[192|d>>6]+Ci[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=Ci[224|d>>12]+Ci[128|d>>6&63]+Ci[128|d&63];continue}h+=1,d=65536+((d&1023)<<10|c.charCodeAt(h)&1023),u[u.length]=Ci[240|d>>18]+Ci[128|d>>12&63]+Ci[128|d>>6&63]+Ci[128|d&63]}a+=u.join("")}return a},Wz=function(e){for(var r=[{obj:{o:e},prop:"o"}],i=[],s=0;s<r.length;++s)for(var o=r[s],n=o.obj[o.prop],a=Object.keys(n),l=0;l<a.length;++l){var c=a[l],u=n[c];typeof u=="object"&&u!==null&&i.indexOf(u)===-1&&(r.push({obj:n,prop:c}),i.push(u))}return Gz(r),e},$z=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},zz=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Xz=function(e,r){return[].concat(e,r)},Yz=function(e,r){if(Go(e)){for(var i=[],s=0;s<e.length;s+=1)i.push(r(e[s]));return i}return r(e)};OU.exports={arrayToObject:UU,assign:Nz,combine:Xz,compact:Wz,decode:Vz,encode:Hz,isBuffer:zz,isRegExp:$z,maybeMap:Yz,merge:Dz}});var HU=ce((N1e,VU)=>{"use strict";var GU=FU(),um=Iv(),Hu=cm(),jz=Object.prototype.hasOwnProperty,DU={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},Ri=Array.isArray,qz=Array.prototype.push,NU=function(t,e){qz.apply(t,Ri(e)?e:[e])},Kz=Date.prototype.toISOString,LU=Hu.default,At={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:um.encode,encodeValuesOnly:!1,filter:void 0,format:LU,formatter:Hu.formatters[LU],indices:!1,serializeDate:function(e){return Kz.call(e)},skipNulls:!1,strictNullHandling:!1},Zz=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Bv={},Qz=function t(e,r,i,s,o,n,a,l,c,u,h,d,f,p,m,x,v,y){for(var g=e,b=y,_=0,S=!1;(b=b.get(Bv))!==void 0&&!S;){var E=b.get(e);if(_+=1,typeof E<"u"){if(E===_)throw new RangeError("Cyclic object value");S=!0}typeof b.get(Bv)>"u"&&(_=0)}if(typeof u=="function"?g=u(r,g):g instanceof Date?g=f(g):i==="comma"&&Ri(g)&&(g=um.maybeMap(g,function(z){return z instanceof Date?f(z):z})),g===null){if(n)return c&&!x?c(r,At.encoder,v,"key",p):r;g=""}if(Zz(g)||um.isBuffer(g)){if(c){var P=x?r:c(r,At.encoder,v,"key",p);return[m(P)+"="+m(c(g,At.encoder,v,"value",p))]}return[m(r)+"="+m(String(g))]}var C=[];if(typeof g>"u")return C;var M;if(i==="comma"&&Ri(g))x&&c&&(g=um.maybeMap(g,c)),M=[{value:g.length>0?g.join(",")||null:void 0}];else if(Ri(u))M=u;else{var R=Object.keys(g);M=h?R.sort(h):R}var F=l?String(r).replace(/\./g,"%2E"):String(r),U=s&&Ri(g)&&g.length===1?F+"[]":F;if(o&&Ri(g)&&g.length===0)return U+"[]";for(var W=0;W<M.length;++W){var N=M[W],G=typeof N=="object"&&N&&typeof N.value<"u"?N.value:g[N];if(!(a&&G===null)){var X=d&&l?String(N).replace(/\./g,"%2E"):String(N),$=Ri(g)?typeof i=="function"?i(U,X):U:U+(d?"."+X:"["+X+"]");y.set(e,_);var D=GU();D.set(Bv,y),NU(C,t(G,$,i,s,o,n,a,l,i==="comma"&&x&&Ri(g)?null:c,u,h,d,f,p,m,x,v,D))}}return C},Jz=function(e){if(!e)return At;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||At.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Hu.default;if(typeof e.format<"u"){if(!jz.call(Hu.formatters,e.format))throw new TypeError("Unknown format option provided.");i=e.format}var s=Hu.formatters[i],o=At.filter;(typeof e.filter=="function"||Ri(e.filter))&&(o=e.filter);var n;if(e.arrayFormat in DU?n=e.arrayFormat:"indices"in e?n=e.indices?"indices":"repeat":n=At.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:At.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:At.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:At.allowEmptyArrays,arrayFormat:n,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:At.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?At.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:At.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:At.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:At.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:At.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:At.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:At.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:At.strictNullHandling}};VU.exports=function(t,e){var r=t,i=Jz(e),s,o;typeof i.filter=="function"?(o=i.filter,r=o("",r)):Ri(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof r!="object"||r===null)return"";var a=DU[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(r)),i.sort&&s.sort(i.sort);for(var c=GU(),u=0;u<s.length;++u){var h=s[u],d=r[h];i.skipNulls&&d===null||NU(n,Qz(d,h,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 XU=ce((V1e,zU)=>{"use strict";var Do=Iv(),Fv=Object.prototype.hasOwnProperty,WU=Array.isArray,ut={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Do.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},eX=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},$U=function(t,e,r){if(t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1)return t.split(",");if(e.throwOnLimitExceeded&&r>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return t},tX="utf8=%26%2310003%3B",rX="utf8=%E2%9C%93",iX=function(e,r){var i={__proto__:null},s=r.ignoreQueryPrefix?e.replace(/^\?/,""):e;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=r.parameterLimit===1/0?void 0:r.parameterLimit,n=s.split(r.delimiter,r.throwOnLimitExceeded?o+1:o);if(r.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,c=r.charset;if(r.charsetSentinel)for(l=0;l<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===rX?c="utf-8":n[l]===tX&&(c="iso-8859-1"),a=l,l=n.length);for(l=0;l<n.length;++l)if(l!==a){var u=n[l],h=u.indexOf("]="),d=h===-1?u.indexOf("="):h+1,f,p;d===-1?(f=r.decoder(u,ut.decoder,c,"key"),p=r.strictNullHandling?null:""):(f=r.decoder(u.slice(0,d),ut.decoder,c,"key"),p=Do.maybeMap($U(u.slice(d+1),r,WU(i[f])?i[f].length:0),function(x){return r.decoder(x,ut.decoder,c,"value")})),p&&r.interpretNumericEntities&&c==="iso-8859-1"&&(p=eX(String(p))),u.indexOf("[]=")>-1&&(p=WU(p)?[p]:p);var m=Fv.call(i,f);m&&r.duplicates==="combine"?i[f]=Do.combine(i[f],p):(!m||r.duplicates==="last")&&(i[f]=p)}return i},sX=function(t,e,r,i){var s=0;if(t.length>0&&t[t.length-1]==="[]"){var o=t.slice(0,-1).join("");s=Array.isArray(e)&&e[o]?e[o].length:0}for(var n=i?e:$U(e,r,s),a=t.length-1;a>=0;--a){var l,c=t[a];if(c==="[]"&&r.parseArrays)l=r.allowEmptyArrays&&(n===""||r.strictNullHandling&&n===null)?[]:Do.combine([],n);else{l=r.plainObjects?{__proto__:null}:{};var u=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,h=r.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(h,10);!r.parseArrays&&h===""?l={0:n}:!isNaN(d)&&c!==h&&String(d)===h&&d>=0&&r.parseArrays&&d<=r.arrayLimit?(l=[],l[d]=n):h!=="__proto__"&&(l[h]=n)}n=l}return n},oX=function(e,r,i,s){if(e){var o=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),c=l?o.slice(0,l.index):o,u=[];if(c){if(!i.plainObjects&&Fv.call(Object.prototype,c)&&!i.allowPrototypes)return;u.push(c)}for(var h=0;i.depth>0&&(l=a.exec(o))!==null&&h<i.depth;){if(h+=1,!i.plainObjects&&Fv.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;u.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");u.push("["+o.slice(l.index)+"]")}return sX(u,r,i,s)}},nX=function(e){if(!e)return ut;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof e.throwOnLimitExceeded<"u"&&typeof e.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var r=typeof e.charset>"u"?ut.charset:e.charset,i=typeof e.duplicates>"u"?ut.duplicates:e.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:ut.allowDots:!!e.allowDots;return{allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:ut.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:ut.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:ut.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:ut.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ut.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:ut.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:ut.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:ut.decoder,delimiter:typeof e.delimiter=="string"||Do.isRegExp(e.delimiter)?e.delimiter:ut.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:ut.depth,duplicates:i,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:ut.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:ut.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:ut.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:ut.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ut.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};zU.exports=function(t,e){var r=nX(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?{__proto__:null}:{};for(var i=typeof t=="string"?iX(t,r):t,s=r.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=oX(a,i[a],r,typeof t=="string");s=Do.merge(s,l,r)}return r.allowSparse===!0?s:Do.compact(s)}});var jU=ce((H1e,YU)=>{"use strict";var aX=HU(),lX=XU(),cX=cm();YU.exports={formats:cX,parse:lX,stringify:aX}});var QU=ce(Va=>{"use strict";var uX=Lk();function Hr(){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 hX=/^([a-z0-9.+-]+:)/i,dX=/:[0-9]*$/,fX=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,pX=["<",">",'"',"`"," ","\r",`
|
|
1093
|
-
`," "],mX=["{","}","|","\\","^","`"].concat(pX),kv=["'"].concat(mX),qU=["%","/","?",";","#"].concat(kv),KU=["/","?","#"],gX=255,ZU=/^[+a-z0-9A-Z_-]{0,63}$/,xX=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,yX={javascript:!0,"javascript:":!0},Uv={javascript:!0,"javascript:":!0},Na={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Ov=jU();function Wu(t,e,r){if(t&&typeof t=="object"&&t instanceof Hr)return t;var i=new Hr;return i.parse(t,e,r),i}Hr.prototype.parse=function(t,e,r){if(typeof t!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),s=i!==-1&&i<t.indexOf("#")?"?":"#",o=t.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),t=o.join(s);var a=t;if(a=a.trim(),!r&&t.split("#").length===1){var l=fX.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],e?this.query=Ov.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var c=hX.exec(a);if(c){c=c[0];var u=c.toLowerCase();this.protocol=u,a=a.substr(c.length)}if(r||c||a.match(/^\/\/[^@/]+@[^@/]+/)){var h=a.substr(0,2)==="//";h&&!(c&&Uv[c])&&(a=a.substr(2),this.slashes=!0)}if(!Uv[c]&&(h||c&&!Na[c])){for(var d=-1,f=0;f<KU.length;f++){var p=a.indexOf(KU[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<qU.length;f++){var p=a.indexOf(qU[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 v=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!v)for(var y=this.hostname.split(/\./),f=0,g=y.length;f<g;f++){var b=y[f];if(b&&!b.match(ZU)){for(var _="",S=0,E=b.length;S<E;S++)b.charCodeAt(S)>127?_+="x":_+=b[S];if(!_.match(ZU)){var P=y.slice(0,f),C=y.slice(f+1),M=b.match(xX);M&&(P.push(M[1]),C.unshift(M[2])),C.length&&(a="/"+C.join(".")+a),this.hostname=P.join(".");break}}}this.hostname.length>gX?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=uX.toASCII(this.hostname));var R=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+R,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!yX[u])for(var f=0,g=kv.length;f<g;f++){var U=kv[f];if(a.indexOf(U)!==-1){var W=encodeURIComponent(U);W===U&&(W=escape(U)),a=a.split(U).join(W)}}var N=a.indexOf("#");N!==-1&&(this.hash=a.substr(N),a=a.slice(0,N));var G=a.indexOf("?");if(G!==-1?(this.search=a.substr(G),this.query=a.substr(G+1),e&&(this.query=Ov.parse(this.query)),a=a.slice(0,G)):e&&(this.search="",this.query={}),a&&(this.pathname=a),Na[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var R=this.pathname||"",X=this.search||"";this.path=R+X}return this.href=this.format(),this};function _X(t){return typeof t=="string"&&(t=Wu(t)),t instanceof Hr?t.format():Hr.prototype.format.call(t)}Hr.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=t+this.host:this.hostname&&(s=t+(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=Ov.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Na[e])&&s!==!1?(s="//"+(s||""),r&&r.charAt(0)!=="/"&&(r="/"+r)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),r=r.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),e+s+r+n+i};function bX(t,e){return Wu(t,!1,!0).resolve(e)}Hr.prototype.resolve=function(t){return this.resolveObject(Wu(t,!1,!0)).format()};function vX(t,e){return t?Wu(t,!1,!0).resolveObject(e):e}Hr.prototype.resolveObject=function(t){if(typeof t=="string"){var e=new Hr;e.parse(t,!1,!0),t=e}for(var r=new Hr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];r[o]=this[o]}if(r.hash=t.hash,t.href==="")return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var n=Object.keys(t),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(r[l]=t[l])}return Na[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!Na[t.protocol]){for(var c=Object.keys(t),u=0;u<c.length;u++){var h=c[u];r[h]=t[h]}return r.href=r.format(),r}if(r.protocol=t.protocol,!t.host&&!Uv[t.protocol]){for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),r.pathname=g.join("/")}else r.pathname=t.pathname;if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var d=r.pathname||"",f=r.search||"";r.path=d+f}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var p=r.pathname&&r.pathname.charAt(0)==="/",m=t.host||t.pathname&&t.pathname.charAt(0)==="/",x=m||p||r.host&&t.pathname,v=x,y=r.pathname&&r.pathname.split("/")||[],g=t.pathname&&t.pathname.split("/")||[],b=r.protocol&&!Na[r.protocol];if(b&&(r.hostname="",r.port=null,r.host&&(y[0]===""?y[0]=r.host:y.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),x=x&&(g[0]===""||y[0]==="")),m)r.host=t.host||t.host===""?t.host:r.host,r.hostname=t.hostname||t.hostname===""?t.hostname:r.hostname,r.search=t.search,r.query=t.query,y=g;else if(g.length)y||(y=[]),y.pop(),y=y.concat(g),r.search=t.search,r.query=t.query;else if(t.search!=null){if(b){r.host=y.shift(),r.hostname=r.host;var _=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;_&&(r.auth=_.shift(),r.hostname=_.shift(),r.host=r.hostname)}return r.search=t.search,r.query=t.query,(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!y.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var S=y.slice(-1)[0],E=(r.host||t.host||y.length>1)&&(S==="."||S==="..")||S==="",P=0,C=y.length;C>=0;C--)S=y[C],S==="."?y.splice(C,1):S===".."?(y.splice(C,1),P++):P&&(y.splice(C,1),P--);if(!x&&!v)for(;P--;P)y.unshift("..");x&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),E&&y.join("/").substr(-1)!=="/"&&y.push("");var M=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(b){r.hostname=M?"":y.length?y.shift():"",r.host=r.hostname;var _=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;_&&(r.auth=_.shift(),r.hostname=_.shift(),r.host=r.hostname)}return x=x||r.host&&y.length,x&&!M&&y.unshift(""),y.length>0?r.pathname=y.join("/"):(r.pathname=null,r.path=null),(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r};Hr.prototype.parseHost=function(){var t=this.host,e=dX.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};Va.parse=Wu;Va.resolve=bX;Va.resolveObject=vX;Va.format=_X;Va.Url=Hr});var IL=()=>{let t=new Map,e=p=>typeof p=="string"&&p.startsWith("blob:"),r=p=>p?typeof p=="string"?p:p.message||String(p):"Unknown error",i=(p,m=180)=>{if(typeof p=="string")return p.length<=m?p:`${p.slice(0,m-1)}...`},s=p=>p.match(/HTTP\s+(\d{3})/)?.[1],o=p=>{let m=r(p),x=s(m);return x==="404"?"File not found.":x==="401"||x==="403"?"Access denied.":x?.startsWith("5")?"File server error.":/URL is missing/i.test(m)?"Missing file URL.":"File could not be downloaded."},n=({key:p,value:m,error:x})=>{let v={assetKey:p,cause:r(x)};return m?.type&&(v.type=m.type),m?.url&&(v.url=i(m.url)),v},a=({key:p,value:m,error:x})=>{let v=o(x),y=`Could not load asset "${p}". ${v}`,g=new Error(y,{cause:x});return g.userMessage=y,g.rootCauseMessage=v,g.details=n({key:p,value:m,error:x}),g},l=p=>typeof p?.type=="string"&&(p.type.startsWith("image/")||p.type.startsWith("video/"))&&typeof p?.url=="string"&&!e(p.url);return{load:async p=>{let m=[];for(let[x,v]of Object.entries(p))t.has(x)||m.push([x,v]);m.length>0&&await Promise.all(m.map(async([x,v])=>{try{if(!v?.url)throw new Error("Asset URL is missing.");if(l(v)){t.set(x,{url:v.url,type:v.type,source:"url"});return}let y=await fetch(v.url);if(!y.ok)throw new Error(`HTTP ${y.status}${y.statusText?` ${y.statusText}`:""}`);let b={buffer:await y.arrayBuffer(),type:v.type,source:"buffer"};t.set(x,b)}catch(y){throw a({key:x,value:v,error:y})}}))},getBufferMap:()=>{let p={};for(let[m,x]of t.entries())p[m]=x;return p},clear:()=>t.clear(),size:()=>t.size,has:p=>t.has(p)}};O();var cP={extension:{type:w.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(lP(),DD))}};O();var hP={extension:{type:w.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(uP(),ND))}};O();ad();td();O();ze();hc();var tf;function xP(t){return tf!==void 0||(tf=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:t??vs.defaultOptions.failIfMajorPerformanceCaveat};try{if(!re.get().getWebGLRenderingContext())return!1;let i=re.get().createCanvas().getContext("webgl",e),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),tf}ze();var rf;async function yP(t={}){return rf!==void 0||(rf=await(async()=>{let e=re.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(t)).requestDevice(),!0}catch{return!1}})()),rf}hc();var MM=["webgl","webgpu","canvas"];async function IM(t){let e=[];t.preference?(e.push(t.preference),MM.forEach(o=>{o!==t.preference&&e.push(o)})):e=MM.slice();let r,i={};for(let o=0;o<e.length;o++){let n=e[o];if(n==="webgpu"&&await yP()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(iR(),rR));r=a,i={...t,...t.webgpu};break}else if(n==="webgl"&&xP(t.failIfMajorPerformanceCaveat??vs.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(RM(),CM));r=a,i={...t,...t.webgl};break}else if(n==="canvas")throw i={...t},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!r)throw new Error("No available renderer for the current environment");let s=new r;return await s.init(i),s}Yr();Oy();tt();var BM=class w_{constructor(...e){this.stage=new ie,e[0]!==void 0&&J(ue,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await IM(e),w_._plugins.forEach(r=>{r.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return J(ue,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,r=!1){let i=w_._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(r),this.stage=null,this.renderer.destroy(e),this.renderer=null}};BM._plugins=[];var nu=BM;K.handleByList(w.Application,nu._plugins);K.add(vc);O();hs();Lg();ze();O();to();vt();Fe();dy();xy();var au=class extends Gn{constructor(e,r){super();let{textures:i,data:s}=e;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 te(n.x+a.x,n.y+a.y,n.width,n.height),u=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:u}}),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=r}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){let{texture:r}=this.pages[e];r.destroy(!0)}this.pages=null}static install(e){rc.install(e)}static uninstall(e){rc.uninstall(e)}};var Cf={test(t){return typeof t=="string"&&t.startsWith("info face=")},parse(t){let e=t.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let h in e){let d=e[h].match(/^[a-z]+/gm)[0],f=e[h].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let m in f){let x=f[m].split("="),v=x[0],y=x[1].replace(/"/gm,""),g=parseFloat(y),b=isNaN(g)?y:g;p[v]=b}r[d].push(p)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=r.info,[o]=r.common,[n]=r.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=r.page;for(let h=0;h<a.length;h++)i.pages.push({id:parseInt(a[h].id,10)||0,file:a[h].file});let l={};i.baseLineOffset=i.lineHeight-parseInt(o.base,10);let c=r.char;for(let h=0;h<c.length;h++){let d=c[h],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 u=r.kerning||[];for(let h=0;h<u.length;h++){let d=parseInt(u[h].first,10),f=parseInt(u[h].second,10),p=parseInt(u[h].amount,10);i.chars[l[f]].kerning[l[d]]=p}return i}};ze();var E_={test(t){let e=t;return typeof e!="string"&&"getElementsByTagName"in e&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(t){let e={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},r=t.getElementsByTagName("info")[0],i=t.getElementsByTagName("common")[0],s=t.getElementsByTagName("distanceField")[0];s&&(e.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=t.getElementsByTagName("page"),n=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning");e.fontSize=parseInt(r.getAttribute("size"),10),e.fontFamily=r.getAttribute("face"),e.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let c=0;c<o.length;c++)e.pages.push({id:parseInt(o[c].getAttribute("id"),10)||0,file:o[c].getAttribute("file")});let l={};e.baseLineOffset=e.lineHeight-parseInt(i.getAttribute("base"),10);for(let c=0;c<n.length;c++){let u=n[c],h=parseInt(u.getAttribute("id"),10),d=u.getAttribute("letter")??u.getAttribute("char")??String.fromCharCode(h);d==="space"&&(d=" "),l[h]=d,e.chars[d]={id:h,page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xOffset:parseInt(u.getAttribute("xoffset"),10),yOffset:parseInt(u.getAttribute("yoffset"),10),xAdvance:parseInt(u.getAttribute("xadvance"),10),kerning:{}}}for(let c=0;c<a.length;c++){let u=parseInt(a[c].getAttribute("first"),10),h=parseInt(a[c].getAttribute("second"),10),d=parseInt(a[c].getAttribute("amount"),10);e.chars[l[h]].kerning[l[u]]=d}return e}};var A_={test(t){return typeof t=="string"&&t.includes("<font>")?E_.test(re.get().parseXML(t)):!1},parse(t){return E_.parse(re.get().parseXML(t))}};var bN=[".xml",".fnt"],FM={extension:{type:w.CacheParser,name:"cacheBitmapFont"},test:t=>t instanceof au,getCacheableAssets(t,e){let r={};return t.forEach(i=>{r[i]=e,r[`${i}-bitmap`]=e}),r[`${e.fontFamily}-bitmap`]=e,r}},kM={extension:{type:w.LoadParser,priority:er.Normal},name:"loadBitmapFont",test(t){return bN.includes(St.extname(t).toLowerCase())},async testParse(t){return Cf.test(t)||A_.test(t)},async parse(t,e,r){let i=Cf.test(t)?Cf.parse(t):A_.parse(t),{src:s}=e,{pages:o}=i,n=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let h=0;h<o.length;++h){let d=o[h].file,f=St.join(St.dirname(s),d);f=Rl(f,s),n.push({src:f,data:a})}let l=await r.load(n),c=n.map(h=>l[h.src]);return new au({data:i,textures:c},s)},async load(t,e){return await(await re.get().fetch(t)).text()},async unload(t,e,r){await Promise.all(t.pages.map(i=>r.unload(i.texture.source._sourceOrigin))),t.destroy()}};Ne();var Rf=class{constructor(e,r=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=r}add(e){e.forEach(r=>{this._assetList.push(r)}),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 e=[],r=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<r;i++)e.push(this._assetList.pop());await this._loader.load(e),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(e){this._isActive!==e&&(this._isActive=e,e&&!this._isLoading&&this._next())}};ds();O();Fe();var UM={extension:{type:w.CacheParser,name:"cacheTextureArray"},test:t=>Array.isArray(t)&&t.every(e=>e instanceof B),getCacheableAssets:(t,e)=>{let r={};return t.forEach(i=>{e.forEach((s,o)=>{r[i+(o===0?"":o+1)]=s})}),r}};O();async function Mf(t){if("Image"in globalThis)return new Promise(e=>{let r=new Image;r.onload=()=>{e(!0)},r.onerror=()=>{e(!1)},r.src=t});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let e=await(await fetch(t)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}var OM={extension:{type:w.DetectionParser,priority:1},test:async()=>Mf("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async t=>[...t,"avif"],remove:async t=>t.filter(e=>e!=="avif")};O();var LM=["png","jpg","jpeg"],GM={extension:{type:w.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...LM],remove:async t=>t.filter(e=>!LM.includes(e))};O();var vN="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Qn(t){return vN?!1:document.createElement("video").canPlayType(t)!==""}var DM={extension:{type:w.DetectionParser,priority:0},test:async()=>Qn("video/mp4"),add:async t=>[...t,"mp4","m4v"],remove:async t=>t.filter(e=>e!=="mp4"&&e!=="m4v")};O();var NM={extension:{type:w.DetectionParser,priority:0},test:async()=>Qn("video/ogg"),add:async t=>[...t,"ogv"],remove:async t=>t.filter(e=>e!=="ogv")};O();var VM={extension:{type:w.DetectionParser,priority:0},test:async()=>Qn("video/webm"),add:async t=>[...t,"webm"],remove:async t=>t.filter(e=>e!=="webm")};O();var HM={extension:{type:w.DetectionParser,priority:0},test:async()=>Mf("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async t=>[...t,"webp"],remove:async t=>t.filter(e=>e!=="webp")};Ne();to();Cl();ed();var If=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,r,i)=>(this._parsersValidated=!1,e[r]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,r){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(r.loadParser&&(o=this._parserHash[r.loadParser],o||Z(`[Assets] specified load parser "${r.loadParser}" not found while loading ${e}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(e,r,this)){o=a;break}}if(!o)return Z(`[Assets] ${e} 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(e,r,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,r,this)&&(s=await a.parse(s,r,this)||s,i.parser=a)}return s})(),i}async load(e,r){this._parsersValidated||this._validateParsers();let i=0,s={},o=ro(e),n=tr(e,c=>({alias:[c],src:c,data:{}})),a=n.length,l=n.map(async c=>{let u=St.toAbsolute(c.src);if(!s[c.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,c)),s[c.src]=await this.promiseCache[u].promise,r&&r(++i/a)}catch(h){throw delete this.promiseCache[u],delete s[c.src],new Error(`[Loader.load] Failed to load ${u}.
|
|
1092
|
+
`+e.prev}function Zp(t,e){var r=dv(t),i=[];if(r){i.length=t.length;for(var s=0;s<t.length;s++)i[s]=Zi(t,s)?e(t[s],t):""}var o=typeof av=="function"?av(t):[],n;if(ka){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var l in t)Zi(t,l)&&(r&&String(Number(l))===l&&l<t.length||ka&&n["$"+l]instanceof Symbol||(Qk.call(/[^\w$]/,l)?i.push(e(l,t)+": "+e(t[l],t)):i.push(l+": "+e(t[l],t))));if(typeof av=="function")for(var c=0;c<o.length;c++)Jk.call(t,o[c])&&i.push("["+e(o[c])+"]: "+e(t[o[c]],t));return i}});var a2=ce((s1e,n2)=>{"use strict";var x$=Ou(),y$=Uo(),em=function(t,e,r){for(var i=t,s;(s=i.next)!=null;i=s)if(s.key===e)return i.next=s.next,r||(s.next=t.next,t.next=s),s},_$=function(t,e){if(t){var r=em(t,e);return r&&r.value}},b$=function(t,e,r){var i=em(t,e);i?i.value=r:t.next={key:e,next:t.next,value:r}},v$=function(t,e){return t?!!em(t,e):!1},T$=function(t,e){if(t)return em(t,e,!0)};n2.exports=function(){var e,r={assert:function(i){if(!r.has(i))throw new y$("Side channel does not contain "+x$(i))},delete:function(i){var s=e&&e.next,o=T$(e,i);return o&&s&&s===o&&(e=void 0),!!o},get:function(i){return _$(e,i)},has:function(i){return v$(e,i)},set:function(i,s){e||(e={next:void 0}),b$(e,i,s)}};return r}});var xv=ce((o1e,l2)=>{"use strict";l2.exports=Object});var u2=ce((n1e,c2)=>{"use strict";c2.exports=Error});var d2=ce((a1e,h2)=>{"use strict";h2.exports=EvalError});var p2=ce((l1e,f2)=>{"use strict";f2.exports=RangeError});var g2=ce((c1e,m2)=>{"use strict";m2.exports=ReferenceError});var y2=ce((u1e,x2)=>{"use strict";x2.exports=SyntaxError});var b2=ce((h1e,_2)=>{"use strict";_2.exports=URIError});var T2=ce((d1e,v2)=>{"use strict";v2.exports=Math.abs});var w2=ce((f1e,S2)=>{"use strict";S2.exports=Math.floor});var A2=ce((p1e,E2)=>{"use strict";E2.exports=Math.max});var C2=ce((m1e,P2)=>{"use strict";P2.exports=Math.min});var M2=ce((g1e,R2)=>{"use strict";R2.exports=Math.pow});var B2=ce((x1e,I2)=>{"use strict";I2.exports=Math.round});var k2=ce((y1e,F2)=>{"use strict";F2.exports=Number.isNaN||function(e){return e!==e}});var O2=ce((_1e,U2)=>{"use strict";var S$=k2();U2.exports=function(e){return S$(e)||e===0?e:e<0?-1:1}});var G2=ce((b1e,L2)=>{"use strict";L2.exports=Object.getOwnPropertyDescriptor});var yv=ce((v1e,D2)=>{"use strict";var tm=G2();if(tm)try{tm([],"length")}catch{tm=null}D2.exports=tm});var V2=ce((T1e,N2)=>{"use strict";var rm=Object.defineProperty||!1;if(rm)try{rm({},"a",{value:1})}catch{rm=!1}N2.exports=rm});var W2=ce((S1e,H2)=>{"use strict";H2.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;e[r]=s;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var n=Object.getOwnPropertySymbols(e);if(n.length!==1||n[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,r);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var X2=ce((w1e,z2)=>{"use strict";var $2=typeof Symbol<"u"&&Symbol,w$=W2();z2.exports=function(){return typeof $2!="function"||typeof Symbol!="function"||typeof $2("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:w$()}});var _v=ce((E1e,Y2)=>{"use strict";Y2.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var bv=ce((A1e,j2)=>{"use strict";var E$=xv();j2.exports=E$.getPrototypeOf||null});var Z2=ce((P1e,K2)=>{"use strict";var A$="Function.prototype.bind called on incompatible ",P$=Object.prototype.toString,C$=Math.max,R$="[object Function]",q2=function(e,r){for(var i=[],s=0;s<e.length;s+=1)i[s]=e[s];for(var o=0;o<r.length;o+=1)i[o+e.length]=r[o];return i},M$=function(e,r){for(var i=[],s=r||0,o=0;s<e.length;s+=1,o+=1)i[o]=e[s];return i},I$=function(t,e){for(var r="",i=0;i<t.length;i+=1)r+=t[i],i+1<t.length&&(r+=e);return r};K2.exports=function(e){var r=this;if(typeof r!="function"||P$.apply(r)!==R$)throw new TypeError(A$+r);for(var i=M$(arguments,1),s,o=function(){if(this instanceof s){var u=r.apply(this,q2(i,arguments));return Object(u)===u?u:this}return r.apply(e,q2(i,arguments))},n=C$(0,r.length-i.length),a=[],l=0;l<n;l++)a[l]="$"+l;if(s=Function("binder","return function ("+I$(a,",")+"){ return binder.apply(this,arguments); }")(o),r.prototype){var c=function(){};c.prototype=r.prototype,s.prototype=new c,c.prototype=null}return s}});var Lu=ce((C1e,Q2)=>{"use strict";var B$=Z2();Q2.exports=Function.prototype.bind||B$});var im=ce((R1e,J2)=>{"use strict";J2.exports=Function.prototype.call});var vv=ce((M1e,eU)=>{"use strict";eU.exports=Function.prototype.apply});var rU=ce((I1e,tU)=>{"use strict";tU.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var sU=ce((B1e,iU)=>{"use strict";var F$=Lu(),k$=vv(),U$=im(),O$=rU();iU.exports=O$||F$.call(U$,k$)});var Tv=ce((F1e,oU)=>{"use strict";var L$=Lu(),G$=Uo(),D$=im(),N$=sU();oU.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new G$("a function is required");return N$(L$,D$,e)}});var hU=ce((k1e,uU)=>{"use strict";var V$=Tv(),nU=yv(),lU;try{lU=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var Sv=!!lU&&nU&&nU(Object.prototype,"__proto__"),cU=Object,aU=cU.getPrototypeOf;uU.exports=Sv&&typeof Sv.get=="function"?V$([Sv.get]):typeof aU=="function"?function(e){return aU(e==null?e:cU(e))}:!1});var gU=ce((U1e,mU)=>{"use strict";var dU=_v(),fU=bv(),pU=hU();mU.exports=dU?function(e){return dU(e)}:fU?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return fU(e)}:pU?function(e){return pU(e)}:null});var yU=ce((O1e,xU)=>{"use strict";var H$=Function.prototype.call,W$=Object.prototype.hasOwnProperty,$$=Lu();xU.exports=$$.call(H$,W$)});var nm=ce((L1e,wU)=>{"use strict";var Ee,z$=xv(),X$=u2(),Y$=d2(),j$=p2(),q$=g2(),Ga=y2(),La=Uo(),K$=b2(),Z$=T2(),Q$=w2(),J$=A2(),ez=C2(),tz=M2(),rz=B2(),iz=O2(),TU=Function,wv=function(t){try{return TU('"use strict"; return ('+t+").constructor;")()}catch{}},Gu=yv(),sz=V2(),Ev=function(){throw new La},oz=Gu?function(){try{return arguments.callee,Ev}catch{try{return Gu(arguments,"callee").get}catch{return Ev}}}():Ev,Ua=X2()(),It=gU(),nz=bv(),az=_v(),SU=vv(),Du=im(),Oa={},lz=typeof Uint8Array>"u"||!It?Ee:It(Uint8Array),Lo={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Ee:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Ee:ArrayBuffer,"%ArrayIteratorPrototype%":Ua&&It?It([][Symbol.iterator]()):Ee,"%AsyncFromSyncIteratorPrototype%":Ee,"%AsyncFunction%":Oa,"%AsyncGenerator%":Oa,"%AsyncGeneratorFunction%":Oa,"%AsyncIteratorPrototype%":Oa,"%Atomics%":typeof Atomics>"u"?Ee:Atomics,"%BigInt%":typeof BigInt>"u"?Ee:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Ee:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Ee:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Ee:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":X$,"%eval%":eval,"%EvalError%":Y$,"%Float16Array%":typeof Float16Array>"u"?Ee:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Ee:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Ee:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Ee:FinalizationRegistry,"%Function%":TU,"%GeneratorFunction%":Oa,"%Int8Array%":typeof Int8Array>"u"?Ee:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Ee:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Ee:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ua&&It?It(It([][Symbol.iterator]())):Ee,"%JSON%":typeof JSON=="object"?JSON:Ee,"%Map%":typeof Map>"u"?Ee:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ua||!It?Ee:It(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":z$,"%Object.getOwnPropertyDescriptor%":Gu,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Ee:Promise,"%Proxy%":typeof Proxy>"u"?Ee:Proxy,"%RangeError%":j$,"%ReferenceError%":q$,"%Reflect%":typeof Reflect>"u"?Ee:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Ee:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ua||!It?Ee:It(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Ee:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ua&&It?It(""[Symbol.iterator]()):Ee,"%Symbol%":Ua?Symbol:Ee,"%SyntaxError%":Ga,"%ThrowTypeError%":oz,"%TypedArray%":lz,"%TypeError%":La,"%Uint8Array%":typeof Uint8Array>"u"?Ee:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Ee:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Ee:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Ee:Uint32Array,"%URIError%":K$,"%WeakMap%":typeof WeakMap>"u"?Ee:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Ee:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Ee:WeakSet,"%Function.prototype.call%":Du,"%Function.prototype.apply%":SU,"%Object.defineProperty%":sz,"%Object.getPrototypeOf%":nz,"%Math.abs%":Z$,"%Math.floor%":Q$,"%Math.max%":J$,"%Math.min%":ez,"%Math.pow%":tz,"%Math.round%":rz,"%Math.sign%":iz,"%Reflect.getPrototypeOf%":az};if(It)try{null.error}catch(t){_U=It(It(t)),Lo["%Error.prototype%"]=_U}var _U,cz=function t(e){var r;if(e==="%AsyncFunction%")r=wv("async function () {}");else if(e==="%GeneratorFunction%")r=wv("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=wv("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=t("%AsyncGenerator%");s&&It&&(r=It(s.prototype))}return Lo[e]=r,r},bU={__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"]},Nu=Lu(),sm=yU(),uz=Nu.call(Du,Array.prototype.concat),hz=Nu.call(SU,Array.prototype.splice),vU=Nu.call(Du,String.prototype.replace),om=Nu.call(Du,String.prototype.slice),dz=Nu.call(Du,RegExp.prototype.exec),fz=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,pz=/\\(\\)?/g,mz=function(e){var r=om(e,0,1),i=om(e,-1);if(r==="%"&&i!=="%")throw new Ga("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new Ga("invalid intrinsic syntax, expected opening `%`");var s=[];return vU(e,fz,function(o,n,a,l){s[s.length]=a?vU(l,pz,"$1"):n||o}),s},gz=function(e,r){var i=e,s;if(sm(bU,i)&&(s=bU[i],i="%"+s[0]+"%"),sm(Lo,i)){var o=Lo[i];if(o===Oa&&(o=cz(i)),typeof o>"u"&&!r)throw new La("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new Ga("intrinsic "+e+" does not exist!")};wU.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new La("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new La('"allowMissing" argument must be a boolean');if(dz(/^%?[^%]*%?$/,e)===null)throw new Ga("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=mz(e),s=i.length>0?i[0]:"",o=gz("%"+s+"%",r),n=o.name,a=o.value,l=!1,c=o.alias;c&&(s=c[0],hz(i,uz([0,1],c)));for(var u=1,h=!0;u<i.length;u+=1){var d=i[u],f=om(d,0,1),p=om(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Ga("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(l=!0),s+="."+d,n="%"+s+"%",sm(Lo,n))a=Lo[n];else if(a!=null){if(!(d in a)){if(!r)throw new La("base intrinsic for "+e+" exists, but the property is not available.");return}if(Gu&&u+1>=i.length){var m=Gu(a,d);h=!!m,h&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else h=sm(a,d),a=a[d];h&&!l&&(Lo[n]=a)}}return a}});var Av=ce((G1e,PU)=>{"use strict";var EU=nm(),AU=Tv(),xz=AU([EU("%String.prototype.indexOf%")]);PU.exports=function(e,r){var i=EU(e,!!r);return typeof i=="function"&&xz(e,".prototype.")>-1?AU([i]):i}});var Pv=ce((D1e,RU)=>{"use strict";var yz=nm(),Vu=Av(),_z=Ou(),bz=Uo(),CU=yz("%Map%",!0),vz=Vu("Map.prototype.get",!0),Tz=Vu("Map.prototype.set",!0),Sz=Vu("Map.prototype.has",!0),wz=Vu("Map.prototype.delete",!0),Ez=Vu("Map.prototype.size",!0);RU.exports=!!CU&&function(){var e,r={assert:function(i){if(!r.has(i))throw new bz("Side channel does not contain "+_z(i))},delete:function(i){if(e){var s=wz(e,i);return Ez(e)===0&&(e=void 0),s}return!1},get:function(i){if(e)return vz(e,i)},has:function(i){return e?Sz(e,i):!1},set:function(i,s){e||(e=new CU),Tz(e,i,s)}};return r}});var IU=ce((N1e,MU)=>{"use strict";var Az=nm(),lm=Av(),Pz=Ou(),am=Pv(),Cz=Uo(),Da=Az("%WeakMap%",!0),Rz=lm("WeakMap.prototype.get",!0),Mz=lm("WeakMap.prototype.set",!0),Iz=lm("WeakMap.prototype.has",!0),Bz=lm("WeakMap.prototype.delete",!0);MU.exports=Da?function(){var e,r,i={assert:function(s){if(!i.has(s))throw new Cz("Side channel does not contain "+Pz(s))},delete:function(s){if(Da&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Bz(e,s)}else if(am&&r)return r.delete(s);return!1},get:function(s){return Da&&s&&(typeof s=="object"||typeof s=="function")&&e?Rz(e,s):r&&r.get(s)},has:function(s){return Da&&s&&(typeof s=="object"||typeof s=="function")&&e?Iz(e,s):!!r&&r.has(s)},set:function(s,o){Da&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Da),Mz(e,s,o)):am&&(r||(r=am()),r.set(s,o))}};return i}:am});var FU=ce((V1e,BU)=>{"use strict";var Fz=Uo(),kz=Ou(),Uz=a2(),Oz=Pv(),Lz=IU(),Gz=Lz||Oz||Uz;BU.exports=function(){var e,r={assert:function(i){if(!r.has(i))throw new Fz("Side channel does not contain "+kz(i))},delete:function(i){return!!e&&e.delete(i)},get:function(i){return e&&e.get(i)},has:function(i){return!!e&&e.has(i)},set:function(i,s){e||(e=Gz()),e.set(i,s)}};return r}});var cm=ce((H1e,kU)=>{"use strict";var Dz=String.prototype.replace,Nz=/%20/g,Cv={RFC1738:"RFC1738",RFC3986:"RFC3986"};kU.exports={default:Cv.RFC3986,formatters:{RFC1738:function(t){return Dz.call(t,Nz,"+")},RFC3986:function(t){return String(t)}},RFC1738:Cv.RFC1738,RFC3986:Cv.RFC3986}});var Iv=ce((W1e,OU)=>{"use strict";var Vz=cm(),Rv=Object.prototype.hasOwnProperty,Go=Array.isArray,Ci=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Hz=function(e){for(;e.length>1;){var r=e.pop(),i=r.obj[r.prop];if(Go(i)){for(var s=[],o=0;o<i.length;++o)typeof i[o]<"u"&&s.push(i[o]);r.obj[r.prop]=s}}},UU=function(e,r){for(var i=r&&r.plainObjects?{__proto__:null}:{},s=0;s<e.length;++s)typeof e[s]<"u"&&(i[s]=e[s]);return i},Wz=function t(e,r,i){if(!r)return e;if(typeof r!="object"&&typeof r!="function"){if(Go(e))e.push(r);else if(e&&typeof e=="object")(i&&(i.plainObjects||i.allowPrototypes)||!Rv.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var s=e;return Go(e)&&!Go(r)&&(s=UU(e,i)),Go(e)&&Go(r)?(r.forEach(function(o,n){if(Rv.call(e,n)){var a=e[n];a&&typeof a=="object"&&o&&typeof o=="object"?e[n]=t(a,o,i):e.push(o)}else e[n]=o}),e):Object.keys(r).reduce(function(o,n){var a=r[n];return Rv.call(o,n)?o[n]=t(o[n],a,i):o[n]=a,o},s)},$z=function(e,r){return Object.keys(r).reduce(function(i,s){return i[s]=r[s],i},e)},zz=function(t,e,r){var i=t.replace(/\+/g," ");if(r==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},Mv=1024,Xz=function(e,r,i,s,o){if(e.length===0)return e;var n=e;if(typeof e=="symbol"?n=Symbol.prototype.toString.call(e):typeof e!="string"&&(n=String(e)),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+=Mv){for(var c=n.length>=Mv?n.slice(l,l+Mv):n,u=[],h=0;h<c.length;++h){var d=c.charCodeAt(h);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===Vz.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(h);continue}if(d<128){u[u.length]=Ci[d];continue}if(d<2048){u[u.length]=Ci[192|d>>6]+Ci[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=Ci[224|d>>12]+Ci[128|d>>6&63]+Ci[128|d&63];continue}h+=1,d=65536+((d&1023)<<10|c.charCodeAt(h)&1023),u[u.length]=Ci[240|d>>18]+Ci[128|d>>12&63]+Ci[128|d>>6&63]+Ci[128|d&63]}a+=u.join("")}return a},Yz=function(e){for(var r=[{obj:{o:e},prop:"o"}],i=[],s=0;s<r.length;++s)for(var o=r[s],n=o.obj[o.prop],a=Object.keys(n),l=0;l<a.length;++l){var c=a[l],u=n[c];typeof u=="object"&&u!==null&&i.indexOf(u)===-1&&(r.push({obj:n,prop:c}),i.push(u))}return Hz(r),e},jz=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},qz=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Kz=function(e,r){return[].concat(e,r)},Zz=function(e,r){if(Go(e)){for(var i=[],s=0;s<e.length;s+=1)i.push(r(e[s]));return i}return r(e)};OU.exports={arrayToObject:UU,assign:$z,combine:Kz,compact:Yz,decode:zz,encode:Xz,isBuffer:qz,isRegExp:jz,maybeMap:Zz,merge:Wz}});var HU=ce(($1e,VU)=>{"use strict";var GU=FU(),um=Iv(),Hu=cm(),Qz=Object.prototype.hasOwnProperty,DU={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},Ri=Array.isArray,Jz=Array.prototype.push,NU=function(t,e){Jz.apply(t,Ri(e)?e:[e])},eX=Date.prototype.toISOString,LU=Hu.default,At={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:um.encode,encodeValuesOnly:!1,filter:void 0,format:LU,formatter:Hu.formatters[LU],indices:!1,serializeDate:function(e){return eX.call(e)},skipNulls:!1,strictNullHandling:!1},tX=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Bv={},rX=function t(e,r,i,s,o,n,a,l,c,u,h,d,f,p,m,x,v,y){for(var g=e,b=y,_=0,S=!1;(b=b.get(Bv))!==void 0&&!S;){var E=b.get(e);if(_+=1,typeof E<"u"){if(E===_)throw new RangeError("Cyclic object value");S=!0}typeof b.get(Bv)>"u"&&(_=0)}if(typeof u=="function"?g=u(r,g):g instanceof Date?g=f(g):i==="comma"&&Ri(g)&&(g=um.maybeMap(g,function(z){return z instanceof Date?f(z):z})),g===null){if(n)return c&&!x?c(r,At.encoder,v,"key",p):r;g=""}if(tX(g)||um.isBuffer(g)){if(c){var P=x?r:c(r,At.encoder,v,"key",p);return[m(P)+"="+m(c(g,At.encoder,v,"value",p))]}return[m(r)+"="+m(String(g))]}var C=[];if(typeof g>"u")return C;var M;if(i==="comma"&&Ri(g))x&&c&&(g=um.maybeMap(g,c)),M=[{value:g.length>0?g.join(",")||null:void 0}];else if(Ri(u))M=u;else{var R=Object.keys(g);M=h?R.sort(h):R}var F=l?String(r).replace(/\./g,"%2E"):String(r),U=s&&Ri(g)&&g.length===1?F+"[]":F;if(o&&Ri(g)&&g.length===0)return U+"[]";for(var W=0;W<M.length;++W){var N=M[W],G=typeof N=="object"&&N&&typeof N.value<"u"?N.value:g[N];if(!(a&&G===null)){var X=d&&l?String(N).replace(/\./g,"%2E"):String(N),$=Ri(g)?typeof i=="function"?i(U,X):U:U+(d?"."+X:"["+X+"]");y.set(e,_);var D=GU();D.set(Bv,y),NU(C,t(G,$,i,s,o,n,a,l,i==="comma"&&x&&Ri(g)?null:c,u,h,d,f,p,m,x,v,D))}}return C},iX=function(e){if(!e)return At;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||At.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Hu.default;if(typeof e.format<"u"){if(!Qz.call(Hu.formatters,e.format))throw new TypeError("Unknown format option provided.");i=e.format}var s=Hu.formatters[i],o=At.filter;(typeof e.filter=="function"||Ri(e.filter))&&(o=e.filter);var n;if(e.arrayFormat in DU?n=e.arrayFormat:"indices"in e?n=e.indices?"indices":"repeat":n=At.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:At.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:At.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:At.allowEmptyArrays,arrayFormat:n,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:At.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?At.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:At.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:At.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:At.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:At.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:At.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:At.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:At.strictNullHandling}};VU.exports=function(t,e){var r=t,i=iX(e),s,o;typeof i.filter=="function"?(o=i.filter,r=o("",r)):Ri(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof r!="object"||r===null)return"";var a=DU[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(r)),i.sort&&s.sort(i.sort);for(var c=GU(),u=0;u<s.length;++u){var h=s[u],d=r[h];i.skipNulls&&d===null||NU(n,rX(d,h,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 XU=ce((z1e,zU)=>{"use strict";var Do=Iv(),Fv=Object.prototype.hasOwnProperty,WU=Array.isArray,ut={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Do.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},sX=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},$U=function(t,e,r){if(t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1)return t.split(",");if(e.throwOnLimitExceeded&&r>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return t},oX="utf8=%26%2310003%3B",nX="utf8=%E2%9C%93",aX=function(e,r){var i={__proto__:null},s=r.ignoreQueryPrefix?e.replace(/^\?/,""):e;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=r.parameterLimit===1/0?void 0:r.parameterLimit,n=s.split(r.delimiter,r.throwOnLimitExceeded?o+1:o);if(r.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,c=r.charset;if(r.charsetSentinel)for(l=0;l<n.length;++l)n[l].indexOf("utf8=")===0&&(n[l]===nX?c="utf-8":n[l]===oX&&(c="iso-8859-1"),a=l,l=n.length);for(l=0;l<n.length;++l)if(l!==a){var u=n[l],h=u.indexOf("]="),d=h===-1?u.indexOf("="):h+1,f,p;d===-1?(f=r.decoder(u,ut.decoder,c,"key"),p=r.strictNullHandling?null:""):(f=r.decoder(u.slice(0,d),ut.decoder,c,"key"),p=Do.maybeMap($U(u.slice(d+1),r,WU(i[f])?i[f].length:0),function(x){return r.decoder(x,ut.decoder,c,"value")})),p&&r.interpretNumericEntities&&c==="iso-8859-1"&&(p=sX(String(p))),u.indexOf("[]=")>-1&&(p=WU(p)?[p]:p);var m=Fv.call(i,f);m&&r.duplicates==="combine"?i[f]=Do.combine(i[f],p):(!m||r.duplicates==="last")&&(i[f]=p)}return i},lX=function(t,e,r,i){var s=0;if(t.length>0&&t[t.length-1]==="[]"){var o=t.slice(0,-1).join("");s=Array.isArray(e)&&e[o]?e[o].length:0}for(var n=i?e:$U(e,r,s),a=t.length-1;a>=0;--a){var l,c=t[a];if(c==="[]"&&r.parseArrays)l=r.allowEmptyArrays&&(n===""||r.strictNullHandling&&n===null)?[]:Do.combine([],n);else{l=r.plainObjects?{__proto__:null}:{};var u=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,h=r.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(h,10);!r.parseArrays&&h===""?l={0:n}:!isNaN(d)&&c!==h&&String(d)===h&&d>=0&&r.parseArrays&&d<=r.arrayLimit?(l=[],l[d]=n):h!=="__proto__"&&(l[h]=n)}n=l}return n},cX=function(e,r,i,s){if(e){var o=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),c=l?o.slice(0,l.index):o,u=[];if(c){if(!i.plainObjects&&Fv.call(Object.prototype,c)&&!i.allowPrototypes)return;u.push(c)}for(var h=0;i.depth>0&&(l=a.exec(o))!==null&&h<i.depth;){if(h+=1,!i.plainObjects&&Fv.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;u.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");u.push("["+o.slice(l.index)+"]")}return lX(u,r,i,s)}},uX=function(e){if(!e)return ut;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof e.throwOnLimitExceeded<"u"&&typeof e.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var r=typeof e.charset>"u"?ut.charset:e.charset,i=typeof e.duplicates>"u"?ut.duplicates:e.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:ut.allowDots:!!e.allowDots;return{allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:ut.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:ut.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:ut.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:ut.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ut.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:ut.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:ut.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:ut.decoder,delimiter:typeof e.delimiter=="string"||Do.isRegExp(e.delimiter)?e.delimiter:ut.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:ut.depth,duplicates:i,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:ut.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:ut.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:ut.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:ut.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ut.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};zU.exports=function(t,e){var r=uX(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?{__proto__:null}:{};for(var i=typeof t=="string"?aX(t,r):t,s=r.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var a=o[n],l=cX(a,i[a],r,typeof t=="string");s=Do.merge(s,l,r)}return r.allowSparse===!0?s:Do.compact(s)}});var jU=ce((X1e,YU)=>{"use strict";var hX=HU(),dX=XU(),fX=cm();YU.exports={formats:fX,parse:dX,stringify:hX}});var QU=ce(Va=>{"use strict";var pX=Lk();function Hr(){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 mX=/^([a-z0-9.+-]+:)/i,gX=/:[0-9]*$/,xX=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,yX=["<",">",'"',"`"," ","\r",`
|
|
1093
|
+
`," "],_X=["{","}","|","\\","^","`"].concat(yX),kv=["'"].concat(_X),qU=["%","/","?",";","#"].concat(kv),KU=["/","?","#"],bX=255,ZU=/^[+a-z0-9A-Z_-]{0,63}$/,vX=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,TX={javascript:!0,"javascript:":!0},Uv={javascript:!0,"javascript:":!0},Na={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Ov=jU();function Wu(t,e,r){if(t&&typeof t=="object"&&t instanceof Hr)return t;var i=new Hr;return i.parse(t,e,r),i}Hr.prototype.parse=function(t,e,r){if(typeof t!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),s=i!==-1&&i<t.indexOf("#")?"?":"#",o=t.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),t=o.join(s);var a=t;if(a=a.trim(),!r&&t.split("#").length===1){var l=xX.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],e?this.query=Ov.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var c=mX.exec(a);if(c){c=c[0];var u=c.toLowerCase();this.protocol=u,a=a.substr(c.length)}if(r||c||a.match(/^\/\/[^@/]+@[^@/]+/)){var h=a.substr(0,2)==="//";h&&!(c&&Uv[c])&&(a=a.substr(2),this.slashes=!0)}if(!Uv[c]&&(h||c&&!Na[c])){for(var d=-1,f=0;f<KU.length;f++){var p=a.indexOf(KU[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<qU.length;f++){var p=a.indexOf(qU[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 v=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!v)for(var y=this.hostname.split(/\./),f=0,g=y.length;f<g;f++){var b=y[f];if(b&&!b.match(ZU)){for(var _="",S=0,E=b.length;S<E;S++)b.charCodeAt(S)>127?_+="x":_+=b[S];if(!_.match(ZU)){var P=y.slice(0,f),C=y.slice(f+1),M=b.match(vX);M&&(P.push(M[1]),C.unshift(M[2])),C.length&&(a="/"+C.join(".")+a),this.hostname=P.join(".");break}}}this.hostname.length>bX?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=pX.toASCII(this.hostname));var R=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+R,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!TX[u])for(var f=0,g=kv.length;f<g;f++){var U=kv[f];if(a.indexOf(U)!==-1){var W=encodeURIComponent(U);W===U&&(W=escape(U)),a=a.split(U).join(W)}}var N=a.indexOf("#");N!==-1&&(this.hash=a.substr(N),a=a.slice(0,N));var G=a.indexOf("?");if(G!==-1?(this.search=a.substr(G),this.query=a.substr(G+1),e&&(this.query=Ov.parse(this.query)),a=a.slice(0,G)):e&&(this.search="",this.query={}),a&&(this.pathname=a),Na[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var R=this.pathname||"",X=this.search||"";this.path=R+X}return this.href=this.format(),this};function SX(t){return typeof t=="string"&&(t=Wu(t)),t instanceof Hr?t.format():Hr.prototype.format.call(t)}Hr.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=t+this.host:this.hostname&&(s=t+(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=Ov.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Na[e])&&s!==!1?(s="//"+(s||""),r&&r.charAt(0)!=="/"&&(r="/"+r)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),r=r.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),e+s+r+n+i};function wX(t,e){return Wu(t,!1,!0).resolve(e)}Hr.prototype.resolve=function(t){return this.resolveObject(Wu(t,!1,!0)).format()};function EX(t,e){return t?Wu(t,!1,!0).resolveObject(e):e}Hr.prototype.resolveObject=function(t){if(typeof t=="string"){var e=new Hr;e.parse(t,!1,!0),t=e}for(var r=new Hr,i=Object.keys(this),s=0;s<i.length;s++){var o=i[s];r[o]=this[o]}if(r.hash=t.hash,t.href==="")return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var n=Object.keys(t),a=0;a<n.length;a++){var l=n[a];l!=="protocol"&&(r[l]=t[l])}return Na[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!Na[t.protocol]){for(var c=Object.keys(t),u=0;u<c.length;u++){var h=c[u];r[h]=t[h]}return r.href=r.format(),r}if(r.protocol=t.protocol,!t.host&&!Uv[t.protocol]){for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),r.pathname=g.join("/")}else r.pathname=t.pathname;if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var d=r.pathname||"",f=r.search||"";r.path=d+f}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var p=r.pathname&&r.pathname.charAt(0)==="/",m=t.host||t.pathname&&t.pathname.charAt(0)==="/",x=m||p||r.host&&t.pathname,v=x,y=r.pathname&&r.pathname.split("/")||[],g=t.pathname&&t.pathname.split("/")||[],b=r.protocol&&!Na[r.protocol];if(b&&(r.hostname="",r.port=null,r.host&&(y[0]===""?y[0]=r.host:y.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),x=x&&(g[0]===""||y[0]==="")),m)r.host=t.host||t.host===""?t.host:r.host,r.hostname=t.hostname||t.hostname===""?t.hostname:r.hostname,r.search=t.search,r.query=t.query,y=g;else if(g.length)y||(y=[]),y.pop(),y=y.concat(g),r.search=t.search,r.query=t.query;else if(t.search!=null){if(b){r.host=y.shift(),r.hostname=r.host;var _=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;_&&(r.auth=_.shift(),r.hostname=_.shift(),r.host=r.hostname)}return r.search=t.search,r.query=t.query,(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!y.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var S=y.slice(-1)[0],E=(r.host||t.host||y.length>1)&&(S==="."||S==="..")||S==="",P=0,C=y.length;C>=0;C--)S=y[C],S==="."?y.splice(C,1):S===".."?(y.splice(C,1),P++):P&&(y.splice(C,1),P--);if(!x&&!v)for(;P--;P)y.unshift("..");x&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),E&&y.join("/").substr(-1)!=="/"&&y.push("");var M=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(b){r.hostname=M?"":y.length?y.shift():"",r.host=r.hostname;var _=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;_&&(r.auth=_.shift(),r.hostname=_.shift(),r.host=r.hostname)}return x=x||r.host&&y.length,x&&!M&&y.unshift(""),y.length>0?r.pathname=y.join("/"):(r.pathname=null,r.path=null),(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r};Hr.prototype.parseHost=function(){var t=this.host,e=gX.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};Va.parse=Wu;Va.resolve=wX;Va.resolveObject=EX;Va.format=SX;Va.Url=Hr});var IL=()=>{let t=new Map,e=p=>typeof p=="string"&&p.startsWith("blob:"),r=p=>p?typeof p=="string"?p:p.message||String(p):"Unknown error",i=(p,m=180)=>{if(typeof p=="string")return p.length<=m?p:`${p.slice(0,m-1)}...`},s=p=>p.match(/HTTP\s+(\d{3})/)?.[1],o=p=>{let m=r(p),x=s(m);return x==="404"?"File not found.":x==="401"||x==="403"?"Access denied.":x?.startsWith("5")?"File server error.":/URL is missing/i.test(m)?"Missing file URL.":"File could not be downloaded."},n=({key:p,value:m,error:x})=>{let v={assetKey:p,cause:r(x)};return m?.type&&(v.type=m.type),m?.url&&(v.url=i(m.url)),v},a=({key:p,value:m,error:x})=>{let v=o(x),y=`Could not load asset "${p}". ${v}`,g=new Error(y,{cause:x});return g.userMessage=y,g.rootCauseMessage=v,g.details=n({key:p,value:m,error:x}),g},l=p=>typeof p?.type=="string"&&(p.type.startsWith("image/")||p.type.startsWith("video/"))&&typeof p?.url=="string"&&!e(p.url);return{load:async p=>{let m=[];for(let[x,v]of Object.entries(p))t.has(x)||m.push([x,v]);m.length>0&&await Promise.all(m.map(async([x,v])=>{try{if(!v?.url)throw new Error("Asset URL is missing.");if(l(v)){t.set(x,{url:v.url,type:v.type,source:"url"});return}let y=await fetch(v.url);if(!y.ok)throw new Error(`HTTP ${y.status}${y.statusText?` ${y.statusText}`:""}`);let b={buffer:await y.arrayBuffer(),type:v.type,source:"buffer"};t.set(x,b)}catch(y){throw a({key:x,value:v,error:y})}}))},getBufferMap:()=>{let p={};for(let[m,x]of t.entries())p[m]=x;return p},clear:()=>t.clear(),size:()=>t.size,has:p=>t.has(p)}};O();var cP={extension:{type:w.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(lP(),DD))}};O();var hP={extension:{type:w.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(uP(),ND))}};O();ad();td();O();ze();hc();var tf;function xP(t){return tf!==void 0||(tf=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:t??vs.defaultOptions.failIfMajorPerformanceCaveat};try{if(!re.get().getWebGLRenderingContext())return!1;let i=re.get().createCanvas().getContext("webgl",e),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),tf}ze();var rf;async function yP(t={}){return rf!==void 0||(rf=await(async()=>{let e=re.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(t)).requestDevice(),!0}catch{return!1}})()),rf}hc();var MM=["webgl","webgpu","canvas"];async function IM(t){let e=[];t.preference?(e.push(t.preference),MM.forEach(o=>{o!==t.preference&&e.push(o)})):e=MM.slice();let r,i={};for(let o=0;o<e.length;o++){let n=e[o];if(n==="webgpu"&&await yP()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(iR(),rR));r=a,i={...t,...t.webgpu};break}else if(n==="webgl"&&xP(t.failIfMajorPerformanceCaveat??vs.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(RM(),CM));r=a,i={...t,...t.webgl};break}else if(n==="canvas")throw i={...t},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!r)throw new Error("No available renderer for the current environment");let s=new r;return await s.init(i),s}Yr();Oy();tt();var BM=class w_{constructor(...e){this.stage=new ie,e[0]!==void 0&&J(ue,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await IM(e),w_._plugins.forEach(r=>{r.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return J(ue,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,r=!1){let i=w_._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(r),this.stage=null,this.renderer.destroy(e),this.renderer=null}};BM._plugins=[];var nu=BM;K.handleByList(w.Application,nu._plugins);K.add(vc);O();hs();Lg();ze();O();to();vt();Fe();dy();xy();var au=class extends Gn{constructor(e,r){super();let{textures:i,data:s}=e;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 te(n.x+a.x,n.y+a.y,n.width,n.height),u=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:u}}),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=r}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){let{texture:r}=this.pages[e];r.destroy(!0)}this.pages=null}static install(e){rc.install(e)}static uninstall(e){rc.uninstall(e)}};var Cf={test(t){return typeof t=="string"&&t.startsWith("info face=")},parse(t){let e=t.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let h in e){let d=e[h].match(/^[a-z]+/gm)[0],f=e[h].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let m in f){let x=f[m].split("="),v=x[0],y=x[1].replace(/"/gm,""),g=parseFloat(y),b=isNaN(g)?y:g;p[v]=b}r[d].push(p)}let i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=r.info,[o]=r.common,[n]=r.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=r.page;for(let h=0;h<a.length;h++)i.pages.push({id:parseInt(a[h].id,10)||0,file:a[h].file});let l={};i.baseLineOffset=i.lineHeight-parseInt(o.base,10);let c=r.char;for(let h=0;h<c.length;h++){let d=c[h],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 u=r.kerning||[];for(let h=0;h<u.length;h++){let d=parseInt(u[h].first,10),f=parseInt(u[h].second,10),p=parseInt(u[h].amount,10);i.chars[l[f]].kerning[l[d]]=p}return i}};ze();var E_={test(t){let e=t;return typeof e!="string"&&"getElementsByTagName"in e&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(t){let e={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},r=t.getElementsByTagName("info")[0],i=t.getElementsByTagName("common")[0],s=t.getElementsByTagName("distanceField")[0];s&&(e.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=t.getElementsByTagName("page"),n=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning");e.fontSize=parseInt(r.getAttribute("size"),10),e.fontFamily=r.getAttribute("face"),e.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let c=0;c<o.length;c++)e.pages.push({id:parseInt(o[c].getAttribute("id"),10)||0,file:o[c].getAttribute("file")});let l={};e.baseLineOffset=e.lineHeight-parseInt(i.getAttribute("base"),10);for(let c=0;c<n.length;c++){let u=n[c],h=parseInt(u.getAttribute("id"),10),d=u.getAttribute("letter")??u.getAttribute("char")??String.fromCharCode(h);d==="space"&&(d=" "),l[h]=d,e.chars[d]={id:h,page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xOffset:parseInt(u.getAttribute("xoffset"),10),yOffset:parseInt(u.getAttribute("yoffset"),10),xAdvance:parseInt(u.getAttribute("xadvance"),10),kerning:{}}}for(let c=0;c<a.length;c++){let u=parseInt(a[c].getAttribute("first"),10),h=parseInt(a[c].getAttribute("second"),10),d=parseInt(a[c].getAttribute("amount"),10);e.chars[l[h]].kerning[l[u]]=d}return e}};var A_={test(t){return typeof t=="string"&&t.includes("<font>")?E_.test(re.get().parseXML(t)):!1},parse(t){return E_.parse(re.get().parseXML(t))}};var bN=[".xml",".fnt"],FM={extension:{type:w.CacheParser,name:"cacheBitmapFont"},test:t=>t instanceof au,getCacheableAssets(t,e){let r={};return t.forEach(i=>{r[i]=e,r[`${i}-bitmap`]=e}),r[`${e.fontFamily}-bitmap`]=e,r}},kM={extension:{type:w.LoadParser,priority:er.Normal},name:"loadBitmapFont",test(t){return bN.includes(St.extname(t).toLowerCase())},async testParse(t){return Cf.test(t)||A_.test(t)},async parse(t,e,r){let i=Cf.test(t)?Cf.parse(t):A_.parse(t),{src:s}=e,{pages:o}=i,n=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let h=0;h<o.length;++h){let d=o[h].file,f=St.join(St.dirname(s),d);f=Rl(f,s),n.push({src:f,data:a})}let l=await r.load(n),c=n.map(h=>l[h.src]);return new au({data:i,textures:c},s)},async load(t,e){return await(await re.get().fetch(t)).text()},async unload(t,e,r){await Promise.all(t.pages.map(i=>r.unload(i.texture.source._sourceOrigin))),t.destroy()}};Ne();var Rf=class{constructor(e,r=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=r}add(e){e.forEach(r=>{this._assetList.push(r)}),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 e=[],r=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<r;i++)e.push(this._assetList.pop());await this._loader.load(e),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(e){this._isActive!==e&&(this._isActive=e,e&&!this._isLoading&&this._next())}};ds();O();Fe();var UM={extension:{type:w.CacheParser,name:"cacheTextureArray"},test:t=>Array.isArray(t)&&t.every(e=>e instanceof B),getCacheableAssets:(t,e)=>{let r={};return t.forEach(i=>{e.forEach((s,o)=>{r[i+(o===0?"":o+1)]=s})}),r}};O();async function Mf(t){if("Image"in globalThis)return new Promise(e=>{let r=new Image;r.onload=()=>{e(!0)},r.onerror=()=>{e(!1)},r.src=t});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let e=await(await fetch(t)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}var OM={extension:{type:w.DetectionParser,priority:1},test:async()=>Mf("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async t=>[...t,"avif"],remove:async t=>t.filter(e=>e!=="avif")};O();var LM=["png","jpg","jpeg"],GM={extension:{type:w.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...LM],remove:async t=>t.filter(e=>!LM.includes(e))};O();var vN="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Qn(t){return vN?!1:document.createElement("video").canPlayType(t)!==""}var DM={extension:{type:w.DetectionParser,priority:0},test:async()=>Qn("video/mp4"),add:async t=>[...t,"mp4","m4v"],remove:async t=>t.filter(e=>e!=="mp4"&&e!=="m4v")};O();var NM={extension:{type:w.DetectionParser,priority:0},test:async()=>Qn("video/ogg"),add:async t=>[...t,"ogv"],remove:async t=>t.filter(e=>e!=="ogv")};O();var VM={extension:{type:w.DetectionParser,priority:0},test:async()=>Qn("video/webm"),add:async t=>[...t,"webm"],remove:async t=>t.filter(e=>e!=="webm")};O();var HM={extension:{type:w.DetectionParser,priority:0},test:async()=>Mf("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async t=>[...t,"webp"],remove:async t=>t.filter(e=>e!=="webp")};Ne();to();Cl();ed();var If=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,r,i)=>(this._parsersValidated=!1,e[r]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,r){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(r.loadParser&&(o=this._parserHash[r.loadParser],o||Z(`[Assets] specified load parser "${r.loadParser}" not found while loading ${e}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(e,r,this)){o=a;break}}if(!o)return Z(`[Assets] ${e} 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(e,r,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,r,this)&&(s=await a.parse(s,r,this)||s,i.parser=a)}return s})(),i}async load(e,r){this._parsersValidated||this._validateParsers();let i=0,s={},o=ro(e),n=tr(e,c=>({alias:[c],src:c,data:{}})),a=n.length,l=n.map(async c=>{let u=St.toAbsolute(c.src);if(!s[c.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,c)),s[c.src]=await this.promiseCache[u].promise,r&&r(++i/a)}catch(h){throw delete this.promiseCache[u],delete s[c.src],new Error(`[Loader.load] Failed to load ${u}.
|
|
1094
1094
|
${h}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(e){let i=tr(e,s=>({alias:[s],src:s})).map(async s=>{let o=St.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(e=>e.name).reduce((e,r)=>(r.name?e[r.name]&&Z(`[Assets] loadParser name conflict "${r.name}"`):Z("[Assets] loadParser should have a name"),{...e,[r.name]:r}),{})}};ze();O();function Fr(t,e){if(Array.isArray(e)){for(let r of e)if(t.startsWith(`data:${r}`))return!0;return!1}return t.startsWith(`data:${e}`)}to();function kr(t,e){let r=t.split("?")[0],i=St.extname(r).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}hs();var TN=".json",SN="application/json",WM={extension:{type:w.LoadParser,priority:er.Low},name:"loadJson",test(t){return Fr(t,SN)||kr(t,TN)},async load(t){return await(await re.get().fetch(t)).json()}};ze();O();hs();var wN=".txt",EN="text/plain",$M={name:"loadTxt",extension:{type:w.LoadParser,priority:er.Low,name:"loadTxt"},test(t){return Fr(t,EN)||kr(t,wN)},async load(t){return await(await re.get().fetch(t)).text()}};ze();O();Ne();to();ds();hs();var AN=["normal","bold","100","200","300","400","500","600","700","800","900"],PN=[".ttf",".otf",".woff",".woff2"],CN=["font/ttf","font/otf","font/woff","font/woff2"],RN=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function MN(t){let e=St.extname(t),s=St.basename(t,e).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(RN)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var IN=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function BN(t){return IN.test(t)?t:encodeURI(t)}var zM={extension:{type:w.LoadParser,priority:er.Low},name:"loadWebFont",test(t){return Fr(t,CN)||kr(t,PN)},async load(t,e){let r=re.get().getFontFaceSet();if(r){let i=[],s=e.data?.family??MN(t),o=e.data?.weights?.filter(a=>AN.includes(a))??["normal"],n=e.data??{};for(let a=0;a<o.length;a++){let l=o[a],c=new FontFace(s,`url(${BN(t)})`,{...n,weight:l});await c.load(),r.add(c),i.push(c)}return Ue.set(`${s}-and-url`,{url:t,fontFaces:i}),i.length===1?i[0]:i}return Z("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(t){(Array.isArray(t)?t:[t]).forEach(e=>{Ue.remove(`${e.family}-and-url`),re.get().getFontFaceSet().delete(e)})}};ze();O();xn();Nd();mn();function Jn(t,e=1){let r=_r.RETINA_PREFIX?.exec(t);return r?parseFloat(r[1]):e}hs();Fe();Ne();ds();function ea(t,e,r){t.label=r,t._sourceOrigin=r;let i=new B({source:t,label:r}),s=()=>{delete e.promiseCache[r],Ue.has(r)&&Ue.remove(r)};return i.source.once("destroy",()=>{e.promiseCache[r]&&(Z("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),i.once("destroy",()=>{t.destroyed||(Z("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var FN=".svg",kN="image/svg+xml",XM={extension:{type:w.LoadParser,priority:er.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(t){return Fr(t,kN)||kr(t,FN)},async load(t,e,r){return e.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?ON(t):UN(t,e,r,this.config.crossOrigin)},unload(t){t.destroy(!0)}};async function UN(t,e,r,i){let o=await(await re.get().fetch(t)).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"),u=e.data?.resolution||Jn(t),h=e.data?.width??a.width,d=e.data?.height??a.height;l.width=h*u,l.height=d*u,c.drawImage(a,0,0,h*u,d*u);let{parseAsGraphicsContext:f,...p}=e.data??{},m=new lr({resource:l,alphaMode:"premultiply-alpha-on-upload",resolution:u,...p});return ea(m,r,t)}async function ON(t){let r=await(await re.get().fetch(t)).text(),i=new ir;return i.svg(r),i}ze();O();xn();var LN=`(function () {
|
|
1095
1095
|
'use strict';
|
|
1096
1096
|
|
|
@@ -1260,7 +1260,7 @@ fn mainFragment(
|
|
|
1260
1260
|
}`;function rI(t,e){let r=Uf[e],i=r.length,s=[],o=[],n=[];for(let h=0;h<e;h++){s[h]=`@location(${h}) offset${h}: vec2<f32>,`,t?o[h]=`filteredCord + vec2(${h-i+1} * pixelStrength, 0.0),`:o[h]=`filteredCord + vec2(0.0, ${h-i+1} * pixelStrength),`;let d=h<i?h:e-h-1,f=r[d].toString();n[h]=`finalColor += textureSample(uTexture, uSampler, offset${h}) * ${f};`}let a=s.join(`
|
|
1261
1261
|
`),l=o.join(`
|
|
1262
1262
|
`),c=n.join(`
|
|
1263
|
-
`),u=tI.replace("%blur-struct%",a).replace("%blur-vertex-out%",l).replace("%blur-fragment-in%",a).replace("%blur-sampling%",c).replace("%dimension%",t?"z":"w");return hr.from({vertex:{source:u,entryPoint:"mainVertex"},fragment:{source:u,entryPoint:"mainFragment"}})}var iI=class sI extends Br{constructor(e){e={...sI.defaultOptions,...e};let r=eI(e.horizontal,e.kernelSize),i=rI(e.horizontal,e.kernelSize);super({glProgram:r,gpuProgram:i,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}},...e}),this.horizontal=e.horizontal,this._quality=0,this.quality=e.quality,this.blur=e.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(e,r,i,s){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)e.applyFilter(this,r,i,s);else{let o=Ve.getSameSizeTexture(r),n=r,a=o;this._state.blend=!1;let l=e.renderer.type===Xe.WEBGPU;for(let c=0;c<this.passes-1;c++){e.applyFilter(this,n,a,c===0?!0:l);let u=a;a=n,n=u}this._state.blend=!0,e.applyFilter(this,n,i,s),Ve.returnTexture(o)}}get blur(){return this.strength}set blur(e){this.padding=1+Math.abs(e)*2,this.strength=e}get quality(){return this._quality}set quality(e){this._quality=e,this.passes=e}};iI.defaultOptions={strength:8,quality:4,kernelSize:5};var Of=iI;var sa=class extends Br{constructor(...e){let r=e[0]??{};typeof r=="number"&&(J(ue,"BlurFilter constructor params are now options object. See params: { strength, quality, resolution, kernelSize }"),r={strength:r},e[1]!==void 0&&(r.quality=e[1]),e[2]!==void 0&&(r.resolution=e[2]||"inherit"),e[3]!==void 0&&(r.kernelSize=e[3])),r={...Of.defaultOptions,...r};let{strength:i,strengthX:s,strengthY:o,quality:n,...a}=r;super({...a,compatibleRenderers:Xe.BOTH,resources:{}}),this._repeatEdgePixels=!1,this.blurXFilter=new Of({horizontal:!0,...r}),this.blurYFilter=new Of({horizontal:!1,...r}),this.quality=n,this.strengthX=s??i,this.strengthY=o??i,this.repeatEdgePixels=!1}apply(e,r,i,s){let o=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(o&&n){let a=Ve.getSameSizeTexture(r);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(e,r,a,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,a,i,s),Ve.returnTexture(a)}else n?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,r,i,s)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(e,r,i,s))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(e){this.blurXFilter.quality=this.blurYFilter.quality=e}get strengthX(){return this.blurXFilter.blur}set strengthX(e){this.blurXFilter.blur=e,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(e){this.blurYFilter.blur=e,this.updatePadding()}get blur(){return J("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength}set blur(e){J("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength=e}get blurX(){return J("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX}set blurX(e){J("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX=e}get blurY(){return J("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY}set blurY(e){J("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}};sa.defaultOptions={strength:8,quality:4,kernelSize:5};Fe();Sl();pn();Il();var ws=class t extends ke{constructor(...e){let r=e[0];Array.isArray(e[0])&&(r={textures:e[0],autoUpdate:e[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:c=null,textures:u,updateAnchor:h=!1,...d}=r,[f]=u;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=h,this.onComplete=a,this.onFrameChange=l,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=u,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Tt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Tt.shared.add(this.update,this,hi.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(e){this.stop(),this.currentFrame=e}gotoAndPlay(e){this.currentFrame=e,this.play()}update(e){if(!this._playing)return;let r=e.deltaTime,i=this.animationSpeed*r,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*r);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 e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this.texture=this._textures[e],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(e){let r=[];for(let i=0;i<e.length;++i)r.push(B.from(e[i]));return new t(r)}static fromImages(e){let r=[];for(let i=0;i<e.length;++i)r.push(B.from(e[i]));return new t(r)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(e){if(e[0]instanceof B)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(let r=0;r<e.length;r++)this._textures.push(e[r].texture),this._durations.push(e[r].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e}set currentFrame(e){if(e<0||e>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${e}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let r=this.currentFrame;this._currentTime=e,r!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(Tt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(Tt.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Uh();tt();Jh();var Lf=class extends us{constructor(e,r){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:c,...u}=e;super({...u}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=r,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Ft({_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(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,r){typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,this.bounds.width),r!==void 0&&this._setHeight(r,this.bounds.height)}containsPoint(e){let r=this.bounds.width,i=this.bounds.height,s=-r*this.anchor.x,o=0;return e.x>=s&&e.x<=s+r&&(o=-i*this.anchor.y,e.y>=o&&e.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}};function oI(t,e){let r=t[0]??{};return(typeof r=="string"||t[1])&&(J(ue,`use new ${e}({ text: "hi!", style }) instead`),r={text:r,style:t[1]}),r}ec();po();var vr=class extends Lf{constructor(...e){let r=oI(e,"Text");super(r,Ge),this.renderPipeId="text"}updateBounds(){let e=this._bounds,r=this._anchor,i=Ye.measureText(this._text,this._style),{width:s,height:o}=i;e.minX=-r._x*s,e.maxX=e.minX+s,e.minY=-r._y*o,e.maxY=e.minY+o}};cc();Ae();gr();vt();oo();Wt();$y();Qt();Fe();nf();Yg();br();Yr();ho();cy();Il();ec();po();Gg();Vt();var jN=Xs(Td(),1);K.add(cP,hP);var qN=new(window.AudioContext||window.webkitAudioContext),Gf={},cu={},KN=t=>t?typeof t=="string"?t:t.message||String(t):"Unknown error",ZN=(t,e)=>{let r="Unsupported or damaged audio file.",i=`Could not load audio "${t}". ${r}`,s=new Error(i,{cause:e});return s.userMessage=i,s.rootCauseMessage=r,s.details={assetKey:t,assetKind:"audio",phase:"decode",cause:KN(e)},s},QN=(t,e)=>{if(Gf[t])return Gf[t];if(cu[t])return cu[t];if(e.byteLength!==0)return cu[t]=qN.decodeAudioData(e).then(r=>(Gf[t]=r,r)).catch(r=>{throw ZN(t,r)}).finally(()=>{delete cu[t]}),cu[t]},JN=t=>Gf[t],oa={load:QN,getAsset:JN};var dt=({type:t,add:e,update:r,delete:i,parse:s,shouldUpdateUnchanged:o})=>({type:t,add:e,update:r,delete:i,parse:s,shouldUpdateUnchanged:o});var M_=({type:t})=>({type:t});var I_=({type:t,add:e,update:r,delete:i})=>({type:t,add:e,update:r,delete:i});var Df={alpha:"alpha",x:"x",y:"y",translateX:"translateX",translateY:"translateY",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation",blurX:"blurX",blurY:"blurY",uProgress:"uProgress"};var Nf={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"],blurX:["_routeGraphicsBlur","x"],blurY:["_routeGraphicsBlur","y"],uProgress:["uProgress"]};var Tr={RECT:"rect",TEXT:"text",INPUT:"input",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",SPRITESHEET_ANIMATION:"spritesheet-animation",VIDEO:"video"};var $e={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var nI={color:"black",alpha:1,blur:0,offsetX:2,offsetY:2},e3=(t={})=>{let e=typeof t.stroke=="object"&&t.stroke!==null?t.stroke:{};return{...e,color:t.strokeColor??e.color??$e.strokeColor,width:t.strokeWidth??e.width??$e.strokeWidth}},t3=t=>{if(t===void 0)return;if(t===null||t===!1)return null;let e=typeof t=="object"&&t!==null?{...nI,...t}:nI,r=e.offsetX,i=e.offsetY,s=Math.hypot(r,i);return{alpha:e.alpha,angle:s===0?0:Math.atan2(i,r),blur:e.blur,color:e.color,distance:s}},r3=t=>t?Math.ceil(Math.max(0,t.blur)+t.distance):0,Ut=(t={},e={})=>{let r=e.includeShadow!==!1,{strokeColor:i,strokeWidth:s,stroke:o,shadow:n,...a}=t;delete a.dropShadow;let l={...a,stroke:e3({strokeColor:i,strokeWidth:s,stroke:o})};if(r){let c=t3(n),u=r3(c),h=Math.max(a.padding??0,u);n!==void 0&&(l.dropShadow=c),h>0&&(l.padding=h)}return l};var wi=(t,e)=>{let r={fill:e?.fill??$e.fill,fontFamily:e?.fontFamily??$e.fontFamily,fontSize:e?.fontSize??$e.fontSize,align:e?.align??$e.align,lineHeight:e?.lineHeight??$e.lineHeight,wordWrap:e?.wordWrap??$e.wordWrap,breakWords:e?.breakWords??$e.breakWords,strokeColor:e?.strokeColor??$e.strokeColor,strokeWidth:e?.strokeWidth??$e.strokeWidth,wordWrapWidth:e?.wordWrapWidth??$e.wordWrapWidth,...Object.prototype.hasOwnProperty.call(e??{},"shadow")?{shadow:e.shadow}:{}};t.style=Ut(r)};var _o=(t=0)=>t*Math.PI/180,B_=(t=0)=>t*180/Math.PI,aI=t=>typeof t=="number"&&Number.isFinite(t)&&t!==0?t:1,Vf=t=>({x:Math.round((t.x??0)+(t.originX??0)),y:Math.round((t.y??0)+(t.originY??0))}),Ur=(t,e)=>{let r=e.originX??0,i=e.originY??0,s=aI(t.scale?.x),o=aI(t.scale?.y),n=Vf(e);t.pivot?.set?.(r/s,i/o),t.x=n.x,t.y=n.y,t.rotation=_o(e.rotation??0)},Or=(t,e={})=>{let r=Vf(t),i={x:r.x,y:r.y,...e};return t.rotation!==void 0&&(i.rotation=t.rotation),i};var Es=t=>t==="translateX"||t==="translateY",uI=(t,e)=>typeof e!="string"?e:t[e]??e,i3=(t,e,r,i)=>{let s=uI(r,e);if(typeof s=="string"){let n=t[s];return n===void 0?i:e==="rotation"?B_(n):n}let o=t;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:e==="rotation"?B_(o):o},s3=(t,e,r,i)=>{let s=uI(r,e),o=e==="rotation"?_o(i):i;if(typeof s=="string")return t[s]=o,t;let n=t;for(let a=0;a<s.length-1;a++){let l=s[a];l in n||(n[l]={}),n=n[l]}return n[s[s.length-1]]=o,t},lI=t=>typeof t=="number"&&Number.isFinite(t),o3=t=>{let e=t?.getLocalBounds?.();return e?.rectangle??e??null},cI=(t,e)=>{let r=e==="x"?t?.width:t?.height;if(lI(r)&&r>0)return r;let i=o3(t),s=e==="x"?i?.width:i?.height,o=e==="x"?t?.scale?.x:t?.scale?.y;return lI(s)&&s>0?Math.abs(s*(o??1)):0},As=t=>({x:t?.x??0,y:t?.y??0,width:cI(t,"x"),height:cI(t,"y")}),hI=({object:t,property:e,propertyPathMap:r,subjectState:i,defaultValue:s=0})=>e==="translateX"||e==="translateY"?s:i3(t,e,r,s),uu=({object:t,property:e,propertyPathMap:r,subjectState:i,value:s})=>e==="translateX"?(t.x=i.x+s*i.width,t):e==="translateY"?(t.y=i.y+s*i.height,t):s3(t,e,r,s);var dI=(t,e,r=Nf,i)=>{let s=i;for(let o of e)for(let[n,a]of Object.entries(o.tween)){if(!Df[n])throw new Error(`${n} is not a supported property for animation.`);a.initialValue!==void 0&&(!s&&Es(n)&&(s=As(t)),uu({object:t,property:n,propertyPathMap:r,subjectState:s,value:a.initialValue}))}},Hf=({animations:t,animationBus:e,completionTracker:r,element:i,targetState:s,onComplete:o,animationBaseState:n})=>{for(let a of t){if(typeof e?.hasContext=="function"&&e.hasContext(a.id))continue;for(let[u,h]of Object.entries(a.tween))if(h.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,u)))throw new Error(`Animation "${a.id}" cannot auto-resolve property "${u}" from targetState.`);let l=a.playback?.continuity!=="persistent",c=l?r.getVersion():null;l&&r.track(c),e.dispatch({type:"START",payload:{id:a.id,animationType:a.type,targetId:a.targetId,continuity:a.playback?.continuity??"render",playbackSpeed:a.playback?.speed,signature:a.signature??JSON.stringify({type:a.type,tween:a.tween,playback:a.playback??null}),element:i,properties:a.tween,targetState:s,animationBaseState:n,onComplete:()=>{l&&r.complete(c),o?.(a)}}})}};var n3=t=>{if(!t?.dropShadow||typeof t.clone!="function")return t;let e=t.clone();return e.dropShadow=null,e};function Wf(t,e){let r=t.text.substring(0,e),s=Ye.measureText(r,n3(t.style)).width;return t.x+s}var a3=async(t,e)=>new Promise((r,i)=>{if(e?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&e?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),r()},t);s=()=>{clearTimeout(n),o(),i(e.reason)},e?.addEventListener("abort",s,{once:!0})}),$f=a3;var hu={softness:1.25,easing:"linear",lineOverlap:0,lineDelay:0},l3=18,c3=64,k_={linear:t=>t,easeOutCubic:t=>1-(1-t)**3},u3=(t,e,r)=>Math.max(e,Math.min(r,t)),F_=(t,e)=>typeof t=="number"&&Number.isFinite(t)?t:e,bo=(t={})=>{let e=t&&typeof t=="object"?t:{};return{softness:Math.max(0,F_(e.softness,hu.softness)),easing:Object.prototype.hasOwnProperty.call(k_,e.easing)?e.easing:hu.easing,lineOverlap:u3(F_(e.lineOverlap,hu.lineOverlap),0,.95),lineDelay:Math.max(0,F_(e.lineDelay,hu.lineDelay))}},U_=t=>k_[t]??k_[hu.easing],O_=({maxLineHeight:t,softWipe:e})=>Math.max(l3,Math.min(c3,Math.round(t*e.softness)));var na=(t,e,r,i)=>{if(!r)return;let s=o=>{o?.detail?.elementId===e&&typeof o?.detail?.frameIndex=="number"&&(t.gotoAndStop(o?.detail?.frameIndex),i?.())};window.addEventListener("snapShotAnimatedSpriteFrame",s),t._snapShotKeyFrameHandler=s},vo=t=>{t._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",t._snapShotKeyFrameHandler),delete t._snapShotKeyFrameHandler)};var fI=(t={})=>{if(t.frame){let n=t.frame.w??0,a=t.frame.h??0,l=t.sourceSize?.w??n,c=t.sourceSize?.h??a,u={frame:{x:t.frame.x??0,y:t.frame.y??0,w:n,h:a},rotated:t.rotated??!1,trimmed:t.trimmed??!1,spriteSourceSize:{x:t.spriteSourceSize?.x??0,y:t.spriteSourceSize?.y??0,w:t.spriteSourceSize?.w??n,h:t.spriteSourceSize?.h??a},sourceSize:{w:l,h:c}};return t.anchor?u.anchor={x:t.anchor.x??0,y:t.anchor.y??0}:t.pivot&&(u.anchor={x:t.pivot.x??0,y:t.pivot.y??0}),t.borders&&(u.borders={...t.borders}),u}let e=t.width??t.w??0,r=t.height??t.h??0,i=t.sourceWidth??e,s=t.sourceHeight??r,o={frame:{x:t.x??0,y:t.y??0,w:e,h:r},rotated:t.rotated??!1,trimmed:t.trimmed??!1,spriteSourceSize:{x:t.offsetX??0,y:t.offsetY??0,w:e,h:r},sourceSize:{w:i,h:s}};return t.anchor?o.anchor={x:t.anchor.x??0,y:t.anchor.y??0}:t.pivot&&(o.anchor={x:t.pivot.x??0,y:t.pivot.y??0}),t.borders&&(o.borders={...t.borders}),o},L_=(t={})=>!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Array.isArray(r)?r.map(i=>String(i)):[]])),h3=(t,e={})=>{let r=Math.max(0,Number(e.from??0)),i=Math.min(t.length-1,Number(e.to??r));if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return[];let s=t.slice(r,i+1),o=String(e.direction??"forward").toLowerCase();if(o==="reverse"||o==="backward")return[...s].reverse();if(o==="pingpong")return[...s,...s.slice(1,-1).reverse()];if(o==="pingpong_reverse"){let n=[...s].reverse();return[...n,...n.slice(1,-1).reverse()]}return s},d3=(t=[],e=[])=>!Array.isArray(t)||e.length===0?{}:Object.fromEntries(t.map(r=>{let i=typeof r?.name=="string"?r.name:"";return i?[i,h3(e,r)]:null}).filter(Boolean)),Qr=(t={})=>{let e=t??{},r=L_(e.animations);return{frames:Array.isArray(e.frames)?Object.fromEntries(e.frames.map(s=>{let o=s?.filename??s?.name;return typeof o!="string"||o.length===0?null:[o,fI(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,fI(o)])),...Object.keys(r).length>0?{animations:r}:{},meta:{...e.meta??{},scale:String(e.scale??e.meta?.scale??1),...e.width!=null||e.height!=null?{size:{w:e.width??e.meta?.size?.w??0,h:e.height??e.meta?.size?.h??0}}:{}}}},Jr=(t={},e={},r={},i=[])=>({...d3(r?.frameTags,i),...L_(e),...L_(t)}),f3=(t,e)=>{if(!Array.isArray(e?.frames))return[];let r=Object.keys(t.frames??{});return e.frames.map(i=>typeof i=="number"?r[i]:String(i)).filter(Boolean)},Lr=({atlas:t={frames:{}},clips:e={},playback:r,legacyAnimation:i})=>{let s=r??i??{},o={fps:s.fps??null,loop:s.loop??!0,autoplay:s.autoplay??!0};return typeof s.clip=="string"&&s.clip.length>0&&(o.clip=s.clip),Array.isArray(s.frames)?o.frames=s.frames.map(n=>typeof n=="number"?Object.keys(t.frames??{})[n]:String(n)).filter(Boolean):o.clip||(o.frames=f3(t,i)),o.fps==null&&(typeof s.animationSpeed=="number"?o.fps=s.animationSpeed*60:o.fps=30),o.clip&&(!Array.isArray(o.frames)||o.frames.length===0)&&(o.frames=Array.isArray(e[o.clip])?[...e[o.clip]]:[]),Array.isArray(o.frames)||(o.frames=[]),o},aa=({spritesheet:t,atlas:e,clips:r={},playback:i,legacyAnimation:s})=>{let o=Lr({atlas:e,clips:r,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>t.textures[a]),playback:o}},la=t=>typeof t=="number"?t/60:.5;var Xi=Symbol("textRevealRuntime"),zf=Symbol("textRevealSnapshot"),ca=Symbol("textRevealIndicator"),yI=Symbol("textRevealIndicatorPlayback"),N_=50,p3=0,W_=100,G_=W_-1,pI=10,_I=120,m3=.9,g3=360,x3=1.2,D_=20,y3=16,_3=0,b3=(t,e,r)=>Math.max(e,Math.min(r,t)),bI=(t=N_)=>typeof t!="number"||!Number.isFinite(t)?N_:Math.max(p3,Math.min(W_,t)),v3=t=>bI(t)>=W_,$_=(t,{maxRate:e=_I,curve:r=m3}={})=>{let i=Math.min(bI(t),G_),o=(G_>0?i/G_:0)**r;return pI*(e/pI)**o},T3=t=>$_(t,{maxRate:g3,curve:x3}),S3=t=>{let e=1e3/t;return e>=D_||t<=_I?{stepDelay:Math.max(1,Math.floor(e)),charactersPerStep:1}:{stepDelay:D_,charactersPerStep:Math.max(2,Math.round(t*D_/1e3))}},w3=t=>t?.revealEffect==="softWipe"?"softWipe":"typewriter",z_=t=>{let e=t?.initialRevealedCharacters;return typeof e!="number"||!Number.isFinite(e)?0:Math.max(0,Math.floor(e))},E3=t=>(t?.content??[]).reduce((e,r)=>e+(r.lineParts??[]).reduce((i,s)=>i+(s.text?.length??0),0),0),ua=t=>t?.revealEffect==="none"||v3(t?.speed??N_),V_=t=>t!==null&&typeof t=="object"&&typeof t.then=="function",X_=(t={})=>t.kind??(t.atlas!==void 0||t.clips!==void 0||t.playback!==void 0?"spritesheet":"image"),A3=t=>["revealing","complete"].some(e=>X_(t?.indicator?.[e])==="spritesheet"&&!!t?.indicator?.[e]?.src),vI=t=>`${t.id}-indicator`,TI=(t,e,r)=>{typeof e?.width=="number"?t.width=e.width:r?.width&&(t.width=r.width),typeof e?.height=="number"?t.height=e.height:r?.height&&(t.height=r.height)},SI=(t={})=>{let e=t?.src?B.from(t.src):B.EMPTY,r=new ke(e);return TI(r,t,e),r},P3=(t={},{app:e,element:r})=>{if(!t?.src)return SI(t);let i=Qr(t.atlas),s=Jr(t.clips,t.atlas?.animations,t.atlas?.meta,Object.keys(i.frames??{})),o=Lr({atlas:i,clips:s,playback:t.playback});return(async()=>{let n=new pi(B.from(t.src),i);await n.parse();let{frameTextures:a}=aa({spritesheet:n,atlas:i,clips:s,playback:o}),l=new ws(a.length>0?a:[B.EMPTY]);return l.animationSpeed=la(o.fps),l.loop=o.loop,l[yI]=o,TI(l,t,a[0]),e?.debug&&na(l,vI(r),e.debug,()=>{typeof e.render=="function"&&e.render()}),l})()},mI=(t,e)=>X_(t)==="spritesheet"?P3(t,e):SI(t),gI=(t,e)=>{t instanceof ws&&!e?.debug&&t[yI]?.autoplay!==!1&&t.play()},wI=t=>{!t||t.destroyed||(vo(t),typeof t.stop=="function"&&t.stop(),t.destroy({children:!0}))},H_=t=>{let e=t?.[ca];if(e){for(let r of e.displays)vo(r);for(let r of e.displays)r?.parent!==t&&wI(r);delete t[ca]}t.destroy({children:!0})},C3=({element:t,app:e,revealingDisplay:r,completeDisplay:i})=>{let s=new ie({label:vI(t)}),o=new Set([r]);return i&&o.add(i),s.addChild(r),s[ca]={displays:o,currentDisplay:r,completeDisplay:i,start(){gI(this.currentDisplay,e)},showComplete(){if(!this.completeDisplay||this.currentDisplay===this.completeDisplay)return;let n=this.currentDisplay;n?.parent===s&&s.removeChild(n),wI(n),o.delete(n),this.currentDisplay=this.completeDisplay,s.addChild(this.completeDisplay),gI(this.completeDisplay,e)}},s},R3=(t,{app:e}={})=>{let r=t?.indicator?.revealing??{},i=t?.indicator?.complete,s=mI(r,{app:e,element:t}),o=i?.src||X_(i)==="spritesheet"?mI(i,{app:e,element:t}):null,n=(a,l)=>C3({element:t,app:e,revealingDisplay:a,completeDisplay:l});return V_(s)||V_(o)?Promise.all([s,o]).then(([a,l])=>n(a,l)):n(s,o)},M3=t=>{t?.[ca]?.showComplete()},ha=(t,e="revealing")=>{let r=t?.indicator?.[e]??{};return{x:r.offsetX??t?.indicator?.offsetX??y3,y:r.offsetY??t?.indicator?.offsetY??_3}},I3=(t,e)=>{if(!e)return 0;let r=Math.max(0,e.lineMaxHeight??0),i=Math.max(0,t?.height??0);return e.y+Math.max(0,r-i)},Yi=(t,e,r)=>{t.x=r.x,t.y=I3(t,e)+r.y},EI=(t,e,r)=>{if(!e||e.text.length===0){t.x=r.x;return}t.x=Wf(e,e.text.length-1)+r.x},Ps=(t,e,r,i)=>{M3(t);let s=ha(i,"complete");Yi(t,e,s),EI(t,r,s)},B3=(t,e)=>{if(t[Xi]){let r=t[Xi];delete t[Xi],r()}t[Xi]=e},F3=t=>t?.[zf]??null,du=(t,e)=>t?e?(t[zf]=e,e):(delete t[zf],null):null,AI=t=>{let e=F3(t);return!e||e.mode!=="typewriter"||e.completed===!0?null:e},PI=t=>!!AI(t),Y_=t=>{if(t[Xi]){let r=t[Xi];delete t[Xi],r()}delete t[zf],t.onRender=void 0,t.removeChildren().forEach(r=>{if(r?.[ca]){H_(r);return}r.destroy({children:!0})})},j_=(t,e="",r="")=>{let i=new Ge(Ut(t.textStyle)),s=new vr({text:e,style:i,x:Math.round(t.x),y:Math.round(t.y)}),o=null;if(t.furigana){let n=new Ge(Ut(t.furigana.textStyle));o=new vr({text:r,style:n,x:Math.round(t.furigana.x),y:Math.round(t.furigana.y)})}return{text:s,furiganaText:o}},q_=(t,e)=>{let r=null,i=null,s=0,o=0,n=[];for(let a=0;a<e.content.length;a++){let l=e.content[a],c=new ie({label:`${e.id}-line-${a}`}),u=[],h=null,d=0;t.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}=j_(p,p.text,p.furigana?.text||"");x&&(c.addChild(x),u.push(x)),c.addChild(m),u.push(m),r=m,h=m,s+=p.text.length,d+=p.text.length}if(u.length>0){let f=c.getLocalBounds();n.push({chunk:l,container:c,lastTextObject:h,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else c.destroy()}return{lines:n,lastTextObject:r,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:t.getLocalBounds()}},xI=({contentContainer:t,indicatorSprite:e,element:r})=>{let{lastTextObject:i,lastChunk:s}=q_(t,r);Ps(e,s,i,r)},k3=({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})=>{let s=ha(r),o=r.content[0]??null,n=E3(r),a=Math.min(i,Math.max(0,n)),l=null,c=null;if(a<=0){Yi(e,o,s);return}e:for(let u=0;u<r.content.length;u++){let h=r.content[u];for(let d=0;d<h.lineParts.length;d++){let f=h.lineParts[d],p=Math.min(f.text.length,a);if(p<=0)break e;let m=f.furigana?.text||"",x=m.length,v=f.text.length>0?Math.round(p/f.text.length*x):0,{text:y,furiganaText:g}=j_(f,f.text.substring(0,p),m.substring(0,v));if(g&&t.addChild(g),t.addChild(y),l=y,c=h,a-=p,p<f.text.length)break e}}c?(Yi(e,c,s),EI(e,l,s)):Yi(e,o,s),i>=n&&Ps(e,c??o,l,r)},U3=({contentContainer:t,indicatorSprite:e,element:r})=>{let i=z_(r);if(i<=0){let s=ha(r),o=r.content[0]??null;Yi(e,o,s);return}r.revealEffect==="softWipe"?N3({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i}):k3({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})},O3=async({contentContainer:t,indicatorSprite:e,element:r,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=T3(r.speed??50),a=ha(r),{stepDelay:l,charactersPerStep:c}=S3(n),u=Math.max(l,Math.floor(4e3/n)),h=Math.max(0,Math.floor(s)),d=!1,f=null,p=null;o&&(o.revealedCharacters=h,o.completed=!1);for(let m=0;m<r.content.length;m++){if(i?.aborted||t.destroyed)return!1;let x=r.content[m],v=!1;Yi(e,x,a);for(let y=0;y<x.lineParts.length;y++){if(i?.aborted||t.destroyed)return!1;let g=x.lineParts[y],{text:b,furiganaText:_}=j_(g);_&&t.addChild(_),t.addChild(b);let S=g.text,E=g.furigana?.text||"";S.length>0&&(f=b,p=x);let P=E.length,C=Math.min(S.length,h),M=S.length>0?Math.round(C/S.length*P):0;b.text=S.substring(0,C),_&&(_.text=E.substring(0,M)),h-=C,C>0&&(e.x=Wf(b,C-1)+a.x);let R=C;for(;R<S.length;){if(i?.aborted||t.destroyed)return!1;let F=Math.min(S.length,R+c),U=F-1;if(b.text=S.substring(0,F),e.x=Wf(b,U)+a.x,v=!0,d=!0,o&&(o.revealedCharacters+=F-R),_){let W=Math.round(F/S.length*P);_.text=E.substring(0,W)}R=F,R<S.length&&await $f(l,i)}}m<r.content.length-1&&v&&await $f(u,i)}return d&&(await $f(l,i),i?.aborted||t.destroyed)?!1:(Ps(e,p,f,r),o&&(o.completed=!0),!0)},CI=({lines:t,edgeWidth:e,baseDuration:r,softWipe:i})=>{let s=t.map(c=>{let u=Math.max(1,c.totalCharacters),h=1+e/Math.max(1,c.bounds.width);return u*h}),o=s.reduce((c,u)=>c+u,0),n=[],a=0,l=0;for(let c=0;c<t.length;c++){let u=s[c],h=o>0?Math.max(1,r*u/o):r,d=Math.max(0,a),f=d+h;n.push({...t[c],startTime:d,endTime:f,duration:h}),l=Math.max(l,f),a=f-h*i.lineOverlap+i.lineDelay}return{timedLines:n,duration:Math.max(1,Math.ceil(l))}},L3=({currentTime:t,line:e,easing:r})=>{let i=e.duration>0?(t-e.startTime)/e.duration:1;return r(Math.max(0,Math.min(i,1)))},G3=({progress:t,easingName:e})=>{let r=b3(t,0,1);return e==="easeOutCubic"?1-Math.cbrt(1-r):r},RI=({timedLines:t,initialRevealedCharacters:e,softWipe:r,easingName:i})=>{let s=Math.max(0,Math.floor(e)),o=s<=0,n=0,a=0;return{timedLines:t.map(c=>{let u=Math.max(0,c.totalCharacters??0),h=0,d=!1;if(!o&&s>0)if(u<=0||s>=u)s-=u,h=1,d=!0;else{let m=s/u;h=G3({progress:m,easingName:i}),s=0,o=!0}if(d)return{...c,startTime:-c.duration,endTime:0};o=!0;let f=h>0?-h*c.duration:Math.max(0,n),p=f+c.duration;return a=Math.max(a,p),n=p-c.duration*r.lineOverlap+r.lineDelay,{...c,startTime:f,endTime:p}}),duration:Math.max(1,Math.ceil(a))}},D3=t=>{t.forEach(e=>{e&&(e.line.container.mask===e.sprite&&(e.line.container.mask=null),e.sprite.parent&&e.sprite.parent.removeChild(e.sprite),e.sprite.destroy(),e.texture.destroy(!0))})},MI=({contentContainer:t,timedLines:e,edgeWidth:r})=>{let i=e.map(s=>{let o=document.createElement("canvas");o.width=Math.max(1,Math.ceil(s.bounds.width+r)),o.height=Math.max(1,Math.ceil(s.bounds.height));let n=o.getContext("2d");if(!n)return null;let a=yo(o),l=new ke(a);return l.x=Math.floor(s.bounds.x-r),l.y=Math.floor(s.bounds.y),s.container.mask=l,t.addChild(l),{canvas:o,context:n,texture:a,sprite:l,line:s,edgeWidth:r}});return i.some(s=>s===null)?(D3(i),null):i},II=({timedLines:t,lineMasks:e,easing:r,indicatorSprite:i,indicatorOffsets:s,currentTime:o})=>{let n=t[0],a=n.bounds.x;for(let l=0;l<t.length;l++){let c=t[l],u=e[l],h=L3({currentTime:o,line:c,easing:r}),{context:d,canvas:f,texture:p}=u;if(d.clearRect(0,0,f.width,f.height),h<=0){p.source.update();continue}let m=0,x=c.bounds.width+u.edgeWidth,v=u.edgeWidth,y=v+h*x,g=Math.max(v,y-u.edgeWidth);g>v&&(d.fillStyle="#ffffff",d.fillRect(v,m,Math.min(g-v,c.bounds.width),c.bounds.height));let b=Math.max(v,y-u.edgeWidth),_=Math.min(v+c.bounds.width,y);if(_>b){let S=d.createLinearGradient(b,0,_,0);S.addColorStop(0,"rgba(255, 255, 255, 1)"),S.addColorStop(1,"rgba(255, 255, 255, 0)"),d.fillStyle=S,d.fillRect(b,m,_-b,c.bounds.height)}p.source.update(),n=c,a=c.bounds.x+Math.min(x,Math.max(0,y-v))}Yi(i,n.chunk,s),i.x=a+s.x},N3=({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})=>{let s=ha(r),{lines:o,lastTextObject:n,lastChunk:a,totalCharacters:l,maxLineHeight:c}=q_(t,r);if(Yi(e,a,s),o.length===0||l===0||i>=l||!o.some(y=>y.bounds.width>0&&y.bounds.height>0)||!globalThis.document){Ps(e,a,n,r);return}let u=bo(r.softWipe),h=U_(u.easing),d=O_({maxLineHeight:c,softWipe:u}),f=$_(r.speed??50),p=Math.max(1,Math.round(l/f*1e3)),m=CI({lines:o,edgeWidth:d,baseDuration:p,softWipe:u}),{timedLines:x}=RI({timedLines:m.timedLines,initialRevealedCharacters:i,softWipe:u,easingName:u.easing}),v=MI({contentContainer:t,timedLines:x,edgeWidth:d});if(!v){Ps(e,a,n,r);return}II({timedLines:x,lineMasks:v,easing:h,indicatorSprite:e,indicatorOffsets:s,currentTime:0})},V3=({container:t,contentContainer:e,indicatorSprite:r,element:i,animationBus:s,completionTracker:o})=>{let n=ha(i),a=$_(i.speed??50),{lines:l,lastTextObject:c,lastChunk:u,totalCharacters:h,maxLineHeight:d}=q_(e,i),f=z_(i);if(Yi(r,u,n),l.length===0||h===0||f>=h||!l.some(R=>R.bounds.width>0&&R.bounds.height>0)||!globalThis.document||!s)return Ps(r,u,c,i),!1;let p=bo(i.softWipe),m=U_(p.easing),x=O_({maxLineHeight:d,softWipe:p}),v=Math.max(1,Math.round(h/a*1e3)),y=CI({lines:l,edgeWidth:x,baseDuration:v,softWipe:p}),{timedLines:g,duration:b}=RI({timedLines:y.timedLines,initialRevealedCharacters:f,softWipe:p,easingName:p.easing}),_=o.getVersion(),S=`${i.id}-soft-wipe`,E=MI({contentContainer:e,timedLines:g,edgeWidth:x});if(!E)return Ps(r,u,c,i),!1;let P=!1,C=R=>{P||(P=!0,t[Xi]===M&&delete t[Xi],E.forEach(F=>{F.line.container.mask===F.sprite&&(F.line.container.mask=null),F.sprite.parent&&F.sprite.parent.removeChild(F.sprite),F.sprite.destroy(),F.texture.destroy(!0)}),R&&Ps(r,u,c,i))},M=()=>{s.dispatch({type:"CANCEL",id:S}),C(!1)};return B3(t,M),o.track(_),s.dispatch({type:"START",payload:{id:S,driver:"custom",duration:b,applyFrame:R=>{II({timedLines:g,lineMasks:E,easing:m,indicatorSprite:r,indicatorOffsets:n,currentTime:Math.min(b,R)})},applyTargetState:()=>{C(!1)},onComplete:()=>{o.complete(_),C(!0)},onCancel:()=>{o.complete(_),C(!1)},isValid:()=>!!t&&!t.destroyed&&!e.destroyed&&!r.destroyed}}),!0},ji=async({container:t,element:e,completionTracker:r,animationBus:i,zIndex:s,signal:o,app:n,playback:a="autoplay"})=>{if(o?.aborted||t.destroyed)return;let l=ua(e),c=a==="resume"?AI(t):null,u=z_(e);if(a==="resume"&&!c)return;let h=r?.getVersion?.(),d=A3(e),f=!1,p=()=>{!d||f||(r?.track?.(h),f=!0)},m=()=>{f&&(f=!1,r?.complete?.(h))};p(),Y_(t),t.zIndex=s;let x=new ie({label:`${e.id}-content`}),v;try{let y=R3(e,{app:n});if(v=V_(y)?await y:y,o?.aborted||t.destroyed){H_(v),m();return}if(t.addChild(x),t.addChild(v),v?.[ca]?.start(),a==="paused-initial"){l||du(t,{mode:w3(e),revealedCharacters:u,completed:!1}),l?(du(t,{mode:"none",completed:!0}),xI({contentContainer:x,indicatorSprite:v,element:e})):U3({contentContainer:x,indicatorSprite:v,element:e}),m();return}let g=r.getVersion(),b=!1;if(l)r.track(g),m(),du(t,{mode:"none",completed:!0}),xI({contentContainer:x,indicatorSprite:v,element:e}),b=!0;else if(e.revealEffect==="softWipe")if(du(t,{mode:"softWipe",revealedCharacters:u,completed:!1}),!V3({container:t,contentContainer:x,indicatorSprite:v,element:e,animationBus:i,completionTracker:r})&&!o?.aborted&&!t.destroyed)r.track(g),m(),b=!0;else{m();return}else{r.track(g),m();let _=c?.revealedCharacters??u,S=du(t,{mode:"typewriter",revealedCharacters:_,completed:!1});b=await O3({contentContainer:x,indicatorSprite:v,element:e,signal:o,startAtCharacter:_,snapshot:S})}b&&!o?.aborted&&!t.destroyed&&r.complete(g)}catch(y){if(m(),v&&!v.destroyed&&!v.parent&&H_(v),y?.name!=="AbortError"&&!o?.aborted)throw y}};var Xf=({suppressAnimations:t=!1,deferredMountOperations:e=[]}={})=>({suppressAnimations:t,deferredMountOperations:e}),BI=t=>{switch(t?.type){case"play-animated-sprite":t.animatedSprite?.destroyed||t.animatedSprite?.play();return;case"play-video":t.video?.play();return;case"start-particles":if(t.app?.debug){let e=r=>{if(t.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",e);return}r?.detail?.deltaMS&&(t.emitter.update(Number(r.detail.deltaMS)/1e3),typeof t.app?.render=="function"&&t.app.render())};window.addEventListener("snapShotKeyFrame",e),t.container.customTickerHandler=e;return}t.app.ticker.add(t.tickerCallback);return;case"autoplay-text-reveal":ji({container:t.container,element:t.element,completionTracker:t.completionTracker,animationBus:t.animationBus,zIndex:t.zIndex,signal:t.signal,app:t.app,playback:"autoplay"});return;case"start-update-animations":if(!t.element||t.element.destroyed)return;Hf({animations:t.animations,animationBus:t.animationBus,completionTracker:t.completionTracker,element:t.element,targetState:t.targetState,animationBaseState:t.animationBaseState});return}},fu=(t,e)=>{if(e?.type){if(!t?.suppressAnimations){BI(e);return}t.deferredMountOperations.push(e)}},pu=t=>{t?.deferredMountOperations&&(t.deferredMountOperations.length=0)},FI=(t,e)=>fu(t,{type:"play-animated-sprite",animatedSprite:e}),kI=(t,e)=>fu(t,{type:"play-video",video:e}),UI=(t,{app:e,emitter:r,container:i,tickerCallback:s})=>fu(t,{type:"start-particles",app:e,emitter:r,container:i,tickerCallback:s}),Yf=(t,{app:e,container:r,element:i,completionTracker:s,animationBus:o,zIndex:n,signal:a})=>fu(t,{type:"autoplay-text-reveal",app:e,container:r,element:i,completionTracker:s,animationBus:o,zIndex:n,signal:a}),OI=(t,{animations:e,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:n})=>fu(t,{type:"start-update-animations",animations:e,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:n}),LI=t=>{if(!t?.deferredMountOperations?.length)return;let e=t.deferredMountOperations.splice(0);for(let r of e)BI(r)};var H3=Object.prototype.hasOwnProperty,ye=(t,e)=>{if(Object.is(t,e))return!0;if(t===null||e===null||typeof t!="object"||typeof e!="object")return!1;let r=Array.isArray(t),i=Array.isArray(e);if(r!==i)return!1;if(r&&i){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!ye(t[n],e[n]))return!1;return!0}let s=Object.keys(t),o=Object.keys(e);if(s.length!==o.length)return!1;for(let n of s)if(!H3.call(e,n)||!ye(t[n],e[n]))return!1;return!0};var To=t=>{let e=new Set;if(t.id&&e.add(t.id),t.children&&Array.isArray(t.children))for(let r of t.children)for(let i of To(r))e.add(i);return e};var DI=(t=[])=>{if(t instanceof Map)return t;let e=new Map;for(let r of t)e.has(r.targetId)||e.set(r.targetId,[]),e.get(r.targetId).push(r);return e},jf=(t,e)=>t?t instanceof Map?t.get(e)??[]:t.filter(r=>r.targetId===e):[],NI=(t,e)=>jf(t,e).filter(r=>r.type==="update"),qf=(t,e)=>jf(t,e).find(r=>r.type==="transition")??null,GI=(t=[])=>t.some(e=>Object.keys(e.tween??{}).some(Es)),mu=(t=[],e,r=[])=>{for(let i of t){if(i?.id===e)return{element:i,ancestorIds:r};if(Array.isArray(i?.children)){let s=mu(i.children,e,[...r,i.id]);if(s)return s}}return null},VI=(t,e)=>ye(t?.ancestorIds??null,e?.ancestorIds??null),W3=({subtreeRoot:t,nextAnimations:e,continuingAnimationId:r})=>{if(!t)return!1;let i=To(t);for(let s of e??[])if(!(!s||s.id===r)&&i.has(s.targetId))return!0;return!1},K_=(t={})=>t.type==="update"?JSON.stringify({type:t.type,tween:t.tween,playback:t.playback??null}):JSON.stringify({type:t.type,prev:t.prev??null,next:t.next??null,mask:t.mask??null,compositor:t.compositor??null,tween:t.tween??null,playback:t.playback??null}),$3=({prevState:t,nextState:e,animation:r})=>{let i=mu(t?.elements,r.targetId),s=mu(e?.elements,r.targetId);return i!==null&&s!==null&&VI(i,s)&&ye(i.element,s.element)},z3=({prevState:t,nextState:e,animation:r})=>{let i=mu(t?.elements,r.targetId),s=mu(e?.elements,r.targetId);return i===null&&s===null?!0:i===null||s===null||!VI(i,s)||!ye(i.element,s.element)?!1:!W3({subtreeRoot:s.element,nextAnimations:e?.animations,continuingAnimationId:r.id})},HI=({prevState:t,nextState:e,activeAnimations:r})=>{let i=new Set,s=r instanceof Map?r:new Map(r?.map(o=>[o.id,o])??[]);for(let o of e?.animations??[]){if(o?.playback?.continuity!=="persistent")continue;let n=s.get(o.id);if(n&&!(n.type!==o.type||n.targetId!==o.targetId||n.signature!==K_(o))){if(o.type==="update"){$3({prevState:t,nextState:e,animation:o})&&i.add(o.id);continue}z3({prevState:t,nextState:e,animation:o})&&i.add(o.id)}}return{continuedAnimationIds:i}},X3=({animations:t,targetId:e,animationBus:r,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=NI(t,e),c=l.filter(h=>typeof r?.hasContext=="function"?r.hasContext(h.id):!1),u=l.filter(h=>!c.includes(h));if(l.length===0)return!1;if(u.length===0)return!0;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");let h=GI(u)?As(s):void 0;return dI(s,u,void 0,h),OI(a,{animations:u,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:h}),!0}return Hf({animations:u,animationBus:r,completionTracker:i,element:s,targetState:o,onComplete:n,animationBaseState:GI(u)?As(s):void 0}),!0},da=NI;var oe=X3;var WI=t=>!!t&&typeof t=="object"&&!Array.isArray(t),Y3=(t,e)=>e===void 0?t:e===null||e===!1?null:WI(e)?{...WI(t)?t:{},...e}:e,Ei=(t={},e={})=>{if(!e)return{...t};let r={...t,...e};return Object.prototype.hasOwnProperty.call(e,"shadow")&&(r.shadow=Y3(t?.shadow,e.shadow)),r};var zI=Symbol("routeGraphicsTextAnchorRatios"),So=Symbol("routeGraphicsTextLayoutState"),$I=(t,e)=>typeof t!="number"||t===0?0:e/t,Z_=t=>t?.align??$e.align,j3=t=>{let e=t[So];return e?.fixedWidth&&typeof e.layoutWidth=="number"?e.layoutWidth:typeof e?.measuredWidth=="number"?e.measuredWidth:t.width},q3=(t,e)=>{let r=Ye.measureText(String(t??""),new Ge(Ut(e,{includeShadow:!1})));return{width:r.width,height:r.height}},XI=t=>t?.shadow!==void 0&&t.shadow!==null&&t.shadow!==!1,eb=(t,e)=>XI(e)?q3(t.text,e):{width:t.width,height:t.height},Q_=t=>{let e=t[So];return typeof e?.measuredWidth=="number"?e.measuredWidth:t.width},K3=t=>{let e=t[So];return typeof e?.measuredHeight=="number"?e.measuredHeight:t.height},YI=(t,e,r)=>{let i=!!e.__fixedWidth,s=r??eb(t,e.textStyle),o=s.width??e.measuredWidth??e.width,n=s.height??e.height??t.height;t[So]={fixedWidth:i,layoutWidth:i?e.width:o,measuredWidth:o,measuredHeight:n}},J_=(t,e,r)=>{let i=Math.max(0,t-e);return r==="center"?i/2:r==="right"?i:0},tb=t=>{let e=t.measuredWidth??t.width,r=J_(t.width,e,Z_(t.textStyle));return{x:t.x+r,y:t.y}},Kf=(t,e)=>{let r=eb(t,e.textStyle),i=e.__fixedWidth&&typeof e.width=="number"?e.width:r.width,s=r.height,o=typeof e.__anchorXRatio=="number"?e.__anchorXRatio:$I(i,e.originX),n=typeof e.__anchorYRatio=="number"?e.__anchorYRatio:$I(s,e.originY);t[zI]={x:o,y:n},YI(t,e,r)},Z3=t=>typeof t?.fontSize!="number"||t.fontSize===0||typeof t?.lineHeight!="number"?$e.lineHeight:t.lineHeight/t.fontSize,Q3=(t,e)=>{if(!e)return t;let r=Ei(t,e);if(e.fontSize!==void 0||e.lineHeight!==void 0){let i=e.lineHeight??Z3(t);r.lineHeight=Math.round(r.fontSize*i)}return r},jI=(t,e,r)=>{let i=t[zI],s=j3(t),o=Q3(e,r);if(!i){wi(t,o);return}let n=J_(s,Q_(t),Z_(t.style)),l=t.x-n+s*i.x,c=t.y+K3(t)*i.y;wi(t,o);let u=eb(t,o),d=t[So]?.fixedWidth===!0?s:u.width,f=J_(d,u.width,Z_(o));t.x=l-d*i.x+f,t.y=c-u.height*i.y,t[So]={...t[So]??{},layoutWidth:d,measuredWidth:u.width,measuredHeight:u.height}},Zf=(t,e)=>{YI(t,e);let r=XI(e.textStyle)?e.measuredWidth??Q_(t):Q_(t),i=tb({...e,measuredWidth:r,width:e.__fixedWidth&&typeof e.width=="number"?e.width:r});t.x=i.x,t.y=i.y};var J3=(t,e)=>{let r=Number(t);if(Number.isFinite(r))return r;let i=Number(e);return Number.isFinite(i)?i:100},je=(t,e=100)=>{let r=J3(t??e,e);return Math.min(Math.max(r,0),100)/100};var qI=t=>{if(!(!t||typeof t!="object")){if(typeof t.button=="number")return t.button;if(typeof t.data?.button=="number")return t.data.button;if(typeof t.nativeEvent?.button=="number")return t.nativeEvent.button}},Ot=t=>{let e=qI(t);return e===void 0||e===0},KI=t=>qI(t)===2;var rb=Symbol.for("routeGraphics.setInheritedHover"),ZI=Symbol.for("routeGraphics.treeInheritedHoverActive"),ib=Symbol.for("routeGraphics.setInheritedPress"),QI=Symbol.for("routeGraphics.treeInheritedPressActive"),sb=Symbol.for("routeGraphics.setInheritedRightPress"),JI=Symbol.for("routeGraphics.treeInheritedRightPressActive"),fa=t=>Array.isArray(t?.children)?t.children:[],ob=({displayObject:t,symbol:e,source:r,isActive:i})=>{let s=t?.[e];typeof s=="function"&&s(r,i)},Qf=({displayObject:t,symbol:e})=>{t&&e in t&&delete t[e]},nb=({displayObject:t,symbol:e,onStateChange:r})=>{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&&r(c),c};return t[e]=(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:()=>{Qf({displayObject:t,symbol:e})}}},pa=t=>Qf({displayObject:t,symbol:rb}),Jf=t=>Qf({displayObject:t,symbol:ib}),ep=t=>Qf({displayObject:t,symbol:sb}),Cs=({displayObject:t,onHoverChange:e})=>{let r=nb({displayObject:t,symbol:rb,onStateChange:e});return{setDirectHover:r.setDirectState,isHovering:r.isActive,destroy:r.destroy}},ma=({displayObject:t,onPressChange:e})=>{let r=nb({displayObject:t,symbol:ib,onStateChange:e});return{setDirectPress:r.setDirectState,isPressed:r.isActive,destroy:r.destroy}},ga=({displayObject:t,onPressChange:e})=>{let r=nb({displayObject:t,symbol:sb,onStateChange:e});return{setDirectPress:r.setDirectState,isPressed:r.isActive,destroy:r.destroy}},ab=t=>t?.[ZI]===!0,lb=t=>t?.[QI]===!0,cb=t=>t?.[JI]===!0,xa=({root:t,isHovered:e})=>{if(!t)return;t[ZI]=e;let r=[...fa(t)];for(;r.length>0;){let i=r.pop();ob({displayObject:i,symbol:rb,source:t,isActive:e}),r.push(...fa(i))}},wo=({root:t,isPressed:e})=>{if(!t)return;t[QI]=e;let r=[...fa(t)];for(;r.length>0;){let i=r.pop();ob({displayObject:i,symbol:ib,source:t,isActive:e}),r.push(...fa(i))}},qi=({root:t,isPressed:e})=>{if(!t)return;t[JI]=e;let r=[...fa(t)];for(;r.length>0;){let i=r.pop();ob({displayObject:i,symbol:sb,source:t,isActive:e}),r.push(...fa(i))}};var eB="__rtglScrollHandled",tB=t=>t?.payload&&typeof t.payload=="object"?t.payload:{},Gr=({canvas:t,displayObject:e,width:r,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1,l=Number.isFinite(r)&&Number.isFinite(i)&&r>0&&i>0;e.eventMode="static",l&&(e.hitArea=new te(0,0,Math.round(r),Math.round(i)));let c=(p,m)=>{m?.[eB]||(m&&(m[eB]=!0),p<0&&s&&n?n("scrollUp",{_event:{id:e.label},...tB(s)}):p>0&&o&&n&&n("scrollDown",{_event:{id:e.label},...tB(o)}))},u=()=>{a=!0},h=()=>{a=!1},d=p=>{p.preventDefault?.(),c(p.deltaY,p.nativeEvent)},f=p=>{a&&(p.preventDefault(),c(p.deltaY,p))};e.on("pointerover",u),e.on("pointerout",h),e.on("wheel",d),t?.addEventListener("wheel",f,{passive:!1}),e._cleanupScrollInteraction=()=>{a=!1,e.off("pointerover",u),e.off("pointerout",h),e.off("wheel",d),t?.removeEventListener("wheel",f),l&&(e.hitArea=null),delete e._cleanupScrollInteraction}},ub=({root:t})=>{t?._cleanupScrollInteraction?.(),t?.children?.forEach(e=>{ub({root:e})})};var ya=t=>{t._cleanupScrollInteraction?.(),t.removeAllListeners("pointerover"),t.removeAllListeners("pointerout"),t.removeAllListeners("pointerdown"),t.removeAllListeners("pointerupoutside"),t.removeAllListeners("pointerup"),t.removeAllListeners("rightdown"),t.removeAllListeners("rightclick"),t.removeAllListeners("rightup"),t.removeAllListeners("rightupoutside"),t.removeAllListeners("wheel"),pa(t),Jf(t),ep(t),t.cursor="auto",t.eventMode="auto"},gu=({app:t,displayObject:e,textComputedNode:r,eventHandler:i,applyStyle:s})=>{let o=r?.hover,n=r?.click,a=r?.rightClick,l=r?.scrollUp,c=r?.scrollDown,u=null,h=null,d=null,f=()=>{let p=u?.isHovering()??!1,m=h?.isPressed()??!1;(d?.isPressed()??!1)&&a?.textStyle?s(a.textStyle):m&&n?.textStyle?s(n.textStyle):p&&o?.textStyle?s(o.textStyle):s()};if(o){let{cursor:p,soundSrc:m,payload:x}=o;e.eventMode="static",u=Cs({displayObject:e,onHoverChange:f});let v=()=>{u.setDirectHover(!0),x&&i&&i("hover",{_event:{id:e.label},...x}),p&&(e.cursor=p),m&&t.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1})},y=()=>{u.setDirectHover(!1),e.cursor="auto"};e.on("pointerover",v),e.on("pointerout",y)}if(n){let{soundSrc:p,soundVolume:m,payload:x}=n;e.eventMode="static",h=ma({displayObject:e,onPressChange:f});let v=b=>{Ot(b)&&h.setDirectPress(!0)},y=b=>{Ot(b)&&(h.setDirectPress(!1),x&&i&&i("click",{_event:{id:e.label},...x}),p&&t.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1,volume:je(m)}))},g=()=>{h.setDirectPress(!1)};e.on("pointerdown",v),e.on("pointerup",y),e.on("pointerupoutside",g)}if(a){let{soundSrc:p,payload:m}=a;e.eventMode="static",d=ga({displayObject:e,onPressChange:f});let x=()=>{d.setDirectPress(!0)},v=()=>{d.setDirectPress(!1)},y=()=>{d.setDirectPress(!1),m&&i&&i("rightClick",{_event:{id:e.label},...m}),p&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:p,loop:!1})},g=()=>{d.setDirectPress(!1)};e.on("rightdown",x),e.on("rightup",v),e.on("rightclick",y),e.on("rightupoutside",g)}(l||c)&&Gr({canvas:t.canvas,displayObject:e,scrollUpEvent:l,scrollDownEvent:c,eventHandler:i})};var sB=Symbol("routeGraphicsRichTextDisplay"),eV=t=>t?.align??$e.align,tV=(t,e,r)=>{let i=Math.max(0,t-e.width),s=0;return r==="center"?s=i/2:r==="right"&&(s=i),s-e.x},rV=t=>{t.removeChildren().forEach(r=>{r.destroy({children:!0})})},rB=({text:t,style:e,x:r,y:i})=>new vr({text:t,style:new Ge(Ut(e)),x:Math.round(r),y:Math.round(i)}),iB=(t,e)=>e?Ei(t,e):t,Eo=t=>Array.isArray(t?.content),oB=t=>!!t?.[sB],nB=t=>({x:t.x,y:t.y}),xu=(t,e,r)=>{rV(t),t.label=e.id,t.x=Math.round(e.x??0),t.y=Math.round(e.y??0),t.alpha=e.alpha??1;let i=e.width??e.measuredWidth??0;for(let s=0;s<e.content.length;s++){let o=e.content[s],n=new ie({label:`${e.id}-line-${s}`});for(let l of o.lineParts??[])l.furigana&&n.addChild(rB({text:l.furigana.text,style:iB(l.furigana.textStyle,r),x:l.furigana.x,y:l.furigana.y})),n.addChild(rB({text:l.text,style:iB(l.textStyle,r),x:l.x,y:l.y}));let a=n.getLocalBounds();n.x=tV(i,a,eV(e.textStyle)),t.addChild(n)}t.hitArea=new te(0,0,Math.max(0,i),Math.max(0,e.height??0))},aB=(t,e)=>{let r=new ie({label:t.id});return r[sB]=!0,r.zIndex=e,xu(r,t),r};var hb="__routeGraphicsManagedFilters",iV=["shadow","blur","shader"],sV=t=>(t[hb]||Object.defineProperty(t,hb,{value:new Map,enumerable:!1,configurable:!0}),t[hb]),oV=t=>t.filters?Array.isArray(t.filters)?t.filters:[t.filters]:[],tp=t=>t?Array.isArray(t)?t.filter(Boolean):[t]:[],nV=(t,e,r)=>{let i=new Set;for(let a of e.values())for(let l of tp(a))i.add(l);for(let a of tp(r))i.add(a);let s=oV(t).filter(a=>!i.has(a)),n=[...iV.flatMap(a=>tp(e.get(a))),...s];t.filters=n.length>0?n:null},aV=t=>{for(let e of tp(t))e.destroy?.()},Ao=(t,e,r)=>{let i=sV(t),s=i.get(e);r?i.set(e,r):i.delete(e),nV(t,i,s),s&&s!==r&&aV(s)};var lB=/^[a-z][A-Za-z0-9]*$/;var lV=new Set(["shader"]),cB=new Set(["normal","add","multiply","screen"]),uB=new Set(["clamp","repeat"]),cV=new Set(["uTexture","uPrevTexture","uNextTexture","uNextTextureMatrix","uNextTextureClamp","uProgress","uResolution","uSampler","GlobalFilterUniforms","ShaderUniforms","VSOutput","gfu","shaderUniforms","mainVertex","mainFragment","uInputSize","uInputPixel","uInputClamp","uOutputFrame","uGlobalFrame","uOutputTexture"]),uV=t=>!!t&&typeof t=="object"&&!Array.isArray(t),hB=t=>typeof t=="number"&&Number.isFinite(t),Rs=(t,e)=>{if(!uV(t))throw new Error(`Input Error: ${e} must be an object`)},yu=(t,e)=>{if(typeof t!="string"||t.length===0)throw new Error(`Input Error: ${e} must be a non-empty string`)},dB=(t,e)=>{if(!lB.test(t))throw new Error(`Input Error: ${e} must match ${lB.source}`)},fB=t=>t.charAt(0).toUpperCase()+t.slice(1),hV=t=>`u${fB(t)}`,dV=t=>`u${fB(t)}Texture`,pB=({key:t,symbol:e,path:r,symbols:i,kind:s})=>{if(cV.has(e))throw new Error(`Input Error: ${r}.${t} generates reserved shader symbol ${e}`);if(i.has(e))throw new Error(`Input Error: ${r}.${t} generates duplicate shader symbol ${e}`);i.set(e,{key:t,kind:s})},fV=(t,e)=>{if(hB(t))return{type:"f32",value:t};if(Array.isArray(t)&&(t.length===2||t.length===4)&&t.every(hB))return{type:t.length===2?"vec2<f32>":"vec4<f32>",value:[...t]};throw new Error(`Input Error: ${e} must be a number, a length-2 number array, or a length-4 number array`)},pV=(t,e,r)=>t===void 0?[]:(Rs(t,e),Object.keys(t).sort().map(i=>{dB(i,`${e}.${i}`);let s=hV(i);return pB({key:i,symbol:s,path:e,symbols:r,kind:"uniform"}),{key:i,symbol:s,...fV(t[i],`${e}.${i}`)}})),mV=({textures:t,path:e,symbols:r,maxTextures:i})=>{if(t===void 0)return[];Rs(t,e);let s=Object.keys(t).sort();if(s.length>i)throw new Error(`Input Error: ${e} supports at most ${i} custom textures`);return s.map(o=>{dB(o,`${e}.${o}`),yu(t[o],`${e}.${o}`);let n=dV(o);return pB({key:o,symbol:n,path:e,symbols:r,kind:"texture"}),{key:o,symbol:n,src:t[o]}})},gV=(t,e)=>{if(t===void 0)return{blend:"normal",textureWrap:"clamp",mipmap:!1};Rs(t,e);let r=t.blend??"normal";if(!cB.has(r))throw new Error(`Input Error: ${e}.blend must be one of: ${Array.from(cB).join(", ")}`);let i=t.textureWrap??"clamp";if(!uB.has(i))throw new Error(`Input Error: ${e}.textureWrap must be one of: ${Array.from(uB).join(", ")}`);let s=t.mipmap??!1;if(typeof s!="boolean")throw new Error(`Input Error: ${e}.mipmap must be a boolean`);return{blend:r,textureWrap:i,mipmap:s}},xV=(t,e)=>{if(Rs(t,e),Rs(t.webgl,`${e}.webgl`),Rs(t.webgpu,`${e}.webgpu`),t.webgl.vertex!==void 0&&typeof t.webgl.vertex!="string")throw new Error(`Input Error: ${e}.webgl.vertex must be a string`);if(yu(t.webgl.fragment,`${e}.webgl.fragment`),yu(t.webgpu.source,`${e}.webgpu.source`),!t.webgpu.source.includes("mainVertex")||!t.webgpu.source.includes("mainFragment"))throw new Error(`Input Error: ${e}.webgpu.source must define mainVertex and mainFragment`);return{webgl:{...t.webgl.vertex!==void 0?{vertex:t.webgl.vertex}:{},fragment:t.webgl.fragment},webgpu:{source:t.webgpu.source}}},yV=(t,e)=>{if(t===void 0)return{grid:[1,1]};if(Rs(t,e),!Array.isArray(t.grid)||t.grid.length!==2||!t.grid.every(r=>Number.isInteger(r)&&r>=1))throw new Error(`Input Error: ${e}.grid must be [columns, rows] with positive integers`);return{grid:[t.grid[0],t.grid[1]]}},mB=({shader:t,path:e,requireId:r,textureLimit:i,allowMesh:s})=>{if(Rs(t,e),!lV.has(t.type))throw new Error(`Input Error: ${e}.type must be shader`);let o={type:"shader"};r?(yu(t.id,`${e}.id`),o.id=t.id):t.id!==void 0&&(yu(t.id,`${e}.id`),o.id=t.id);let n=new Map;if(o.uniforms=pV(t.uniforms,`${e}.uniforms`,n),o.textures=mV({textures:t.textures,path:`${e}.textures`,symbols:n,maxTextures:i}),o.pipeline=gV(t.pipeline,`${e}.pipeline`),o.source=xV(t.source,`${e}.source`),t.mesh!==void 0&&!s)throw new Error(`Input Error: ${e}.mesh is only valid for compositors`);return s&&(o.mesh=yV(t.mesh,`${e}.mesh`)),o},gB=(t,e="filters")=>{if(t===void 0)return;if(!Array.isArray(t))throw new Error(`Input Error: ${e} must be an array`);let r=new Set;return t.map((i,s)=>{let o=mB({shader:i,path:`${e}[${s}]`,requireId:!0,textureLimit:7,allowMesh:!1});if(r.has(o.id))throw new Error(`Input Error: ${e}[${s}].id must be unique within filters`);return r.add(o.id),o})},xB=(t,e="compositor")=>mB({shader:t,path:e,requireId:!1,textureLimit:6,allowMesh:!0}),yB=t=>JSON.stringify(t??null);var fb="__routeGraphicsShaderFilters",Po="__routeGraphicsShaderProgress",_B="__routeGraphicsShaderDestroyCleanup",_V=`
|
|
1263
|
+
`),u=tI.replace("%blur-struct%",a).replace("%blur-vertex-out%",l).replace("%blur-fragment-in%",a).replace("%blur-sampling%",c).replace("%dimension%",t?"z":"w");return hr.from({vertex:{source:u,entryPoint:"mainVertex"},fragment:{source:u,entryPoint:"mainFragment"}})}var iI=class sI extends Br{constructor(e){e={...sI.defaultOptions,...e};let r=eI(e.horizontal,e.kernelSize),i=rI(e.horizontal,e.kernelSize);super({glProgram:r,gpuProgram:i,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}},...e}),this.horizontal=e.horizontal,this._quality=0,this.quality=e.quality,this.blur=e.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(e,r,i,s){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)e.applyFilter(this,r,i,s);else{let o=Ve.getSameSizeTexture(r),n=r,a=o;this._state.blend=!1;let l=e.renderer.type===Xe.WEBGPU;for(let c=0;c<this.passes-1;c++){e.applyFilter(this,n,a,c===0?!0:l);let u=a;a=n,n=u}this._state.blend=!0,e.applyFilter(this,n,i,s),Ve.returnTexture(o)}}get blur(){return this.strength}set blur(e){this.padding=1+Math.abs(e)*2,this.strength=e}get quality(){return this._quality}set quality(e){this._quality=e,this.passes=e}};iI.defaultOptions={strength:8,quality:4,kernelSize:5};var Of=iI;var sa=class extends Br{constructor(...e){let r=e[0]??{};typeof r=="number"&&(J(ue,"BlurFilter constructor params are now options object. See params: { strength, quality, resolution, kernelSize }"),r={strength:r},e[1]!==void 0&&(r.quality=e[1]),e[2]!==void 0&&(r.resolution=e[2]||"inherit"),e[3]!==void 0&&(r.kernelSize=e[3])),r={...Of.defaultOptions,...r};let{strength:i,strengthX:s,strengthY:o,quality:n,...a}=r;super({...a,compatibleRenderers:Xe.BOTH,resources:{}}),this._repeatEdgePixels=!1,this.blurXFilter=new Of({horizontal:!0,...r}),this.blurYFilter=new Of({horizontal:!1,...r}),this.quality=n,this.strengthX=s??i,this.strengthY=o??i,this.repeatEdgePixels=!1}apply(e,r,i,s){let o=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(o&&n){let a=Ve.getSameSizeTexture(r);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(e,r,a,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,a,i,s),Ve.returnTexture(a)}else n?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,r,i,s)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(e,r,i,s))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(e){this.blurXFilter.quality=this.blurYFilter.quality=e}get strengthX(){return this.blurXFilter.blur}set strengthX(e){this.blurXFilter.blur=e,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(e){this.blurYFilter.blur=e,this.updatePadding()}get blur(){return J("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength}set blur(e){J("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength=e}get blurX(){return J("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX}set blurX(e){J("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX=e}get blurY(){return J("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY}set blurY(e){J("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}};sa.defaultOptions={strength:8,quality:4,kernelSize:5};Fe();Sl();pn();Il();var ws=class t extends ke{constructor(...e){let r=e[0];Array.isArray(e[0])&&(r={textures:e[0],autoUpdate:e[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:c=null,textures:u,updateAnchor:h=!1,...d}=r,[f]=u;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=h,this.onComplete=a,this.onFrameChange=l,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=u,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Tt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Tt.shared.add(this.update,this,hi.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(e){this.stop(),this.currentFrame=e}gotoAndPlay(e){this.currentFrame=e,this.play()}update(e){if(!this._playing)return;let r=e.deltaTime,i=this.animationSpeed*r,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*r);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 e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this.texture=this._textures[e],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(e){let r=[];for(let i=0;i<e.length;++i)r.push(B.from(e[i]));return new t(r)}static fromImages(e){let r=[];for(let i=0;i<e.length;++i)r.push(B.from(e[i]));return new t(r)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(e){if(e[0]instanceof B)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(let r=0;r<e.length;r++)this._textures.push(e[r].texture),this._durations.push(e[r].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e}set currentFrame(e){if(e<0||e>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${e}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let r=this.currentFrame;this._currentTime=e,r!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(Tt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(Tt.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Uh();tt();Jh();var Lf=class extends us{constructor(e,r){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:c,...u}=e;super({...u}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=r,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Ft({_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(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,r){typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,this.bounds.width),r!==void 0&&this._setHeight(r,this.bounds.height)}containsPoint(e){let r=this.bounds.width,i=this.bounds.height,s=-r*this.anchor.x,o=0;return e.x>=s&&e.x<=s+r&&(o=-i*this.anchor.y,e.y>=o&&e.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}};function oI(t,e){let r=t[0]??{};return(typeof r=="string"||t[1])&&(J(ue,`use new ${e}({ text: "hi!", style }) instead`),r={text:r,style:t[1]}),r}ec();po();var vr=class extends Lf{constructor(...e){let r=oI(e,"Text");super(r,Ge),this.renderPipeId="text"}updateBounds(){let e=this._bounds,r=this._anchor,i=Ye.measureText(this._text,this._style),{width:s,height:o}=i;e.minX=-r._x*s,e.maxX=e.minX+s,e.minY=-r._y*o,e.maxY=e.minY+o}};cc();Ae();gr();vt();oo();Wt();$y();Qt();Fe();nf();Yg();br();Yr();ho();cy();Il();ec();po();Gg();Vt();var jN=Xs(Td(),1);K.add(cP,hP);var qN=new(window.AudioContext||window.webkitAudioContext),Gf={},cu={},KN=t=>t?typeof t=="string"?t:t.message||String(t):"Unknown error",ZN=(t,e)=>{let r="Unsupported or damaged audio file.",i=`Could not load audio "${t}". ${r}`,s=new Error(i,{cause:e});return s.userMessage=i,s.rootCauseMessage=r,s.details={assetKey:t,assetKind:"audio",phase:"decode",cause:KN(e)},s},QN=(t,e)=>{if(Gf[t])return Gf[t];if(cu[t])return cu[t];if(e.byteLength!==0)return cu[t]=qN.decodeAudioData(e).then(r=>(Gf[t]=r,r)).catch(r=>{throw ZN(t,r)}).finally(()=>{delete cu[t]}),cu[t]},JN=t=>Gf[t],oa={load:QN,getAsset:JN};var dt=({type:t,add:e,update:r,delete:i,parse:s,shouldUpdateUnchanged:o})=>({type:t,add:e,update:r,delete:i,parse:s,shouldUpdateUnchanged:o});var M_=({type:t})=>({type:t});var I_=({type:t,add:e,update:r,delete:i})=>({type:t,add:e,update:r,delete:i});var Df={alpha:"alpha",x:"x",y:"y",translateX:"translateX",translateY:"translateY",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation",blurX:"blurX",blurY:"blurY",uProgress:"uProgress"};var Nf={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"],blurX:["_routeGraphicsBlur","x"],blurY:["_routeGraphicsBlur","y"],uProgress:["uProgress"]};var Tr={RECT:"rect",TEXT:"text",INPUT:"input",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",SPRITESHEET_ANIMATION:"spritesheet-animation",VIDEO:"video"};var He={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var nI={color:"black",alpha:1,blur:0,offsetX:2,offsetY:2},e3=.4,t3=t=>{if(typeof t=="number"&&Number.isFinite(t))return Math.max(0,t);if(typeof t=="string"){let e=Number.parseFloat(t);if(Number.isFinite(e))return Math.max(0,e)}return He.fontSize},r3=t=>typeof t=="number"&&Number.isFinite(t)?t:0,i3=(t={})=>Math.ceil(t3(t.fontSize)*e3),s3=(t={})=>{let e=typeof t.stroke=="object"&&t.stroke!==null?t.stroke:{};return{...e,color:t.strokeColor??e.color??He.strokeColor,width:t.strokeWidth??e.width??He.strokeWidth}},o3=t=>{if(t===void 0)return;if(t===null||t===!1)return null;let e=typeof t=="object"&&t!==null?{...nI,...t}:nI,r=e.offsetX,i=e.offsetY,s=Math.hypot(r,i);return{alpha:e.alpha,angle:s===0?0:Math.atan2(i,r),blur:e.blur,color:e.color,distance:s}},n3=t=>t?Math.ceil(Math.max(0,t.blur)+t.distance):0,Ut=(t={},e={})=>{let r=e.includeShadow!==!1,{strokeColor:i,strokeWidth:s,stroke:o,shadow:n,...a}=t;delete a.dropShadow;let l={...a,stroke:s3({strokeColor:i,strokeWidth:s,stroke:o})};if(r){let c=o3(n),u=n3(c),h=Math.max(r3(a.padding),u,i3(a));n!==void 0&&(l.dropShadow=c),h>0&&(l.padding=h)}return l};var wi=(t,e)=>{let r={fill:e?.fill??He.fill,fontFamily:e?.fontFamily??He.fontFamily,fontSize:e?.fontSize??He.fontSize,align:e?.align??He.align,lineHeight:e?.lineHeight??He.lineHeight,wordWrap:e?.wordWrap??He.wordWrap,breakWords:e?.breakWords??He.breakWords,strokeColor:e?.strokeColor??He.strokeColor,strokeWidth:e?.strokeWidth??He.strokeWidth,wordWrapWidth:e?.wordWrapWidth??He.wordWrapWidth,...e?.padding!==void 0?{padding:e.padding}:{},...Object.prototype.hasOwnProperty.call(e??{},"shadow")?{shadow:e.shadow}:{}};t.style=Ut(r)};var _o=(t=0)=>t*Math.PI/180,B_=(t=0)=>t*180/Math.PI,aI=t=>typeof t=="number"&&Number.isFinite(t)&&t!==0?t:1,Vf=t=>({x:Math.round((t.x??0)+(t.originX??0)),y:Math.round((t.y??0)+(t.originY??0))}),Ur=(t,e)=>{let r=e.originX??0,i=e.originY??0,s=aI(t.scale?.x),o=aI(t.scale?.y),n=Vf(e);t.pivot?.set?.(r/s,i/o),t.x=n.x,t.y=n.y,t.rotation=_o(e.rotation??0)},Or=(t,e={})=>{let r=Vf(t),i={x:r.x,y:r.y,...e};return t.rotation!==void 0&&(i.rotation=t.rotation),i};var Es=t=>t==="translateX"||t==="translateY",uI=(t,e)=>typeof e!="string"?e:t[e]??e,a3=(t,e,r,i)=>{let s=uI(r,e);if(typeof s=="string"){let n=t[s];return n===void 0?i:e==="rotation"?B_(n):n}let o=t;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:e==="rotation"?B_(o):o},l3=(t,e,r,i)=>{let s=uI(r,e),o=e==="rotation"?_o(i):i;if(typeof s=="string")return t[s]=o,t;let n=t;for(let a=0;a<s.length-1;a++){let l=s[a];l in n||(n[l]={}),n=n[l]}return n[s[s.length-1]]=o,t},lI=t=>typeof t=="number"&&Number.isFinite(t),c3=t=>{let e=t?.getLocalBounds?.();return e?.rectangle??e??null},cI=(t,e)=>{let r=e==="x"?t?.width:t?.height;if(lI(r)&&r>0)return r;let i=c3(t),s=e==="x"?i?.width:i?.height,o=e==="x"?t?.scale?.x:t?.scale?.y;return lI(s)&&s>0?Math.abs(s*(o??1)):0},As=t=>({x:t?.x??0,y:t?.y??0,width:cI(t,"x"),height:cI(t,"y")}),hI=({object:t,property:e,propertyPathMap:r,subjectState:i,defaultValue:s=0})=>e==="translateX"||e==="translateY"?s:a3(t,e,r,s),uu=({object:t,property:e,propertyPathMap:r,subjectState:i,value:s})=>e==="translateX"?(t.x=i.x+s*i.width,t):e==="translateY"?(t.y=i.y+s*i.height,t):l3(t,e,r,s);var dI=(t,e,r=Nf,i)=>{let s=i;for(let o of e)for(let[n,a]of Object.entries(o.tween)){if(!Df[n])throw new Error(`${n} is not a supported property for animation.`);a.initialValue!==void 0&&(!s&&Es(n)&&(s=As(t)),uu({object:t,property:n,propertyPathMap:r,subjectState:s,value:a.initialValue}))}},Hf=({animations:t,animationBus:e,completionTracker:r,element:i,targetState:s,onComplete:o,animationBaseState:n})=>{for(let a of t){if(typeof e?.hasContext=="function"&&e.hasContext(a.id))continue;for(let[u,h]of Object.entries(a.tween))if(h.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,u)))throw new Error(`Animation "${a.id}" cannot auto-resolve property "${u}" from targetState.`);let l=a.playback?.continuity!=="persistent",c=l?r.getVersion():null;l&&r.track(c),e.dispatch({type:"START",payload:{id:a.id,animationType:a.type,targetId:a.targetId,continuity:a.playback?.continuity??"render",playbackSpeed:a.playback?.speed,signature:a.signature??JSON.stringify({type:a.type,tween:a.tween,playback:a.playback??null}),element:i,properties:a.tween,targetState:s,animationBaseState:n,onComplete:()=>{l&&r.complete(c),o?.(a)}}})}};var u3=t=>{if(!t?.dropShadow||typeof t.clone!="function")return t;let e=t.clone();return e.dropShadow=null,e};function Wf(t,e){let r=t.text.substring(0,e),s=Ye.measureText(r,u3(t.style)).width;return t.x+s}var h3=async(t,e)=>new Promise((r,i)=>{if(e?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&e?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),r()},t);s=()=>{clearTimeout(n),o(),i(e.reason)},e?.addEventListener("abort",s,{once:!0})}),$f=h3;var hu={softness:1.25,easing:"linear",lineOverlap:0,lineDelay:0},d3=18,f3=64,k_={linear:t=>t,easeOutCubic:t=>1-(1-t)**3},p3=(t,e,r)=>Math.max(e,Math.min(r,t)),F_=(t,e)=>typeof t=="number"&&Number.isFinite(t)?t:e,bo=(t={})=>{let e=t&&typeof t=="object"?t:{};return{softness:Math.max(0,F_(e.softness,hu.softness)),easing:Object.prototype.hasOwnProperty.call(k_,e.easing)?e.easing:hu.easing,lineOverlap:p3(F_(e.lineOverlap,hu.lineOverlap),0,.95),lineDelay:Math.max(0,F_(e.lineDelay,hu.lineDelay))}},U_=t=>k_[t]??k_[hu.easing],O_=({maxLineHeight:t,softWipe:e})=>Math.max(d3,Math.min(f3,Math.round(t*e.softness)));var na=(t,e,r,i)=>{if(!r)return;let s=o=>{o?.detail?.elementId===e&&typeof o?.detail?.frameIndex=="number"&&(t.gotoAndStop(o?.detail?.frameIndex),i?.())};window.addEventListener("snapShotAnimatedSpriteFrame",s),t._snapShotKeyFrameHandler=s},vo=t=>{t._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",t._snapShotKeyFrameHandler),delete t._snapShotKeyFrameHandler)};var fI=(t={})=>{if(t.frame){let n=t.frame.w??0,a=t.frame.h??0,l=t.sourceSize?.w??n,c=t.sourceSize?.h??a,u={frame:{x:t.frame.x??0,y:t.frame.y??0,w:n,h:a},rotated:t.rotated??!1,trimmed:t.trimmed??!1,spriteSourceSize:{x:t.spriteSourceSize?.x??0,y:t.spriteSourceSize?.y??0,w:t.spriteSourceSize?.w??n,h:t.spriteSourceSize?.h??a},sourceSize:{w:l,h:c}};return t.anchor?u.anchor={x:t.anchor.x??0,y:t.anchor.y??0}:t.pivot&&(u.anchor={x:t.pivot.x??0,y:t.pivot.y??0}),t.borders&&(u.borders={...t.borders}),u}let e=t.width??t.w??0,r=t.height??t.h??0,i=t.sourceWidth??e,s=t.sourceHeight??r,o={frame:{x:t.x??0,y:t.y??0,w:e,h:r},rotated:t.rotated??!1,trimmed:t.trimmed??!1,spriteSourceSize:{x:t.offsetX??0,y:t.offsetY??0,w:e,h:r},sourceSize:{w:i,h:s}};return t.anchor?o.anchor={x:t.anchor.x??0,y:t.anchor.y??0}:t.pivot&&(o.anchor={x:t.pivot.x??0,y:t.pivot.y??0}),t.borders&&(o.borders={...t.borders}),o},L_=(t={})=>!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Array.isArray(r)?r.map(i=>String(i)):[]])),m3=(t,e={})=>{let r=Math.max(0,Number(e.from??0)),i=Math.min(t.length-1,Number(e.to??r));if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return[];let s=t.slice(r,i+1),o=String(e.direction??"forward").toLowerCase();if(o==="reverse"||o==="backward")return[...s].reverse();if(o==="pingpong")return[...s,...s.slice(1,-1).reverse()];if(o==="pingpong_reverse"){let n=[...s].reverse();return[...n,...n.slice(1,-1).reverse()]}return s},g3=(t=[],e=[])=>!Array.isArray(t)||e.length===0?{}:Object.fromEntries(t.map(r=>{let i=typeof r?.name=="string"?r.name:"";return i?[i,m3(e,r)]:null}).filter(Boolean)),Qr=(t={})=>{let e=t??{},r=L_(e.animations);return{frames:Array.isArray(e.frames)?Object.fromEntries(e.frames.map(s=>{let o=s?.filename??s?.name;return typeof o!="string"||o.length===0?null:[o,fI(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,fI(o)])),...Object.keys(r).length>0?{animations:r}:{},meta:{...e.meta??{},scale:String(e.scale??e.meta?.scale??1),...e.width!=null||e.height!=null?{size:{w:e.width??e.meta?.size?.w??0,h:e.height??e.meta?.size?.h??0}}:{}}}},Jr=(t={},e={},r={},i=[])=>({...g3(r?.frameTags,i),...L_(e),...L_(t)}),x3=(t,e)=>{if(!Array.isArray(e?.frames))return[];let r=Object.keys(t.frames??{});return e.frames.map(i=>typeof i=="number"?r[i]:String(i)).filter(Boolean)},Lr=({atlas:t={frames:{}},clips:e={},playback:r,legacyAnimation:i})=>{let s=r??i??{},o={fps:s.fps??null,loop:s.loop??!0,autoplay:s.autoplay??!0};return typeof s.clip=="string"&&s.clip.length>0&&(o.clip=s.clip),Array.isArray(s.frames)?o.frames=s.frames.map(n=>typeof n=="number"?Object.keys(t.frames??{})[n]:String(n)).filter(Boolean):o.clip||(o.frames=x3(t,i)),o.fps==null&&(typeof s.animationSpeed=="number"?o.fps=s.animationSpeed*60:o.fps=30),o.clip&&(!Array.isArray(o.frames)||o.frames.length===0)&&(o.frames=Array.isArray(e[o.clip])?[...e[o.clip]]:[]),Array.isArray(o.frames)||(o.frames=[]),o},aa=({spritesheet:t,atlas:e,clips:r={},playback:i,legacyAnimation:s})=>{let o=Lr({atlas:e,clips:r,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>t.textures[a]),playback:o}},la=t=>typeof t=="number"?t/60:.5;var Xi=Symbol("textRevealRuntime"),zf=Symbol("textRevealSnapshot"),ca=Symbol("textRevealIndicator"),yI=Symbol("textRevealIndicatorPlayback"),N_=50,y3=0,W_=100,G_=W_-1,pI=10,_I=120,_3=.9,b3=360,v3=1.2,D_=20,T3=16,S3=0,w3=(t,e,r)=>Math.max(e,Math.min(r,t)),bI=(t=N_)=>typeof t!="number"||!Number.isFinite(t)?N_:Math.max(y3,Math.min(W_,t)),E3=t=>bI(t)>=W_,$_=(t,{maxRate:e=_I,curve:r=_3}={})=>{let i=Math.min(bI(t),G_),o=(G_>0?i/G_:0)**r;return pI*(e/pI)**o},A3=t=>$_(t,{maxRate:b3,curve:v3}),P3=t=>{let e=1e3/t;return e>=D_||t<=_I?{stepDelay:Math.max(1,Math.floor(e)),charactersPerStep:1}:{stepDelay:D_,charactersPerStep:Math.max(2,Math.round(t*D_/1e3))}},C3=t=>t?.revealEffect==="softWipe"?"softWipe":"typewriter",z_=t=>{let e=t?.initialRevealedCharacters;return typeof e!="number"||!Number.isFinite(e)?0:Math.max(0,Math.floor(e))},R3=t=>(t?.content??[]).reduce((e,r)=>e+(r.lineParts??[]).reduce((i,s)=>i+(s.text?.length??0),0),0),ua=t=>t?.revealEffect==="none"||E3(t?.speed??N_),V_=t=>t!==null&&typeof t=="object"&&typeof t.then=="function",X_=(t={})=>t.kind??(t.atlas!==void 0||t.clips!==void 0||t.playback!==void 0?"spritesheet":"image"),M3=t=>["revealing","complete"].some(e=>X_(t?.indicator?.[e])==="spritesheet"&&!!t?.indicator?.[e]?.src),vI=t=>`${t.id}-indicator`,TI=(t,e,r)=>{typeof e?.width=="number"?t.width=e.width:r?.width&&(t.width=r.width),typeof e?.height=="number"?t.height=e.height:r?.height&&(t.height=r.height)},SI=(t={})=>{let e=t?.src?B.from(t.src):B.EMPTY,r=new ke(e);return TI(r,t,e),r},I3=(t={},{app:e,element:r})=>{if(!t?.src)return SI(t);let i=Qr(t.atlas),s=Jr(t.clips,t.atlas?.animations,t.atlas?.meta,Object.keys(i.frames??{})),o=Lr({atlas:i,clips:s,playback:t.playback});return(async()=>{let n=new pi(B.from(t.src),i);await n.parse();let{frameTextures:a}=aa({spritesheet:n,atlas:i,clips:s,playback:o}),l=new ws(a.length>0?a:[B.EMPTY]);return l.animationSpeed=la(o.fps),l.loop=o.loop,l[yI]=o,TI(l,t,a[0]),e?.debug&&na(l,vI(r),e.debug,()=>{typeof e.render=="function"&&e.render()}),l})()},mI=(t,e)=>X_(t)==="spritesheet"?I3(t,e):SI(t),gI=(t,e)=>{t instanceof ws&&!e?.debug&&t[yI]?.autoplay!==!1&&t.play()},wI=t=>{!t||t.destroyed||(vo(t),typeof t.stop=="function"&&t.stop(),t.destroy({children:!0}))},H_=t=>{let e=t?.[ca];if(e){for(let r of e.displays)vo(r);for(let r of e.displays)r?.parent!==t&&wI(r);delete t[ca]}t.destroy({children:!0})},B3=({element:t,app:e,revealingDisplay:r,completeDisplay:i})=>{let s=new ie({label:vI(t)}),o=new Set([r]);return i&&o.add(i),s.addChild(r),s[ca]={displays:o,currentDisplay:r,completeDisplay:i,start(){gI(this.currentDisplay,e)},showComplete(){if(!this.completeDisplay||this.currentDisplay===this.completeDisplay)return;let n=this.currentDisplay;n?.parent===s&&s.removeChild(n),wI(n),o.delete(n),this.currentDisplay=this.completeDisplay,s.addChild(this.completeDisplay),gI(this.completeDisplay,e)}},s},F3=(t,{app:e}={})=>{let r=t?.indicator?.revealing??{},i=t?.indicator?.complete,s=mI(r,{app:e,element:t}),o=i?.src||X_(i)==="spritesheet"?mI(i,{app:e,element:t}):null,n=(a,l)=>B3({element:t,app:e,revealingDisplay:a,completeDisplay:l});return V_(s)||V_(o)?Promise.all([s,o]).then(([a,l])=>n(a,l)):n(s,o)},k3=t=>{t?.[ca]?.showComplete()},ha=(t,e="revealing")=>{let r=t?.indicator?.[e]??{};return{x:r.offsetX??t?.indicator?.offsetX??T3,y:r.offsetY??t?.indicator?.offsetY??S3}},U3=(t,e)=>{if(!e)return 0;let r=Math.max(0,e.lineMaxHeight??0),i=Math.max(0,t?.height??0);return e.y+Math.max(0,r-i)},Yi=(t,e,r)=>{t.x=r.x,t.y=U3(t,e)+r.y},EI=(t,e,r)=>{if(!e||e.text.length===0){t.x=r.x;return}t.x=Wf(e,e.text.length-1)+r.x},Ps=(t,e,r,i)=>{k3(t);let s=ha(i,"complete");Yi(t,e,s),EI(t,r,s)},O3=(t,e)=>{if(t[Xi]){let r=t[Xi];delete t[Xi],r()}t[Xi]=e},L3=t=>t?.[zf]??null,du=(t,e)=>t?e?(t[zf]=e,e):(delete t[zf],null):null,AI=t=>{let e=L3(t);return!e||e.mode!=="typewriter"||e.completed===!0?null:e},PI=t=>!!AI(t),Y_=t=>{if(t[Xi]){let r=t[Xi];delete t[Xi],r()}delete t[zf],t.onRender=void 0,t.removeChildren().forEach(r=>{if(r?.[ca]){H_(r);return}r.destroy({children:!0})})},j_=(t,e="",r="")=>{let i=new Ge(Ut(t.textStyle)),s=new vr({text:e,style:i,x:Math.round(t.x),y:Math.round(t.y)}),o=null;if(t.furigana){let n=new Ge(Ut(t.furigana.textStyle));o=new vr({text:r,style:n,x:Math.round(t.furigana.x),y:Math.round(t.furigana.y)})}return{text:s,furiganaText:o}},q_=(t,e)=>{let r=null,i=null,s=0,o=0,n=[];for(let a=0;a<e.content.length;a++){let l=e.content[a],c=new ie({label:`${e.id}-line-${a}`}),u=[],h=null,d=0;t.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}=j_(p,p.text,p.furigana?.text||"");x&&(c.addChild(x),u.push(x)),c.addChild(m),u.push(m),r=m,h=m,s+=p.text.length,d+=p.text.length}if(u.length>0){let f=c.getLocalBounds();n.push({chunk:l,container:c,lastTextObject:h,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else c.destroy()}return{lines:n,lastTextObject:r,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:t.getLocalBounds()}},xI=({contentContainer:t,indicatorSprite:e,element:r})=>{let{lastTextObject:i,lastChunk:s}=q_(t,r);Ps(e,s,i,r)},G3=({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})=>{let s=ha(r),o=r.content[0]??null,n=R3(r),a=Math.min(i,Math.max(0,n)),l=null,c=null;if(a<=0){Yi(e,o,s);return}e:for(let u=0;u<r.content.length;u++){let h=r.content[u];for(let d=0;d<h.lineParts.length;d++){let f=h.lineParts[d],p=Math.min(f.text.length,a);if(p<=0)break e;let m=f.furigana?.text||"",x=m.length,v=f.text.length>0?Math.round(p/f.text.length*x):0,{text:y,furiganaText:g}=j_(f,f.text.substring(0,p),m.substring(0,v));if(g&&t.addChild(g),t.addChild(y),l=y,c=h,a-=p,p<f.text.length)break e}}c?(Yi(e,c,s),EI(e,l,s)):Yi(e,o,s),i>=n&&Ps(e,c??o,l,r)},D3=({contentContainer:t,indicatorSprite:e,element:r})=>{let i=z_(r);if(i<=0){let s=ha(r),o=r.content[0]??null;Yi(e,o,s);return}r.revealEffect==="softWipe"?$3({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i}):G3({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})},N3=async({contentContainer:t,indicatorSprite:e,element:r,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=A3(r.speed??50),a=ha(r),{stepDelay:l,charactersPerStep:c}=P3(n),u=Math.max(l,Math.floor(4e3/n)),h=Math.max(0,Math.floor(s)),d=!1,f=null,p=null;o&&(o.revealedCharacters=h,o.completed=!1);for(let m=0;m<r.content.length;m++){if(i?.aborted||t.destroyed)return!1;let x=r.content[m],v=!1;Yi(e,x,a);for(let y=0;y<x.lineParts.length;y++){if(i?.aborted||t.destroyed)return!1;let g=x.lineParts[y],{text:b,furiganaText:_}=j_(g);_&&t.addChild(_),t.addChild(b);let S=g.text,E=g.furigana?.text||"";S.length>0&&(f=b,p=x);let P=E.length,C=Math.min(S.length,h),M=S.length>0?Math.round(C/S.length*P):0;b.text=S.substring(0,C),_&&(_.text=E.substring(0,M)),h-=C,C>0&&(e.x=Wf(b,C-1)+a.x);let R=C;for(;R<S.length;){if(i?.aborted||t.destroyed)return!1;let F=Math.min(S.length,R+c),U=F-1;if(b.text=S.substring(0,F),e.x=Wf(b,U)+a.x,v=!0,d=!0,o&&(o.revealedCharacters+=F-R),_){let W=Math.round(F/S.length*P);_.text=E.substring(0,W)}R=F,R<S.length&&await $f(l,i)}}m<r.content.length-1&&v&&await $f(u,i)}return d&&(await $f(l,i),i?.aborted||t.destroyed)?!1:(Ps(e,p,f,r),o&&(o.completed=!0),!0)},CI=({lines:t,edgeWidth:e,baseDuration:r,softWipe:i})=>{let s=t.map(c=>{let u=Math.max(1,c.totalCharacters),h=1+e/Math.max(1,c.bounds.width);return u*h}),o=s.reduce((c,u)=>c+u,0),n=[],a=0,l=0;for(let c=0;c<t.length;c++){let u=s[c],h=o>0?Math.max(1,r*u/o):r,d=Math.max(0,a),f=d+h;n.push({...t[c],startTime:d,endTime:f,duration:h}),l=Math.max(l,f),a=f-h*i.lineOverlap+i.lineDelay}return{timedLines:n,duration:Math.max(1,Math.ceil(l))}},V3=({currentTime:t,line:e,easing:r})=>{let i=e.duration>0?(t-e.startTime)/e.duration:1;return r(Math.max(0,Math.min(i,1)))},H3=({progress:t,easingName:e})=>{let r=w3(t,0,1);return e==="easeOutCubic"?1-Math.cbrt(1-r):r},RI=({timedLines:t,initialRevealedCharacters:e,softWipe:r,easingName:i})=>{let s=Math.max(0,Math.floor(e)),o=s<=0,n=0,a=0;return{timedLines:t.map(c=>{let u=Math.max(0,c.totalCharacters??0),h=0,d=!1;if(!o&&s>0)if(u<=0||s>=u)s-=u,h=1,d=!0;else{let m=s/u;h=H3({progress:m,easingName:i}),s=0,o=!0}if(d)return{...c,startTime:-c.duration,endTime:0};o=!0;let f=h>0?-h*c.duration:Math.max(0,n),p=f+c.duration;return a=Math.max(a,p),n=p-c.duration*r.lineOverlap+r.lineDelay,{...c,startTime:f,endTime:p}}),duration:Math.max(1,Math.ceil(a))}},W3=t=>{t.forEach(e=>{e&&(e.line.container.mask===e.sprite&&(e.line.container.mask=null),e.sprite.parent&&e.sprite.parent.removeChild(e.sprite),e.sprite.destroy(),e.texture.destroy(!0))})},MI=({contentContainer:t,timedLines:e,edgeWidth:r})=>{let i=e.map(s=>{let o=document.createElement("canvas");o.width=Math.max(1,Math.ceil(s.bounds.width+r)),o.height=Math.max(1,Math.ceil(s.bounds.height));let n=o.getContext("2d");if(!n)return null;let a=yo(o),l=new ke(a);return l.x=Math.floor(s.bounds.x-r),l.y=Math.floor(s.bounds.y),s.container.mask=l,t.addChild(l),{canvas:o,context:n,texture:a,sprite:l,line:s,edgeWidth:r}});return i.some(s=>s===null)?(W3(i),null):i},II=({timedLines:t,lineMasks:e,easing:r,indicatorSprite:i,indicatorOffsets:s,currentTime:o})=>{let n=t[0],a=n.bounds.x;for(let l=0;l<t.length;l++){let c=t[l],u=e[l],h=V3({currentTime:o,line:c,easing:r}),{context:d,canvas:f,texture:p}=u;if(d.clearRect(0,0,f.width,f.height),h<=0){p.source.update();continue}let m=0,x=c.bounds.width+u.edgeWidth,v=u.edgeWidth,y=v+h*x,g=Math.max(v,y-u.edgeWidth);g>v&&(d.fillStyle="#ffffff",d.fillRect(v,m,Math.min(g-v,c.bounds.width),c.bounds.height));let b=Math.max(v,y-u.edgeWidth),_=Math.min(v+c.bounds.width,y);if(_>b){let S=d.createLinearGradient(b,0,_,0);S.addColorStop(0,"rgba(255, 255, 255, 1)"),S.addColorStop(1,"rgba(255, 255, 255, 0)"),d.fillStyle=S,d.fillRect(b,m,_-b,c.bounds.height)}p.source.update(),n=c,a=c.bounds.x+Math.min(x,Math.max(0,y-v))}Yi(i,n.chunk,s),i.x=a+s.x},$3=({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})=>{let s=ha(r),{lines:o,lastTextObject:n,lastChunk:a,totalCharacters:l,maxLineHeight:c}=q_(t,r);if(Yi(e,a,s),o.length===0||l===0||i>=l||!o.some(y=>y.bounds.width>0&&y.bounds.height>0)||!globalThis.document){Ps(e,a,n,r);return}let u=bo(r.softWipe),h=U_(u.easing),d=O_({maxLineHeight:c,softWipe:u}),f=$_(r.speed??50),p=Math.max(1,Math.round(l/f*1e3)),m=CI({lines:o,edgeWidth:d,baseDuration:p,softWipe:u}),{timedLines:x}=RI({timedLines:m.timedLines,initialRevealedCharacters:i,softWipe:u,easingName:u.easing}),v=MI({contentContainer:t,timedLines:x,edgeWidth:d});if(!v){Ps(e,a,n,r);return}II({timedLines:x,lineMasks:v,easing:h,indicatorSprite:e,indicatorOffsets:s,currentTime:0})},z3=({container:t,contentContainer:e,indicatorSprite:r,element:i,animationBus:s,completionTracker:o})=>{let n=ha(i),a=$_(i.speed??50),{lines:l,lastTextObject:c,lastChunk:u,totalCharacters:h,maxLineHeight:d}=q_(e,i),f=z_(i);if(Yi(r,u,n),l.length===0||h===0||f>=h||!l.some(R=>R.bounds.width>0&&R.bounds.height>0)||!globalThis.document||!s)return Ps(r,u,c,i),!1;let p=bo(i.softWipe),m=U_(p.easing),x=O_({maxLineHeight:d,softWipe:p}),v=Math.max(1,Math.round(h/a*1e3)),y=CI({lines:l,edgeWidth:x,baseDuration:v,softWipe:p}),{timedLines:g,duration:b}=RI({timedLines:y.timedLines,initialRevealedCharacters:f,softWipe:p,easingName:p.easing}),_=o.getVersion(),S=`${i.id}-soft-wipe`,E=MI({contentContainer:e,timedLines:g,edgeWidth:x});if(!E)return Ps(r,u,c,i),!1;let P=!1,C=R=>{P||(P=!0,t[Xi]===M&&delete t[Xi],E.forEach(F=>{F.line.container.mask===F.sprite&&(F.line.container.mask=null),F.sprite.parent&&F.sprite.parent.removeChild(F.sprite),F.sprite.destroy(),F.texture.destroy(!0)}),R&&Ps(r,u,c,i))},M=()=>{s.dispatch({type:"CANCEL",id:S}),C(!1)};return O3(t,M),o.track(_),s.dispatch({type:"START",payload:{id:S,driver:"custom",duration:b,applyFrame:R=>{II({timedLines:g,lineMasks:E,easing:m,indicatorSprite:r,indicatorOffsets:n,currentTime:Math.min(b,R)})},applyTargetState:()=>{C(!1)},onComplete:()=>{o.complete(_),C(!0)},onCancel:()=>{o.complete(_),C(!1)},isValid:()=>!!t&&!t.destroyed&&!e.destroyed&&!r.destroyed}}),!0},ji=async({container:t,element:e,completionTracker:r,animationBus:i,zIndex:s,signal:o,app:n,playback:a="autoplay"})=>{if(o?.aborted||t.destroyed)return;let l=ua(e),c=a==="resume"?AI(t):null,u=z_(e);if(a==="resume"&&!c)return;let h=r?.getVersion?.(),d=M3(e),f=!1,p=()=>{!d||f||(r?.track?.(h),f=!0)},m=()=>{f&&(f=!1,r?.complete?.(h))};p(),Y_(t),t.zIndex=s;let x=new ie({label:`${e.id}-content`}),v;try{let y=F3(e,{app:n});if(v=V_(y)?await y:y,o?.aborted||t.destroyed){H_(v),m();return}if(t.addChild(x),t.addChild(v),v?.[ca]?.start(),a==="paused-initial"){l||du(t,{mode:C3(e),revealedCharacters:u,completed:!1}),l?(du(t,{mode:"none",completed:!0}),xI({contentContainer:x,indicatorSprite:v,element:e})):D3({contentContainer:x,indicatorSprite:v,element:e}),m();return}let g=r.getVersion(),b=!1;if(l)r.track(g),m(),du(t,{mode:"none",completed:!0}),xI({contentContainer:x,indicatorSprite:v,element:e}),b=!0;else if(e.revealEffect==="softWipe")if(du(t,{mode:"softWipe",revealedCharacters:u,completed:!1}),!z3({container:t,contentContainer:x,indicatorSprite:v,element:e,animationBus:i,completionTracker:r})&&!o?.aborted&&!t.destroyed)r.track(g),m(),b=!0;else{m();return}else{r.track(g),m();let _=c?.revealedCharacters??u,S=du(t,{mode:"typewriter",revealedCharacters:_,completed:!1});b=await N3({contentContainer:x,indicatorSprite:v,element:e,signal:o,startAtCharacter:_,snapshot:S})}b&&!o?.aborted&&!t.destroyed&&r.complete(g)}catch(y){if(m(),v&&!v.destroyed&&!v.parent&&H_(v),y?.name!=="AbortError"&&!o?.aborted)throw y}};var Xf=({suppressAnimations:t=!1,deferredMountOperations:e=[]}={})=>({suppressAnimations:t,deferredMountOperations:e}),BI=t=>{switch(t?.type){case"play-animated-sprite":t.animatedSprite?.destroyed||t.animatedSprite?.play();return;case"play-video":t.video?.play();return;case"start-particles":if(t.app?.debug){let e=r=>{if(t.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",e);return}r?.detail?.deltaMS&&(t.emitter.update(Number(r.detail.deltaMS)/1e3),typeof t.app?.render=="function"&&t.app.render())};window.addEventListener("snapShotKeyFrame",e),t.container.customTickerHandler=e;return}t.app.ticker.add(t.tickerCallback);return;case"autoplay-text-reveal":ji({container:t.container,element:t.element,completionTracker:t.completionTracker,animationBus:t.animationBus,zIndex:t.zIndex,signal:t.signal,app:t.app,playback:"autoplay"});return;case"start-update-animations":if(!t.element||t.element.destroyed)return;Hf({animations:t.animations,animationBus:t.animationBus,completionTracker:t.completionTracker,element:t.element,targetState:t.targetState,animationBaseState:t.animationBaseState});return}},fu=(t,e)=>{if(e?.type){if(!t?.suppressAnimations){BI(e);return}t.deferredMountOperations.push(e)}},pu=t=>{t?.deferredMountOperations&&(t.deferredMountOperations.length=0)},FI=(t,e)=>fu(t,{type:"play-animated-sprite",animatedSprite:e}),kI=(t,e)=>fu(t,{type:"play-video",video:e}),UI=(t,{app:e,emitter:r,container:i,tickerCallback:s})=>fu(t,{type:"start-particles",app:e,emitter:r,container:i,tickerCallback:s}),Yf=(t,{app:e,container:r,element:i,completionTracker:s,animationBus:o,zIndex:n,signal:a})=>fu(t,{type:"autoplay-text-reveal",app:e,container:r,element:i,completionTracker:s,animationBus:o,zIndex:n,signal:a}),OI=(t,{animations:e,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:n})=>fu(t,{type:"start-update-animations",animations:e,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:n}),LI=t=>{if(!t?.deferredMountOperations?.length)return;let e=t.deferredMountOperations.splice(0);for(let r of e)BI(r)};var X3=Object.prototype.hasOwnProperty,ye=(t,e)=>{if(Object.is(t,e))return!0;if(t===null||e===null||typeof t!="object"||typeof e!="object")return!1;let r=Array.isArray(t),i=Array.isArray(e);if(r!==i)return!1;if(r&&i){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!ye(t[n],e[n]))return!1;return!0}let s=Object.keys(t),o=Object.keys(e);if(s.length!==o.length)return!1;for(let n of s)if(!X3.call(e,n)||!ye(t[n],e[n]))return!1;return!0};var To=t=>{let e=new Set;if(t.id&&e.add(t.id),t.children&&Array.isArray(t.children))for(let r of t.children)for(let i of To(r))e.add(i);return e};var DI=(t=[])=>{if(t instanceof Map)return t;let e=new Map;for(let r of t)e.has(r.targetId)||e.set(r.targetId,[]),e.get(r.targetId).push(r);return e},jf=(t,e)=>t?t instanceof Map?t.get(e)??[]:t.filter(r=>r.targetId===e):[],NI=(t,e)=>jf(t,e).filter(r=>r.type==="update"),qf=(t,e)=>jf(t,e).find(r=>r.type==="transition")??null,GI=(t=[])=>t.some(e=>Object.keys(e.tween??{}).some(Es)),mu=(t=[],e,r=[])=>{for(let i of t){if(i?.id===e)return{element:i,ancestorIds:r};if(Array.isArray(i?.children)){let s=mu(i.children,e,[...r,i.id]);if(s)return s}}return null},VI=(t,e)=>ye(t?.ancestorIds??null,e?.ancestorIds??null),Y3=({subtreeRoot:t,nextAnimations:e,continuingAnimationId:r})=>{if(!t)return!1;let i=To(t);for(let s of e??[])if(!(!s||s.id===r)&&i.has(s.targetId))return!0;return!1},K_=(t={})=>t.type==="update"?JSON.stringify({type:t.type,tween:t.tween,playback:t.playback??null}):JSON.stringify({type:t.type,prev:t.prev??null,next:t.next??null,mask:t.mask??null,compositor:t.compositor??null,tween:t.tween??null,playback:t.playback??null}),j3=({prevState:t,nextState:e,animation:r})=>{let i=mu(t?.elements,r.targetId),s=mu(e?.elements,r.targetId);return i!==null&&s!==null&&VI(i,s)&&ye(i.element,s.element)},q3=({prevState:t,nextState:e,animation:r})=>{let i=mu(t?.elements,r.targetId),s=mu(e?.elements,r.targetId);return i===null&&s===null?!0:i===null||s===null||!VI(i,s)||!ye(i.element,s.element)?!1:!Y3({subtreeRoot:s.element,nextAnimations:e?.animations,continuingAnimationId:r.id})},HI=({prevState:t,nextState:e,activeAnimations:r})=>{let i=new Set,s=r instanceof Map?r:new Map(r?.map(o=>[o.id,o])??[]);for(let o of e?.animations??[]){if(o?.playback?.continuity!=="persistent")continue;let n=s.get(o.id);if(n&&!(n.type!==o.type||n.targetId!==o.targetId||n.signature!==K_(o))){if(o.type==="update"){j3({prevState:t,nextState:e,animation:o})&&i.add(o.id);continue}q3({prevState:t,nextState:e,animation:o})&&i.add(o.id)}}return{continuedAnimationIds:i}},K3=({animations:t,targetId:e,animationBus:r,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=NI(t,e),c=l.filter(h=>typeof r?.hasContext=="function"?r.hasContext(h.id):!1),u=l.filter(h=>!c.includes(h));if(l.length===0)return!1;if(u.length===0)return!0;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");let h=GI(u)?As(s):void 0;return dI(s,u,void 0,h),OI(a,{animations:u,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:h}),!0}return Hf({animations:u,animationBus:r,completionTracker:i,element:s,targetState:o,onComplete:n,animationBaseState:GI(u)?As(s):void 0}),!0},da=NI;var oe=K3;var WI=t=>!!t&&typeof t=="object"&&!Array.isArray(t),Z3=(t,e)=>e===void 0?t:e===null||e===!1?null:WI(e)?{...WI(t)?t:{},...e}:e,Ei=(t={},e={})=>{if(!e)return{...t};let r={...t,...e};return Object.prototype.hasOwnProperty.call(e,"shadow")&&(r.shadow=Z3(t?.shadow,e.shadow)),r};var zI=Symbol("routeGraphicsTextAnchorRatios"),So=Symbol("routeGraphicsTextLayoutState"),$I=(t,e)=>typeof t!="number"||t===0?0:e/t,Z_=t=>t?.align??He.align,Q3=t=>{let e=t[So];return e?.fixedWidth&&typeof e.layoutWidth=="number"?e.layoutWidth:typeof e?.measuredWidth=="number"?e.measuredWidth:t.width},J3=(t,e)=>{let r=Ye.measureText(String(t??""),new Ge(Ut(e,{includeShadow:!1})));return{width:r.width,height:r.height}},XI=t=>t?.shadow!==void 0&&t.shadow!==null&&t.shadow!==!1,eb=(t,e)=>XI(e)?J3(t.text,e):{width:t.width,height:t.height},Q_=t=>{let e=t[So];return typeof e?.measuredWidth=="number"?e.measuredWidth:t.width},eV=t=>{let e=t[So];return typeof e?.measuredHeight=="number"?e.measuredHeight:t.height},YI=(t,e,r)=>{let i=!!e.__fixedWidth,s=r??eb(t,e.textStyle),o=s.width??e.measuredWidth??e.width,n=s.height??e.height??t.height;t[So]={fixedWidth:i,layoutWidth:i?e.width:o,measuredWidth:o,measuredHeight:n}},J_=(t,e,r)=>{let i=Math.max(0,t-e);return r==="center"?i/2:r==="right"?i:0},tb=t=>{let e=t.measuredWidth??t.width,r=J_(t.width,e,Z_(t.textStyle));return{x:t.x+r,y:t.y}},Kf=(t,e)=>{let r=eb(t,e.textStyle),i=e.__fixedWidth&&typeof e.width=="number"?e.width:r.width,s=r.height,o=typeof e.__anchorXRatio=="number"?e.__anchorXRatio:$I(i,e.originX),n=typeof e.__anchorYRatio=="number"?e.__anchorYRatio:$I(s,e.originY);t[zI]={x:o,y:n},YI(t,e,r)},tV=t=>typeof t?.fontSize!="number"||t.fontSize===0||typeof t?.lineHeight!="number"?He.lineHeight:t.lineHeight/t.fontSize,rV=(t,e)=>{if(!e)return t;let r=Ei(t,e);if(e.fontSize!==void 0||e.lineHeight!==void 0){let i=e.lineHeight??tV(t);r.lineHeight=Math.round(r.fontSize*i)}return r},jI=(t,e,r)=>{let i=t[zI],s=Q3(t),o=rV(e,r);if(!i){wi(t,o);return}let n=J_(s,Q_(t),Z_(t.style)),l=t.x-n+s*i.x,c=t.y+eV(t)*i.y;wi(t,o);let u=eb(t,o),d=t[So]?.fixedWidth===!0?s:u.width,f=J_(d,u.width,Z_(o));t.x=l-d*i.x+f,t.y=c-u.height*i.y,t[So]={...t[So]??{},layoutWidth:d,measuredWidth:u.width,measuredHeight:u.height}},Zf=(t,e)=>{YI(t,e);let r=XI(e.textStyle)?e.measuredWidth??Q_(t):Q_(t),i=tb({...e,measuredWidth:r,width:e.__fixedWidth&&typeof e.width=="number"?e.width:r});t.x=i.x,t.y=i.y};var iV=(t,e)=>{let r=Number(t);if(Number.isFinite(r))return r;let i=Number(e);return Number.isFinite(i)?i:100},je=(t,e=100)=>{let r=iV(t??e,e);return Math.min(Math.max(r,0),100)/100};var qI=t=>{if(!(!t||typeof t!="object")){if(typeof t.button=="number")return t.button;if(typeof t.data?.button=="number")return t.data.button;if(typeof t.nativeEvent?.button=="number")return t.nativeEvent.button}},Ot=t=>{let e=qI(t);return e===void 0||e===0},KI=t=>qI(t)===2;var rb=Symbol.for("routeGraphics.setInheritedHover"),ZI=Symbol.for("routeGraphics.treeInheritedHoverActive"),ib=Symbol.for("routeGraphics.setInheritedPress"),QI=Symbol.for("routeGraphics.treeInheritedPressActive"),sb=Symbol.for("routeGraphics.setInheritedRightPress"),JI=Symbol.for("routeGraphics.treeInheritedRightPressActive"),fa=t=>Array.isArray(t?.children)?t.children:[],ob=({displayObject:t,symbol:e,source:r,isActive:i})=>{let s=t?.[e];typeof s=="function"&&s(r,i)},Qf=({displayObject:t,symbol:e})=>{t&&e in t&&delete t[e]},nb=({displayObject:t,symbol:e,onStateChange:r})=>{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&&r(c),c};return t[e]=(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:()=>{Qf({displayObject:t,symbol:e})}}},pa=t=>Qf({displayObject:t,symbol:rb}),Jf=t=>Qf({displayObject:t,symbol:ib}),ep=t=>Qf({displayObject:t,symbol:sb}),Cs=({displayObject:t,onHoverChange:e})=>{let r=nb({displayObject:t,symbol:rb,onStateChange:e});return{setDirectHover:r.setDirectState,isHovering:r.isActive,destroy:r.destroy}},ma=({displayObject:t,onPressChange:e})=>{let r=nb({displayObject:t,symbol:ib,onStateChange:e});return{setDirectPress:r.setDirectState,isPressed:r.isActive,destroy:r.destroy}},ga=({displayObject:t,onPressChange:e})=>{let r=nb({displayObject:t,symbol:sb,onStateChange:e});return{setDirectPress:r.setDirectState,isPressed:r.isActive,destroy:r.destroy}},ab=t=>t?.[ZI]===!0,lb=t=>t?.[QI]===!0,cb=t=>t?.[JI]===!0,xa=({root:t,isHovered:e})=>{if(!t)return;t[ZI]=e;let r=[...fa(t)];for(;r.length>0;){let i=r.pop();ob({displayObject:i,symbol:rb,source:t,isActive:e}),r.push(...fa(i))}},wo=({root:t,isPressed:e})=>{if(!t)return;t[QI]=e;let r=[...fa(t)];for(;r.length>0;){let i=r.pop();ob({displayObject:i,symbol:ib,source:t,isActive:e}),r.push(...fa(i))}},qi=({root:t,isPressed:e})=>{if(!t)return;t[JI]=e;let r=[...fa(t)];for(;r.length>0;){let i=r.pop();ob({displayObject:i,symbol:sb,source:t,isActive:e}),r.push(...fa(i))}};var eB="__rtglScrollHandled",tB=t=>t?.payload&&typeof t.payload=="object"?t.payload:{},Gr=({canvas:t,displayObject:e,width:r,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1,l=Number.isFinite(r)&&Number.isFinite(i)&&r>0&&i>0;e.eventMode="static",l&&(e.hitArea=new te(0,0,Math.round(r),Math.round(i)));let c=(p,m)=>{m?.[eB]||(m&&(m[eB]=!0),p<0&&s&&n?n("scrollUp",{_event:{id:e.label},...tB(s)}):p>0&&o&&n&&n("scrollDown",{_event:{id:e.label},...tB(o)}))},u=()=>{a=!0},h=()=>{a=!1},d=p=>{p.preventDefault?.(),c(p.deltaY,p.nativeEvent)},f=p=>{a&&(p.preventDefault(),c(p.deltaY,p))};e.on("pointerover",u),e.on("pointerout",h),e.on("wheel",d),t?.addEventListener("wheel",f,{passive:!1}),e._cleanupScrollInteraction=()=>{a=!1,e.off("pointerover",u),e.off("pointerout",h),e.off("wheel",d),t?.removeEventListener("wheel",f),l&&(e.hitArea=null),delete e._cleanupScrollInteraction}},ub=({root:t})=>{t?._cleanupScrollInteraction?.(),t?.children?.forEach(e=>{ub({root:e})})};var ya=t=>{t._cleanupScrollInteraction?.(),t.removeAllListeners("pointerover"),t.removeAllListeners("pointerout"),t.removeAllListeners("pointerdown"),t.removeAllListeners("pointerupoutside"),t.removeAllListeners("pointerup"),t.removeAllListeners("rightdown"),t.removeAllListeners("rightclick"),t.removeAllListeners("rightup"),t.removeAllListeners("rightupoutside"),t.removeAllListeners("wheel"),pa(t),Jf(t),ep(t),t.cursor="auto",t.eventMode="auto"},gu=({app:t,displayObject:e,textComputedNode:r,eventHandler:i,applyStyle:s})=>{let o=r?.hover,n=r?.click,a=r?.rightClick,l=r?.scrollUp,c=r?.scrollDown,u=null,h=null,d=null,f=()=>{let p=u?.isHovering()??!1,m=h?.isPressed()??!1;(d?.isPressed()??!1)&&a?.textStyle?s(a.textStyle):m&&n?.textStyle?s(n.textStyle):p&&o?.textStyle?s(o.textStyle):s()};if(o){let{cursor:p,soundSrc:m,payload:x}=o;e.eventMode="static",u=Cs({displayObject:e,onHoverChange:f});let v=()=>{u.setDirectHover(!0),x&&i&&i("hover",{_event:{id:e.label},...x}),p&&(e.cursor=p),m&&t.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1})},y=()=>{u.setDirectHover(!1),e.cursor="auto"};e.on("pointerover",v),e.on("pointerout",y)}if(n){let{soundSrc:p,soundVolume:m,payload:x}=n;e.eventMode="static",h=ma({displayObject:e,onPressChange:f});let v=b=>{Ot(b)&&h.setDirectPress(!0)},y=b=>{Ot(b)&&(h.setDirectPress(!1),x&&i&&i("click",{_event:{id:e.label},...x}),p&&t.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1,volume:je(m)}))},g=()=>{h.setDirectPress(!1)};e.on("pointerdown",v),e.on("pointerup",y),e.on("pointerupoutside",g)}if(a){let{soundSrc:p,payload:m}=a;e.eventMode="static",d=ga({displayObject:e,onPressChange:f});let x=()=>{d.setDirectPress(!0)},v=()=>{d.setDirectPress(!1)},y=()=>{d.setDirectPress(!1),m&&i&&i("rightClick",{_event:{id:e.label},...m}),p&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:p,loop:!1})},g=()=>{d.setDirectPress(!1)};e.on("rightdown",x),e.on("rightup",v),e.on("rightclick",y),e.on("rightupoutside",g)}(l||c)&&Gr({canvas:t.canvas,displayObject:e,scrollUpEvent:l,scrollDownEvent:c,eventHandler:i})};var sB=Symbol("routeGraphicsRichTextDisplay"),sV=t=>t?.align??He.align,oV=(t,e,r)=>{let i=Math.max(0,t-e.width),s=0;return r==="center"?s=i/2:r==="right"&&(s=i),s-e.x},nV=t=>{t.removeChildren().forEach(r=>{r.destroy({children:!0})})},rB=({text:t,style:e,x:r,y:i})=>new vr({text:t,style:new Ge(Ut(e)),x:Math.round(r),y:Math.round(i)}),iB=(t,e)=>e?Ei(t,e):t,Eo=t=>Array.isArray(t?.content),oB=t=>!!t?.[sB],nB=t=>({x:t.x,y:t.y}),xu=(t,e,r)=>{nV(t),t.label=e.id,t.x=Math.round(e.x??0),t.y=Math.round(e.y??0),t.alpha=e.alpha??1;let i=e.width??e.measuredWidth??0;for(let s=0;s<e.content.length;s++){let o=e.content[s],n=new ie({label:`${e.id}-line-${s}`});for(let l of o.lineParts??[])l.furigana&&n.addChild(rB({text:l.furigana.text,style:iB(l.furigana.textStyle,r),x:l.furigana.x,y:l.furigana.y})),n.addChild(rB({text:l.text,style:iB(l.textStyle,r),x:l.x,y:l.y}));let a=n.getLocalBounds();n.x=oV(i,a,sV(e.textStyle)),t.addChild(n)}t.hitArea=new te(0,0,Math.max(0,i),Math.max(0,e.height??0))},aB=(t,e)=>{let r=new ie({label:t.id});return r[sB]=!0,r.zIndex=e,xu(r,t),r};var hb="__routeGraphicsManagedFilters",aV=["shadow","blur","shader"],lV=t=>(t[hb]||Object.defineProperty(t,hb,{value:new Map,enumerable:!1,configurable:!0}),t[hb]),cV=t=>t.filters?Array.isArray(t.filters)?t.filters:[t.filters]:[],tp=t=>t?Array.isArray(t)?t.filter(Boolean):[t]:[],uV=(t,e,r)=>{let i=new Set;for(let a of e.values())for(let l of tp(a))i.add(l);for(let a of tp(r))i.add(a);let s=cV(t).filter(a=>!i.has(a)),n=[...aV.flatMap(a=>tp(e.get(a))),...s];t.filters=n.length>0?n:null},hV=t=>{for(let e of tp(t))e.destroy?.()},Ao=(t,e,r)=>{let i=lV(t),s=i.get(e);r?i.set(e,r):i.delete(e),uV(t,i,s),s&&s!==r&&hV(s)};var lB=/^[a-z][A-Za-z0-9]*$/;var dV=new Set(["shader"]),cB=new Set(["normal","add","multiply","screen"]),uB=new Set(["clamp","repeat"]),fV=new Set(["uTexture","uPrevTexture","uNextTexture","uNextTextureMatrix","uNextTextureClamp","uProgress","uResolution","uSampler","GlobalFilterUniforms","ShaderUniforms","VSOutput","gfu","shaderUniforms","mainVertex","mainFragment","uInputSize","uInputPixel","uInputClamp","uOutputFrame","uGlobalFrame","uOutputTexture"]),pV=t=>!!t&&typeof t=="object"&&!Array.isArray(t),hB=t=>typeof t=="number"&&Number.isFinite(t),Rs=(t,e)=>{if(!pV(t))throw new Error(`Input Error: ${e} must be an object`)},yu=(t,e)=>{if(typeof t!="string"||t.length===0)throw new Error(`Input Error: ${e} must be a non-empty string`)},dB=(t,e)=>{if(!lB.test(t))throw new Error(`Input Error: ${e} must match ${lB.source}`)},fB=t=>t.charAt(0).toUpperCase()+t.slice(1),mV=t=>`u${fB(t)}`,gV=t=>`u${fB(t)}Texture`,pB=({key:t,symbol:e,path:r,symbols:i,kind:s})=>{if(fV.has(e))throw new Error(`Input Error: ${r}.${t} generates reserved shader symbol ${e}`);if(i.has(e))throw new Error(`Input Error: ${r}.${t} generates duplicate shader symbol ${e}`);i.set(e,{key:t,kind:s})},xV=(t,e)=>{if(hB(t))return{type:"f32",value:t};if(Array.isArray(t)&&(t.length===2||t.length===4)&&t.every(hB))return{type:t.length===2?"vec2<f32>":"vec4<f32>",value:[...t]};throw new Error(`Input Error: ${e} must be a number, a length-2 number array, or a length-4 number array`)},yV=(t,e,r)=>t===void 0?[]:(Rs(t,e),Object.keys(t).sort().map(i=>{dB(i,`${e}.${i}`);let s=mV(i);return pB({key:i,symbol:s,path:e,symbols:r,kind:"uniform"}),{key:i,symbol:s,...xV(t[i],`${e}.${i}`)}})),_V=({textures:t,path:e,symbols:r,maxTextures:i})=>{if(t===void 0)return[];Rs(t,e);let s=Object.keys(t).sort();if(s.length>i)throw new Error(`Input Error: ${e} supports at most ${i} custom textures`);return s.map(o=>{dB(o,`${e}.${o}`),yu(t[o],`${e}.${o}`);let n=gV(o);return pB({key:o,symbol:n,path:e,symbols:r,kind:"texture"}),{key:o,symbol:n,src:t[o]}})},bV=(t,e)=>{if(t===void 0)return{blend:"normal",textureWrap:"clamp",mipmap:!1};Rs(t,e);let r=t.blend??"normal";if(!cB.has(r))throw new Error(`Input Error: ${e}.blend must be one of: ${Array.from(cB).join(", ")}`);let i=t.textureWrap??"clamp";if(!uB.has(i))throw new Error(`Input Error: ${e}.textureWrap must be one of: ${Array.from(uB).join(", ")}`);let s=t.mipmap??!1;if(typeof s!="boolean")throw new Error(`Input Error: ${e}.mipmap must be a boolean`);return{blend:r,textureWrap:i,mipmap:s}},vV=(t,e)=>{if(Rs(t,e),Rs(t.webgl,`${e}.webgl`),Rs(t.webgpu,`${e}.webgpu`),t.webgl.vertex!==void 0&&typeof t.webgl.vertex!="string")throw new Error(`Input Error: ${e}.webgl.vertex must be a string`);if(yu(t.webgl.fragment,`${e}.webgl.fragment`),yu(t.webgpu.source,`${e}.webgpu.source`),!t.webgpu.source.includes("mainVertex")||!t.webgpu.source.includes("mainFragment"))throw new Error(`Input Error: ${e}.webgpu.source must define mainVertex and mainFragment`);return{webgl:{...t.webgl.vertex!==void 0?{vertex:t.webgl.vertex}:{},fragment:t.webgl.fragment},webgpu:{source:t.webgpu.source}}},TV=(t,e)=>{if(t===void 0)return{grid:[1,1]};if(Rs(t,e),!Array.isArray(t.grid)||t.grid.length!==2||!t.grid.every(r=>Number.isInteger(r)&&r>=1))throw new Error(`Input Error: ${e}.grid must be [columns, rows] with positive integers`);return{grid:[t.grid[0],t.grid[1]]}},mB=({shader:t,path:e,requireId:r,textureLimit:i,allowMesh:s})=>{if(Rs(t,e),!dV.has(t.type))throw new Error(`Input Error: ${e}.type must be shader`);let o={type:"shader"};r?(yu(t.id,`${e}.id`),o.id=t.id):t.id!==void 0&&(yu(t.id,`${e}.id`),o.id=t.id);let n=new Map;if(o.uniforms=yV(t.uniforms,`${e}.uniforms`,n),o.textures=_V({textures:t.textures,path:`${e}.textures`,symbols:n,maxTextures:i}),o.pipeline=bV(t.pipeline,`${e}.pipeline`),o.source=vV(t.source,`${e}.source`),t.mesh!==void 0&&!s)throw new Error(`Input Error: ${e}.mesh is only valid for compositors`);return s&&(o.mesh=TV(t.mesh,`${e}.mesh`)),o},gB=(t,e="filters")=>{if(t===void 0)return;if(!Array.isArray(t))throw new Error(`Input Error: ${e} must be an array`);let r=new Set;return t.map((i,s)=>{let o=mB({shader:i,path:`${e}[${s}]`,requireId:!0,textureLimit:7,allowMesh:!1});if(r.has(o.id))throw new Error(`Input Error: ${e}[${s}].id must be unique within filters`);return r.add(o.id),o})},xB=(t,e="compositor")=>mB({shader:t,path:e,requireId:!1,textureLimit:6,allowMesh:!0}),yB=t=>JSON.stringify(t??null);var fb="__routeGraphicsShaderFilters",Po="__routeGraphicsShaderProgress",_B="__routeGraphicsShaderDestroyCleanup",SV=`
|
|
1264
1264
|
precision mediump float;
|
|
1265
1265
|
|
|
1266
1266
|
in vec2 aPosition;
|
|
@@ -1291,13 +1291,13 @@ void main(void)
|
|
|
1291
1291
|
gl_Position = filterVertexPosition();
|
|
1292
1292
|
vTextureCoord = filterTextureCoord();
|
|
1293
1293
|
}
|
|
1294
|
-
`,pb=t=>Number.isFinite(t)?t:0,bV=(t,e)=>t?t instanceof Map?t.get(e)??[]:t.filter(r=>r?.targetId===e):[],Qe=(t,e)=>bV(t,e).some(r=>r?.type==="update"&&r.tween?.uProgress!==void 0),vV=t=>t.type==="f32"?t.value:new Float32Array(t.value),TV=(t,e,r,i,{includeNextTextureTransform:s=!1}={})=>{let o={uProgress:{value:pb(i),type:"f32"},uResolution:{value:new Float32Array([Math.max(1,e),Math.max(1,r)]),type:"vec2<f32>"}};s&&(o.uNextTextureMatrix={value:new V,type:"mat3x3<f32>"},o.uNextTextureClamp={value:new Float32Array([0,0,1,1]),type:"vec4<f32>"});for(let n of t.uniforms??[])o[n.symbol]={value:vV(n),type:n.type};return new Ce(o)},SV=t=>t?.textureWrap==="repeat"?"repeat":"clamp-to-edge",wV=t=>t?.mipmap===!0?"linear":"nearest",EV=(t,e)=>!t||!t.resource||t.uploadMethodId==="video"?t:Re.from({...t.options??{},resource:t.resource,width:t.width,height:t.height,resolution:t.resolution,format:t.format,dimensions:t.dimension,mipLevelCount:t.mipLevelCount,autoGenerateMipmaps:e?.mipmap===!0,sampleCount:t.sampleCount,antialias:t.antialias,alphaMode:t.alphaMode,addressMode:SV(e),mipmapFilter:wV(e)}),AV=t=>{let e={},r=[];for(let i of t.textures??[]){let s=B.from(i.src).source,o=EV(s,t.pipeline);e[i.symbol]=o,o!==s&&r.push(o)}return{resources:e,ownedTextureSources:r}},PV=(t=[1,1])=>{let e=Math.max(1,t[0]??1),r=Math.max(1,t[1]??1);if(e===1&&r===1)return null;let i=[],s=[];for(let n=0;n<=r;n++)for(let a=0;a<=e;a++)i.push(a/e,n/r);let o=e+1;for(let n=0;n<r;n++)for(let a=0;a<e;a++){let l=n*o+a,c=l+1,u=l+o,h=u+1;s.push(l,c,u,c,h,u)}return new rr({attributes:{aPosition:{buffer:new Float32Array(i),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array(s)})},CV=({filterManager:t,filter:e,geometry:r,input:i,output:s,clear:o})=>{let n=t.renderer,a=t._filterStack[t._filterStackIndex],l=a.bounds,c=ve.shared,h=a.previousRenderSurface===s,d=n.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=t._filterStackIndex-1;for(;f>0&&t._filterStack[f].skip;)f--;f>0&&(d=t._filterStack[f].inputTexture.source._resolution);let p=t._filterGlobalUniforms,m=p.uniforms,x=m.uOutputFrame,v=m.uInputSize,y=m.uInputPixel,g=m.uInputClamp,b=m.uGlobalFrame,_=m.uOutputTexture;if(h){let P=t._filterStackIndex;for(;P>0;){P--;let C=t._filterStack[P];if(!C.skip){c.x=C.bounds.minX,c.y=C.bounds.minY;break}}x[0]=l.minX-c.x,x[1]=l.minY-c.y}else x[0]=0,x[1]=0;x[2]=i.frame.width,x[3]=i.frame.height,v[0]=i.source.width,v[1]=i.source.height,v[2]=1/v[0],v[3]=1/v[1],y[0]=i.source.pixelWidth,y[1]=i.source.pixelHeight,y[2]=1/y[0],y[3]=1/y[1],g[0]=.5*y[2],g[1]=.5*y[3],g[2]=i.frame.width*v[2]-.5*y[2],g[3]=i.frame.height*v[3]-.5*y[3];let S=n.renderTarget.rootRenderTarget.colorTexture;b[0]=c.x*d,b[1]=c.y*d,b[2]=S.source.width*d,b[3]=S.source.height*d;let E=n.renderTarget.getRenderTarget(s);if(n.renderTarget.bind(s,!!o),s instanceof B?(_[0]=s.frame.width,_[1]=s.frame.height):(_[0]=E.width,_[1]=E.height),_[2]=E.isRoot?-1:1,p.update(),n.renderPipes.uniformBatch){let P=n.renderPipes.uniformBatch.getUboResource(p);t._globalFilterBindGroup.setResource(P,0)}else t._globalFilterBindGroup.setResource(p,0);t._globalFilterBindGroup.setResource(i.source,1),t._globalFilterBindGroup.setResource(i.source.style,2),e.groups[0]=t._globalFilterBindGroup,n.encoder.draw({geometry:r,shader:e,state:e._state,topology:"triangle-list"}),n.type===Xe.WEBGL&&n.renderTarget.finishRenderPass()},rp=(t,e)=>{let r=t?.resources?.shaderUniforms;r?.uniforms&&(r.uniforms.uProgress=pb(e),r.update())},mb=(t,e,r)=>{let i=t?.resources?.shaderUniforms;i?.uniforms&&(i.uniforms.uResolution=new Float32Array([Math.max(1,e),Math.max(1,r)]),i.update())},gb=({shader:t,width:e,height:r,progress:i=0,nextTextureSource:s,name:o="route-graphics-shader-filter"})=>{let n=TV(t,e,r,i,{includeNextTextureTransform:!!s}),a=AV(t),l={shaderUniforms:n,...s?{uNextTexture:s}:{},...a.resources},c=Br.from({gpu:{vertex:{source:t.source.webgpu.source,entryPoint:"mainVertex"},fragment:{source:t.source.webgpu.source,entryPoint:"mainFragment"}},gl:{vertex:t.source.webgl.vertex??_V,fragment:t.source.webgl.fragment,name:o},resources:l,blendMode:t.pipeline?.blend??"normal"}),u=PV(t.mesh?.grid);if(u&&(c.apply=(h,d,f,p)=>{CV({filterManager:h,filter:c,geometry:u,input:d,output:f,clear:p})}),u||a.ownedTextureSources.length>0){let h=c.destroy.bind(c);c.destroy=(...d)=>{h(...d),u?.destroy();for(let f of a.ownedTextureSources)f.destroy()}}return c},xb=t=>t?.[fb]??null,RV=(t,e)=>{Object.defineProperty(t,fb,{value:e,enumerable:!1,configurable:!0,writable:!0})},MV=t=>{if(!t||typeof t.destroy!="function"||t[_B])return;let e=t.destroy;Object.defineProperty(t,_B,{value:!0,enumerable:!1,configurable:!0}),t.destroy=function(...i){return db(this),e.apply(this,i)}},IV=(t,e)=>{let r=xb(t);for(let i of r?.filters??[])rp(i,e)},BV=t=>{if(!t)return;t[Po]===void 0&&Object.defineProperty(t,Po,{value:0,enumerable:!1,configurable:!0,writable:!0});let e=Object.getOwnPropertyDescriptor(t,"uProgress");e?.get||e?.set||Object.defineProperty(t,"uProgress",{get(){return this[Po]??0},set(r){this[Po]=pb(r),IV(this,this[Po])},enumerable:!1,configurable:!0})},Dr=t=>{!t||t[Po]===void 0||(t.uProgress=0)},FV=t=>t?.filters?.some(e=>e?.type==="shader")??!1,bB=(t,e)=>{if(!t||!e)return null;if(t.label===e)return t;for(let r of t.children??[]){let i=bB(r,e);if(i)return i}return null},vB=({parent:t,element:e,animations:r})=>{if(!e)return!1;if(FV(e)&&!Qe(r,e.id)){let i=bB(t,e.id);if(i?.[Po]!==void 0&&i.uProgress!==0)return!0}return yb({parent:t,elements:e.children,animations:r})},yb=({parent:t,elements:e=[],animations:r})=>(e??[]).some(i=>vB({parent:t,element:i,animations:r})),Nr=({parent:t,nextElement:e,animations:r})=>vB({parent:t,element:e,animations:r}),db=t=>{xb(t)&&(Ao(t,"shader",null),delete t[fb])},Oe=(t,e,{width:r,height:i,force:s=!1}={})=>{if(!t)return;if(!e?.length&&!s){db(t);return}if(BV(t),MV(t),!e?.length){db(t);return}let o=Math.max(1,Math.round(r??t.width??1)),n=Math.max(1,Math.round(i??t.height??1)),a=yB(e),l=xb(t);if(l?.signature===a){for(let u of l.filters)mb(u,o,n),rp(u,t.uProgress);Ao(t,"shader",l.filters);return}let c=e.map(u=>gb({shader:u,width:o,height:n,progress:t.uProgress,name:`route-graphics-shader-filter-${u.id}`}));RV(t,{signature:a,filters:c}),Ao(t,"shader",c)},st=(t,{force:e=!1}={})=>!t?.filters?.length&&!e?{}:{uProgress:0};var _b=t=>({...Eo(t)?nB(t):tb(t),alpha:t.alpha}),bb=(t,e)=>{if(Eo(t))return aB(t,e);let r=new vr({label:t.id});return r.zIndex=e,r.text=t.content,wi(r,t.textStyle),Kf(r,t),r.alpha=t.alpha,Zf(r,t),Oe(r,t.filters,{width:t.width,height:t.height}),r},ip=(t,e,r)=>{if(Eo(e)){xu(t,e,r);return}jI(t,e.textStyle,r)},TB=({app:t,parent:e,element:r,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=bb(r,l),u=Qe(i,r.id);Oe(c,r.filters,{width:r.width,height:r.height,force:u}),gu({app:t,displayObject:c,textComputedNode:r,eventHandler:s,applyStyle:h=>ip(c,r,h)}),e.addChild(c),oe({animations:i,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{..._b(r),...st(r,{force:u})},renderContext:a})};var kV=(t,e)=>oB(t)!==Eo(e),UV=({app:t,parent:e,displayObject:r,textComputedNode:i,eventHandler:s,zIndex:o})=>{ya(r);let n=bb(i,o);return gu({app:t,displayObject:n,textComputedNode:i,eventHandler:s,applyStyle:a=>ip(n,i,a)}),e.addChild(n),r.destroy({children:!0}),n},OV=(t,e)=>{t.text=e.content,wi(t,e.textStyle),Kf(t,e),Zf(t,e),t.alpha=e.alpha},LV=({displayObject:t,textComputedNode:e,app:r,eventHandler:i})=>{Eo(e)?xu(t,e):OV(t,e),ya(t),gu({app:r,displayObject:t,textComputedNode:e,eventHandler:i,applyStyle:s=>ip(t,e,s)})},SB=({app:t,parent:e,prevElement:r,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let c=e.children.find(f=>f.label===r.id);if(!c)return;c.zIndex=l;let u=Qe(o,r.id);u?Oe(c,r.filters,{width:r.width,height:r.height,force:!0}):Dr(c);let h=()=>{if(!ye(r,i)){if(kV(c,i)){c=UV({app:t,parent:e,displayObject:c,textComputedNode:i,eventHandler:s,zIndex:l}),Oe(c,i.filters,{width:i.width,height:i.height,force:u});return}LV({displayObject:c,textComputedNode:i,app:t,eventHandler:s}),Oe(c,i.filters,{width:i.width,height:i.height,force:u})}};oe({animations:o,targetId:r.id,animationBus:n,completionTracker:a,element:c,targetState:{..._b(i),...st(i,{force:u})},onComplete:()=>{h()}})||h()};var wB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.getChildByLabel(e.id);if(!o)return;oe({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(ya(o),o.destroy({children:!0}))}})||(ya(o),o.destroy({children:!0}))};var EB=({positionX:t=0,positionY:e=0,width:r,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof r!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:r*s,y:i*o},a=t-n.x,l=e-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var GV=new Set([Tr.RECT,Tr.TEXT,Tr.CONTAINER,Tr.SPRITE,Tr.SPRITESHEET_ANIMATION,Tr.VIDEO]),Et=t=>{if(typeof t.width!="number"||typeof t.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(Tr).includes(t.type))throw new Error("Input Error: Type must be one of "+Object.values(Tr).join(", "));if(!t.id)throw new Error("Input Error: Id is missing");let e=t.scaleX?t.scaleX*t.width:t.width,r=t.scaleY?t.scaleY*t.height:t.height;t.type===Tr.CONTAINER&&(e=t.width,r=t.height);let{x:i,y:s,originX:o,originY:n}=EB({positionX:t.x,positionY:t.y,width:e,height:r,anchorX:t.anchorX,anchorY:t.anchorY}),a=typeof t.originX=="number"?t.originX:o,l=typeof t.originY=="number"?t.originY:n,c={id:t.id,type:t.type,width:Math.round(e),height:Math.round(r),x:Math.round(i),y:Math.round(s),originX:Math.round(a),originY:Math.round(l),alpha:t.alpha??1};if(t.hover&&(c.hover=t.hover),t.click&&(c.click=t.click),t.filters!==void 0){if(!GV.has(t.type))throw new Error(`Input Error: filters are not supported on ${t.type} elements`);c.filters=gB(t.filters)}return c};var DV=t=>typeof t!="number"||!Number.isFinite(t)?0:Math.max(0,Math.floor(t)),NV="top",VV=2,PB=["top","bottom"],HV=new Set(PB),WV=16,$V=0,CB=["image","spritesheet"],zV=new Set(CB),XV=(t,e)=>{if(t===void 0)return NV;if(HV.has(t))return t;throw new Error(`Input Error: ${e}.placement must be one of ${PB.join(", ")}.`)},YV=(t,e)=>{if(t===void 0)return 0;if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t;throw new Error(`Input Error: ${e}.gap must be a finite number >= 0.`)},jV=(t={})=>t.kind??(t.atlas!==void 0||t.clips!==void 0||t.playback!==void 0?"spritesheet":"image"),AB=(t={},e)=>{let r=jV(t);if(!zV.has(r))throw new Error(`Input Error: ${e}.kind must be one of ${CB.join(", ")}.`);let i={kind:r,src:t.src??"",width:t.width??12,height:t.height??12};if(t.offsetX!==void 0&&(i.offsetX=t.offsetX),t.offsetY!==void 0&&(i.offsetY=t.offsetY),r==="image")return i;let s=t.atlas,o=Qr(s),n=Jr(t.clips,s?.animations,s?.meta,Object.keys(o.frames??{})),a=Lr({atlas:o,clips:n,playback:t.playback});return{...i,atlas:o,clips:n,playback:a}},qV=({placement:t,gap:e,x:r,y:i,partWidth:s,partHeight:o,furiganaWidth:n,furiganaHeight:a})=>{let l=Math.round(r+(s-n)/2);return t==="bottom"?{x:l,y:i+o+e}:{x:l,y:i-a+VV-e}},KV=t=>t===`
|
|
1295
|
-
`||t==="\r",
|
|
1296
|
-
`&&(a+=1),{remainingText:t.slice(a),consumedExplicitNewline:!0}}return r?{remainingText:t.slice(n),consumedExplicitNewline:!1}:{remainingText:t.slice(o),consumedExplicitNewline:!1}},vb=(t,e,{minimumWidth:r=e}={})=>{let i=[],s=[],o=0,n=0,a=0,l=0,c=0,u=[...t],h=new WeakSet,d=Math.max(10,t.reduce((m,x)=>m+(x?.text?.length??0),0)*4),f=()=>{i.push({lineParts:[...s],y:n,lineMaxHeight:a}),o=0,n+=a,a=0,s=[]};for(;u.length>0;){if(c+=1,c>d)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let m=u[0];if(!m.text||m.text.length===0){u.shift();continue}let x=m.text,v=Math.max(1,Math.round(e-o)),y=m.textStyle.wordWrap?{...m.textStyle,wordWrapWidth:v}:m.textStyle,g=Ye.measureText(m.text,new Ge(Ut(y,{includeShadow:!1})));if(g.lineWidths[0]>v&&s.length>0){f();continue}let b=g.lines[0]??"",_=g.lines.length>1,S="",E=!1;if(g.lines.length===1&&m.text.endsWith(" ")&&!b.endsWith(" ")&&(b+=" "),b.length>0){let R=QV(x,b,_);S=R.remainingText,E=R.consumedExplicitNewline}if(b.length===0&&x.length>0){let R=x.match(/^\s+/)?.[0]??"";b=R.length>0?R:x[0],S=x.slice(b.length)}if(S===x){let R=x.match(/^\s+/)?.[0]??x[0]??"";if(R.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");b=R,S=x.slice(R.length)}let P=Ye.measureText(b,new Ge({...Ut(m.textStyle,{includeShadow:!1}),wordWrap:!1,breakWords:!1})),C=Math.max(0,Math.round(P.width??g.lineWidths[0]??0)),M={text:b,textStyle:y,height:P.height,x:o,y:n};if(m.furigana&&!h.has(m)){h.add(m);let R=Ye.measureText(m.furigana.text,new Ge(Ut(m.furigana.textStyle,{includeShadow:!1}))),F=qV({placement:m.furigana.placement,gap:m.furigana.gap,x:o,y:n,partWidth:C,partHeight:P.height,furiganaWidth:R.width,furiganaHeight:R.height}),U={text:m.furigana.text,textStyle:m.furigana.textStyle,x:F.x,y:F.y};M.furigana=U}s.push(M),a=Math.max(a,P.height),o+=C,l=Math.max(l,o),S&&S.length>0?m.text=S:u.shift(),(_||E)&&o>0&&f()}s.length>0&&i.push({lineParts:s,y:n,lineMaxHeight:a});for(let m=0;m<i.length;m++){let x=i[m].lineMaxHeight;i[m].lineParts=i[m].lineParts.map(v=>{let y=v.height;v.height&&delete v.height;let g=v.y+(x-y),b=v.furigana;return b&&(b.y=b.y-v.y+g),{...v,...b&&{furigana:b},y:g}})}let p=i.length>0?i[i.length-1].y+i[i.length-1].lineMaxHeight:0;return{chunks:i,width:Math.max(l,r),height:p}},Tb=({content:t,defaultTextStyle:e,width:r})=>(t||[]).map((i,s)=>{let o=Ei(e,i.textStyle);o.lineHeight=Math.round(o.lineHeight*o.fontSize),typeof r=="number"&&(o.wordWrapWidth=r,o.wordWrap=!0);let n=null;if(i.furigana){let l=Ei(e,i.furigana.textStyle);l.lineHeight=Math.round(l.lineHeight*l.fontSize),typeof r=="number"&&(l.wordWrapWidth=r,l.wordWrap=!0),n={text:String(i.furigana.text),textStyle:l,placement:XV(i.furigana.placement,`content[${s}].furigana`),gap:YV(i.furigana.gap,`content[${s}].furigana`)}}return{text:String(i.text).replace(/ +$/,l=>"\xA0".repeat(l.length)),textStyle:o,...n&&{furigana:n}}}),RB=({state:t})=>{let e=Ei({...$e,wordWrap:!0},t.textStyle),r=Tb({content:t.content,defaultTextStyle:e,width:t.width||void 0}),i=t.width||500,{chunks:s,width:o,height:n}=vb(r,i),a=t.width||o,c=Et({...t,width:a,height:n});if(c.alpha=t.alpha??1,t.indicator){let u=t.indicator;if(u.offset!==void 0)throw new Error("Input Error: indicator.offset is no longer supported. Use offsetX and offsetY.");c.indicator={revealing:AB(u.revealing,"indicator.revealing"),complete:AB(u.complete,"indicator.complete"),offsetX:u.offsetX??WV,offsetY:u.offsetY??$V}}return{...c,content:s,textStyle:{...e},speed:t.speed??50,revealEffect:t.revealEffect??"typewriter",...t.softWipe!==void 0&&{softWipe:bo(t.softWipe)},...t.initialRevealedCharacters!==void 0&&{initialRevealedCharacters:DV(t.initialRevealedCharacters)},...t.width!==void 0&&{width:t.width},...t.complete&&{complete:t.complete}}};var JV=1e5,eH=(t,e)=>typeof t.width=="number"?t.width:e.wordWrap&&typeof e.wordWrapWidth=="number"&&Number.isFinite(e.wordWrapWidth)&&e.wordWrapWidth>0?e.wordWrapWidth:JV,MB=({state:t})=>{let e=Array.isArray(t.content),r=Ei($e,t.textStyle),i={...r};if(i.lineHeight=Math.round(i.fontSize*i.lineHeight),typeof t.width=="number"&&(i.wordWrapWidth=t.width,i.wordWrap=!0),e){let d=eH(t,r),f=Tb({content:t.content,defaultTextStyle:r,width:typeof t.width=="number"?t.width:void 0}),{chunks:p,width:m,height:x}=vb(f,d,{minimumWidth:0}),v=Math.round(m),y=Math.round(x),g=typeof t.width=="number"?Math.round(t.width):v,_={...Et({...t,width:g,height:y}),content:p,measuredWidth:v,textStyle:{...i},...t.hover&&{hover:t.hover},...t.click&&{click:t.click},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}};return Object.defineProperties(_,{__anchorXRatio:{value:t.anchorX??0,enumerable:!1},__anchorYRatio:{value:t.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof t.width=="number",enumerable:!1}}),_}let s=String(t.content??""),{width:o,height:n}=Ye.measureText(s,new Ge(Ut(i,{includeShadow:!1}))),a=Math.round(o),l=Math.round(n),c=typeof t.width=="number"?Math.round(t.width):a,h={...Et({...t,width:c,height:l}),content:s,measuredWidth:a,textStyle:{...i},...t.hover&&{hover:t.hover},...t.click&&{click:t.click},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}};return Object.defineProperties(h,{__anchorXRatio:{value:t.anchorX??0,enumerable:!1},__anchorYRatio:{value:t.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof t.width=="number",enumerable:!1}}),h};var tH=dt({type:"text",add:TB,update:SB,delete:wB,parse:MB,shouldUpdateUnchanged:Nr});var IB={color:0,alpha:0},rH={x:0,y:0},iH={x:0,y:1},sH={x:.5,y:.5},BB=t=>t==null||t===""||t==="transparent",FB=t=>[...t].sort((e,r)=>e.offset-r.offset),oH=(t,e)=>{if(!t||!e)return t;let r=e.originX??0,i=e.originY??0,s=Vf(e),o=_o(e.rotation??0),n=Math.cos(o),a=Math.sin(o),l=t.x-s.x,c=t.y-s.y;return{x:r+l*n+c*a,y:i-l*a+c*n}},sp=(t,e,r,i)=>e.coordinateSpace==="global"?oH(t??i,r):t,Ms=t=>{t._rtglFillResource?.destroy(),delete t._rtglFillResource},nH=(t,e)=>BB(t)?IB:typeof t=="string"?t:t.type==="solid"?BB(t.color)?IB:t.color:t.type==="linear-gradient"?new wt({type:"linear",start:sp(t.start,t,e,rH),end:sp(t.end,t,e,iH),colorStops:FB(t.stops),textureSpace:t.coordinateSpace,textureSize:t.textureSize,wrapMode:t.wrapMode}):t.type==="radial-gradient"?new wt({type:"radial",center:sp(t.innerCenter,t,e,sH),innerRadius:t.innerRadius,outerCenter:sp(t.outerCenter,t,e),outerRadius:t.outerRadius,colorStops:FB(t.stops),textureSpace:t.coordinateSpace,textureSize:t.textureSize,wrapMode:t.wrapMode,scale:t.scale,rotation:t.rotation}):t,_a=(t,e,r)=>{Ms(t);let i=nH(e,r);return i instanceof wt&&(t._rtglFillResource=i),i};var kB=({app:t,parent:e,element:r,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:c,width:u,height:h,fill:d,border:f,alpha:p,scaleX:m,scaleY:x}=r,v=Qe(i,c),y=new Ze;y.label=c,y.zIndex=n,y.on("destroyed",()=>{Ms(y)});let g=Or(r,{alpha:p});m!==void 0&&(g.scaleX=m),x!==void 0&&(g.scaleY=x),(()=>{y.clear(),y.rect(0,0,Math.round(u),Math.round(h)).fill(_a(y,d,r)),y.alpha=p,y.scale.x=1,y.scale.y=1,Ur(y,r),f&&y.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)}),Oe(y,r.filters,{width:u,height:h,force:v})})();let _=r?.hover,S=r?.click,E=r?.rightClick,P=r?.scrollUp,C=r?.scrollDown,M=r?.drag;if(_){let{cursor:R,soundSrc:F,payload:U}=_;y.eventMode="static";let W=()=>{U&&o&&o("hover",{_event:{id:y.label},...U}),R&&(y.cursor=R),F&&t.audioStage.add({id:`hover-${Date.now()}`,url:F,loop:!1})},N=()=>{y.cursor="auto"};y.on("pointerover",W),y.on("pointerout",N)}if(S){let{soundSrc:R,soundVolume:F,payload:U}=S;y.eventMode="static";let W=N=>{Ot(N)&&(U&&o&&o("click",{_event:{id:y.label},...U}),R&&t.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:je(F)}))};y.on("pointerup",W)}if(E){let{soundSrc:R,payload:F}=E;y.eventMode="static";let U=()=>{F&&o&&o("rightClick",{_event:{id:y.label},...F}),R&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})};y.on("rightclick",U)}if((P||C)&&Gr({canvas:t.canvas,displayObject:y,width:u,height:h,scrollUpEvent:P,scrollDownEvent:C,eventHandler:o}),M){let{start:R,end:F,move:U}=M;y.eventMode="static";let W=()=>{y._isDragging=!0,R&&o&&o("dragStart",{_event:{id:y.label},...typeof R?.payload=="object"?R.payload:{}})},N=()=>{y._isDragging=!1,F&&o&&o("dragEnd",{_event:{id:y.label},...typeof F?.payload=="object"?F.payload:{}})},G=X=>{U&&o&&y._isDragging&&o("dragMove",{_event:{id:y.label,x:X.global.x,y:X.global.y},...typeof U?.payload=="object"?U.payload:{}})};y.on("pointerdown",W),y.on("pointerup",N),y.on("globalpointermove",G),y.on("pointerupoutside",N)}e.addChild(y),oe({animations:i,targetId:c,animationBus:s,completionTracker:a,element:y,targetState:{...g,...st(r,{force:v})},renderContext:l})};var UB=({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=e.children.find(_=>_.label===r.id);if(!c)return;c.zIndex=a;let{width:u,height:h,fill:d,border:f,alpha:p,scaleX:m,scaleY:x}=i,v=Qe(s,r.id);v?Oe(c,r.filters,{width:r.width,height:r.height,force:!0}):Dr(c);let y=Or(i,{alpha:p});m!==void 0&&(y.scaleX=m),x!==void 0&&(y.scaleY=x);let g=()=>{if(!ye(r,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(u),Math.round(h)).fill(_a(c,d,i)),c.alpha=p,c.scale.x=1,c.scale.y=1,Ur(c,i),f&&c.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)}),Oe(c,i.filters,{width:u,height:h,force:v}),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 _=i?.hover,S=i?.click,E=i?.rightClick,P=i?.scrollUp,C=i?.scrollDown,M=i?.drag;if(_){let{cursor:R,soundSrc:F,payload:U}=_;c.eventMode="static";let W=()=>{U&&n&&n("hover",{_event:{id:c.label},...U}),R&&(c.cursor=R),F&&t.audioStage.add({id:`hover-${Date.now()}`,url:F,loop:!1})},N=()=>{c.cursor="auto"};c.on("pointerover",W),c.on("pointerout",N)}if(S){let{soundSrc:R,soundVolume:F,payload:U}=S;c.eventMode="static";let W=N=>{Ot(N)&&(U&&n&&n("click",{_event:{id:c.label},...U}),R&&t.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:je(F)}))};c.on("pointerup",W)}if(E){let{soundSrc:R,payload:F}=E;c.eventMode="static";let U=()=>{F&&n&&n("rightClick",{_event:{id:c.label},...F}),R&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})};c.on("rightclick",U)}if((P||C)&&Gr({canvas:t.canvas,displayObject:c,width:u,height:h,scrollUpEvent:P,scrollDownEvent:C,eventHandler:n}),M){let{start:R,end:F,move:U}=M;c.eventMode="static";let W=()=>{c._isDragging=!0,R&&n&&n("dragStart",{_event:{id:c.label},...typeof R?.payload=="object"?R.payload:{}})},N=()=>{c._isDragging=!1,F&&n&&n("dragEnd",{_event:{id:c.label},...typeof F?.payload=="object"?F.payload:{}})},G=X=>{U&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:X.global.x,y:X.global.y},...typeof U?.payload=="object"?U.payload:{}})};c.on("pointerdown",W),c.on("pointerup",N),c.on("globalpointermove",G),c.on("pointerupoutside",N)}}};oe({animations:s,targetId:r.id,animationBus:o,completionTracker:l,element:c,targetState:{...y,...st(i,{force:v})},onComplete:()=>{g()}})||g()};var OB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.getChildByLabel(e.id);if(!o)return;oe({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),Ms(o),o.destroy())}})||(o._cleanupScrollInteraction?.(),Ms(o),o.destroy())};var LB=({state:t})=>{let e=Et(t),r=t.border?.width,i=e;return typeof r=="number"&&r>0&&(i={...e,border:{alpha:t.border?.alpha??1,color:t.border?.color??"black",width:r}}),{...i,...t.fill!==void 0?{fill:t.fill}:{},...t.scaleX!==void 0?{scaleX:t.scaleX}:{},...t.scaleY!==void 0?{scaleY:t.scaleY}:{},rotation:t.rotation??0,...t.drag&&{drag:t.drag},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}}};var aH=dt({type:"rect",add:kB,update:UB,delete:OB,parse:LB,shouldUpdateUnchanged:Nr});var DB="_routeGraphicsBlur",np="_routeGraphicsBlurFilter",Sb="_routeGraphicsBlurOptions",lH=new Set([5,7,9,11,13,15]),op={quality:4,kernelSize:5,repeatEdgePixels:!1},NB=t=>typeof t=="number"&&Number.isFinite(t),GB=(t,e)=>{if(!NB(t)||t<0)throw new Error(`Input Error: ${e} must be a finite number >= 0`)},Is=(t,e="blur")=>{if(t===void 0)return;if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be an object`);if(t.x===void 0||t.y===void 0)throw new Error(`Input Error: ${e}.x and ${e}.y are required`);GB(t.x,`${e}.x`),GB(t.y,`${e}.y`);let r=t.quality??op.quality;if(!NB(r)||r<1)throw new Error(`Input Error: ${e}.quality must be a finite number >= 1`);let i=t.kernelSize??op.kernelSize;if(!lH.has(i))throw new Error(`Input Error: ${e}.kernelSize must be one of 5, 7, 9, 11, 13, 15`);let s=t.repeatEdgePixels??op.repeatEdgePixels;if(typeof s!="boolean")throw new Error(`Input Error: ${e}.repeatEdgePixels must be a boolean`);return{x:t.x,y:t.y,quality:r,kernelSize:i,repeatEdgePixels:s}},cH=(t,e)=>t?t instanceof Map?t.get(e)??[]:t.filter(r=>r?.targetId===e):[],zt=(t,e)=>cH(t,e).some(r=>r?.type==="update"&&(r.tween?.blurX||r.tween?.blurY)),uH=t=>({get x(){return t.strengthX},set x(e){t.strengthX=Math.max(0,e)},get y(){return t.strengthY},set y(e){t.strengthY=Math.max(0,e)}}),hH=(t,e)=>{let r=t[Sb];return t[np]&&r?.quality===e.quality&&r?.kernelSize===e.kernelSize&&r?.repeatEdgePixels===e.repeatEdgePixels},dH=t=>{Ao(t,"blur",null),delete t[DB],delete t[np],delete t[Sb]},gt=(t,e,{force:r=!1}={})=>{if(!e&&!r){dH(t);return}let i=e??{x:0,y:0,...op},s=hH(t,i)?t[np]:new sa({strengthX:i.x,strengthY:i.y,quality:i.quality,kernelSize:i.kernelSize});s.repeatEdgePixels=i.repeatEdgePixels,s.strengthX=i.x,s.strengthY=i.y,t[np]=s,t[Sb]={quality:i.quality,kernelSize:i.kernelSize,repeatEdgePixels:i.repeatEdgePixels},t[DB]=uH(s),Ao(t,"blur",s)},Xt=(t,{force:e=!1}={})=>!t?.blur&&!e?{}:{blurX:t?.blur?.x??0,blurY:t?.blur?.y??0};var VB=({app:t,parent:e,element:r,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:c,width:u,height:h,src:d,alpha:f}=r,p=d?B.from(d):B.EMPTY,m=new ke(p);m.label=c,m.zIndex=l,m.width=Math.round(u),m.height=Math.round(h),m.alpha=f,Ur(m,r);let x=zt(i,c);gt(m,r.blur,{force:x});let v=Qe(i,c);Oe(m,r.filters,{width:u,height:h,force:v});let y=r?.hover,g=r?.click,b=r?.rightClick,_=r?.scrollUp,S=r?.scrollDown,E=null,P=null,C=null,M=()=>{let R=E?.isHovering()??!1,F=P?.isPressed()??!1;if((C?.isPressed()??!1)&&b?.src){let W=B.from(b.src);m.texture=W}else if(F&&g?.src){let W=B.from(g.src);m.texture=W}else if(R&&y?.src){let W=B.from(y.src);m.texture=W}else m.texture=p};if(y){let{cursor:R,soundSrc:F,payload:U}=y;m.eventMode="static",E=Cs({displayObject:m,onHoverChange:M});let W=()=>{E.setDirectHover(!0),U&&s&&s("hover",{_event:{id:m.label},...U}),R&&(m.cursor=R),F&&t.audioStage.add({id:`hover-${Date.now()}`,url:F,loop:!1})},N=()=>{E.setDirectHover(!1),m.cursor="auto"};m.on("pointerover",W),m.on("pointerout",N)}if(g){let{soundSrc:R,soundVolume:F,payload:U}=g;m.eventMode="static",P=ma({displayObject:m,onPressChange:M});let W=X=>{Ot(X)&&P.setDirectPress(!0)},N=X=>{Ot(X)&&(P.setDirectPress(!1),U&&s&&s("click",{_event:{id:m.label},...U}),R&&t.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:je(F)}))},G=()=>{P.setDirectPress(!1)};m.on("pointerdown",W),m.on("pointerup",N),m.on("pointerupoutside",G)}if(b){let{soundSrc:R,payload:F}=b;m.eventMode="static",C=ga({displayObject:m,onPressChange:M});let U=()=>{C.setDirectPress(!0)},W=()=>{C.setDirectPress(!1)},N=()=>{C.setDirectPress(!1),F&&s&&s("rightClick",{_event:{id:m.label},...F}),R&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})},G=()=>{C.setDirectPress(!1)};m.on("rightdown",U),m.on("rightup",W),m.on("rightclick",N),m.on("rightupoutside",G)}(_||S)&&Gr({canvas:t.canvas,displayObject:m,scrollUpEvent:_,scrollDownEvent:S,eventHandler:s}),e.addChild(m),oe({animations:i,targetId:c,animationBus:o,completionTracker:n,element:m,targetState:{...Or(r),width:u,height:h,alpha:f,...Xt(r,{force:x}),...st(r,{force:v})},renderContext:a})};var HB=({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(P=>P.label===r.id);if(!c)return;c.zIndex=l;let{width:u,height:h,src:d,alpha:f}=i,p=zt(s,r.id);p&>(c,r.blur,{force:!0});let m=Qe(s,r.id);m?Oe(c,r.filters,{width:r.width,height:r.height,force:!0}):Dr(c);let x=!1,v=da(s,r.id),y=v.length>0,g=P=>v.some(C=>Object.prototype.hasOwnProperty.call(C.tween??{},P)),b=P=>{c._cleanupScrollInteraction?.(),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"),c.removeAllListeners("wheel"),pa(c),Jf(c),ep(c);let C=i?.hover,M=i?.click,R=i?.rightClick,F=i?.scrollUp,U=i?.scrollDown,W=null,N=null,G=null,X=()=>{let $=W?.isHovering()??!1,D=N?.isPressed()??!1;if((G?.isPressed()??!1)&&R?.src){let le=B.from(R.src);c.texture=le}else if(D&&M?.src){let le=B.from(M.src);c.texture=le}else if($&&C?.src){let le=B.from(C.src);c.texture=le}else c.texture=P};if(C){let{cursor:$,soundSrc:D,payload:z}=C;c.eventMode="static",W=Cs({displayObject:c,onHoverChange:X});let le=()=>{W.setDirectHover(!0),z&&a&&a("hover",{_event:{id:c.label},...z}),$&&(c.cursor=$),D&&t.audioStage.add({id:`hover-${Date.now()}`,url:D,loop:!1})},de=()=>{W.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",le),c.on("pointerout",de)}if(M){let{soundSrc:$,soundVolume:D,payload:z}=M;c.eventMode="static",N=ma({displayObject:c,onPressChange:X});let le=Se=>{Ot(Se)&&N.setDirectPress(!0)},de=Se=>{Ot(Se)&&(N.setDirectPress(!1),z&&a&&a("click",{_event:{id:c.label},...z}),$&&t.audioStage.add({id:`click-${Date.now()}`,url:$,loop:!1,volume:je(D)}))},be=()=>{N.setDirectPress(!1)};c.on("pointerdown",le),c.on("pointerup",de),c.on("pointerupoutside",be)}if(R){let{soundSrc:$,payload:D}=R;c.eventMode="static",G=ga({displayObject:c,onPressChange:X});let z=()=>{G.setDirectPress(!0)},le=()=>{G.setDirectPress(!1)},de=()=>{G.setDirectPress(!1),D&&a&&a("rightClick",{_event:{id:c.label},...D}),$&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:$,loop:!1})},be=()=>{G.setDirectPress(!1)};c.on("rightdown",z),c.on("rightup",le),c.on("rightclick",de),c.on("rightupoutside",be)}(F||U)&&Gr({canvas:t.canvas,displayObject:c,scrollUpEvent:F,scrollDownEvent:U,eventHandler:a})},_=({preserveWidth:P=!1,preserveHeight:C=!1}={})=>{let M=c.width,R=c.height,F=d?B.from(d):B.EMPTY;c.texture=F,c.width=Math.round(P?M:u),c.height=Math.round(C?R:h),b(F)},S=()=>{ye(r,i)||(x||_(),c.width=Math.round(u),c.height=Math.round(h),c.alpha=f,Ur(c,i),gt(c,i.blur,{force:p}),Oe(c,i.filters,{width:u,height:h,force:m}))};r.src!==i.src&&y&&(_({preserveWidth:g("width"),preserveHeight:g("height")}),x=!0),oe({animations:s,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{...Or(i),width:u,height:h,alpha:f,...Xt(i,{force:p}),...st(i,{force:m})},onComplete:()=>{S()}})||S()};var WB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.children.find(a=>a.label===e.id);if(!o)return;oe({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var $B=({state:t})=>({...Et(t),src:t.src??"",alpha:t.alpha??1,rotation:t.rotation??0,...t.blur!==void 0&&{blur:Is(t.blur)},...t.hover&&{hover:t.hover},...t.click&&{click:t.click},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}});var fH=dt({type:"sprite",add:VB,update:HB,delete:WB,parse:$B,shouldUpdateUnchanged:Nr});var pH=t=>!t||t.ended?!0:Number.isFinite(t.duration)&&t.duration>0&&t.currentTime>=t.duration,wb=({videoElement:t,video:e})=>{e&&t?._videoEndedListener&&e.removeEventListener("ended",t._videoEndedListener),t&&(t._videoEndedListener=void 0,t._playbackStateVersion=null)},ap=({videoElement:t,video:e,loop:r,completionTracker:i})=>{if(wb({videoElement:t,video:e}),(r??!1)||pH(e))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};e.addEventListener("ended",o),t._videoEndedListener=o,t._playbackStateVersion=s};var zB=({parent:t,element:e,animations:r,animationBus:i,renderContext:s,completionTracker:o,zIndex:n})=>{let{id:a,x:l,y:c,width:u,height:h,src:d,volume:f,loop:p,alpha:m}=e,x=B.from(d),v=x.source.resource;v.pause(),v.currentTime=0,v.loop=p??!1,v.volume=je(f),v.muted=!1;let y=new ke(x);y.label=a,y.zIndex=n,y._videoEndedListener=void 0,y._playbackStateVersion=null,y.x=Math.round(l),y.y=Math.round(c),y.width=Math.round(u),y.height=Math.round(h),y.alpha=m??1;let g=zt(r,a);gt(y,e.blur,{force:g});let b=Qe(r,a);Oe(y,e.filters,{width:u,height:h,force:b}),ap({videoElement:y,video:v,loop:p,completionTracker:o}),kI(s,v),t.addChild(y),oe({animations:r,targetId:a,animationBus:i,completionTracker:o,element:y,targetState:{x:l,y:c,width:u,height:h,alpha:m??1,...Xt(e,{force:g}),...st(e,{force:b})},renderContext:s})};var XB=({parent:t,prevElement:e,nextElement:r,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(P=>P.label===e.id);if(!l)return;l.zIndex=a;let{x:c,y:u,width:h,height:d,alpha:f}=r,p=zt(i,e.id);p&>(l,e.blur,{force:!0});let m=Qe(i,e.id);m?Oe(l,e.filters,{width:e.width,height:e.height,force:!0}):Dr(l);let x=e.src,v=!1,y=da(i,e.id),g=y.length>0,b=P=>y.some(C=>Object.prototype.hasOwnProperty.call(C.tween??{},P)),_=()=>{let P=l.texture.source.resource,C=x!==r.src;if(C){let M=P;wb({videoElement:l,video:M}),M&&M.pause();let R=B.from(r.src);l.texture=R,P=R.source.resource,P.muted=!1,P.pause(),P.currentTime=0,x=r.src}ap({videoElement:l,video:P,loop:r.loop,completionTracker:n}),P.volume=je(r.volume),P.loop=r.loop??!1,C&&P.play()},S=()=>{ye(e,r)||(l.x=Math.round(c),l.y=Math.round(u),l.width=Math.round(h),l.height=Math.round(d),l.alpha=f??1,gt(l,r.blur,{force:p}),Oe(l,r.filters,{width:h,height:d,force:m}),v||_())};if(e.src!==r.src&&g){let P=l.width,C=l.height;_(),l.width=Math.round(b("width")?P:h),l.height=Math.round(b("height")?C:d),v=!0}oe({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:u,width:h,height:d,alpha:f??1,...Xt(r,{force:p}),...st(r,{force:m})},onComplete:S})||S()};var YB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.children.find(l=>l.label===e.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()),t.removeChild(o),o.destroy()}};oe({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var jB=({state:t})=>({...Et(t),src:t.src,volume:t.volume??100,loop:t.loop??!1,...t.blur!==void 0&&{blur:Is(t.blur)}});var mH=dt({type:"video",add:zB,update:XB,delete:YB,parse:jB,shouldUpdateUnchanged:Nr});var qB=0,KB=16,ba=Symbol("routeGraphicsSliderRuntime"),gH=(t,e)=>t!==null&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,e),Pb=t=>Math.max(0,Math.min(1,t)),ZB=t=>t.initialValue??t.min,Eb=t=>{if(!(!t||typeof t!="object")){if(typeof t.pointerId=="number")return t.pointerId;if(typeof t.nativeEvent?.pointerId=="number")return t.nativeEvent.pointerId;if(typeof t.data?.pointerId=="number")return t.data.pointerId}},xH=t=>{if(!t||typeof t!="object")return null;if(typeof t.clientX=="number"&&typeof t.clientY=="number")return{x:t.clientX,y:t.clientY};let e=t.changedTouches?.[0]??t.touches?.[0];return e&&typeof e.clientX=="number"&&typeof e.clientY=="number"?{x:e.clientX,y:e.clientY}:null},QB=t=>typeof globalThis.addEventListener=="function"&&typeof globalThis.removeEventListener=="function"&&typeof globalThis.document?.addEventListener=="function"&&typeof globalThis.document?.removeEventListener=="function"&&typeof t?.renderer?.events?.mapPositionToPoint=="function",yH=({app:t,nativeEvent:e})=>{let r=xH(e);if(!r)return null;let i={x:0,y:0};return t.renderer.events.mapPositionToPoint(i,r.x,r.y),i},JB=t=>{t.removeNativeDragListeners?.(),t.removeNativeDragListeners=null},_H=({runtime:t,moveListener:e,upListener:r})=>{if(!QB(t.app)||t.removeNativeDragListeners)return;let i=[],s=(o,n,a)=>{o.addEventListener(n,a,!0),i.push([o,n,a])};typeof globalThis.PointerEvent=="function"?(s(globalThis.document,"pointermove",e),s(globalThis,"pointerup",r),s(globalThis,"pointercancel",r)):(s(globalThis.document,"mousemove",e),s(globalThis,"mouseup",r),"ontouchstart"in globalThis&&(s(globalThis.document,"touchmove",e),s(globalThis,"touchend",r),s(globalThis,"touchcancel",r))),t.removeNativeDragListeners=()=>{for(let[o,n,a]of i)o.removeEventListener(n,a,!0)}},Co=t=>t?B.from(t):B.EMPTY,va=t=>({bar:`${t}-bar`,inactiveBar:`${t}-inactive-bar`,barMask:`${t}-bar-mask`,thumb:`${t}-thumb`}),eF=({sliderContainer:t,fromId:e,toId:r})=>{if(e===r)return;let i=va(e),s=va(r);for(let[o,n]of Object.entries(i)){let a=t.getChildByLabel(n);a&&(a.label=s[o])}},Ta=({sliderContainer:t,id:e})=>{let r=va(e);return{bar:t.getChildByLabel(r.bar),inactiveBar:t.getChildByLabel(r.inactiveBar),barMask:t.getChildByLabel(r.barMask),thumb:t.getChildByLabel(r.thumb)}},Ab=({baseValue:t,override:e,key:r})=>gH(e,r)?e[r]??"":t??"",bH=(t,e=null)=>({thumbSrc:Ab({baseValue:t.thumbSrc,override:e,key:"thumbSrc"}),barSrc:Ab({baseValue:t.barSrc,override:e,key:"barSrc"}),inactiveBarSrc:Ab({baseValue:t.inactiveBarSrc,override:e,key:"inactiveBarSrc"})}),vH=t=>{let e=new ke(B.EMPTY);return e.label=t,e.eventMode="static",e.zIndex=0,e},TH=t=>{let e=new Ze;return e.label=t,e.zIndex=0,e},SH=({sliderContainer:t,id:e,bar:r})=>{let i=va(e),{inactiveBar:s,barMask:o}=Ta({sliderContainer:t,id:e});return s||(s=vH(i.inactiveBar),t.addChild(s)),o||(o=TH(i.barMask),t.addChild(o)),r.mask=o,{inactiveBar:s,barMask:o}},wH=({sliderContainer:t,id:e,bar:r})=>{let{inactiveBar:i,barMask:s}=Ta({sliderContainer:t,id:e});r?.mask===s&&(r.mask=null),i&&(t.removeChild(i),i.destroy()),s&&(t.removeChild(s),s.destroy())},tF=({currentValue:t,min:e,max:r})=>{let i=r-e;return i<=0?0:Pb((t-e)/i)},EH=({barMask:t,direction:e,width:r,height:i,currentValue:s,min:o,max:n})=>{if(!t)return;let a=tF({currentValue:s,min:o,max:n}),l=Math.round(e==="horizontal"?r*a:r),c=Math.round(e==="horizontal"?i:i*a);t.clear(),!(l<=0||c<=0)&&t.rect(0,0,l,c).fill({color:16777215,alpha:0})},AH=({thumb:t,direction:e,currentValue:r,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=tF({currentValue:r,min:i,max:s});if(e==="horizontal"){t.x=a*(o-t.width),t.y=(n-t.height)/2;return}t.x=(o-t.width)/2,t.y=a*(n-t.height)},cp=({thumb:t,thumbSrc:e,direction:r,trackWidth:i,trackHeight:s})=>{let o=r==="horizontal"?s-qB*2:i-qB*2,n=Co(e),a=n.width||KB,l=n.height||KB,c=o/a,u=o/l,h=Math.min(c,u);t.width=a*h,t.height=l*h},PH=({sliderContainer:t,sliderComputedNode:e,thumb:r,currentValue:i,hoverOverride:s=null})=>{let{id:o,width:n,height:a,direction:l,min:c,max:u}=e,{barSrc:h,inactiveBarSrc:d,thumbSrc:f}=bH(e,s),{bar:p}=Ta({sliderContainer:t,id:o});if(p){if(p.texture=Co(h),p.width=n,p.height=a,r.texture=Co(f),d){let{inactiveBar:m,barMask:x}=SH({sliderContainer:t,id:o,bar:p});m.texture=Co(d),m.width=n,m.height=a,EH({barMask:x,direction:l,width:n,height:a,currentValue:i,min:c,max:u})}else wH({sliderContainer:t,id:o,bar:p});AH({thumb:r,direction:l,currentValue:i,min:c,max:u,trackWidth:n,trackHeight:a})}},CH=({position:t,thumb:e,direction:r,min:i,max:s,step:o,trackWidth:n,trackHeight:a})=>{let l=s-i,c;if(r==="horizontal"){let h=t.x-e.width/2,d=Math.max(n-e.width,1);c=Pb(h/d)}else{let h=t.y-e.height/2,d=Math.max(a-e.height,1);c=Pb(h/d)}let u=i+c*l;return o>0&&(u=Math.round((u-i)/o)*o+i,u=Math.max(i,Math.min(s,u))),u},rF=({sliderContainer:t,sliderComputedNode:e,cursor:r})=>{let i=r??"auto",{bar:s,inactiveBar:o,thumb:n}=Ta({sliderContainer:t,id:e.id});t.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},_u=t=>{PH({sliderContainer:t.sliderContainer,sliderComputedNode:t.sliderComputedNode,thumb:t.thumb,currentValue:t.currentValue,hoverOverride:t.sliderComputedNode.hover&&t.hoverController?.isHovering()?t.sliderComputedNode.hover:null})},lp=t=>{let e=t.hoverController?.isHovering()===!0?t.sliderComputedNode.hover?.cursor:null;rF({sliderContainer:t.sliderContainer,sliderComputedNode:t.sliderComputedNode,cursor:e})},iF=({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s})=>{let o=e[ba];return o||(pa(e),o={app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s,currentValue:ZB(r),isDragging:!1,activePointerId:void 0,listenersBound:!1,hoverController:null,removeNativeDragListeners:null},o.hoverController=Cs({displayObject:e,onHoverChange:()=>{_u(o),lp(o)}}),e[ba]=o),o.app=t,o.sliderContainer=e,o.sliderComputedNode=r,o.thumb=i,o.eventHandler=s,o},up=({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s,adoptExternalValue:o=!0})=>{let n=iF({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s});return o&&(n.currentValue=ZB(r)),_u(n),lp(n),n},sF=({sliderContainer:t})=>{let e=t?.[ba];e&&(JB(e),e.hoverController?.destroy?.(),delete t[ba])},oF=({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s})=>{let o=iF({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s});if(o.listenersBound)return;o.listenersBound=!0;let n=p=>{let{sliderComputedNode:m}=o,x=o.sliderContainer.toLocal(p),v=CH({position:x,thumb:o.thumb,direction:m.direction,min:m.min,max:m.max,step:m.step,trackWidth:m.width,trackHeight:m.height});v!==o.currentValue&&(o.currentValue=v,_u(o),m.change?.payload&&o.eventHandler&&o.eventHandler("change",{_event:{id:m.id,value:o.currentValue},...m.change.payload}))},a=p=>{p?.global&&n(p.global)},l=p=>{let m=Eb(p);o.activePointerId!==void 0&&m!==void 0&&m!==o.activePointerId||o.isDragging&&(o.isDragging=!1,o.activePointerId=void 0,JB(o))},c=p=>{if(!o.isDragging)return;let m=Eb(p);if(o.activePointerId!==void 0&&m!==void 0&&m!==o.activePointerId)return;let x=yH({app:o.app,nativeEvent:p});x&&n(x)},u=p=>{o.isDragging=!0,o.activePointerId=Eb(p),_H({runtime:o,moveListener:c,upListener:l}),a(p)},h=p=>{o.isDragging&&a(p)};e.on("pointerdown",u),QB(t)||e.on("globalpointermove",h),e.on("pointerup",l),e.on("pointerupoutside",l);let d=()=>{o.hoverController?.setDirectHover(!0),_u(o),lp(o);let p=o.sliderComputedNode.hover;p&&(rF({sliderContainer:o.sliderContainer,sliderComputedNode:o.sliderComputedNode,cursor:p.cursor}),p.soundSrc&&o.app?.audioStage?.add({id:`hover-${Date.now()}`,url:p.soundSrc,loop:!1}))},f=()=>{o.isDragging||(o.hoverController?.setDirectHover(!1),_u(o),lp(o))};e.on("pointerover",d),e.on("pointerout",f),e.on("pointerupoutside",f)};var nF=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{let{id:c,x:u,y:h,width:d,height:f,alpha:p,thumbSrc:m,barSrc:x}=r,v=new ie;v.label=c,v.zIndex=l,v.x=u,v.y=h,v.alpha=p,v.sortableChildren=!0,v.eventMode="static";let y=va(c),g=new ke(Co(x));g.label=y.bar,g.eventMode="static",g.zIndex=1;let b=new ke(Co(m));b.label=y.thumb,b.eventMode="static",b.zIndex=2,cp({thumb:b,thumbSrc:m,direction:r.direction,trackWidth:d,trackHeight:f}),v.addChild(g),v.addChild(b),oF({app:t,sliderContainer:v,sliderComputedNode:r,thumb:b,eventHandler:n}),up({app:t,sliderContainer:v,sliderComputedNode:r,thumb:b,eventHandler:n}),e.addChild(v),oe({animations:i,targetId:c,animationBus:s,completionTracker:o,element:v,targetState:{x:u,y:h,alpha:p},renderContext:a})};var aF=({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(m=>m.label===r.id);if(!c)return;c.zIndex=l;let u=()=>{if(!ye(r,i)){c.x=i.x,c.y=i.y,c.alpha=i.alpha,c.label=i.id,c.pivot.set(i.originX,i.originY),eF({sliderContainer:c,fromId:r.id,toId:i.id});let{bar:m,thumb:x}=Ta({sliderContainer:c,id:i.id});if(m&&x&&cp({thumb:x,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),!m||!x)return;let v=c[ba]?.isDragging!==!0||r.initialValue!==i.initialValue;up({app:t,sliderContainer:c,sliderComputedNode:i,thumb:x,eventHandler:a,adoptExternalValue:v})}},{x:h,y:d,alpha:f}=i;oe({animations:s,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,alpha:f},onComplete:u})||u()};var lF=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o})=>{let n=e.getChildByLabel(r.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(sF({sliderContainer:n}),n.destroy({children:!0}))};oe({animations:i,targetId:r.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var RH=(t,e,r)=>Math.max(e,Math.min(r,t)),cF=({state:t})=>{let e=Et(t),r=t.min??0,i=t.max??100;if(i<=r)throw new Error("Input error: the max value of a slider must be larger than the min value");if(t.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof t.initialValue!="number"||Number.isNaN(t.initialValue))throw new Error("Input error: slider initialValue must be a valid number");let s=RH(t.initialValue,r,i);return{...e,direction:t.direction??"horizontal",thumbSrc:t.thumbSrc??"",barSrc:t.barSrc??"",...t.inactiveBarSrc!==void 0&&{inactiveBarSrc:t.inactiveBarSrc??""},alpha:t.alpha??1,min:r,max:i,step:t.step??1,initialValue:s,...t.hover&&{hover:t.hover},...t.change&&{change:t.change}}};var MH=dt({type:"slider",add:nF,update:aF,delete:lF,parse:cF});var wa=Symbol("routeGraphicsInputRuntime"),hp={top:10,right:12,bottom:10,left:12},Rb="#FFFFFF",Mb={color:"#2E2E2E",width:1,alpha:1},Ib={color:"#4A89FF",width:2,alpha:1},uF={fill:"#4A89FF",alpha:.3},Cb={fill:"#111111",width:2},IH=(t={})=>{let e=t.fontSize??$e.fontSize,r=t.lineHeight??$e.lineHeight;return typeof r!="number"?Math.round(e*$e.lineHeight):r>8?Math.round(r):Math.round(e*r)},mp=(t={},e={})=>({...$e,...t,align:t.align??"left",lineHeight:IH(t),wordWrap:!1,breakWords:!1,wordWrapWidth:e.wordWrapWidth??0,whiteSpace:"pre"}),Bb=t=>typeof t=="number"?{top:t,right:t,bottom:t,left:t}:Array.isArray(t)?{top:t[0]??0,right:t[1]??t[0]??0,bottom:t[2]??t[0]??0,left:t[3]??t[1]??t[0]??0}:{top:t?.top??hp.top,right:t?.right??hp.right,bottom:t?.bottom??hp.bottom,left:t?.left??hp.left},BH=(t,e)=>typeof t!="number"||!Number.isFinite(t)?e:Math.max(0,Math.round(t)),FH=(t,e)=>typeof t=="number"&&Number.isFinite(t)?t:e,Fb=(t,e)=>({color:t?.color??e.color,width:BH(t?.width,e.width),alpha:FH(t?.alpha,e.alpha)}),Sa=t=>String(t??"").replace(/\r\n/g,`
|
|
1294
|
+
`,pb=t=>Number.isFinite(t)?t:0,wV=(t,e)=>t?t instanceof Map?t.get(e)??[]:t.filter(r=>r?.targetId===e):[],Qe=(t,e)=>wV(t,e).some(r=>r?.type==="update"&&r.tween?.uProgress!==void 0),EV=t=>t.type==="f32"?t.value:new Float32Array(t.value),AV=(t,e,r,i,{includeNextTextureTransform:s=!1}={})=>{let o={uProgress:{value:pb(i),type:"f32"},uResolution:{value:new Float32Array([Math.max(1,e),Math.max(1,r)]),type:"vec2<f32>"}};s&&(o.uNextTextureMatrix={value:new V,type:"mat3x3<f32>"},o.uNextTextureClamp={value:new Float32Array([0,0,1,1]),type:"vec4<f32>"});for(let n of t.uniforms??[])o[n.symbol]={value:EV(n),type:n.type};return new Ce(o)},PV=t=>t?.textureWrap==="repeat"?"repeat":"clamp-to-edge",CV=t=>t?.mipmap===!0?"linear":"nearest",RV=(t,e)=>!t||!t.resource||t.uploadMethodId==="video"?t:Re.from({...t.options??{},resource:t.resource,width:t.width,height:t.height,resolution:t.resolution,format:t.format,dimensions:t.dimension,mipLevelCount:t.mipLevelCount,autoGenerateMipmaps:e?.mipmap===!0,sampleCount:t.sampleCount,antialias:t.antialias,alphaMode:t.alphaMode,addressMode:PV(e),mipmapFilter:CV(e)}),MV=t=>{let e={},r=[];for(let i of t.textures??[]){let s=B.from(i.src).source,o=RV(s,t.pipeline);e[i.symbol]=o,o!==s&&r.push(o)}return{resources:e,ownedTextureSources:r}},IV=(t=[1,1])=>{let e=Math.max(1,t[0]??1),r=Math.max(1,t[1]??1);if(e===1&&r===1)return null;let i=[],s=[];for(let n=0;n<=r;n++)for(let a=0;a<=e;a++)i.push(a/e,n/r);let o=e+1;for(let n=0;n<r;n++)for(let a=0;a<e;a++){let l=n*o+a,c=l+1,u=l+o,h=u+1;s.push(l,c,u,c,h,u)}return new rr({attributes:{aPosition:{buffer:new Float32Array(i),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array(s)})},BV=({filterManager:t,filter:e,geometry:r,input:i,output:s,clear:o})=>{let n=t.renderer,a=t._filterStack[t._filterStackIndex],l=a.bounds,c=ve.shared,h=a.previousRenderSurface===s,d=n.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=t._filterStackIndex-1;for(;f>0&&t._filterStack[f].skip;)f--;f>0&&(d=t._filterStack[f].inputTexture.source._resolution);let p=t._filterGlobalUniforms,m=p.uniforms,x=m.uOutputFrame,v=m.uInputSize,y=m.uInputPixel,g=m.uInputClamp,b=m.uGlobalFrame,_=m.uOutputTexture;if(h){let P=t._filterStackIndex;for(;P>0;){P--;let C=t._filterStack[P];if(!C.skip){c.x=C.bounds.minX,c.y=C.bounds.minY;break}}x[0]=l.minX-c.x,x[1]=l.minY-c.y}else x[0]=0,x[1]=0;x[2]=i.frame.width,x[3]=i.frame.height,v[0]=i.source.width,v[1]=i.source.height,v[2]=1/v[0],v[3]=1/v[1],y[0]=i.source.pixelWidth,y[1]=i.source.pixelHeight,y[2]=1/y[0],y[3]=1/y[1],g[0]=.5*y[2],g[1]=.5*y[3],g[2]=i.frame.width*v[2]-.5*y[2],g[3]=i.frame.height*v[3]-.5*y[3];let S=n.renderTarget.rootRenderTarget.colorTexture;b[0]=c.x*d,b[1]=c.y*d,b[2]=S.source.width*d,b[3]=S.source.height*d;let E=n.renderTarget.getRenderTarget(s);if(n.renderTarget.bind(s,!!o),s instanceof B?(_[0]=s.frame.width,_[1]=s.frame.height):(_[0]=E.width,_[1]=E.height),_[2]=E.isRoot?-1:1,p.update(),n.renderPipes.uniformBatch){let P=n.renderPipes.uniformBatch.getUboResource(p);t._globalFilterBindGroup.setResource(P,0)}else t._globalFilterBindGroup.setResource(p,0);t._globalFilterBindGroup.setResource(i.source,1),t._globalFilterBindGroup.setResource(i.source.style,2),e.groups[0]=t._globalFilterBindGroup,n.encoder.draw({geometry:r,shader:e,state:e._state,topology:"triangle-list"}),n.type===Xe.WEBGL&&n.renderTarget.finishRenderPass()},rp=(t,e)=>{let r=t?.resources?.shaderUniforms;r?.uniforms&&(r.uniforms.uProgress=pb(e),r.update())},mb=(t,e,r)=>{let i=t?.resources?.shaderUniforms;i?.uniforms&&(i.uniforms.uResolution=new Float32Array([Math.max(1,e),Math.max(1,r)]),i.update())},gb=({shader:t,width:e,height:r,progress:i=0,nextTextureSource:s,name:o="route-graphics-shader-filter"})=>{let n=AV(t,e,r,i,{includeNextTextureTransform:!!s}),a=MV(t),l={shaderUniforms:n,...s?{uNextTexture:s}:{},...a.resources},c=Br.from({gpu:{vertex:{source:t.source.webgpu.source,entryPoint:"mainVertex"},fragment:{source:t.source.webgpu.source,entryPoint:"mainFragment"}},gl:{vertex:t.source.webgl.vertex??SV,fragment:t.source.webgl.fragment,name:o},resources:l,blendMode:t.pipeline?.blend??"normal"}),u=IV(t.mesh?.grid);if(u&&(c.apply=(h,d,f,p)=>{BV({filterManager:h,filter:c,geometry:u,input:d,output:f,clear:p})}),u||a.ownedTextureSources.length>0){let h=c.destroy.bind(c);c.destroy=(...d)=>{h(...d),u?.destroy();for(let f of a.ownedTextureSources)f.destroy()}}return c},xb=t=>t?.[fb]??null,FV=(t,e)=>{Object.defineProperty(t,fb,{value:e,enumerable:!1,configurable:!0,writable:!0})},kV=t=>{if(!t||typeof t.destroy!="function"||t[_B])return;let e=t.destroy;Object.defineProperty(t,_B,{value:!0,enumerable:!1,configurable:!0}),t.destroy=function(...i){return db(this),e.apply(this,i)}},UV=(t,e)=>{let r=xb(t);for(let i of r?.filters??[])rp(i,e)},OV=t=>{if(!t)return;t[Po]===void 0&&Object.defineProperty(t,Po,{value:0,enumerable:!1,configurable:!0,writable:!0});let e=Object.getOwnPropertyDescriptor(t,"uProgress");e?.get||e?.set||Object.defineProperty(t,"uProgress",{get(){return this[Po]??0},set(r){this[Po]=pb(r),UV(this,this[Po])},enumerable:!1,configurable:!0})},Dr=t=>{!t||t[Po]===void 0||(t.uProgress=0)},LV=t=>t?.filters?.some(e=>e?.type==="shader")??!1,bB=(t,e)=>{if(!t||!e)return null;if(t.label===e)return t;for(let r of t.children??[]){let i=bB(r,e);if(i)return i}return null},vB=({parent:t,element:e,animations:r})=>{if(!e)return!1;if(LV(e)&&!Qe(r,e.id)){let i=bB(t,e.id);if(i?.[Po]!==void 0&&i.uProgress!==0)return!0}return yb({parent:t,elements:e.children,animations:r})},yb=({parent:t,elements:e=[],animations:r})=>(e??[]).some(i=>vB({parent:t,element:i,animations:r})),Nr=({parent:t,nextElement:e,animations:r})=>vB({parent:t,element:e,animations:r}),db=t=>{xb(t)&&(Ao(t,"shader",null),delete t[fb])},Oe=(t,e,{width:r,height:i,force:s=!1}={})=>{if(!t)return;if(!e?.length&&!s){db(t);return}if(OV(t),kV(t),!e?.length){db(t);return}let o=Math.max(1,Math.round(r??t.width??1)),n=Math.max(1,Math.round(i??t.height??1)),a=yB(e),l=xb(t);if(l?.signature===a){for(let u of l.filters)mb(u,o,n),rp(u,t.uProgress);Ao(t,"shader",l.filters);return}let c=e.map(u=>gb({shader:u,width:o,height:n,progress:t.uProgress,name:`route-graphics-shader-filter-${u.id}`}));FV(t,{signature:a,filters:c}),Ao(t,"shader",c)},st=(t,{force:e=!1}={})=>!t?.filters?.length&&!e?{}:{uProgress:0};var _b=t=>({...Eo(t)?nB(t):tb(t),alpha:t.alpha}),bb=(t,e)=>{if(Eo(t))return aB(t,e);let r=new vr({label:t.id});return r.zIndex=e,r.text=t.content,wi(r,t.textStyle),Kf(r,t),r.alpha=t.alpha,Zf(r,t),Oe(r,t.filters,{width:t.width,height:t.height}),r},ip=(t,e,r)=>{if(Eo(e)){xu(t,e,r);return}jI(t,e.textStyle,r)},TB=({app:t,parent:e,element:r,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=bb(r,l),u=Qe(i,r.id);Oe(c,r.filters,{width:r.width,height:r.height,force:u}),gu({app:t,displayObject:c,textComputedNode:r,eventHandler:s,applyStyle:h=>ip(c,r,h)}),e.addChild(c),oe({animations:i,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{..._b(r),...st(r,{force:u})},renderContext:a})};var GV=(t,e)=>oB(t)!==Eo(e),DV=({app:t,parent:e,displayObject:r,textComputedNode:i,eventHandler:s,zIndex:o})=>{ya(r);let n=bb(i,o);return gu({app:t,displayObject:n,textComputedNode:i,eventHandler:s,applyStyle:a=>ip(n,i,a)}),e.addChild(n),r.destroy({children:!0}),n},NV=(t,e)=>{t.text=e.content,wi(t,e.textStyle),Kf(t,e),Zf(t,e),t.alpha=e.alpha},VV=({displayObject:t,textComputedNode:e,app:r,eventHandler:i})=>{Eo(e)?xu(t,e):NV(t,e),ya(t),gu({app:r,displayObject:t,textComputedNode:e,eventHandler:i,applyStyle:s=>ip(t,e,s)})},SB=({app:t,parent:e,prevElement:r,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let c=e.children.find(f=>f.label===r.id);if(!c)return;c.zIndex=l;let u=Qe(o,r.id);u?Oe(c,r.filters,{width:r.width,height:r.height,force:!0}):Dr(c);let h=()=>{if(!ye(r,i)){if(GV(c,i)){c=DV({app:t,parent:e,displayObject:c,textComputedNode:i,eventHandler:s,zIndex:l}),Oe(c,i.filters,{width:i.width,height:i.height,force:u});return}VV({displayObject:c,textComputedNode:i,app:t,eventHandler:s}),Oe(c,i.filters,{width:i.width,height:i.height,force:u})}};oe({animations:o,targetId:r.id,animationBus:n,completionTracker:a,element:c,targetState:{..._b(i),...st(i,{force:u})},onComplete:()=>{h()}})||h()};var wB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.getChildByLabel(e.id);if(!o)return;oe({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(ya(o),o.destroy({children:!0}))}})||(ya(o),o.destroy({children:!0}))};var EB=({positionX:t=0,positionY:e=0,width:r,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof r!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:r*s,y:i*o},a=t-n.x,l=e-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var HV=new Set([Tr.RECT,Tr.TEXT,Tr.CONTAINER,Tr.SPRITE,Tr.SPRITESHEET_ANIMATION,Tr.VIDEO]),Et=t=>{if(typeof t.width!="number"||typeof t.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(Tr).includes(t.type))throw new Error("Input Error: Type must be one of "+Object.values(Tr).join(", "));if(!t.id)throw new Error("Input Error: Id is missing");let e=t.scaleX?t.scaleX*t.width:t.width,r=t.scaleY?t.scaleY*t.height:t.height;t.type===Tr.CONTAINER&&(e=t.width,r=t.height);let{x:i,y:s,originX:o,originY:n}=EB({positionX:t.x,positionY:t.y,width:e,height:r,anchorX:t.anchorX,anchorY:t.anchorY}),a=typeof t.originX=="number"?t.originX:o,l=typeof t.originY=="number"?t.originY:n,c={id:t.id,type:t.type,width:Math.round(e),height:Math.round(r),x:Math.round(i),y:Math.round(s),originX:Math.round(a),originY:Math.round(l),alpha:t.alpha??1};if(t.hover&&(c.hover=t.hover),t.click&&(c.click=t.click),t.filters!==void 0){if(!HV.has(t.type))throw new Error(`Input Error: filters are not supported on ${t.type} elements`);c.filters=gB(t.filters)}return c};var WV=t=>typeof t!="number"||!Number.isFinite(t)?0:Math.max(0,Math.floor(t)),$V="top",zV=2,PB=["top","bottom"],XV=new Set(PB),YV=16,jV=0,CB=["image","spritesheet"],qV=new Set(CB),KV=(t,e)=>{if(t===void 0)return $V;if(XV.has(t))return t;throw new Error(`Input Error: ${e}.placement must be one of ${PB.join(", ")}.`)},ZV=(t,e)=>{if(t===void 0)return 0;if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t;throw new Error(`Input Error: ${e}.gap must be a finite number >= 0.`)},QV=(t={})=>t.kind??(t.atlas!==void 0||t.clips!==void 0||t.playback!==void 0?"spritesheet":"image"),AB=(t={},e)=>{let r=QV(t);if(!qV.has(r))throw new Error(`Input Error: ${e}.kind must be one of ${CB.join(", ")}.`);let i={kind:r,src:t.src??"",width:t.width??12,height:t.height??12};if(t.offsetX!==void 0&&(i.offsetX=t.offsetX),t.offsetY!==void 0&&(i.offsetY=t.offsetY),r==="image")return i;let s=t.atlas,o=Qr(s),n=Jr(t.clips,s?.animations,s?.meta,Object.keys(o.frames??{})),a=Lr({atlas:o,clips:n,playback:t.playback});return{...i,atlas:o,clips:n,playback:a}},JV=({placement:t,gap:e,x:r,y:i,partWidth:s,partHeight:o,furiganaWidth:n,furiganaHeight:a})=>{let l=Math.round(r+(s-n)/2);return t==="bottom"?{x:l,y:i+o+e}:{x:l,y:i-a+zV-e}},eH=t=>t===`
|
|
1295
|
+
`||t==="\r",tH=t=>typeof t=="string"&&Ye.isBreakingSpace(t),rH=(t,e,r)=>{let i=0,s=0;for(;i<t.length&&s<e.length&&t[i]===e[s];)i+=1,s+=1;if(s<e.length){let a=Math.min(t.length,e.length);return{remainingText:t.slice(a),consumedExplicitNewline:!1}}let o=i,n=o;for(;n<t.length&&tH(t[n]);)n+=1;if(eH(t[n])){let a=n+1;return t[n]==="\r"&&t[n+1]===`
|
|
1296
|
+
`&&(a+=1),{remainingText:t.slice(a),consumedExplicitNewline:!0}}return r?{remainingText:t.slice(n),consumedExplicitNewline:!1}:{remainingText:t.slice(o),consumedExplicitNewline:!1}},vb=(t,e,{minimumWidth:r=e}={})=>{let i=[],s=[],o=0,n=0,a=0,l=0,c=0,u=[...t],h=new WeakSet,d=Math.max(10,t.reduce((m,x)=>m+(x?.text?.length??0),0)*4),f=()=>{i.push({lineParts:[...s],y:n,lineMaxHeight:a}),o=0,n+=a,a=0,s=[]};for(;u.length>0;){if(c+=1,c>d)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let m=u[0];if(!m.text||m.text.length===0){u.shift();continue}let x=m.text,v=Math.max(1,Math.round(e-o)),y=m.textStyle.wordWrap?{...m.textStyle,wordWrapWidth:v}:m.textStyle,g=Ye.measureText(m.text,new Ge(Ut(y,{includeShadow:!1})));if(g.lineWidths[0]>v&&s.length>0){f();continue}let b=g.lines[0]??"",_=g.lines.length>1,S="",E=!1;if(g.lines.length===1&&m.text.endsWith(" ")&&!b.endsWith(" ")&&(b+=" "),b.length>0){let R=rH(x,b,_);S=R.remainingText,E=R.consumedExplicitNewline}if(b.length===0&&x.length>0){let R=x.match(/^\s+/)?.[0]??"";b=R.length>0?R:x[0],S=x.slice(b.length)}if(S===x){let R=x.match(/^\s+/)?.[0]??x[0]??"";if(R.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");b=R,S=x.slice(R.length)}let P=Ye.measureText(b,new Ge({...Ut(m.textStyle,{includeShadow:!1}),wordWrap:!1,breakWords:!1})),C=Math.max(0,Math.round(P.width??g.lineWidths[0]??0)),M={text:b,textStyle:y,height:P.height,x:o,y:n};if(m.furigana&&!h.has(m)){h.add(m);let R=Ye.measureText(m.furigana.text,new Ge(Ut(m.furigana.textStyle,{includeShadow:!1}))),F=JV({placement:m.furigana.placement,gap:m.furigana.gap,x:o,y:n,partWidth:C,partHeight:P.height,furiganaWidth:R.width,furiganaHeight:R.height}),U={text:m.furigana.text,textStyle:m.furigana.textStyle,x:F.x,y:F.y};M.furigana=U}s.push(M),a=Math.max(a,P.height),o+=C,l=Math.max(l,o),S&&S.length>0?m.text=S:u.shift(),(_||E)&&o>0&&f()}s.length>0&&i.push({lineParts:s,y:n,lineMaxHeight:a});for(let m=0;m<i.length;m++){let x=i[m].lineMaxHeight;i[m].lineParts=i[m].lineParts.map(v=>{let y=v.height;v.height&&delete v.height;let g=v.y+(x-y),b=v.furigana;return b&&(b.y=b.y-v.y+g),{...v,...b&&{furigana:b},y:g}})}let p=i.length>0?i[i.length-1].y+i[i.length-1].lineMaxHeight:0;return{chunks:i,width:Math.max(l,r),height:p}},Tb=({content:t,defaultTextStyle:e,width:r})=>(t||[]).map((i,s)=>{let o=Ei(e,i.textStyle);o.lineHeight=Math.round(o.lineHeight*o.fontSize),typeof r=="number"&&(o.wordWrapWidth=r,o.wordWrap=!0);let n=null;if(i.furigana){let l=Ei(e,i.furigana.textStyle);l.lineHeight=Math.round(l.lineHeight*l.fontSize),typeof r=="number"&&(l.wordWrapWidth=r,l.wordWrap=!0),n={text:String(i.furigana.text),textStyle:l,placement:KV(i.furigana.placement,`content[${s}].furigana`),gap:ZV(i.furigana.gap,`content[${s}].furigana`)}}return{text:String(i.text).replace(/ +$/,l=>"\xA0".repeat(l.length)),textStyle:o,...n&&{furigana:n}}}),RB=({state:t})=>{let e=Ei({...He,wordWrap:!0},t.textStyle),r=Tb({content:t.content,defaultTextStyle:e,width:t.width||void 0}),i=t.width||500,{chunks:s,width:o,height:n}=vb(r,i),a=t.width||o,c=Et({...t,width:a,height:n});if(c.alpha=t.alpha??1,t.indicator){let u=t.indicator;if(u.offset!==void 0)throw new Error("Input Error: indicator.offset is no longer supported. Use offsetX and offsetY.");c.indicator={revealing:AB(u.revealing,"indicator.revealing"),complete:AB(u.complete,"indicator.complete"),offsetX:u.offsetX??YV,offsetY:u.offsetY??jV}}return{...c,content:s,textStyle:{...e},speed:t.speed??50,revealEffect:t.revealEffect??"typewriter",...t.softWipe!==void 0&&{softWipe:bo(t.softWipe)},...t.initialRevealedCharacters!==void 0&&{initialRevealedCharacters:WV(t.initialRevealedCharacters)},...t.width!==void 0&&{width:t.width},...t.complete&&{complete:t.complete}}};var iH=1e5,sH=(t,e)=>typeof t.width=="number"?t.width:e.wordWrap&&typeof e.wordWrapWidth=="number"&&Number.isFinite(e.wordWrapWidth)&&e.wordWrapWidth>0?e.wordWrapWidth:iH,MB=({state:t})=>{let e=Array.isArray(t.content),r=Ei(He,t.textStyle),i={...r};if(i.lineHeight=Math.round(i.fontSize*i.lineHeight),typeof t.width=="number"&&(i.wordWrapWidth=t.width,i.wordWrap=!0),e){let d=sH(t,r),f=Tb({content:t.content,defaultTextStyle:r,width:typeof t.width=="number"?t.width:void 0}),{chunks:p,width:m,height:x}=vb(f,d,{minimumWidth:0}),v=Math.round(m),y=Math.round(x),g=typeof t.width=="number"?Math.round(t.width):v,_={...Et({...t,width:g,height:y}),content:p,measuredWidth:v,textStyle:{...i},...t.hover&&{hover:t.hover},...t.click&&{click:t.click},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}};return Object.defineProperties(_,{__anchorXRatio:{value:t.anchorX??0,enumerable:!1},__anchorYRatio:{value:t.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof t.width=="number",enumerable:!1}}),_}let s=String(t.content??""),{width:o,height:n}=Ye.measureText(s,new Ge(Ut(i,{includeShadow:!1}))),a=Math.round(o),l=Math.round(n),c=typeof t.width=="number"?Math.round(t.width):a,h={...Et({...t,width:c,height:l}),content:s,measuredWidth:a,textStyle:{...i},...t.hover&&{hover:t.hover},...t.click&&{click:t.click},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}};return Object.defineProperties(h,{__anchorXRatio:{value:t.anchorX??0,enumerable:!1},__anchorYRatio:{value:t.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof t.width=="number",enumerable:!1}}),h};var oH=dt({type:"text",add:TB,update:SB,delete:wB,parse:MB,shouldUpdateUnchanged:Nr});var IB={color:0,alpha:0},nH={x:0,y:0},aH={x:0,y:1},lH={x:.5,y:.5},BB=t=>t==null||t===""||t==="transparent",FB=t=>[...t].sort((e,r)=>e.offset-r.offset),cH=(t,e)=>{if(!t||!e)return t;let r=e.originX??0,i=e.originY??0,s=Vf(e),o=_o(e.rotation??0),n=Math.cos(o),a=Math.sin(o),l=t.x-s.x,c=t.y-s.y;return{x:r+l*n+c*a,y:i-l*a+c*n}},sp=(t,e,r,i)=>e.coordinateSpace==="global"?cH(t??i,r):t,Ms=t=>{t._rtglFillResource?.destroy(),delete t._rtglFillResource},uH=(t,e)=>BB(t)?IB:typeof t=="string"?t:t.type==="solid"?BB(t.color)?IB:t.color:t.type==="linear-gradient"?new wt({type:"linear",start:sp(t.start,t,e,nH),end:sp(t.end,t,e,aH),colorStops:FB(t.stops),textureSpace:t.coordinateSpace,textureSize:t.textureSize,wrapMode:t.wrapMode}):t.type==="radial-gradient"?new wt({type:"radial",center:sp(t.innerCenter,t,e,lH),innerRadius:t.innerRadius,outerCenter:sp(t.outerCenter,t,e),outerRadius:t.outerRadius,colorStops:FB(t.stops),textureSpace:t.coordinateSpace,textureSize:t.textureSize,wrapMode:t.wrapMode,scale:t.scale,rotation:t.rotation}):t,_a=(t,e,r)=>{Ms(t);let i=uH(e,r);return i instanceof wt&&(t._rtglFillResource=i),i};var kB=({app:t,parent:e,element:r,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:c,width:u,height:h,fill:d,border:f,alpha:p,scaleX:m,scaleY:x}=r,v=Qe(i,c),y=new Ze;y.label=c,y.zIndex=n,y.on("destroyed",()=>{Ms(y)});let g=Or(r,{alpha:p});m!==void 0&&(g.scaleX=m),x!==void 0&&(g.scaleY=x),(()=>{y.clear(),y.rect(0,0,Math.round(u),Math.round(h)).fill(_a(y,d,r)),y.alpha=p,y.scale.x=1,y.scale.y=1,Ur(y,r),f&&y.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)}),Oe(y,r.filters,{width:u,height:h,force:v})})();let _=r?.hover,S=r?.click,E=r?.rightClick,P=r?.scrollUp,C=r?.scrollDown,M=r?.drag;if(_){let{cursor:R,soundSrc:F,payload:U}=_;y.eventMode="static";let W=()=>{U&&o&&o("hover",{_event:{id:y.label},...U}),R&&(y.cursor=R),F&&t.audioStage.add({id:`hover-${Date.now()}`,url:F,loop:!1})},N=()=>{y.cursor="auto"};y.on("pointerover",W),y.on("pointerout",N)}if(S){let{soundSrc:R,soundVolume:F,payload:U}=S;y.eventMode="static";let W=N=>{Ot(N)&&(U&&o&&o("click",{_event:{id:y.label},...U}),R&&t.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:je(F)}))};y.on("pointerup",W)}if(E){let{soundSrc:R,payload:F}=E;y.eventMode="static";let U=()=>{F&&o&&o("rightClick",{_event:{id:y.label},...F}),R&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})};y.on("rightclick",U)}if((P||C)&&Gr({canvas:t.canvas,displayObject:y,width:u,height:h,scrollUpEvent:P,scrollDownEvent:C,eventHandler:o}),M){let{start:R,end:F,move:U}=M;y.eventMode="static";let W=()=>{y._isDragging=!0,R&&o&&o("dragStart",{_event:{id:y.label},...typeof R?.payload=="object"?R.payload:{}})},N=()=>{y._isDragging=!1,F&&o&&o("dragEnd",{_event:{id:y.label},...typeof F?.payload=="object"?F.payload:{}})},G=X=>{U&&o&&y._isDragging&&o("dragMove",{_event:{id:y.label,x:X.global.x,y:X.global.y},...typeof U?.payload=="object"?U.payload:{}})};y.on("pointerdown",W),y.on("pointerup",N),y.on("globalpointermove",G),y.on("pointerupoutside",N)}e.addChild(y),oe({animations:i,targetId:c,animationBus:s,completionTracker:a,element:y,targetState:{...g,...st(r,{force:v})},renderContext:l})};var UB=({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=e.children.find(_=>_.label===r.id);if(!c)return;c.zIndex=a;let{width:u,height:h,fill:d,border:f,alpha:p,scaleX:m,scaleY:x}=i,v=Qe(s,r.id);v?Oe(c,r.filters,{width:r.width,height:r.height,force:!0}):Dr(c);let y=Or(i,{alpha:p});m!==void 0&&(y.scaleX=m),x!==void 0&&(y.scaleY=x);let g=()=>{if(!ye(r,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(u),Math.round(h)).fill(_a(c,d,i)),c.alpha=p,c.scale.x=1,c.scale.y=1,Ur(c,i),f&&c.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)}),Oe(c,i.filters,{width:u,height:h,force:v}),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 _=i?.hover,S=i?.click,E=i?.rightClick,P=i?.scrollUp,C=i?.scrollDown,M=i?.drag;if(_){let{cursor:R,soundSrc:F,payload:U}=_;c.eventMode="static";let W=()=>{U&&n&&n("hover",{_event:{id:c.label},...U}),R&&(c.cursor=R),F&&t.audioStage.add({id:`hover-${Date.now()}`,url:F,loop:!1})},N=()=>{c.cursor="auto"};c.on("pointerover",W),c.on("pointerout",N)}if(S){let{soundSrc:R,soundVolume:F,payload:U}=S;c.eventMode="static";let W=N=>{Ot(N)&&(U&&n&&n("click",{_event:{id:c.label},...U}),R&&t.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:je(F)}))};c.on("pointerup",W)}if(E){let{soundSrc:R,payload:F}=E;c.eventMode="static";let U=()=>{F&&n&&n("rightClick",{_event:{id:c.label},...F}),R&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})};c.on("rightclick",U)}if((P||C)&&Gr({canvas:t.canvas,displayObject:c,width:u,height:h,scrollUpEvent:P,scrollDownEvent:C,eventHandler:n}),M){let{start:R,end:F,move:U}=M;c.eventMode="static";let W=()=>{c._isDragging=!0,R&&n&&n("dragStart",{_event:{id:c.label},...typeof R?.payload=="object"?R.payload:{}})},N=()=>{c._isDragging=!1,F&&n&&n("dragEnd",{_event:{id:c.label},...typeof F?.payload=="object"?F.payload:{}})},G=X=>{U&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:X.global.x,y:X.global.y},...typeof U?.payload=="object"?U.payload:{}})};c.on("pointerdown",W),c.on("pointerup",N),c.on("globalpointermove",G),c.on("pointerupoutside",N)}}};oe({animations:s,targetId:r.id,animationBus:o,completionTracker:l,element:c,targetState:{...y,...st(i,{force:v})},onComplete:()=>{g()}})||g()};var OB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.getChildByLabel(e.id);if(!o)return;oe({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),Ms(o),o.destroy())}})||(o._cleanupScrollInteraction?.(),Ms(o),o.destroy())};var LB=({state:t})=>{let e=Et(t),r=t.border?.width,i=e;return typeof r=="number"&&r>0&&(i={...e,border:{alpha:t.border?.alpha??1,color:t.border?.color??"black",width:r}}),{...i,...t.fill!==void 0?{fill:t.fill}:{},...t.scaleX!==void 0?{scaleX:t.scaleX}:{},...t.scaleY!==void 0?{scaleY:t.scaleY}:{},rotation:t.rotation??0,...t.drag&&{drag:t.drag},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}}};var hH=dt({type:"rect",add:kB,update:UB,delete:OB,parse:LB,shouldUpdateUnchanged:Nr});var DB="_routeGraphicsBlur",np="_routeGraphicsBlurFilter",Sb="_routeGraphicsBlurOptions",dH=new Set([5,7,9,11,13,15]),op={quality:4,kernelSize:5,repeatEdgePixels:!1},NB=t=>typeof t=="number"&&Number.isFinite(t),GB=(t,e)=>{if(!NB(t)||t<0)throw new Error(`Input Error: ${e} must be a finite number >= 0`)},Is=(t,e="blur")=>{if(t===void 0)return;if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be an object`);if(t.x===void 0||t.y===void 0)throw new Error(`Input Error: ${e}.x and ${e}.y are required`);GB(t.x,`${e}.x`),GB(t.y,`${e}.y`);let r=t.quality??op.quality;if(!NB(r)||r<1)throw new Error(`Input Error: ${e}.quality must be a finite number >= 1`);let i=t.kernelSize??op.kernelSize;if(!dH.has(i))throw new Error(`Input Error: ${e}.kernelSize must be one of 5, 7, 9, 11, 13, 15`);let s=t.repeatEdgePixels??op.repeatEdgePixels;if(typeof s!="boolean")throw new Error(`Input Error: ${e}.repeatEdgePixels must be a boolean`);return{x:t.x,y:t.y,quality:r,kernelSize:i,repeatEdgePixels:s}},fH=(t,e)=>t?t instanceof Map?t.get(e)??[]:t.filter(r=>r?.targetId===e):[],zt=(t,e)=>fH(t,e).some(r=>r?.type==="update"&&(r.tween?.blurX||r.tween?.blurY)),pH=t=>({get x(){return t.strengthX},set x(e){t.strengthX=Math.max(0,e)},get y(){return t.strengthY},set y(e){t.strengthY=Math.max(0,e)}}),mH=(t,e)=>{let r=t[Sb];return t[np]&&r?.quality===e.quality&&r?.kernelSize===e.kernelSize&&r?.repeatEdgePixels===e.repeatEdgePixels},gH=t=>{Ao(t,"blur",null),delete t[DB],delete t[np],delete t[Sb]},gt=(t,e,{force:r=!1}={})=>{if(!e&&!r){gH(t);return}let i=e??{x:0,y:0,...op},s=mH(t,i)?t[np]:new sa({strengthX:i.x,strengthY:i.y,quality:i.quality,kernelSize:i.kernelSize});s.repeatEdgePixels=i.repeatEdgePixels,s.strengthX=i.x,s.strengthY=i.y,t[np]=s,t[Sb]={quality:i.quality,kernelSize:i.kernelSize,repeatEdgePixels:i.repeatEdgePixels},t[DB]=pH(s),Ao(t,"blur",s)},Xt=(t,{force:e=!1}={})=>!t?.blur&&!e?{}:{blurX:t?.blur?.x??0,blurY:t?.blur?.y??0};var VB=({app:t,parent:e,element:r,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:c,width:u,height:h,src:d,alpha:f}=r,p=d?B.from(d):B.EMPTY,m=new ke(p);m.label=c,m.zIndex=l,m.width=Math.round(u),m.height=Math.round(h),m.alpha=f,Ur(m,r);let x=zt(i,c);gt(m,r.blur,{force:x});let v=Qe(i,c);Oe(m,r.filters,{width:u,height:h,force:v});let y=r?.hover,g=r?.click,b=r?.rightClick,_=r?.scrollUp,S=r?.scrollDown,E=null,P=null,C=null,M=()=>{let R=E?.isHovering()??!1,F=P?.isPressed()??!1;if((C?.isPressed()??!1)&&b?.src){let W=B.from(b.src);m.texture=W}else if(F&&g?.src){let W=B.from(g.src);m.texture=W}else if(R&&y?.src){let W=B.from(y.src);m.texture=W}else m.texture=p};if(y){let{cursor:R,soundSrc:F,payload:U}=y;m.eventMode="static",E=Cs({displayObject:m,onHoverChange:M});let W=()=>{E.setDirectHover(!0),U&&s&&s("hover",{_event:{id:m.label},...U}),R&&(m.cursor=R),F&&t.audioStage.add({id:`hover-${Date.now()}`,url:F,loop:!1})},N=()=>{E.setDirectHover(!1),m.cursor="auto"};m.on("pointerover",W),m.on("pointerout",N)}if(g){let{soundSrc:R,soundVolume:F,payload:U}=g;m.eventMode="static",P=ma({displayObject:m,onPressChange:M});let W=X=>{Ot(X)&&P.setDirectPress(!0)},N=X=>{Ot(X)&&(P.setDirectPress(!1),U&&s&&s("click",{_event:{id:m.label},...U}),R&&t.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:je(F)}))},G=()=>{P.setDirectPress(!1)};m.on("pointerdown",W),m.on("pointerup",N),m.on("pointerupoutside",G)}if(b){let{soundSrc:R,payload:F}=b;m.eventMode="static",C=ga({displayObject:m,onPressChange:M});let U=()=>{C.setDirectPress(!0)},W=()=>{C.setDirectPress(!1)},N=()=>{C.setDirectPress(!1),F&&s&&s("rightClick",{_event:{id:m.label},...F}),R&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})},G=()=>{C.setDirectPress(!1)};m.on("rightdown",U),m.on("rightup",W),m.on("rightclick",N),m.on("rightupoutside",G)}(_||S)&&Gr({canvas:t.canvas,displayObject:m,scrollUpEvent:_,scrollDownEvent:S,eventHandler:s}),e.addChild(m),oe({animations:i,targetId:c,animationBus:o,completionTracker:n,element:m,targetState:{...Or(r),width:u,height:h,alpha:f,...Xt(r,{force:x}),...st(r,{force:v})},renderContext:a})};var HB=({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(P=>P.label===r.id);if(!c)return;c.zIndex=l;let{width:u,height:h,src:d,alpha:f}=i,p=zt(s,r.id);p&>(c,r.blur,{force:!0});let m=Qe(s,r.id);m?Oe(c,r.filters,{width:r.width,height:r.height,force:!0}):Dr(c);let x=!1,v=da(s,r.id),y=v.length>0,g=P=>v.some(C=>Object.prototype.hasOwnProperty.call(C.tween??{},P)),b=P=>{c._cleanupScrollInteraction?.(),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"),c.removeAllListeners("wheel"),pa(c),Jf(c),ep(c);let C=i?.hover,M=i?.click,R=i?.rightClick,F=i?.scrollUp,U=i?.scrollDown,W=null,N=null,G=null,X=()=>{let $=W?.isHovering()??!1,D=N?.isPressed()??!1;if((G?.isPressed()??!1)&&R?.src){let le=B.from(R.src);c.texture=le}else if(D&&M?.src){let le=B.from(M.src);c.texture=le}else if($&&C?.src){let le=B.from(C.src);c.texture=le}else c.texture=P};if(C){let{cursor:$,soundSrc:D,payload:z}=C;c.eventMode="static",W=Cs({displayObject:c,onHoverChange:X});let le=()=>{W.setDirectHover(!0),z&&a&&a("hover",{_event:{id:c.label},...z}),$&&(c.cursor=$),D&&t.audioStage.add({id:`hover-${Date.now()}`,url:D,loop:!1})},de=()=>{W.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",le),c.on("pointerout",de)}if(M){let{soundSrc:$,soundVolume:D,payload:z}=M;c.eventMode="static",N=ma({displayObject:c,onPressChange:X});let le=Se=>{Ot(Se)&&N.setDirectPress(!0)},de=Se=>{Ot(Se)&&(N.setDirectPress(!1),z&&a&&a("click",{_event:{id:c.label},...z}),$&&t.audioStage.add({id:`click-${Date.now()}`,url:$,loop:!1,volume:je(D)}))},be=()=>{N.setDirectPress(!1)};c.on("pointerdown",le),c.on("pointerup",de),c.on("pointerupoutside",be)}if(R){let{soundSrc:$,payload:D}=R;c.eventMode="static",G=ga({displayObject:c,onPressChange:X});let z=()=>{G.setDirectPress(!0)},le=()=>{G.setDirectPress(!1)},de=()=>{G.setDirectPress(!1),D&&a&&a("rightClick",{_event:{id:c.label},...D}),$&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:$,loop:!1})},be=()=>{G.setDirectPress(!1)};c.on("rightdown",z),c.on("rightup",le),c.on("rightclick",de),c.on("rightupoutside",be)}(F||U)&&Gr({canvas:t.canvas,displayObject:c,scrollUpEvent:F,scrollDownEvent:U,eventHandler:a})},_=({preserveWidth:P=!1,preserveHeight:C=!1}={})=>{let M=c.width,R=c.height,F=d?B.from(d):B.EMPTY;c.texture=F,c.width=Math.round(P?M:u),c.height=Math.round(C?R:h),b(F)},S=()=>{ye(r,i)||(x||_(),c.width=Math.round(u),c.height=Math.round(h),c.alpha=f,Ur(c,i),gt(c,i.blur,{force:p}),Oe(c,i.filters,{width:u,height:h,force:m}))};r.src!==i.src&&y&&(_({preserveWidth:g("width"),preserveHeight:g("height")}),x=!0),oe({animations:s,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{...Or(i),width:u,height:h,alpha:f,...Xt(i,{force:p}),...st(i,{force:m})},onComplete:()=>{S()}})||S()};var WB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.children.find(a=>a.label===e.id);if(!o)return;oe({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var $B=({state:t})=>({...Et(t),src:t.src??"",alpha:t.alpha??1,rotation:t.rotation??0,...t.blur!==void 0&&{blur:Is(t.blur)},...t.hover&&{hover:t.hover},...t.click&&{click:t.click},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}});var xH=dt({type:"sprite",add:VB,update:HB,delete:WB,parse:$B,shouldUpdateUnchanged:Nr});var yH=t=>!t||t.ended?!0:Number.isFinite(t.duration)&&t.duration>0&&t.currentTime>=t.duration,wb=({videoElement:t,video:e})=>{e&&t?._videoEndedListener&&e.removeEventListener("ended",t._videoEndedListener),t&&(t._videoEndedListener=void 0,t._playbackStateVersion=null)},ap=({videoElement:t,video:e,loop:r,completionTracker:i})=>{if(wb({videoElement:t,video:e}),(r??!1)||yH(e))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};e.addEventListener("ended",o),t._videoEndedListener=o,t._playbackStateVersion=s};var zB=({parent:t,element:e,animations:r,animationBus:i,renderContext:s,completionTracker:o,zIndex:n})=>{let{id:a,x:l,y:c,width:u,height:h,src:d,volume:f,loop:p,alpha:m}=e,x=B.from(d),v=x.source.resource;v.pause(),v.currentTime=0,v.loop=p??!1,v.volume=je(f),v.muted=!1;let y=new ke(x);y.label=a,y.zIndex=n,y._videoEndedListener=void 0,y._playbackStateVersion=null,y.x=Math.round(l),y.y=Math.round(c),y.width=Math.round(u),y.height=Math.round(h),y.alpha=m??1;let g=zt(r,a);gt(y,e.blur,{force:g});let b=Qe(r,a);Oe(y,e.filters,{width:u,height:h,force:b}),ap({videoElement:y,video:v,loop:p,completionTracker:o}),kI(s,v),t.addChild(y),oe({animations:r,targetId:a,animationBus:i,completionTracker:o,element:y,targetState:{x:l,y:c,width:u,height:h,alpha:m??1,...Xt(e,{force:g}),...st(e,{force:b})},renderContext:s})};var XB=({parent:t,prevElement:e,nextElement:r,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(P=>P.label===e.id);if(!l)return;l.zIndex=a;let{x:c,y:u,width:h,height:d,alpha:f}=r,p=zt(i,e.id);p&>(l,e.blur,{force:!0});let m=Qe(i,e.id);m?Oe(l,e.filters,{width:e.width,height:e.height,force:!0}):Dr(l);let x=e.src,v=!1,y=da(i,e.id),g=y.length>0,b=P=>y.some(C=>Object.prototype.hasOwnProperty.call(C.tween??{},P)),_=()=>{let P=l.texture.source.resource,C=x!==r.src;if(C){let M=P;wb({videoElement:l,video:M}),M&&M.pause();let R=B.from(r.src);l.texture=R,P=R.source.resource,P.muted=!1,P.pause(),P.currentTime=0,x=r.src}ap({videoElement:l,video:P,loop:r.loop,completionTracker:n}),P.volume=je(r.volume),P.loop=r.loop??!1,C&&P.play()},S=()=>{ye(e,r)||(l.x=Math.round(c),l.y=Math.round(u),l.width=Math.round(h),l.height=Math.round(d),l.alpha=f??1,gt(l,r.blur,{force:p}),Oe(l,r.filters,{width:h,height:d,force:m}),v||_())};if(e.src!==r.src&&g){let P=l.width,C=l.height;_(),l.width=Math.round(b("width")?P:h),l.height=Math.round(b("height")?C:d),v=!0}oe({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:u,width:h,height:d,alpha:f??1,...Xt(r,{force:p}),...st(r,{force:m})},onComplete:S})||S()};var YB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.children.find(l=>l.label===e.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()),t.removeChild(o),o.destroy()}};oe({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var jB=({state:t})=>({...Et(t),src:t.src,volume:t.volume??100,loop:t.loop??!1,...t.blur!==void 0&&{blur:Is(t.blur)}});var _H=dt({type:"video",add:zB,update:XB,delete:YB,parse:jB,shouldUpdateUnchanged:Nr});var qB=0,KB=16,ba=Symbol("routeGraphicsSliderRuntime"),bH=(t,e)=>t!==null&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,e),Pb=t=>Math.max(0,Math.min(1,t)),ZB=t=>t.initialValue??t.min,Eb=t=>{if(!(!t||typeof t!="object")){if(typeof t.pointerId=="number")return t.pointerId;if(typeof t.nativeEvent?.pointerId=="number")return t.nativeEvent.pointerId;if(typeof t.data?.pointerId=="number")return t.data.pointerId}},vH=t=>{if(!t||typeof t!="object")return null;if(typeof t.clientX=="number"&&typeof t.clientY=="number")return{x:t.clientX,y:t.clientY};let e=t.changedTouches?.[0]??t.touches?.[0];return e&&typeof e.clientX=="number"&&typeof e.clientY=="number"?{x:e.clientX,y:e.clientY}:null},QB=t=>typeof globalThis.addEventListener=="function"&&typeof globalThis.removeEventListener=="function"&&typeof globalThis.document?.addEventListener=="function"&&typeof globalThis.document?.removeEventListener=="function"&&typeof t?.renderer?.events?.mapPositionToPoint=="function",TH=({app:t,nativeEvent:e})=>{let r=vH(e);if(!r)return null;let i={x:0,y:0};return t.renderer.events.mapPositionToPoint(i,r.x,r.y),i},JB=t=>{t.removeNativeDragListeners?.(),t.removeNativeDragListeners=null},SH=({runtime:t,moveListener:e,upListener:r})=>{if(!QB(t.app)||t.removeNativeDragListeners)return;let i=[],s=(o,n,a)=>{o.addEventListener(n,a,!0),i.push([o,n,a])};typeof globalThis.PointerEvent=="function"?(s(globalThis.document,"pointermove",e),s(globalThis,"pointerup",r),s(globalThis,"pointercancel",r)):(s(globalThis.document,"mousemove",e),s(globalThis,"mouseup",r),"ontouchstart"in globalThis&&(s(globalThis.document,"touchmove",e),s(globalThis,"touchend",r),s(globalThis,"touchcancel",r))),t.removeNativeDragListeners=()=>{for(let[o,n,a]of i)o.removeEventListener(n,a,!0)}},Co=t=>t?B.from(t):B.EMPTY,va=t=>({bar:`${t}-bar`,inactiveBar:`${t}-inactive-bar`,barMask:`${t}-bar-mask`,thumb:`${t}-thumb`}),eF=({sliderContainer:t,fromId:e,toId:r})=>{if(e===r)return;let i=va(e),s=va(r);for(let[o,n]of Object.entries(i)){let a=t.getChildByLabel(n);a&&(a.label=s[o])}},Ta=({sliderContainer:t,id:e})=>{let r=va(e);return{bar:t.getChildByLabel(r.bar),inactiveBar:t.getChildByLabel(r.inactiveBar),barMask:t.getChildByLabel(r.barMask),thumb:t.getChildByLabel(r.thumb)}},Ab=({baseValue:t,override:e,key:r})=>bH(e,r)?e[r]??"":t??"",wH=(t,e=null)=>({thumbSrc:Ab({baseValue:t.thumbSrc,override:e,key:"thumbSrc"}),barSrc:Ab({baseValue:t.barSrc,override:e,key:"barSrc"}),inactiveBarSrc:Ab({baseValue:t.inactiveBarSrc,override:e,key:"inactiveBarSrc"})}),EH=t=>{let e=new ke(B.EMPTY);return e.label=t,e.eventMode="static",e.zIndex=0,e},AH=t=>{let e=new Ze;return e.label=t,e.zIndex=0,e},PH=({sliderContainer:t,id:e,bar:r})=>{let i=va(e),{inactiveBar:s,barMask:o}=Ta({sliderContainer:t,id:e});return s||(s=EH(i.inactiveBar),t.addChild(s)),o||(o=AH(i.barMask),t.addChild(o)),r.mask=o,{inactiveBar:s,barMask:o}},CH=({sliderContainer:t,id:e,bar:r})=>{let{inactiveBar:i,barMask:s}=Ta({sliderContainer:t,id:e});r?.mask===s&&(r.mask=null),i&&(t.removeChild(i),i.destroy()),s&&(t.removeChild(s),s.destroy())},tF=({currentValue:t,min:e,max:r})=>{let i=r-e;return i<=0?0:Pb((t-e)/i)},RH=({barMask:t,direction:e,width:r,height:i,currentValue:s,min:o,max:n})=>{if(!t)return;let a=tF({currentValue:s,min:o,max:n}),l=Math.round(e==="horizontal"?r*a:r),c=Math.round(e==="horizontal"?i:i*a);t.clear(),!(l<=0||c<=0)&&t.rect(0,0,l,c).fill({color:16777215,alpha:0})},MH=({thumb:t,direction:e,currentValue:r,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=tF({currentValue:r,min:i,max:s});if(e==="horizontal"){t.x=a*(o-t.width),t.y=(n-t.height)/2;return}t.x=(o-t.width)/2,t.y=a*(n-t.height)},cp=({thumb:t,thumbSrc:e,direction:r,trackWidth:i,trackHeight:s})=>{let o=r==="horizontal"?s-qB*2:i-qB*2,n=Co(e),a=n.width||KB,l=n.height||KB,c=o/a,u=o/l,h=Math.min(c,u);t.width=a*h,t.height=l*h},IH=({sliderContainer:t,sliderComputedNode:e,thumb:r,currentValue:i,hoverOverride:s=null})=>{let{id:o,width:n,height:a,direction:l,min:c,max:u}=e,{barSrc:h,inactiveBarSrc:d,thumbSrc:f}=wH(e,s),{bar:p}=Ta({sliderContainer:t,id:o});if(p){if(p.texture=Co(h),p.width=n,p.height=a,r.texture=Co(f),d){let{inactiveBar:m,barMask:x}=PH({sliderContainer:t,id:o,bar:p});m.texture=Co(d),m.width=n,m.height=a,RH({barMask:x,direction:l,width:n,height:a,currentValue:i,min:c,max:u})}else CH({sliderContainer:t,id:o,bar:p});MH({thumb:r,direction:l,currentValue:i,min:c,max:u,trackWidth:n,trackHeight:a})}},BH=({position:t,thumb:e,direction:r,min:i,max:s,step:o,trackWidth:n,trackHeight:a})=>{let l=s-i,c;if(r==="horizontal"){let h=t.x-e.width/2,d=Math.max(n-e.width,1);c=Pb(h/d)}else{let h=t.y-e.height/2,d=Math.max(a-e.height,1);c=Pb(h/d)}let u=i+c*l;return o>0&&(u=Math.round((u-i)/o)*o+i,u=Math.max(i,Math.min(s,u))),u},rF=({sliderContainer:t,sliderComputedNode:e,cursor:r})=>{let i=r??"auto",{bar:s,inactiveBar:o,thumb:n}=Ta({sliderContainer:t,id:e.id});t.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},_u=t=>{IH({sliderContainer:t.sliderContainer,sliderComputedNode:t.sliderComputedNode,thumb:t.thumb,currentValue:t.currentValue,hoverOverride:t.sliderComputedNode.hover&&t.hoverController?.isHovering()?t.sliderComputedNode.hover:null})},lp=t=>{let e=t.hoverController?.isHovering()===!0?t.sliderComputedNode.hover?.cursor:null;rF({sliderContainer:t.sliderContainer,sliderComputedNode:t.sliderComputedNode,cursor:e})},iF=({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s})=>{let o=e[ba];return o||(pa(e),o={app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s,currentValue:ZB(r),isDragging:!1,activePointerId:void 0,listenersBound:!1,hoverController:null,removeNativeDragListeners:null},o.hoverController=Cs({displayObject:e,onHoverChange:()=>{_u(o),lp(o)}}),e[ba]=o),o.app=t,o.sliderContainer=e,o.sliderComputedNode=r,o.thumb=i,o.eventHandler=s,o},up=({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s,adoptExternalValue:o=!0})=>{let n=iF({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s});return o&&(n.currentValue=ZB(r)),_u(n),lp(n),n},sF=({sliderContainer:t})=>{let e=t?.[ba];e&&(JB(e),e.hoverController?.destroy?.(),delete t[ba])},oF=({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s})=>{let o=iF({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s});if(o.listenersBound)return;o.listenersBound=!0;let n=p=>{let{sliderComputedNode:m}=o,x=o.sliderContainer.toLocal(p),v=BH({position:x,thumb:o.thumb,direction:m.direction,min:m.min,max:m.max,step:m.step,trackWidth:m.width,trackHeight:m.height});v!==o.currentValue&&(o.currentValue=v,_u(o),m.change?.payload&&o.eventHandler&&o.eventHandler("change",{_event:{id:m.id,value:o.currentValue},...m.change.payload}))},a=p=>{p?.global&&n(p.global)},l=p=>{let m=Eb(p);o.activePointerId!==void 0&&m!==void 0&&m!==o.activePointerId||o.isDragging&&(o.isDragging=!1,o.activePointerId=void 0,JB(o))},c=p=>{if(!o.isDragging)return;let m=Eb(p);if(o.activePointerId!==void 0&&m!==void 0&&m!==o.activePointerId)return;let x=TH({app:o.app,nativeEvent:p});x&&n(x)},u=p=>{o.isDragging=!0,o.activePointerId=Eb(p),SH({runtime:o,moveListener:c,upListener:l}),a(p)},h=p=>{o.isDragging&&a(p)};e.on("pointerdown",u),QB(t)||e.on("globalpointermove",h),e.on("pointerup",l),e.on("pointerupoutside",l);let d=()=>{o.hoverController?.setDirectHover(!0),_u(o),lp(o);let p=o.sliderComputedNode.hover;p&&(rF({sliderContainer:o.sliderContainer,sliderComputedNode:o.sliderComputedNode,cursor:p.cursor}),p.soundSrc&&o.app?.audioStage?.add({id:`hover-${Date.now()}`,url:p.soundSrc,loop:!1}))},f=()=>{o.isDragging||(o.hoverController?.setDirectHover(!1),_u(o),lp(o))};e.on("pointerover",d),e.on("pointerout",f),e.on("pointerupoutside",f)};var nF=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{let{id:c,x:u,y:h,width:d,height:f,alpha:p,thumbSrc:m,barSrc:x}=r,v=new ie;v.label=c,v.zIndex=l,v.x=u,v.y=h,v.alpha=p,v.sortableChildren=!0,v.eventMode="static";let y=va(c),g=new ke(Co(x));g.label=y.bar,g.eventMode="static",g.zIndex=1;let b=new ke(Co(m));b.label=y.thumb,b.eventMode="static",b.zIndex=2,cp({thumb:b,thumbSrc:m,direction:r.direction,trackWidth:d,trackHeight:f}),v.addChild(g),v.addChild(b),oF({app:t,sliderContainer:v,sliderComputedNode:r,thumb:b,eventHandler:n}),up({app:t,sliderContainer:v,sliderComputedNode:r,thumb:b,eventHandler:n}),e.addChild(v),oe({animations:i,targetId:c,animationBus:s,completionTracker:o,element:v,targetState:{x:u,y:h,alpha:p},renderContext:a})};var aF=({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(m=>m.label===r.id);if(!c)return;c.zIndex=l;let u=()=>{if(!ye(r,i)){c.x=i.x,c.y=i.y,c.alpha=i.alpha,c.label=i.id,c.pivot.set(i.originX,i.originY),eF({sliderContainer:c,fromId:r.id,toId:i.id});let{bar:m,thumb:x}=Ta({sliderContainer:c,id:i.id});if(m&&x&&cp({thumb:x,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),!m||!x)return;let v=c[ba]?.isDragging!==!0||r.initialValue!==i.initialValue;up({app:t,sliderContainer:c,sliderComputedNode:i,thumb:x,eventHandler:a,adoptExternalValue:v})}},{x:h,y:d,alpha:f}=i;oe({animations:s,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,alpha:f},onComplete:u})||u()};var lF=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o})=>{let n=e.getChildByLabel(r.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(sF({sliderContainer:n}),n.destroy({children:!0}))};oe({animations:i,targetId:r.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var FH=(t,e,r)=>Math.max(e,Math.min(r,t)),cF=({state:t})=>{let e=Et(t),r=t.min??0,i=t.max??100;if(i<=r)throw new Error("Input error: the max value of a slider must be larger than the min value");if(t.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof t.initialValue!="number"||Number.isNaN(t.initialValue))throw new Error("Input error: slider initialValue must be a valid number");let s=FH(t.initialValue,r,i);return{...e,direction:t.direction??"horizontal",thumbSrc:t.thumbSrc??"",barSrc:t.barSrc??"",...t.inactiveBarSrc!==void 0&&{inactiveBarSrc:t.inactiveBarSrc??""},alpha:t.alpha??1,min:r,max:i,step:t.step??1,initialValue:s,...t.hover&&{hover:t.hover},...t.change&&{change:t.change}}};var kH=dt({type:"slider",add:nF,update:aF,delete:lF,parse:cF});var wa=Symbol("routeGraphicsInputRuntime"),hp={top:10,right:12,bottom:10,left:12},Rb="#FFFFFF",Mb={color:"#2E2E2E",width:1,alpha:1},Ib={color:"#4A89FF",width:2,alpha:1},uF={fill:"#4A89FF",alpha:.3},Cb={fill:"#111111",width:2},UH=(t={})=>{let e=t.fontSize??He.fontSize,r=t.lineHeight??He.lineHeight;return typeof r!="number"?Math.round(e*He.lineHeight):r>8?Math.round(r):Math.round(e*r)},mp=(t={},e={})=>({...He,...t,align:t.align??"left",lineHeight:UH(t),wordWrap:!1,breakWords:!1,wordWrapWidth:e.wordWrapWidth??0,whiteSpace:"pre"}),Bb=t=>typeof t=="number"?{top:t,right:t,bottom:t,left:t}:Array.isArray(t)?{top:t[0]??0,right:t[1]??t[0]??0,bottom:t[2]??t[0]??0,left:t[3]??t[1]??t[0]??0}:{top:t?.top??hp.top,right:t?.right??hp.right,bottom:t?.bottom??hp.bottom,left:t?.left??hp.left},OH=(t,e)=>typeof t!="number"||!Number.isFinite(t)?e:Math.max(0,Math.round(t)),LH=(t,e)=>typeof t=="number"&&Number.isFinite(t)?t:e,Fb=(t,e)=>({color:t?.color??e.color,width:OH(t?.width,e.width),alpha:LH(t?.alpha,e.alpha)}),Sa=t=>String(t??"").replace(/\r\n/g,`
|
|
1297
1297
|
`).replace(/\r/g,`
|
|
1298
|
-
`),
|
|
1299
|
-
`),s=i.map((a,l)=>({text:a,width:fr(a,e),startIndex:l===0?0:i.slice(0,l).reduce((c,u)=>c+u.length+1,0)})),o=s.reduce((a,l)=>Math.max(a,l.width),0),n=e.lineHeight;return{lines:s,lineHeight:n,totalHeight:s.length*n,maxLineWidth:o,textValue:r}}
|
|
1300
|
-
`){s+=1,o=0;continue}o+=1}return{line:s,column:o}},kb=({contentWidth:t,lineWidth:e,align:r})=>kH(t,e,r),VH=t=>new vr({label:t,text:""}),HH=(t,e)=>{for(;t.textNodes.length<e;){let r=VH(`${t.element.id}-text-line-${t.textNodes.length}`);t.text.addChild(r),t.textNodes.push(r)}for(;t.textNodes.length>e;){let r=t.textNodes.pop();r?.removeFromParent(),r?.destroy()}},fp=({contentWidth:t,lineWidth:e,align:r,scrollOffsetX:i})=>e>t?-i:kb({contentWidth:t,lineWidth:e,align:r}),pF=({contentWidth:t,lineWidth:e,align:r})=>kb({contentWidth:t,lineWidth:e,align:r}),pp=({padding:t,contentWidth:e,lineWidth:r,align:i,scrollOffsetX:s})=>t.left+pF({contentWidth:e,lineWidth:r,align:i})-s,mF=t=>{let e=new Ze;e.label=`${t.id}-background`,e.on("destroyed",()=>{Ms(e)});let r=new Ze;r.label=`${t.id}-selection`;let i=new ie;i.label=`${t.id}-text`;let s=new vr({label:`${t.id}-placeholder`,text:t.placeholder}),o=new Ze;o.label=`${t.id}-caret`;let n=new Ze;return n.label=`${t.id}-clip`,i.mask=n,s.mask=n,r.mask=n,o.mask=n,{background:e,selection:r,text:i,placeholder:s,caret:o,clip:n}},gF=({app:t,container:e,display:r,element:i})=>({app:t,container:e,...r,value:Sa(i.value??""),selectionStart:Sa(i.value??"").length,selectionEnd:Sa(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:Sa(i.value??""),tickerListener:null,element:i}),gp=(t,e,r)=>{let i=OH({app:t,container:e,fallbackElement:r});if(!i)return null;let{fullBounds:s,visibleBounds:o}=i,n=LH(s,o);return{x:s.x,y:s.y,width:s.width,height:s.height,visible:!!o&&e.visible!==!1&&e.renderable!==!1,clipInsets:n}},ft=(t,e)=>{let r=Bb(e.padding),i=Math.max(0,e.width-r.left-r.right),s=Math.max(0,e.height-r.top-r.bottom),o=mp(e.textStyle,{wordWrapWidth:i}),n=mp({...e.textStyle,fill:"#7A7A7A"},{wordWrapWidth:i}),a=String(t.value??""),l=NH({element:e,displayedValue:a,textStyle:o}),c=o.align??"left",u=Bs(Math.min(t.selectionStart,t.selectionEnd),0,a.length),h=Bs(Math.max(t.selectionStart,t.selectionEnd),0,a.length),d=Bs(t.selectionEnd??a.length,0,a.length);if(t.layoutState={padding:r,contentWidth:i,contentHeight:s,textStyle:o,placeholderStyle:n,displayedValue:a,layout:l,align:c},HH(t,l.lines.length),t.textNodes.forEach((y,g)=>{let b=l.lines[g]??{text:"",width:0};wi(y,o),y.text=b.text}),wi(t.placeholder,n),t.placeholder.text=e.placeholder??"",e.multiline){let y=dp({value:a,index:d}),g=l.lines[y.line]??l.lines.at(-1),b=g?.width??0,_=fr((g?.text??"").slice(0,y.column),o),S=l.totalHeight,E=y.line*l.lineHeight,P=E+l.lineHeight;if(b<=i)t.scrollOffsetX=0;else if(t.focused){let M=Math.max(0,b-i);_-t.scrollOffsetX>i-8?t.scrollOffsetX=_-(i-8):_-t.scrollOffsetX<8&&(t.scrollOffsetX=_-8),t.scrollOffsetX=Bs(t.scrollOffsetX,0,M)}else t.scrollOffsetX=0;if(S<=s)t.scrollOffsetY=0;else if(t.focused){let C=Math.max(0,S-s);P-t.scrollOffsetY>s?t.scrollOffsetY=P-s:E-t.scrollOffsetY<0&&(t.scrollOffsetY=E),t.scrollOffsetY=Bs(t.scrollOffsetY,0,C)}else t.scrollOffsetY=0}else{let y=l.lines[0],g=fr(y.text.slice(0,d),o);if(y.width<=i)t.scrollOffsetX=0;else if(t.focused){let _=Math.max(0,y.width-i);g-t.scrollOffsetX>i-8?t.scrollOffsetX=g-(i-8):g-t.scrollOffsetX<8&&(t.scrollOffsetX=g-8),t.scrollOffsetX=Bs(t.scrollOffsetX,0,_)}else t.scrollOffsetX=0;t.scrollOffsetY=0}if(e.multiline)t.text.x=r.left-t.scrollOffsetX,t.text.y=r.top-t.scrollOffsetY,t.textNodes.forEach((y,g)=>{let b=l.lines[g]??{width:0};y.x=pF({contentWidth:i,lineWidth:b.width,align:c}),y.y=g*l.lineHeight});else{let y=l.lines[0],g=t.textNodes[0],b=fp({contentWidth:i,lineWidth:y.width,align:c,scrollOffsetX:t.scrollOffsetX});g.x=0,g.y=0,t.text.x=r.left+b,t.text.y=r.top+Math.max(0,(s-g.height)/2)}let f=Ye.measureText(t.placeholder.text,fF(n));t.placeholder.x=r.left,t.placeholder.y=e.multiline?r.top:r.top+Math.max(0,(s-t.placeholder.height)/2),f.width<=i&&(t.placeholder.x+=kb({contentWidth:i,lineWidth:f.width,align:c})),t.placeholder.visible=t.value.length===0&&t.composing!==!0;let p=()=>{t.background.rect(0,0,e.width,e.height)},m=e.fill!==void 0?e.fill:Rb,x=e.border??Mb,v=e.focusRing??Ib;if(t.background.clear(),p(),t.background.fill(_a(t.background,m,e)),x.width>0&&t.background.stroke({color:x.color,alpha:x.alpha,width:x.width}),t.focused&&v.width>0&&e.disabled!==!0&&(p(),t.background.stroke({color:v.color,alpha:v.alpha,width:v.width})),t.clip.clear(),t.clip.rect(r.left,r.top,i,Math.max(0,s)),t.clip.fill({color:16777215,alpha:1}),t.selection.clear(),t.focused&&u!==h&&e.disabled!==!0){if(e.multiline){let y=dp({value:a,index:u}),g=dp({value:a,index:h});for(let b=y.line;b<=g.line;b+=1){let _=l.lines[b];if(!_)continue;let S=b===y.line?y.column:0,E=b===g.line?g.column:_.text.length,P=pp({padding:r,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:t.scrollOffsetX})+fr(_.text.slice(0,S),o),C=pp({padding:r,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:t.scrollOffsetX})+fr(_.text.slice(0,E),o),M=r.top+b*l.lineHeight-t.scrollOffsetY;t.selection.rect(P,M,Math.max(C-P,1),l.lineHeight)}}else{let y=l.lines[0],g=fp({contentWidth:i,lineWidth:y.width,align:c,scrollOffsetX:t.scrollOffsetX}),b=r.left+g+fr(y.text.slice(0,u),o),_=r.left+g+fr(y.text.slice(0,h),o),S=r.top+Math.max(0,(s-t.text.height)/2);t.selection.rect(b,S,Math.max(_-b,1),Math.max(t.text.height,o.lineHeight))}t.selection.fill({color:uF.fill,alpha:uF.alpha})}if(t.caret.clear(),t.focused&&t.selectionStart===t.selectionEnd&&t.blinkVisible!==!1&&e.disabled!==!0){if(e.multiline){let y=dp({value:a,index:d}),g=l.lines[y.line]??l.lines.at(-1),b=pp({padding:r,contentWidth:i,lineWidth:g?.width??0,align:c,scrollOffsetX:t.scrollOffsetX})+fr((g?.text??"").slice(0,y.column),o),_=r.top+y.line*l.lineHeight-t.scrollOffsetY;t.caret.rect(b,_,Cb.width,l.lineHeight)}else{let y=l.lines[0],g=fp({contentWidth:i,lineWidth:y.width,align:c,scrollOffsetX:t.scrollOffsetX}),b=r.left+g+fr(y.text.slice(0,d),o),_=r.top+Math.max(0,(s-t.text.height)/2);t.caret.rect(b,_,Cb.width,Math.max(t.text.height,o.lineHeight))}t.caret.fill({color:Cb.fill,alpha:1})}},Ub=(t,e)=>{let r=t.layoutState;if(!r)return 0;let{padding:i,contentWidth:s,textStyle:o,displayedValue:n,layout:a,align:l}=r,c=e?.x??0,u=e?.y??0;if(!t.element.multiline){let m=a.lines[0]??{text:n,width:fr(n,o)},x=fp({contentWidth:s,lineWidth:m.width,align:l,scrollOffsetX:t.scrollOffsetX}),v=i.left+x;return hF({text:m.text,style:o,targetX:c-v})}let h=a.lineHeight||o.lineHeight||1,d=Bs(Math.floor((u-i.top+t.scrollOffsetY)/h),0,Math.max(a.lines.length-1,0)),f=a.lines[d]??{text:"",startIndex:0},p=hF({text:f.text,style:o,targetX:c-pp({padding:i,contentWidth:s,lineWidth:f.width??0,align:l,scrollOffsetX:t.scrollOffsetX})});return f.startIndex+p};var Fs=({eventHandler:t,eventName:e,element:r,eventConfig:i,snapshot:s})=>{!t||!i||t(e,{_event:{id:r.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload})},WH=({element:t,runtime:e,eventHandler:r})=>({onValueChange:i=>{e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.lastExternalValue=i.value,ft(e,t),Fs({eventHandler:r,eventName:"change",element:t,eventConfig:t.change,snapshot:i})},onFocus:i=>{let s=e.nativeFocused===!0;e.nativeFocused=!0,e.focused=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.selectionAnchor=i.selectionStart===i.selectionEnd?i.selectionEnd:e.selectionAnchor,e.blinkVisible=!0,e.blinkTick=0,ft(e,t),!s&&Fs({eventHandler:r,eventName:"focus",element:t,eventConfig:t.focusEvent,snapshot:i})},onBlur:i=>{e.nativeFocused=!1,e.focused=!1,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.blinkVisible=!1,e.composing=!1,ft(e,t),Fs({eventHandler:r,eventName:"blur",element:t,eventConfig:t.blurEvent,snapshot:i})},onSelectionChange:i=>{e.nativeFocused=i.focused,e.focused=i.focused,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,i.selectionStart===i.selectionEnd&&(e.selectionAnchor=i.selectionEnd),ft(e,t),Fs({eventHandler:r,eventName:"selectionChange",element:t,eventConfig:t.selectionChange,snapshot:i})},...t.submit&&{onSubmit:i=>{Fs({eventHandler:r,eventName:"submit",element:t,eventConfig:t.submit,snapshot:i})}},onCompositionStart:i=>{e.composing=!0,ft(e,t),Fs({eventHandler:r,eventName:"compositionStart",element:t,eventConfig:t.compositionStart,snapshot:i})},onCompositionUpdate:i=>{e.composing=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,ft(e,t),Fs({eventHandler:r,eventName:"compositionUpdate",element:t,eventConfig:t.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{e.composing=!1,e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,ft(e,t),Fs({eventHandler:r,eventName:"compositionEnd",element:t,eventConfig:t.compositionEnd,snapshot:i})}}),xF=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{if(!t.inputDomBridge?.mount||!t.inputDomBridge?.focus||!t.inputDomBridge?.setSelection)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let c=new ie({label:r.id});c.zIndex=l,c.sortableChildren=!0,c.eventMode="static",c.cursor=r.disabled?"default":"text",c.x=Math.round(r.x),c.y=Math.round(r.y),c.alpha=r.alpha;let u=mF(r),h=gF({app:t,container:c,display:u,element:r});c.addChild(h.background,h.selection,h.text,h.placeholder,h.caret,h.clip),h.tickerListener=g=>{if(!h.focused){if(h.blinkVisible===!1)return;h.blinkVisible=!1,ft(h,h.element);return}h.blinkTick+=g.deltaMS??g.deltaTime??16,h.blinkTick>=530&&(h.blinkTick=0,h.blinkVisible=!h.blinkVisible,ft(h,h.element))},t.ticker?.add?.(h.tickerListener);let d=({start:g,end:b,shouldFocus:_=!1})=>{if(_){t.inputDomBridge.focus(r.id,{selectionStart:g,selectionEnd:b});return}t.inputDomBridge.setSelection(r.id,g,b)},f=g=>{g?.stopPropagation?.()},p=({start:g,end:b,shouldFocus:_=!1,anchor:S=h.selectionAnchor})=>{h.focused=!0,h.selectionStart=g,h.selectionEnd=b,h.selectionAnchor=S,h.blinkVisible=!0,h.blinkTick=0,ft(h,h.element),d({start:g,end:b,shouldFocus:_})},m=g=>{if(f(g),h.element.disabled===!0)return;let b=c.toLocal(g.global),_=Ub(h,b),S=!!g.shiftKey&&h.focused,E=S?h.selectionAnchor??(h.selectionStart!==h.selectionEnd?h.selectionStart:h.selectionEnd):_,P=S?Math.min(E,_):_,C=S?Math.max(E,_):_;h.draggingSelection=!0,p({start:P,end:C,shouldFocus:!0,anchor:E})},x=g=>{if(!h.draggingSelection||h.element.disabled===!0)return;f(g);let b=c.toLocal(g.global),_=Ub(h,b),S=h.selectionAnchor??_,E=Math.min(S,_),P=Math.max(S,_);p({start:E,end:P,anchor:S})},v=g=>{f(g),h.draggingSelection=!1},y=g=>{f(g),h.draggingSelection=!1,h.element.disabled!==!0&&t.inputDomBridge.focus(r.id,{selectionStart:h.selectionStart,selectionEnd:h.selectionEnd})};c.on("pointerdown",m),c.on("globalpointermove",x),c.on("pointerup",y),c.on("pointerupoutside",v),c.on("rightclick",f),c[wa]=h,ft(h,r),t.inputDomBridge.mount(r.id,{...r,value:h.value,callbacks:WH({element:r,runtime:h,eventHandler:n}),getGeometry:()=>gp(t,c,r)}),e.addChild(c),oe({animations:i,targetId:r.id,animationBus:s,completionTracker:o,element:c,targetState:{x:r.x,y:r.y,alpha:r.alpha},renderContext:a})};var ks=({eventHandler:t,eventName:e,element:r,eventConfig:i,snapshot:s})=>{!t||!i||t(e,{_event:{id:r.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload})},$H=({element:t,runtime:e,eventHandler:r})=>({onValueChange:i=>{e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.lastExternalValue=i.value,ft(e,t),ks({eventHandler:r,eventName:"change",element:t,eventConfig:t.change,snapshot:i})},onFocus:i=>{let s=e.nativeFocused===!0;e.nativeFocused=!0,e.focused=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.selectionAnchor=i.selectionStart===i.selectionEnd?i.selectionEnd:e.selectionAnchor,e.blinkVisible=!0,e.blinkTick=0,ft(e,t),!s&&ks({eventHandler:r,eventName:"focus",element:t,eventConfig:t.focusEvent,snapshot:i})},onBlur:i=>{e.nativeFocused=!1,e.focused=!1,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.blinkVisible=!1,e.composing=!1,ft(e,t),ks({eventHandler:r,eventName:"blur",element:t,eventConfig:t.blurEvent,snapshot:i})},onSelectionChange:i=>{e.nativeFocused=i.focused,e.focused=i.focused,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,i.selectionStart===i.selectionEnd&&(e.selectionAnchor=i.selectionEnd),ft(e,t),ks({eventHandler:r,eventName:"selectionChange",element:t,eventConfig:t.selectionChange,snapshot:i})},...t.submit&&{onSubmit:i=>{ks({eventHandler:r,eventName:"submit",element:t,eventConfig:t.submit,snapshot:i})}},onCompositionStart:i=>{e.composing=!0,ft(e,t),ks({eventHandler:r,eventName:"compositionStart",element:t,eventConfig:t.compositionStart,snapshot:i})},onCompositionUpdate:i=>{e.composing=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,ft(e,t),ks({eventHandler:r,eventName:"compositionUpdate",element:t,eventConfig:t.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{e.composing=!1,e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,ft(e,t),ks({eventHandler:r,eventName:"compositionEnd",element:t,eventConfig:t.compositionEnd,snapshot:i})}}),yF=({app:t,parent:e,prevElement:r,nextElement:i,eventHandler:s,zIndex:o})=>{let n=e.children.find(u=>u.label===r.id);if(!n)return;if(!t.inputDomBridge?.update)throw new Error("Input plugin requires app.inputDomBridge to be initialized");n.zIndex=o;let a=n[wa];if(!a)return;let l={...i},c=a.focused!==!0||i.value!==r.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),(!ye(r,i)||c)&&ft(a,l),t.inputDomBridge.update(i.id,{...l,value:a.value,callbacks:$H({element:l,runtime:a,eventHandler:s}),getGeometry:()=>gp(t,n,l)})};var _F=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o})=>{let n=e.getChildByLabel(r.id);if(!n)return;if(!t.inputDomBridge?.unmount)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let a=n[wa],l=()=>{n.destroyed||(a?.tickerListener&&t.ticker?.remove?.(a.tickerListener),t.inputDomBridge.unmount(r.id),n.destroy({children:!0}))};oe({animations:i,targetId:r.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:l})||l()};var bF=({state:t})=>{let e=Et(t),r=String(t.value??""),i=String(t.placeholder??"");return delete e.originX,delete e.originY,{...e,value:r,placeholder:i,multiline:t.multiline===!0,disabled:t.disabled===!0,...typeof t.submitOnEnter=="boolean"&&{submitOnEnter:t.submitOnEnter},...typeof t.maxLength=="number"&&{maxLength:Math.round(t.maxLength)},textStyle:mp(t.textStyle),padding:Bb(t.padding),fill:t.fill!==void 0?t.fill:Rb,border:Fb(t.border,Mb),focusRing:Fb(t.focusRing,Ib),...t.change&&{change:t.change},...t.submit&&{submit:t.submit},...t.focusEvent&&{focusEvent:t.focusEvent},...t.blurEvent&&{blurEvent:t.blurEvent},...t.selectionChange&&{selectionChange:t.selectionChange},...t.compositionStart&&{compositionStart:t.compositionStart},...t.compositionUpdate&&{compositionUpdate:t.compositionUpdate},...t.compositionEnd&&{compositionEnd:t.compositionEnd}}};var zH=dt({type:"input",add:xF,update:yF,delete:_F,parse:bF});var XH=24,YH=24,Ro=(t,e,r)=>Math.min(r,Math.max(e,t)),SF=t=>Ro(t,0,1),Ea=t=>{t?.stopPropagation?.()},jH=t=>t?B.from(t):B.EMPTY,xp=({label:t})=>{let e=new ke(B.EMPTY);return e.label=t,e.eventMode="static",e.cursor="pointer",e},qH=({config:t,state:e})=>t?e?.pressed&&t.pressSrc?t.pressSrc:e?.hovered&&t.hoverSrc?t.hoverSrc:t.src??"":"",yp=({sprite:t,config:e,state:r,width:i,height:s})=>{t&&(t.texture=jH(qH({config:e,state:r})),t.width=Math.max(i,0),t.height=Math.max(s,0),t.visible=t.width>0&&t.height>0,t.eventMode=t.visible?"static":"none")},KH=t=>({root:`${t}-scrollbar-vertical`,track:`${t}-scrollbar-vertical-track`,thumb:`${t}-scrollbar-vertical-thumb`,startButton:`${t}-scrollbar-vertical-start-button`,endButton:`${t}-scrollbar-vertical-end-button`}),vF=(t,e)=>Math.abs(t-e)<.5,TF=({hasOverflow:t,minScroll:e,previousOffset:r,wasAtEnd:i,anchorToEnd:s})=>t?s&&(r===void 0||i)?e:typeof r=="number"?Ro(r,e,0):0:0,ZH=({controller:t})=>{let e=KH(t.container.label),r=t.element.scrollbar?.vertical;if(!r)return null;let i=new ie({label:e.root});i.eventMode="static",i.cursor="pointer";let s=xp({label:e.track}),o=xp({label:e.thumb}),n={config:r,root:i,track:s,thumb:o,startButton:null,endButton:null,states:{track:{hovered:!1,pressed:!1},thumb:{hovered:!1,pressed:!1,dragging:!1},startButton:{hovered:!1,pressed:!1},endButton:{hovered:!1,pressed:!1}},dragOffsetY:0};i.addChild(s),i.addChild(o),r.startButton&&(n.startButton=xp({label:e.startButton}),i.addChild(n.startButton)),r.endButton&&(n.endButton=xp({label:e.endButton}),i.addChild(n.endButton));let a=()=>{wF({controller:t})};s.on("pointerover",()=>{n.states.track.hovered=!0,a()}),s.on("pointerout",()=>{n.states.track.hovered=!1,a()}),s.on("pointerdown",h=>{Ea(h),n.states.track.pressed=!0,a();let d=i.toLocal(h.global),{thumb:f}=n,p=t.viewportHeight;d.y<f.y?t.setScrollOffsets({y:t.scrollYOffset+p,source:"track"}):d.y>f.y+f.height&&t.setScrollOffsets({y:t.scrollYOffset-p,source:"track"})});let l=h=>{Ea(h),n.states.track.pressed=!1,a()};s.on("pointerup",l),s.on("pointerupoutside",l),o.on("pointerover",()=>{n.states.thumb.hovered=!0,a()}),o.on("pointerout",()=>{n.states.thumb.hovered=!1,n.states.thumb.dragging||a()}),o.on("pointerdown",h=>{Ea(h);let d=i.toLocal(h.global);n.states.thumb.pressed=!0,n.states.thumb.dragging=!0,n.dragOffsetY=d.y-n.thumb.y,a()});let c=h=>{if(Ea(h),!n.states.thumb.dragging){n.states.thumb.pressed=!1,a();return}n.states.thumb.dragging=!1,n.states.thumb.pressed=!1,a()};i.on("globalpointermove",h=>{if(!n.states.thumb.dragging)return;let d=i.toLocal(h.global),f=n.track.y,p=Math.max(n.track.height-n.thumb.height,0);if(p<=0||t.minScrollY===0){t.setScrollOffsets({y:0,source:"thumb"});return}let m=Ro(d.y-n.dragOffsetY,f,f+p),x=SF((m-f)/p);t.setScrollOffsets({y:t.minScrollY*x,source:"thumb"})}),o.on("pointerup",c),o.on("pointerupoutside",c),i.on("pointerup",c),i.on("pointerupoutside",c);let u=({sprite:h,config:d,state:f,deltaDirection:p})=>{if(!h||!d)return;h.on("pointerover",()=>{f.hovered=!0,a()}),h.on("pointerout",()=>{f.hovered=!1,a()}),h.on("pointerdown",x=>{Ea(x),f.pressed=!0,a(),t.setScrollOffsets({y:t.scrollYOffset+p*Math.max(d.step??XH,0),source:"button"})});let m=x=>{Ea(x),f.pressed=!1,a()};h.on("pointerup",m),h.on("pointerupoutside",m)};return u({sprite:n.startButton,config:r.startButton,state:n.states.startButton,deltaDirection:1}),u({sprite:n.endButton,config:r.endButton,state:n.states.endButton,deltaDirection:-1}),t.container.addChild(i),n},wF=({controller:t})=>{let e=t.verticalScrollbar;if(!e)return;let{config:r,root:i,track:s,thumb:o,startButton:n,endButton:a,states:l}=e,c=Math.max(r.thickness??0,0),u=n?Math.max(r.startButton?.size??c,0):0,h=a?Math.max(r.endButton?.size??c,0):0,d=Math.max(t.viewportHeight-u-h,0),f=Math.min(YH,d),p=r.thumb?.length,m=typeof p=="number"?p:t.totalHeight>0?Math.round(t.viewportHeight/t.totalHeight*d):d,x=d>0?typeof p=="number"?Ro(m,0,d):Ro(m,f,d):0,v=Math.max(d-x,0),y=t.minScrollY===0?0:SF(t.scrollYOffset/t.minScrollY);i.visible=t.hasVerticalOverflow&&t.element.scroll&&c>0&&t.viewportHeight>0,i.x=Math.max(t.viewportWidth-c,0),i.y=0,s.x=0,s.y=u,yp({sprite:s,config:r.track,state:l.track,width:c,height:d}),o.x=0,o.y=u+v*y,yp({sprite:o,config:r.thumb,state:l.thumb,width:c,height:x}),n&&(n.x=0,n.y=0,yp({sprite:n,config:r.startButton,state:l.startButton,width:c,height:u})),a&&(a.x=0,a.y=t.viewportHeight-h,yp({sprite:a,config:r.endButton,state:l.endButton,width:c,height:h}))},EF=({container:t})=>{let e=t.__routeGraphicsScrollController;return e?{scrollXOffset:e.scrollXOffset,scrollYOffset:e.scrollYOffset,wasAtHorizontalEnd:e.hasHorizontalOverflow&&vF(e.scrollXOffset,e.minScrollX),wasAtVerticalEnd:e.hasVerticalOverflow&&vF(e.scrollYOffset,e.minScrollY)}:null},bu=({container:t,element:e,interactive:r=!0,allowViewportWithoutScroll:i=!1,previousState:s=null})=>{let o=0,n=0;e.children.forEach(u=>{o=Math.max(u.width+u.x,o),n=Math.max(u.height+u.y,n)});let a=!!(e.height&&n>e.height),l=!!(e.width&&o>e.width);if((e.scroll||i)&&(a||l)){let u=new ie({label:`${t.label}-content`});[...t.children].forEach(x=>{u.addChild(x)}),t.addChild(u);let d=new Ze({label:`${t.label}-clip`}).rect(0,0,e.width||o,e.height||n).fill({color:16711680,alpha:0});t.addChild(d),u.mask=d;let f=-(n-(e.height||n)),p=-(o-(e.width||o)),m={container:t,contentContainer:u,clip:d,element:e,totalWidth:o,totalHeight:n,viewportWidth:e.width||o,viewportHeight:e.height||n,hasHorizontalOverflow:l,hasVerticalOverflow:a,minScrollX:p,minScrollY:f,scrollXOffset:TF({hasOverflow:l,minScroll:p,previousOffset:s?.scrollXOffset,wasAtEnd:s?.wasAtHorizontalEnd,anchorToEnd:!!e.anchorToBottom}),scrollYOffset:TF({hasOverflow:a,minScroll:f,previousOffset:s?.scrollYOffset,wasAtEnd:s?.wasAtVerticalEnd,anchorToEnd:!!e.anchorToBottom}),verticalScrollbar:null,setScrollOffsets:({x,y:v})=>{let y=x??m.scrollXOffset,g=v??m.scrollYOffset;m.scrollXOffset=m.hasHorizontalOverflow?Ro(y,m.minScrollX,0):0,m.scrollYOffset=m.hasVerticalOverflow?Ro(g,m.minScrollY,0):0,m.contentContainer.x=m.scrollXOffset,m.contentContainer.y=m.scrollYOffset,wF({controller:m})}};t.__routeGraphicsScrollController=m,m.verticalScrollbar=ZH({controller:m}),m.setScrollOffsets({x:m.scrollXOffset,y:m.scrollYOffset,source:"initial"}),r&&(t.eventMode="static",t.hitArea=new te(0,0,e.width||o,e.height||n),t.on("wheel",x=>{if(x.preventDefault(),a&&x.deltaY!==0&&m.setScrollOffsets({y:m.scrollYOffset-x.deltaY,source:"wheel"}),l&&(x.deltaX!==0||x.shiftKey&&x.deltaY!==0)){let v=x.deltaX!==0?x.deltaX:x.deltaY;m.setScrollOffsets({x:m.scrollXOffset-v,source:"wheel"})}}))}},Ob=({container:t})=>{let e=t.__routeGraphicsScrollController,r=t.children.find(o=>o.label&&o.label.endsWith("-content")),i=t.children.find(o=>o.label&&o.label.endsWith("-clip")),s=t.children.find(o=>o.label&&o.label.endsWith("-scrollbar-vertical"));r&&([...r.children].forEach(n=>{n.mask=null,t.addChild(n)}),t.removeChild(r),r.destroy({children:!1})),i&&(t.removeChild(i),i.destroy()),s&&(t.removeChild(s),s.destroy({children:!0})),t.eventMode="auto",t.hitArea=null,t.removeAllListeners("wheel"),e&&(t.__routeGraphicsScrollController=void 0)};var Lb=({container:t,element:e,enabled:r})=>{let i=Number.isFinite(e?.width)?e.width:0,s=Number.isFinite(e?.height)?e.height:0;if(r&&i>0&&s>0){t.hitArea=new te(0,0,i,s);return}t.hitArea=null},AF=(t,e)=>{let r=e??null;for(;r;){if(r===t)return!0;r=r.parent??null}return!1},Mo=(t,e)=>{let r=e??null;for(;r;){if(r===t)return!1;if(typeof r.label=="string"&&r.label.startsWith(`${t.label}-scrollbar-`))return!0;r=r.parent??null}return!1},QH=(t,e)=>{if(!e||typeof e.x!="number"||typeof e.y!="number")return!1;let r=t.toLocal(e),i=t.hitArea;return i?.contains?i.contains(r.x,r.y):!1},_p=({app:t,container:e,element:r,eventHandler:i})=>{let s=ab(e),o=lb(e),n=cb(e),a=s;e._cleanupScrollInteraction?.(),xa({root:e,isHovered:!1}),wo({root:e,isPressed:!1}),qi({root:e,isPressed:!1}),e.removeAllListeners("pointerover"),e.removeAllListeners("pointerout"),e.removeAllListeners("pointerdown"),e.removeAllListeners("pointerup"),e.removeAllListeners("pointerupoutside"),e.removeAllListeners("rightdown"),e.removeAllListeners("rightup"),e.removeAllListeners("rightupoutside"),e.removeAllListeners("rightclick"),e.cursor="auto",r.scroll||(e.eventMode="auto",Lb({container:e,element:r,enabled:!1}));let l=r?.hover,c=r?.click,u=r?.rightClick,h=r?.scrollUp,d=r?.scrollDown;if(!!(l||c||u||h||d)&&(e.eventMode="static",r.scroll?e.hitArea||Lb({container:e,element:r,enabled:!0}):Lb({container:e,element:r,enabled:!0})),l){let{cursor:p,soundSrc:m,payload:x,inheritToChildren:v}=l,y=b=>{AF(e,b?.relatedTarget)||a||(a=!0,x&&i&&i("hover",{_event:{id:e.label},...x}),p&&(e.cursor=p),m&&t.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1}),v&&xa({root:e,isHovered:!0}))},g=b=>{AF(e,b?.relatedTarget)||QH(e,b?.global)||a&&(a=!1,e.cursor="auto",v&&xa({root:e,isHovered:!1}))};e.on("pointerover",y),e.on("pointerout",g)}if(c){let{soundSrc:p,soundVolume:m,payload:x,inheritToChildren:v}=c,y=_=>{Ot(_)&&(Mo(e,_?.target)||v&&wo({root:e,isPressed:!0}))},g=_=>{Ot(_)&&(Mo(e,_?.target)||(v&&wo({root:e,isPressed:!1}),x&&i&&i("click",{_event:{id:e.label},...x}),p&&t.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1,volume:je(m)})))},b=_=>{Ot(_)&&(Mo(e,_?.target)||v&&wo({root:e,isPressed:!1}))};e.on("pointerdown",y),e.on("pointerup",g),e.on("pointerupoutside",b)}if(u){let{soundSrc:p,payload:m,inheritToChildren:x}=u,v=S=>{Mo(e,S?.target)||x&&qi({root:e,isPressed:!0})},y=S=>{Mo(e,S?.target)||x&&qi({root:e,isPressed:!1})},g=S=>{KI(S)&&(Mo(e,S?.target)||x&&qi({root:e,isPressed:!1}))},b=S=>{Mo(e,S?.target)||(x&&qi({root:e,isPressed:!1}),m&&i&&i("rightClick",{_event:{id:e.label},...m}),p&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:p,loop:!1}))},_=()=>{x&&qi({root:e,isPressed:!1})};e.on("rightdown",v),e.on("rightup",y),e.on("pointerup",g),e.on("rightclick",b),e.on("pointerupoutside",g),e.on("rightupoutside",_)}(h||d)&&Gr({canvas:t.canvas,displayObject:e,scrollUpEvent:h,scrollDownEvent:d,eventHandler:i}),l?.inheritToChildren&&s&&xa({root:e,isHovered:!0}),c?.inheritToChildren&&o&&wo({root:e,isPressed:!0}),u?.inheritToChildren&&n&&qi({root:e,isPressed:!0})},PF=({container:t})=>{ab(t)&&xa({root:t,isHovered:!0})},CF=({container:t})=>{lb(t)&&wo({root:t,isPressed:!0})},RF=({container:t})=>{cb(t)&&qi({root:t,isPressed:!0})};var MF=(t,e,r=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let c of t)i.add(c.id),s.set(c.id,c);for(let c of e)i.add(c.id),o.set(c.id,c);for(let c of i){let u=s.get(c),h=o.get(c);if(!u&&h)n.push(h);else if(u&&!h)a.push(u);else{let d=To(h),f=r instanceof Map?Array.from(r.keys()).some(p=>d.has(p)):r.find(p=>d.has(p.targetId));(!ye(u,h)||f)&&l.push({prev:u,next:h})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var bp=t=>t<.36363636363636365?7.5625*t*t:t<.7272727272727273?7.5625*(t-=.5454545454545454)*t+.75:t<.9090909090909091?7.5625*(t-=.8181818181818182)*t+.9375:7.5625*(t-=.9545454545454546)*t+.984375,JH=t=>t,e4=t=>t*t,t4=t=>1-(1-t)*(1-t),r4=t=>t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2,IF=Object.freeze({linear:JH,easeInQuad:e4,easeOutQuad:t4,easeInOutQuad:r4,easeInCubic:t=>t*t*t,easeOutCubic:t=>1-Math.pow(1-t,3),easeInOutCubic:t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,easeInQuart:t=>t*t*t*t,easeOutQuart:t=>1-Math.pow(1-t,4),easeInOutQuart:t=>t<.5?8*t*t*t*t:1-Math.pow(-2*t+2,4)/2,easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>1-Math.pow(1-t,5),easeInOutQuint:t=>t<.5?16*t*t*t*t*t:1-Math.pow(-2*t+2,5)/2,easeInSine:t=>1-Math.cos(t*Math.PI/2),easeOutSine:t=>Math.sin(t*Math.PI/2),easeInOutSine:t=>-(Math.cos(Math.PI*t)-1)/2,easeInExpo:t=>t===0?0:Math.pow(2,10*t-10),easeOutExpo:t=>t===1?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>t===0?0:t===1?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2,easeInCirc:t=>1-Math.sqrt(1-Math.pow(t,2)),easeOutCirc:t=>Math.sqrt(1-Math.pow(t-1,2)),easeInOutCirc:t=>t<.5?(1-Math.sqrt(1-Math.pow(2*t,2)))/2:(Math.sqrt(1-Math.pow(-2*t+2,2))+1)/2,easeInBack:t=>2.70158*t*t*t-1.70158*t*t,easeOutBack:t=>1+2.70158*Math.pow(t-1,3)+1.70158*Math.pow(t-1,2),easeInOutBack:t=>{let r=2.5949095;return t<.5?Math.pow(2*t,2)*((r+1)*2*t-r)/2:(Math.pow(2*t-2,2)*((r+1)*(t*2-2)+r)+2)/2},easeInBounce:t=>1-bp(1-t),easeOutBounce:bp,easeInOutBounce:t=>t<.5?(1-bp(1-2*t))/2:(1+bp(2*t-1))/2,easeInElastic:t=>{let e=2*Math.PI/3;return t===0?0:t===1?1:-Math.pow(2,10*t-10)*Math.sin((t*10-10.75)*e)},easeOutElastic:t=>{let e=2*Math.PI/3;return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t*10-.75)*e)+1},easeInOutElastic:t=>{let e=2*Math.PI/4.5;return t===0?0:t===1?1:t<.5?-(Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e))/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1}}),vp=Object.freeze(Object.keys(IF)),i4=(t="linear")=>{let e=IF[t];if(!e)throw new Error(`Unsupported easing: ${t}`);return e},Io=t=>{let e=[],r=0,i;return t.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,e.push({time:r,value:s,easing:"linear"});return}o!==void 0&&(r+=o,i=a?i+s:s,e.push({time:r,value:i,easing:n}))}),e},Aa=t=>{let e=0;for(let{timeline:r}of t){let i=r[r.length-1];i&&i.time>e&&(e=i.time)}return e},Bo=(t,e)=>{if(t.length===0)return 0;if(e<=t[0].time)return t[0].value;if(e>=t[t.length-1].time)return t[t.length-1].value;for(let r=0;r<t.length-1;r++){let{time:i,value:s}=t[r],{time:o,value:n,easing:a}=t[r+1];if(e>=i&&e<=o){let l=(e-i)/(o-i);return s+(n-s)*i4(a)(l)}}return t[t.length-1].value};var s4=t=>{t.customTickerHandler&&(typeof window<"u"&&window.removeEventListener("snapShotKeyFrame",t.customTickerHandler),t.customTickerHandler=void 0)},o4=(t,e)=>{e.tickerCallback&&(t?.ticker?.remove?.(e.tickerCallback),e.tickerCallback=void 0)},Gb=({app:t,particleElement:e}={})=>{e&&(o4(t,e),s4(e),e.emitter&&(e.emitter.destroy(),e.emitter=void 0))},Yt=({app:t,root:e}={})=>{if(!e)return;let r=[e];for(let i of r)i&&((i.emitter||i.tickerCallback||i.customTickerHandler)&&Gb({app:t,particleElement:i}),Array.isArray(i.children)&&i.children.length>0&&r.push(...i.children))};var n4={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},Db=t=>Math.min(1,Math.max(0,t));var Nb=t=>t.getLocalBounds().rectangle.clone(),Vb=t=>(t.width=Math.max(1,Math.ceil(t.width)),t.height=Math.max(1,Math.ceil(t.height)),t),a4=({app:t,displayObject:e,frame:r})=>{let i={x:e.x??0,y:e.y??0,scaleX:e.scale?.x??1,scaleY:e.scale?.y??1,rotation:e.rotation??0,alpha:e.alpha??1,skewX:e.skew?.x??0,skewY:e.skew?.y??0};try{return e.x=0,e.y=0,e.scale?.set?.(1,1),e.rotation=0,e.alpha=1,e.skew?.set?.(0,0),e.updateLocalTransform?.(),t.renderer.generateTexture({target:e,frame:r})}finally{e.x=i.x,e.y=i.y,e.scale?.set?.(i.scaleX,i.scaleY),e.rotation=i.rotation,e.alpha=i.alpha,e.skew?.set?.(i.skewX,i.skewY),e.updateLocalTransform?.()}},BF=(t,e)=>{let r=Vb(Nb(e)),i=e instanceof ke&&(e.filters?.length??0)===0,s=i?e.texture:a4({app:t,displayObject:e,frame:r}),o=new ke(s);i&&(o.tint=e.tint,o.blendMode=e.blendMode),o.x=r.x-(e.pivot?.x??0),o.y=r.y-(e.pivot?.y??0);let n=new ie;return n.x=e.x??0,n.y=e.y??0,n.scale.set(e.scale?.x??1,e.scale?.y??1),n.rotation=e.rotation??0,n.skew?.set?.(e.skew?.x??0,e.skew?.y??0),n.alpha=e.alpha??1,n.addChild(o),{wrapper:n,texture:s,ownsTexture:!i,width:r.width*Math.abs(n.scale.x),height:r.height*Math.abs(n.scale.y)}},l4=(t,e)=>{switch(t){case"x":return e.x;case"y":return e.y;default:return n4[t]??0}},c4=(t={},e)=>Object.entries(t).map(([r,i])=>({property:r,timeline:Io([{value:i.initialValue??l4(r,e)},...i.keyframes])})),Pa=(t,e)=>{if(!t?.wrapper||!e)return{duration:0,timelines:[],apply:()=>{}};let r=t.wrapper,i={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation,width:t.width,height:t.height},s=c4(e,i);return{duration:Aa(s),timelines:s,apply:o=>{r.x=i.x,r.y=i.y,r.alpha=i.alpha,r.scale.x=i.scaleX,r.scale.y=i.scaleY,r.rotation=i.rotation;for(let{property:n,timeline:a}of s){let l=Bo(a,o);switch(n){case"x":r.x=l;break;case"y":r.y=l;break;case"translateX":r.x=i.x+l*i.width;break;case"translateY":r.y=i.y+l*i.height;break;case"alpha":r.alpha=i.alpha*l;break;case"scaleX":r.scale.x=i.scaleX*l;break;case"scaleY":r.scale.y=i.scaleY*l;break;case"rotation":r.rotation=i.rotation+_o(l);break}}}}},u4=t=>{let e=new Set([0]);for(let r of t){e.add(r.duration);for(let{timeline:i}of r.timelines??[])for(let s=0;s<i.length;s++){let o=i[s].time;if(e.add(o),s===0)continue;let n=i[s-1].time,a=o-n;a<=0||(e.add(n+a*.25),e.add(n+a*.5),e.add(n+a*.75))}}return[...e].sort((r,i)=>r-i)},h4=t=>{if(t.length===0)return new te(0,0,1,1);let e=1/0,r=1/0,i=-1/0,s=-1/0;for(let o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x+o.width),s=Math.max(s,o.y+o.height);return new te(e,r,i-e,s-r)},d4=t=>Io([{value:t?.progress?.initialValue??0},...t?.progress?.keyframes??[]]),f4=t=>Io([{value:t.tween?.uProgress?.initialValue??0},...t.tween?.uProgress?.keyframes??[]]),LF=`
|
|
1298
|
+
`),GH=(t,e,r)=>{let i=Math.max(0,t-e);return r==="center"?i/2:r==="right"?i:0},fF=t=>new Ge(Ut(t,{includeShadow:!1})),fr=(t,e)=>Ye.measureText(t,fF(e)).width,Bs=(t,e,r)=>Math.max(e,Math.min(r,t)),hF=({text:t,style:e,targetX:r})=>{let i=Number.isFinite(r)?r:0;if(i<=0||t.length===0)return 0;let s=fr(t,e);if(i>=s)return t.length;for(let o=1;o<=t.length;o+=1){let n=fr(t.slice(0,o-1),e),a=fr(t.slice(0,o),e),l=n+(a-n)/2;if(i<l)return o-1}return t.length},dF=(t,e)=>{let r=Math.max(t.x,e.x),i=Math.max(t.y,e.y),s=Math.min(t.x+t.width,e.x+e.width),o=Math.min(t.y+t.height,e.y+e.height),n=s-r,a=o-i;return n<=0||a<=0?null:{x:r,y:i,width:n,height:a}},DH=t=>{let e=t?.mask;if(!e?.getBounds)return null;let r=e.getBounds();return!r||r.width<=0||r.height<=0?null:{x:r.x,y:r.y,width:r.width,height:r.height}},NH=({app:t,container:e,fallbackElement:r})=>{if(!e||e.destroyed)return null;let i=e.getBounds?.(),s=i?{x:i.x,y:i.y,width:i.width,height:i.height}:{x:e.x??r.x,y:e.y??r.y,width:r.width,height:r.height};if(s.width<=0||s.height<=0)return null;let o={...s},n=e;for(;n;){if(n.visible===!1||n.renderable===!1)return{fullBounds:s,visibleBounds:null};let l=DH(n);if(l&&(o=dF(o,l),!o))return{fullBounds:s,visibleBounds:null};n=n.parent}let a=t?.renderer?{x:0,y:0,width:t.renderer.width,height:t.renderer.height}:null;return a&&(o=dF(o,a)),{fullBounds:s,visibleBounds:o}},VH=(t,e)=>e?{top:Math.max(0,e.y-t.y),right:Math.max(0,t.x+t.width-(e.x+e.width)),bottom:Math.max(0,t.y+t.height-(e.y+e.height)),left:Math.max(0,e.x-t.x)}:{top:t.height,right:0,bottom:0,left:0},HH=({displayedValue:t,textStyle:e})=>{let r=fr(t,e);return{lines:[{text:t,width:r,startIndex:0}],lineHeight:e.lineHeight,totalHeight:e.lineHeight,maxLineWidth:r,textValue:t}},WH=({displayedValue:t,textStyle:e})=>{let r=Sa(t),i=r.split(`
|
|
1299
|
+
`),s=i.map((a,l)=>({text:a,width:fr(a,e),startIndex:l===0?0:i.slice(0,l).reduce((c,u)=>c+u.length+1,0)})),o=s.reduce((a,l)=>Math.max(a,l.width),0),n=e.lineHeight;return{lines:s,lineHeight:n,totalHeight:s.length*n,maxLineWidth:o,textValue:r}},$H=({element:t,displayedValue:e,textStyle:r})=>t.multiline?WH({displayedValue:e,textStyle:r}):HH({displayedValue:e,textStyle:r}),dp=({value:t,index:e})=>{let r=Sa(t),i=Bs(e,0,r.length),s=0,o=0;for(let n=0;n<i;n+=1){if(r[n]===`
|
|
1300
|
+
`){s+=1,o=0;continue}o+=1}return{line:s,column:o}},kb=({contentWidth:t,lineWidth:e,align:r})=>GH(t,e,r),zH=t=>new vr({label:t,text:""}),XH=(t,e)=>{for(;t.textNodes.length<e;){let r=zH(`${t.element.id}-text-line-${t.textNodes.length}`);t.text.addChild(r),t.textNodes.push(r)}for(;t.textNodes.length>e;){let r=t.textNodes.pop();r?.removeFromParent(),r?.destroy()}},fp=({contentWidth:t,lineWidth:e,align:r,scrollOffsetX:i})=>e>t?-i:kb({contentWidth:t,lineWidth:e,align:r}),pF=({contentWidth:t,lineWidth:e,align:r})=>kb({contentWidth:t,lineWidth:e,align:r}),pp=({padding:t,contentWidth:e,lineWidth:r,align:i,scrollOffsetX:s})=>t.left+pF({contentWidth:e,lineWidth:r,align:i})-s,mF=t=>{let e=new Ze;e.label=`${t.id}-background`,e.on("destroyed",()=>{Ms(e)});let r=new Ze;r.label=`${t.id}-selection`;let i=new ie;i.label=`${t.id}-text`;let s=new vr({label:`${t.id}-placeholder`,text:t.placeholder}),o=new Ze;o.label=`${t.id}-caret`;let n=new Ze;return n.label=`${t.id}-clip`,i.mask=n,s.mask=n,r.mask=n,o.mask=n,{background:e,selection:r,text:i,placeholder:s,caret:o,clip:n}},gF=({app:t,container:e,display:r,element:i})=>({app:t,container:e,...r,value:Sa(i.value??""),selectionStart:Sa(i.value??"").length,selectionEnd:Sa(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:Sa(i.value??""),tickerListener:null,element:i}),gp=(t,e,r)=>{let i=NH({app:t,container:e,fallbackElement:r});if(!i)return null;let{fullBounds:s,visibleBounds:o}=i,n=VH(s,o);return{x:s.x,y:s.y,width:s.width,height:s.height,visible:!!o&&e.visible!==!1&&e.renderable!==!1,clipInsets:n}},ft=(t,e)=>{let r=Bb(e.padding),i=Math.max(0,e.width-r.left-r.right),s=Math.max(0,e.height-r.top-r.bottom),o=mp(e.textStyle,{wordWrapWidth:i}),n=mp({...e.textStyle,fill:"#7A7A7A"},{wordWrapWidth:i}),a=String(t.value??""),l=$H({element:e,displayedValue:a,textStyle:o}),c=o.align??"left",u=Bs(Math.min(t.selectionStart,t.selectionEnd),0,a.length),h=Bs(Math.max(t.selectionStart,t.selectionEnd),0,a.length),d=Bs(t.selectionEnd??a.length,0,a.length);if(t.layoutState={padding:r,contentWidth:i,contentHeight:s,textStyle:o,placeholderStyle:n,displayedValue:a,layout:l,align:c},XH(t,l.lines.length),t.textNodes.forEach((y,g)=>{let b=l.lines[g]??{text:"",width:0};wi(y,o),y.text=b.text}),wi(t.placeholder,n),t.placeholder.text=e.placeholder??"",e.multiline){let y=dp({value:a,index:d}),g=l.lines[y.line]??l.lines.at(-1),b=g?.width??0,_=fr((g?.text??"").slice(0,y.column),o),S=l.totalHeight,E=y.line*l.lineHeight,P=E+l.lineHeight;if(b<=i)t.scrollOffsetX=0;else if(t.focused){let M=Math.max(0,b-i);_-t.scrollOffsetX>i-8?t.scrollOffsetX=_-(i-8):_-t.scrollOffsetX<8&&(t.scrollOffsetX=_-8),t.scrollOffsetX=Bs(t.scrollOffsetX,0,M)}else t.scrollOffsetX=0;if(S<=s)t.scrollOffsetY=0;else if(t.focused){let C=Math.max(0,S-s);P-t.scrollOffsetY>s?t.scrollOffsetY=P-s:E-t.scrollOffsetY<0&&(t.scrollOffsetY=E),t.scrollOffsetY=Bs(t.scrollOffsetY,0,C)}else t.scrollOffsetY=0}else{let y=l.lines[0],g=fr(y.text.slice(0,d),o);if(y.width<=i)t.scrollOffsetX=0;else if(t.focused){let _=Math.max(0,y.width-i);g-t.scrollOffsetX>i-8?t.scrollOffsetX=g-(i-8):g-t.scrollOffsetX<8&&(t.scrollOffsetX=g-8),t.scrollOffsetX=Bs(t.scrollOffsetX,0,_)}else t.scrollOffsetX=0;t.scrollOffsetY=0}if(e.multiline)t.text.x=r.left-t.scrollOffsetX,t.text.y=r.top-t.scrollOffsetY,t.textNodes.forEach((y,g)=>{let b=l.lines[g]??{width:0};y.x=pF({contentWidth:i,lineWidth:b.width,align:c}),y.y=g*l.lineHeight});else{let y=l.lines[0],g=t.textNodes[0],b=fp({contentWidth:i,lineWidth:y.width,align:c,scrollOffsetX:t.scrollOffsetX});g.x=0,g.y=0,t.text.x=r.left+b,t.text.y=r.top+Math.max(0,(s-g.height)/2)}let f=Ye.measureText(t.placeholder.text,fF(n));t.placeholder.x=r.left,t.placeholder.y=e.multiline?r.top:r.top+Math.max(0,(s-t.placeholder.height)/2),f.width<=i&&(t.placeholder.x+=kb({contentWidth:i,lineWidth:f.width,align:c})),t.placeholder.visible=t.value.length===0&&t.composing!==!0;let p=()=>{t.background.rect(0,0,e.width,e.height)},m=e.fill!==void 0?e.fill:Rb,x=e.border??Mb,v=e.focusRing??Ib;if(t.background.clear(),p(),t.background.fill(_a(t.background,m,e)),x.width>0&&t.background.stroke({color:x.color,alpha:x.alpha,width:x.width}),t.focused&&v.width>0&&e.disabled!==!0&&(p(),t.background.stroke({color:v.color,alpha:v.alpha,width:v.width})),t.clip.clear(),t.clip.rect(r.left,r.top,i,Math.max(0,s)),t.clip.fill({color:16777215,alpha:1}),t.selection.clear(),t.focused&&u!==h&&e.disabled!==!0){if(e.multiline){let y=dp({value:a,index:u}),g=dp({value:a,index:h});for(let b=y.line;b<=g.line;b+=1){let _=l.lines[b];if(!_)continue;let S=b===y.line?y.column:0,E=b===g.line?g.column:_.text.length,P=pp({padding:r,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:t.scrollOffsetX})+fr(_.text.slice(0,S),o),C=pp({padding:r,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:t.scrollOffsetX})+fr(_.text.slice(0,E),o),M=r.top+b*l.lineHeight-t.scrollOffsetY;t.selection.rect(P,M,Math.max(C-P,1),l.lineHeight)}}else{let y=l.lines[0],g=fp({contentWidth:i,lineWidth:y.width,align:c,scrollOffsetX:t.scrollOffsetX}),b=r.left+g+fr(y.text.slice(0,u),o),_=r.left+g+fr(y.text.slice(0,h),o),S=r.top+Math.max(0,(s-t.text.height)/2);t.selection.rect(b,S,Math.max(_-b,1),Math.max(t.text.height,o.lineHeight))}t.selection.fill({color:uF.fill,alpha:uF.alpha})}if(t.caret.clear(),t.focused&&t.selectionStart===t.selectionEnd&&t.blinkVisible!==!1&&e.disabled!==!0){if(e.multiline){let y=dp({value:a,index:d}),g=l.lines[y.line]??l.lines.at(-1),b=pp({padding:r,contentWidth:i,lineWidth:g?.width??0,align:c,scrollOffsetX:t.scrollOffsetX})+fr((g?.text??"").slice(0,y.column),o),_=r.top+y.line*l.lineHeight-t.scrollOffsetY;t.caret.rect(b,_,Cb.width,l.lineHeight)}else{let y=l.lines[0],g=fp({contentWidth:i,lineWidth:y.width,align:c,scrollOffsetX:t.scrollOffsetX}),b=r.left+g+fr(y.text.slice(0,d),o),_=r.top+Math.max(0,(s-t.text.height)/2);t.caret.rect(b,_,Cb.width,Math.max(t.text.height,o.lineHeight))}t.caret.fill({color:Cb.fill,alpha:1})}},Ub=(t,e)=>{let r=t.layoutState;if(!r)return 0;let{padding:i,contentWidth:s,textStyle:o,displayedValue:n,layout:a,align:l}=r,c=e?.x??0,u=e?.y??0;if(!t.element.multiline){let m=a.lines[0]??{text:n,width:fr(n,o)},x=fp({contentWidth:s,lineWidth:m.width,align:l,scrollOffsetX:t.scrollOffsetX}),v=i.left+x;return hF({text:m.text,style:o,targetX:c-v})}let h=a.lineHeight||o.lineHeight||1,d=Bs(Math.floor((u-i.top+t.scrollOffsetY)/h),0,Math.max(a.lines.length-1,0)),f=a.lines[d]??{text:"",startIndex:0},p=hF({text:f.text,style:o,targetX:c-pp({padding:i,contentWidth:s,lineWidth:f.width??0,align:l,scrollOffsetX:t.scrollOffsetX})});return f.startIndex+p};var Fs=({eventHandler:t,eventName:e,element:r,eventConfig:i,snapshot:s})=>{!t||!i||t(e,{_event:{id:r.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload})},YH=({element:t,runtime:e,eventHandler:r})=>({onValueChange:i=>{e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.lastExternalValue=i.value,ft(e,t),Fs({eventHandler:r,eventName:"change",element:t,eventConfig:t.change,snapshot:i})},onFocus:i=>{let s=e.nativeFocused===!0;e.nativeFocused=!0,e.focused=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.selectionAnchor=i.selectionStart===i.selectionEnd?i.selectionEnd:e.selectionAnchor,e.blinkVisible=!0,e.blinkTick=0,ft(e,t),!s&&Fs({eventHandler:r,eventName:"focus",element:t,eventConfig:t.focusEvent,snapshot:i})},onBlur:i=>{e.nativeFocused=!1,e.focused=!1,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.blinkVisible=!1,e.composing=!1,ft(e,t),Fs({eventHandler:r,eventName:"blur",element:t,eventConfig:t.blurEvent,snapshot:i})},onSelectionChange:i=>{e.nativeFocused=i.focused,e.focused=i.focused,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,i.selectionStart===i.selectionEnd&&(e.selectionAnchor=i.selectionEnd),ft(e,t),Fs({eventHandler:r,eventName:"selectionChange",element:t,eventConfig:t.selectionChange,snapshot:i})},...t.submit&&{onSubmit:i=>{Fs({eventHandler:r,eventName:"submit",element:t,eventConfig:t.submit,snapshot:i})}},onCompositionStart:i=>{e.composing=!0,ft(e,t),Fs({eventHandler:r,eventName:"compositionStart",element:t,eventConfig:t.compositionStart,snapshot:i})},onCompositionUpdate:i=>{e.composing=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,ft(e,t),Fs({eventHandler:r,eventName:"compositionUpdate",element:t,eventConfig:t.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{e.composing=!1,e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,ft(e,t),Fs({eventHandler:r,eventName:"compositionEnd",element:t,eventConfig:t.compositionEnd,snapshot:i})}}),xF=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{if(!t.inputDomBridge?.mount||!t.inputDomBridge?.focus||!t.inputDomBridge?.setSelection)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let c=new ie({label:r.id});c.zIndex=l,c.sortableChildren=!0,c.eventMode="static",c.cursor=r.disabled?"default":"text",c.x=Math.round(r.x),c.y=Math.round(r.y),c.alpha=r.alpha;let u=mF(r),h=gF({app:t,container:c,display:u,element:r});c.addChild(h.background,h.selection,h.text,h.placeholder,h.caret,h.clip),h.tickerListener=g=>{if(!h.focused){if(h.blinkVisible===!1)return;h.blinkVisible=!1,ft(h,h.element);return}h.blinkTick+=g.deltaMS??g.deltaTime??16,h.blinkTick>=530&&(h.blinkTick=0,h.blinkVisible=!h.blinkVisible,ft(h,h.element))},t.ticker?.add?.(h.tickerListener);let d=({start:g,end:b,shouldFocus:_=!1})=>{if(_){t.inputDomBridge.focus(r.id,{selectionStart:g,selectionEnd:b});return}t.inputDomBridge.setSelection(r.id,g,b)},f=g=>{g?.stopPropagation?.()},p=({start:g,end:b,shouldFocus:_=!1,anchor:S=h.selectionAnchor})=>{h.focused=!0,h.selectionStart=g,h.selectionEnd=b,h.selectionAnchor=S,h.blinkVisible=!0,h.blinkTick=0,ft(h,h.element),d({start:g,end:b,shouldFocus:_})},m=g=>{if(f(g),h.element.disabled===!0)return;let b=c.toLocal(g.global),_=Ub(h,b),S=!!g.shiftKey&&h.focused,E=S?h.selectionAnchor??(h.selectionStart!==h.selectionEnd?h.selectionStart:h.selectionEnd):_,P=S?Math.min(E,_):_,C=S?Math.max(E,_):_;h.draggingSelection=!0,p({start:P,end:C,shouldFocus:!0,anchor:E})},x=g=>{if(!h.draggingSelection||h.element.disabled===!0)return;f(g);let b=c.toLocal(g.global),_=Ub(h,b),S=h.selectionAnchor??_,E=Math.min(S,_),P=Math.max(S,_);p({start:E,end:P,anchor:S})},v=g=>{f(g),h.draggingSelection=!1},y=g=>{f(g),h.draggingSelection=!1,h.element.disabled!==!0&&t.inputDomBridge.focus(r.id,{selectionStart:h.selectionStart,selectionEnd:h.selectionEnd})};c.on("pointerdown",m),c.on("globalpointermove",x),c.on("pointerup",y),c.on("pointerupoutside",v),c.on("rightclick",f),c[wa]=h,ft(h,r),t.inputDomBridge.mount(r.id,{...r,value:h.value,callbacks:YH({element:r,runtime:h,eventHandler:n}),getGeometry:()=>gp(t,c,r)}),e.addChild(c),oe({animations:i,targetId:r.id,animationBus:s,completionTracker:o,element:c,targetState:{x:r.x,y:r.y,alpha:r.alpha},renderContext:a})};var ks=({eventHandler:t,eventName:e,element:r,eventConfig:i,snapshot:s})=>{!t||!i||t(e,{_event:{id:r.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload})},jH=({element:t,runtime:e,eventHandler:r})=>({onValueChange:i=>{e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.lastExternalValue=i.value,ft(e,t),ks({eventHandler:r,eventName:"change",element:t,eventConfig:t.change,snapshot:i})},onFocus:i=>{let s=e.nativeFocused===!0;e.nativeFocused=!0,e.focused=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.selectionAnchor=i.selectionStart===i.selectionEnd?i.selectionEnd:e.selectionAnchor,e.blinkVisible=!0,e.blinkTick=0,ft(e,t),!s&&ks({eventHandler:r,eventName:"focus",element:t,eventConfig:t.focusEvent,snapshot:i})},onBlur:i=>{e.nativeFocused=!1,e.focused=!1,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.blinkVisible=!1,e.composing=!1,ft(e,t),ks({eventHandler:r,eventName:"blur",element:t,eventConfig:t.blurEvent,snapshot:i})},onSelectionChange:i=>{e.nativeFocused=i.focused,e.focused=i.focused,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,i.selectionStart===i.selectionEnd&&(e.selectionAnchor=i.selectionEnd),ft(e,t),ks({eventHandler:r,eventName:"selectionChange",element:t,eventConfig:t.selectionChange,snapshot:i})},...t.submit&&{onSubmit:i=>{ks({eventHandler:r,eventName:"submit",element:t,eventConfig:t.submit,snapshot:i})}},onCompositionStart:i=>{e.composing=!0,ft(e,t),ks({eventHandler:r,eventName:"compositionStart",element:t,eventConfig:t.compositionStart,snapshot:i})},onCompositionUpdate:i=>{e.composing=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,ft(e,t),ks({eventHandler:r,eventName:"compositionUpdate",element:t,eventConfig:t.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{e.composing=!1,e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,ft(e,t),ks({eventHandler:r,eventName:"compositionEnd",element:t,eventConfig:t.compositionEnd,snapshot:i})}}),yF=({app:t,parent:e,prevElement:r,nextElement:i,eventHandler:s,zIndex:o})=>{let n=e.children.find(u=>u.label===r.id);if(!n)return;if(!t.inputDomBridge?.update)throw new Error("Input plugin requires app.inputDomBridge to be initialized");n.zIndex=o;let a=n[wa];if(!a)return;let l={...i},c=a.focused!==!0||i.value!==r.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),(!ye(r,i)||c)&&ft(a,l),t.inputDomBridge.update(i.id,{...l,value:a.value,callbacks:jH({element:l,runtime:a,eventHandler:s}),getGeometry:()=>gp(t,n,l)})};var _F=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o})=>{let n=e.getChildByLabel(r.id);if(!n)return;if(!t.inputDomBridge?.unmount)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let a=n[wa],l=()=>{n.destroyed||(a?.tickerListener&&t.ticker?.remove?.(a.tickerListener),t.inputDomBridge.unmount(r.id),n.destroy({children:!0}))};oe({animations:i,targetId:r.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:l})||l()};var bF=({state:t})=>{let e=Et(t),r=String(t.value??""),i=String(t.placeholder??"");return delete e.originX,delete e.originY,{...e,value:r,placeholder:i,multiline:t.multiline===!0,disabled:t.disabled===!0,...typeof t.submitOnEnter=="boolean"&&{submitOnEnter:t.submitOnEnter},...typeof t.maxLength=="number"&&{maxLength:Math.round(t.maxLength)},textStyle:mp(t.textStyle),padding:Bb(t.padding),fill:t.fill!==void 0?t.fill:Rb,border:Fb(t.border,Mb),focusRing:Fb(t.focusRing,Ib),...t.change&&{change:t.change},...t.submit&&{submit:t.submit},...t.focusEvent&&{focusEvent:t.focusEvent},...t.blurEvent&&{blurEvent:t.blurEvent},...t.selectionChange&&{selectionChange:t.selectionChange},...t.compositionStart&&{compositionStart:t.compositionStart},...t.compositionUpdate&&{compositionUpdate:t.compositionUpdate},...t.compositionEnd&&{compositionEnd:t.compositionEnd}}};var qH=dt({type:"input",add:xF,update:yF,delete:_F,parse:bF});var KH=24,ZH=24,Ro=(t,e,r)=>Math.min(r,Math.max(e,t)),SF=t=>Ro(t,0,1),Ea=t=>{t?.stopPropagation?.()},QH=t=>t?B.from(t):B.EMPTY,xp=({label:t})=>{let e=new ke(B.EMPTY);return e.label=t,e.eventMode="static",e.cursor="pointer",e},JH=({config:t,state:e})=>t?e?.pressed&&t.pressSrc?t.pressSrc:e?.hovered&&t.hoverSrc?t.hoverSrc:t.src??"":"",yp=({sprite:t,config:e,state:r,width:i,height:s})=>{t&&(t.texture=QH(JH({config:e,state:r})),t.width=Math.max(i,0),t.height=Math.max(s,0),t.visible=t.width>0&&t.height>0,t.eventMode=t.visible?"static":"none")},e4=t=>({root:`${t}-scrollbar-vertical`,track:`${t}-scrollbar-vertical-track`,thumb:`${t}-scrollbar-vertical-thumb`,startButton:`${t}-scrollbar-vertical-start-button`,endButton:`${t}-scrollbar-vertical-end-button`}),vF=(t,e)=>Math.abs(t-e)<.5,TF=({hasOverflow:t,minScroll:e,previousOffset:r,wasAtEnd:i,anchorToEnd:s})=>t?s&&(r===void 0||i)?e:typeof r=="number"?Ro(r,e,0):0:0,t4=({controller:t})=>{let e=e4(t.container.label),r=t.element.scrollbar?.vertical;if(!r)return null;let i=new ie({label:e.root});i.eventMode="static",i.cursor="pointer";let s=xp({label:e.track}),o=xp({label:e.thumb}),n={config:r,root:i,track:s,thumb:o,startButton:null,endButton:null,states:{track:{hovered:!1,pressed:!1},thumb:{hovered:!1,pressed:!1,dragging:!1},startButton:{hovered:!1,pressed:!1},endButton:{hovered:!1,pressed:!1}},dragOffsetY:0};i.addChild(s),i.addChild(o),r.startButton&&(n.startButton=xp({label:e.startButton}),i.addChild(n.startButton)),r.endButton&&(n.endButton=xp({label:e.endButton}),i.addChild(n.endButton));let a=()=>{wF({controller:t})};s.on("pointerover",()=>{n.states.track.hovered=!0,a()}),s.on("pointerout",()=>{n.states.track.hovered=!1,a()}),s.on("pointerdown",h=>{Ea(h),n.states.track.pressed=!0,a();let d=i.toLocal(h.global),{thumb:f}=n,p=t.viewportHeight;d.y<f.y?t.setScrollOffsets({y:t.scrollYOffset+p,source:"track"}):d.y>f.y+f.height&&t.setScrollOffsets({y:t.scrollYOffset-p,source:"track"})});let l=h=>{Ea(h),n.states.track.pressed=!1,a()};s.on("pointerup",l),s.on("pointerupoutside",l),o.on("pointerover",()=>{n.states.thumb.hovered=!0,a()}),o.on("pointerout",()=>{n.states.thumb.hovered=!1,n.states.thumb.dragging||a()}),o.on("pointerdown",h=>{Ea(h);let d=i.toLocal(h.global);n.states.thumb.pressed=!0,n.states.thumb.dragging=!0,n.dragOffsetY=d.y-n.thumb.y,a()});let c=h=>{if(Ea(h),!n.states.thumb.dragging){n.states.thumb.pressed=!1,a();return}n.states.thumb.dragging=!1,n.states.thumb.pressed=!1,a()};i.on("globalpointermove",h=>{if(!n.states.thumb.dragging)return;let d=i.toLocal(h.global),f=n.track.y,p=Math.max(n.track.height-n.thumb.height,0);if(p<=0||t.minScrollY===0){t.setScrollOffsets({y:0,source:"thumb"});return}let m=Ro(d.y-n.dragOffsetY,f,f+p),x=SF((m-f)/p);t.setScrollOffsets({y:t.minScrollY*x,source:"thumb"})}),o.on("pointerup",c),o.on("pointerupoutside",c),i.on("pointerup",c),i.on("pointerupoutside",c);let u=({sprite:h,config:d,state:f,deltaDirection:p})=>{if(!h||!d)return;h.on("pointerover",()=>{f.hovered=!0,a()}),h.on("pointerout",()=>{f.hovered=!1,a()}),h.on("pointerdown",x=>{Ea(x),f.pressed=!0,a(),t.setScrollOffsets({y:t.scrollYOffset+p*Math.max(d.step??KH,0),source:"button"})});let m=x=>{Ea(x),f.pressed=!1,a()};h.on("pointerup",m),h.on("pointerupoutside",m)};return u({sprite:n.startButton,config:r.startButton,state:n.states.startButton,deltaDirection:1}),u({sprite:n.endButton,config:r.endButton,state:n.states.endButton,deltaDirection:-1}),t.container.addChild(i),n},wF=({controller:t})=>{let e=t.verticalScrollbar;if(!e)return;let{config:r,root:i,track:s,thumb:o,startButton:n,endButton:a,states:l}=e,c=Math.max(r.thickness??0,0),u=n?Math.max(r.startButton?.size??c,0):0,h=a?Math.max(r.endButton?.size??c,0):0,d=Math.max(t.viewportHeight-u-h,0),f=Math.min(ZH,d),p=r.thumb?.length,m=typeof p=="number"?p:t.totalHeight>0?Math.round(t.viewportHeight/t.totalHeight*d):d,x=d>0?typeof p=="number"?Ro(m,0,d):Ro(m,f,d):0,v=Math.max(d-x,0),y=t.minScrollY===0?0:SF(t.scrollYOffset/t.minScrollY);i.visible=t.hasVerticalOverflow&&t.element.scroll&&c>0&&t.viewportHeight>0,i.x=Math.max(t.viewportWidth-c,0),i.y=0,s.x=0,s.y=u,yp({sprite:s,config:r.track,state:l.track,width:c,height:d}),o.x=0,o.y=u+v*y,yp({sprite:o,config:r.thumb,state:l.thumb,width:c,height:x}),n&&(n.x=0,n.y=0,yp({sprite:n,config:r.startButton,state:l.startButton,width:c,height:u})),a&&(a.x=0,a.y=t.viewportHeight-h,yp({sprite:a,config:r.endButton,state:l.endButton,width:c,height:h}))},EF=({container:t})=>{let e=t.__routeGraphicsScrollController;return e?{scrollXOffset:e.scrollXOffset,scrollYOffset:e.scrollYOffset,wasAtHorizontalEnd:e.hasHorizontalOverflow&&vF(e.scrollXOffset,e.minScrollX),wasAtVerticalEnd:e.hasVerticalOverflow&&vF(e.scrollYOffset,e.minScrollY)}:null},bu=({container:t,element:e,interactive:r=!0,allowViewportWithoutScroll:i=!1,previousState:s=null})=>{let o=0,n=0;e.children.forEach(u=>{o=Math.max(u.width+u.x,o),n=Math.max(u.height+u.y,n)});let a=!!(e.height&&n>e.height),l=!!(e.width&&o>e.width);if((e.scroll||i)&&(a||l)){let u=new ie({label:`${t.label}-content`});[...t.children].forEach(x=>{u.addChild(x)}),t.addChild(u);let d=new Ze({label:`${t.label}-clip`}).rect(0,0,e.width||o,e.height||n).fill({color:16711680,alpha:0});t.addChild(d),u.mask=d;let f=-(n-(e.height||n)),p=-(o-(e.width||o)),m={container:t,contentContainer:u,clip:d,element:e,totalWidth:o,totalHeight:n,viewportWidth:e.width||o,viewportHeight:e.height||n,hasHorizontalOverflow:l,hasVerticalOverflow:a,minScrollX:p,minScrollY:f,scrollXOffset:TF({hasOverflow:l,minScroll:p,previousOffset:s?.scrollXOffset,wasAtEnd:s?.wasAtHorizontalEnd,anchorToEnd:!!e.anchorToBottom}),scrollYOffset:TF({hasOverflow:a,minScroll:f,previousOffset:s?.scrollYOffset,wasAtEnd:s?.wasAtVerticalEnd,anchorToEnd:!!e.anchorToBottom}),verticalScrollbar:null,setScrollOffsets:({x,y:v})=>{let y=x??m.scrollXOffset,g=v??m.scrollYOffset;m.scrollXOffset=m.hasHorizontalOverflow?Ro(y,m.minScrollX,0):0,m.scrollYOffset=m.hasVerticalOverflow?Ro(g,m.minScrollY,0):0,m.contentContainer.x=m.scrollXOffset,m.contentContainer.y=m.scrollYOffset,wF({controller:m})}};t.__routeGraphicsScrollController=m,m.verticalScrollbar=t4({controller:m}),m.setScrollOffsets({x:m.scrollXOffset,y:m.scrollYOffset,source:"initial"}),r&&(t.eventMode="static",t.hitArea=new te(0,0,e.width||o,e.height||n),t.on("wheel",x=>{if(x.preventDefault(),a&&x.deltaY!==0&&m.setScrollOffsets({y:m.scrollYOffset-x.deltaY,source:"wheel"}),l&&(x.deltaX!==0||x.shiftKey&&x.deltaY!==0)){let v=x.deltaX!==0?x.deltaX:x.deltaY;m.setScrollOffsets({x:m.scrollXOffset-v,source:"wheel"})}}))}},Ob=({container:t})=>{let e=t.__routeGraphicsScrollController,r=t.children.find(o=>o.label&&o.label.endsWith("-content")),i=t.children.find(o=>o.label&&o.label.endsWith("-clip")),s=t.children.find(o=>o.label&&o.label.endsWith("-scrollbar-vertical"));r&&([...r.children].forEach(n=>{n.mask=null,t.addChild(n)}),t.removeChild(r),r.destroy({children:!1})),i&&(t.removeChild(i),i.destroy()),s&&(t.removeChild(s),s.destroy({children:!0})),t.eventMode="auto",t.hitArea=null,t.removeAllListeners("wheel"),e&&(t.__routeGraphicsScrollController=void 0)};var Lb=({container:t,element:e,enabled:r})=>{let i=Number.isFinite(e?.width)?e.width:0,s=Number.isFinite(e?.height)?e.height:0;if(r&&i>0&&s>0){t.hitArea=new te(0,0,i,s);return}t.hitArea=null},AF=(t,e)=>{let r=e??null;for(;r;){if(r===t)return!0;r=r.parent??null}return!1},Mo=(t,e)=>{let r=e??null;for(;r;){if(r===t)return!1;if(typeof r.label=="string"&&r.label.startsWith(`${t.label}-scrollbar-`))return!0;r=r.parent??null}return!1},r4=(t,e)=>{if(!e||typeof e.x!="number"||typeof e.y!="number")return!1;let r=t.toLocal(e),i=t.hitArea;return i?.contains?i.contains(r.x,r.y):!1},_p=({app:t,container:e,element:r,eventHandler:i})=>{let s=ab(e),o=lb(e),n=cb(e),a=s;e._cleanupScrollInteraction?.(),xa({root:e,isHovered:!1}),wo({root:e,isPressed:!1}),qi({root:e,isPressed:!1}),e.removeAllListeners("pointerover"),e.removeAllListeners("pointerout"),e.removeAllListeners("pointerdown"),e.removeAllListeners("pointerup"),e.removeAllListeners("pointerupoutside"),e.removeAllListeners("rightdown"),e.removeAllListeners("rightup"),e.removeAllListeners("rightupoutside"),e.removeAllListeners("rightclick"),e.cursor="auto",r.scroll||(e.eventMode="auto",Lb({container:e,element:r,enabled:!1}));let l=r?.hover,c=r?.click,u=r?.rightClick,h=r?.scrollUp,d=r?.scrollDown;if(!!(l||c||u||h||d)&&(e.eventMode="static",r.scroll?e.hitArea||Lb({container:e,element:r,enabled:!0}):Lb({container:e,element:r,enabled:!0})),l){let{cursor:p,soundSrc:m,payload:x,inheritToChildren:v}=l,y=b=>{AF(e,b?.relatedTarget)||a||(a=!0,x&&i&&i("hover",{_event:{id:e.label},...x}),p&&(e.cursor=p),m&&t.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1}),v&&xa({root:e,isHovered:!0}))},g=b=>{AF(e,b?.relatedTarget)||r4(e,b?.global)||a&&(a=!1,e.cursor="auto",v&&xa({root:e,isHovered:!1}))};e.on("pointerover",y),e.on("pointerout",g)}if(c){let{soundSrc:p,soundVolume:m,payload:x,inheritToChildren:v}=c,y=_=>{Ot(_)&&(Mo(e,_?.target)||v&&wo({root:e,isPressed:!0}))},g=_=>{Ot(_)&&(Mo(e,_?.target)||(v&&wo({root:e,isPressed:!1}),x&&i&&i("click",{_event:{id:e.label},...x}),p&&t.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1,volume:je(m)})))},b=_=>{Ot(_)&&(Mo(e,_?.target)||v&&wo({root:e,isPressed:!1}))};e.on("pointerdown",y),e.on("pointerup",g),e.on("pointerupoutside",b)}if(u){let{soundSrc:p,payload:m,inheritToChildren:x}=u,v=S=>{Mo(e,S?.target)||x&&qi({root:e,isPressed:!0})},y=S=>{Mo(e,S?.target)||x&&qi({root:e,isPressed:!1})},g=S=>{KI(S)&&(Mo(e,S?.target)||x&&qi({root:e,isPressed:!1}))},b=S=>{Mo(e,S?.target)||(x&&qi({root:e,isPressed:!1}),m&&i&&i("rightClick",{_event:{id:e.label},...m}),p&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:p,loop:!1}))},_=()=>{x&&qi({root:e,isPressed:!1})};e.on("rightdown",v),e.on("rightup",y),e.on("pointerup",g),e.on("rightclick",b),e.on("pointerupoutside",g),e.on("rightupoutside",_)}(h||d)&&Gr({canvas:t.canvas,displayObject:e,scrollUpEvent:h,scrollDownEvent:d,eventHandler:i}),l?.inheritToChildren&&s&&xa({root:e,isHovered:!0}),c?.inheritToChildren&&o&&wo({root:e,isPressed:!0}),u?.inheritToChildren&&n&&qi({root:e,isPressed:!0})},PF=({container:t})=>{ab(t)&&xa({root:t,isHovered:!0})},CF=({container:t})=>{lb(t)&&wo({root:t,isPressed:!0})},RF=({container:t})=>{cb(t)&&qi({root:t,isPressed:!0})};var MF=(t,e,r=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let c of t)i.add(c.id),s.set(c.id,c);for(let c of e)i.add(c.id),o.set(c.id,c);for(let c of i){let u=s.get(c),h=o.get(c);if(!u&&h)n.push(h);else if(u&&!h)a.push(u);else{let d=To(h),f=r instanceof Map?Array.from(r.keys()).some(p=>d.has(p)):r.find(p=>d.has(p.targetId));(!ye(u,h)||f)&&l.push({prev:u,next:h})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var bp=t=>t<.36363636363636365?7.5625*t*t:t<.7272727272727273?7.5625*(t-=.5454545454545454)*t+.75:t<.9090909090909091?7.5625*(t-=.8181818181818182)*t+.9375:7.5625*(t-=.9545454545454546)*t+.984375,i4=t=>t,s4=t=>t*t,o4=t=>1-(1-t)*(1-t),n4=t=>t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2,IF=Object.freeze({linear:i4,easeInQuad:s4,easeOutQuad:o4,easeInOutQuad:n4,easeInCubic:t=>t*t*t,easeOutCubic:t=>1-Math.pow(1-t,3),easeInOutCubic:t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,easeInQuart:t=>t*t*t*t,easeOutQuart:t=>1-Math.pow(1-t,4),easeInOutQuart:t=>t<.5?8*t*t*t*t:1-Math.pow(-2*t+2,4)/2,easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>1-Math.pow(1-t,5),easeInOutQuint:t=>t<.5?16*t*t*t*t*t:1-Math.pow(-2*t+2,5)/2,easeInSine:t=>1-Math.cos(t*Math.PI/2),easeOutSine:t=>Math.sin(t*Math.PI/2),easeInOutSine:t=>-(Math.cos(Math.PI*t)-1)/2,easeInExpo:t=>t===0?0:Math.pow(2,10*t-10),easeOutExpo:t=>t===1?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>t===0?0:t===1?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2,easeInCirc:t=>1-Math.sqrt(1-Math.pow(t,2)),easeOutCirc:t=>Math.sqrt(1-Math.pow(t-1,2)),easeInOutCirc:t=>t<.5?(1-Math.sqrt(1-Math.pow(2*t,2)))/2:(Math.sqrt(1-Math.pow(-2*t+2,2))+1)/2,easeInBack:t=>2.70158*t*t*t-1.70158*t*t,easeOutBack:t=>1+2.70158*Math.pow(t-1,3)+1.70158*Math.pow(t-1,2),easeInOutBack:t=>{let r=2.5949095;return t<.5?Math.pow(2*t,2)*((r+1)*2*t-r)/2:(Math.pow(2*t-2,2)*((r+1)*(t*2-2)+r)+2)/2},easeInBounce:t=>1-bp(1-t),easeOutBounce:bp,easeInOutBounce:t=>t<.5?(1-bp(1-2*t))/2:(1+bp(2*t-1))/2,easeInElastic:t=>{let e=2*Math.PI/3;return t===0?0:t===1?1:-Math.pow(2,10*t-10)*Math.sin((t*10-10.75)*e)},easeOutElastic:t=>{let e=2*Math.PI/3;return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t*10-.75)*e)+1},easeInOutElastic:t=>{let e=2*Math.PI/4.5;return t===0?0:t===1?1:t<.5?-(Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e))/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1}}),vp=Object.freeze(Object.keys(IF)),a4=(t="linear")=>{let e=IF[t];if(!e)throw new Error(`Unsupported easing: ${t}`);return e},Io=t=>{let e=[],r=0,i;return t.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,e.push({time:r,value:s,easing:"linear"});return}o!==void 0&&(r+=o,i=a?i+s:s,e.push({time:r,value:i,easing:n}))}),e},Aa=t=>{let e=0;for(let{timeline:r}of t){let i=r[r.length-1];i&&i.time>e&&(e=i.time)}return e},Bo=(t,e)=>{if(t.length===0)return 0;if(e<=t[0].time)return t[0].value;if(e>=t[t.length-1].time)return t[t.length-1].value;for(let r=0;r<t.length-1;r++){let{time:i,value:s}=t[r],{time:o,value:n,easing:a}=t[r+1];if(e>=i&&e<=o){let l=(e-i)/(o-i);return s+(n-s)*a4(a)(l)}}return t[t.length-1].value};var l4=t=>{t.customTickerHandler&&(typeof window<"u"&&window.removeEventListener("snapShotKeyFrame",t.customTickerHandler),t.customTickerHandler=void 0)},c4=(t,e)=>{e.tickerCallback&&(t?.ticker?.remove?.(e.tickerCallback),e.tickerCallback=void 0)},Gb=({app:t,particleElement:e}={})=>{e&&(c4(t,e),l4(e),e.emitter&&(e.emitter.destroy(),e.emitter=void 0))},Yt=({app:t,root:e}={})=>{if(!e)return;let r=[e];for(let i of r)i&&((i.emitter||i.tickerCallback||i.customTickerHandler)&&Gb({app:t,particleElement:i}),Array.isArray(i.children)&&i.children.length>0&&r.push(...i.children))};var u4={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},Db=t=>Math.min(1,Math.max(0,t));var Nb=t=>t.getLocalBounds().rectangle.clone(),Vb=t=>(t.width=Math.max(1,Math.ceil(t.width)),t.height=Math.max(1,Math.ceil(t.height)),t),h4=({app:t,displayObject:e,frame:r})=>{let i={x:e.x??0,y:e.y??0,scaleX:e.scale?.x??1,scaleY:e.scale?.y??1,rotation:e.rotation??0,alpha:e.alpha??1,skewX:e.skew?.x??0,skewY:e.skew?.y??0};try{return e.x=0,e.y=0,e.scale?.set?.(1,1),e.rotation=0,e.alpha=1,e.skew?.set?.(0,0),e.updateLocalTransform?.(),t.renderer.generateTexture({target:e,frame:r})}finally{e.x=i.x,e.y=i.y,e.scale?.set?.(i.scaleX,i.scaleY),e.rotation=i.rotation,e.alpha=i.alpha,e.skew?.set?.(i.skewX,i.skewY),e.updateLocalTransform?.()}},BF=(t,e)=>{let r=Vb(Nb(e)),i=e instanceof ke&&(e.filters?.length??0)===0,s=i?e.texture:h4({app:t,displayObject:e,frame:r}),o=new ke(s);i&&(o.tint=e.tint,o.blendMode=e.blendMode),o.x=r.x-(e.pivot?.x??0),o.y=r.y-(e.pivot?.y??0);let n=new ie;return n.x=e.x??0,n.y=e.y??0,n.scale.set(e.scale?.x??1,e.scale?.y??1),n.rotation=e.rotation??0,n.skew?.set?.(e.skew?.x??0,e.skew?.y??0),n.alpha=e.alpha??1,n.addChild(o),{wrapper:n,texture:s,ownsTexture:!i,width:r.width*Math.abs(n.scale.x),height:r.height*Math.abs(n.scale.y)}},d4=(t,e)=>{switch(t){case"x":return e.x;case"y":return e.y;default:return u4[t]??0}},f4=(t={},e)=>Object.entries(t).map(([r,i])=>({property:r,timeline:Io([{value:i.initialValue??d4(r,e)},...i.keyframes])})),Pa=(t,e)=>{if(!t?.wrapper||!e)return{duration:0,timelines:[],apply:()=>{}};let r=t.wrapper,i={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation,width:t.width,height:t.height},s=f4(e,i);return{duration:Aa(s),timelines:s,apply:o=>{r.x=i.x,r.y=i.y,r.alpha=i.alpha,r.scale.x=i.scaleX,r.scale.y=i.scaleY,r.rotation=i.rotation;for(let{property:n,timeline:a}of s){let l=Bo(a,o);switch(n){case"x":r.x=l;break;case"y":r.y=l;break;case"translateX":r.x=i.x+l*i.width;break;case"translateY":r.y=i.y+l*i.height;break;case"alpha":r.alpha=i.alpha*l;break;case"scaleX":r.scale.x=i.scaleX*l;break;case"scaleY":r.scale.y=i.scaleY*l;break;case"rotation":r.rotation=i.rotation+_o(l);break}}}}},p4=t=>{let e=new Set([0]);for(let r of t){e.add(r.duration);for(let{timeline:i}of r.timelines??[])for(let s=0;s<i.length;s++){let o=i[s].time;if(e.add(o),s===0)continue;let n=i[s-1].time,a=o-n;a<=0||(e.add(n+a*.25),e.add(n+a*.5),e.add(n+a*.75))}}return[...e].sort((r,i)=>r-i)},m4=t=>{if(t.length===0)return new te(0,0,1,1);let e=1/0,r=1/0,i=-1/0,s=-1/0;for(let o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x+o.width),s=Math.max(s,o.y+o.height);return new te(e,r,i-e,s-r)},g4=t=>Io([{value:t?.progress?.initialValue??0},...t?.progress?.keyframes??[]]),x4=t=>Io([{value:t.tween?.uProgress?.initialValue??0},...t.tween?.uProgress?.keyframes??[]]),LF=`
|
|
1301
1301
|
in vec2 aPosition;
|
|
1302
1302
|
out vec2 vTextureCoord;
|
|
1303
1303
|
out vec2 vSecondaryCoord;
|
|
@@ -1328,7 +1328,7 @@ void main(void)
|
|
|
1328
1328
|
vTextureCoord = filterTextureCoord();
|
|
1329
1329
|
vSecondaryCoord = (uSecondaryMatrix * vec3(vTextureCoord, 1.0)).xy;
|
|
1330
1330
|
}
|
|
1331
|
-
`,
|
|
1331
|
+
`,y4=`
|
|
1332
1332
|
in vec2 vTextureCoord;
|
|
1333
1333
|
in vec2 vSecondaryCoord;
|
|
1334
1334
|
out vec4 finalColor;
|
|
@@ -1500,7 +1500,7 @@ fn mainFragment(
|
|
|
1500
1500
|
|
|
1501
1501
|
return mix(prevColor, nextColor, reveal);
|
|
1502
1502
|
}
|
|
1503
|
-
`,
|
|
1503
|
+
`,_4=`
|
|
1504
1504
|
in vec2 vTextureCoord;
|
|
1505
1505
|
out vec4 finalColor;
|
|
1506
1506
|
|
|
@@ -1578,14 +1578,14 @@ fn mainFragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32>
|
|
|
1578
1578
|
|
|
1579
1579
|
return vec4(outputValue, outputValue, outputValue, 1.0);
|
|
1580
1580
|
}
|
|
1581
|
-
`,Tp=(t="red")=>{switch(t){case"green":return new Float32Array([0,1,0,0]);case"blue":return new Float32Array([0,0,1,0]);case"alpha":return new Float32Array([0,0,0,1]);default:return new Float32Array([1,0,0,0])}},UF=Tp("red"),vu=(t,e)=>xo.create({width:t,height:e,resolution:1}),g4=(t,e)=>{let r=new Ce({uMaskInvert:{value:e?1:0,type:"f32"},uMaskChannelWeights:{value:t,type:"vec4<f32>"}});return{filter:Br.from({gpu:{vertex:{source:kF,entryPoint:"mainVertex"},fragment:{source:kF,entryPoint:"mainFragment"}},gl:{vertex:LF,fragment:m4,name:"replace-mask-channel-filter"},resources:{maskChannelUniforms:r}}),maskChannelUniforms:r}},OF=({app:t,texture:e,width:r,height:i,channelWeights:s,invert:o=!1})=>{let n=B.from(e),a=new ke(n);a.width=r,a.height=i,a.filterArea=new te(0,0,r,i);let l=new ie;l.addChild(a);let c=vu(r,i),{filter:u}=g4(s,o);return a.filters=[u],t.renderer.render({container:l,target:c,clear:!0}),a.filters=[],l.destroy({children:!0}),u.destroy(),c},x4=(t,e,r,i)=>{if(!e)return{textures:[B.WHITE.source],channelWeights:Tp("red"),invert:0,destroy:()=>{}};if(e.kind==="single"){let s=OF({app:t,texture:e.texture,width:r,height:i,channelWeights:Tp(e.channel??"red"),invert:e.invert??!1});return{textures:[s.source],channelWeights:UF,invert:0,destroy:()=>{s.destroy(!0)}}}if(e.kind==="sequence"){let s=e.frames.map(o=>OF({app:t,texture:o.texture,width:r,height:i,channelWeights:Tp(e.channel??"red"),invert:e.invert??!1}));return{textures:s.map(o=>o.source),channelWeights:UF,invert:0,destroy:()=>{for(let o of s)o.destroy(!0)}}}throw new Error(`Unsupported replace mask kind: ${e.kind}.`)},y4=()=>{let t=new Ce({uProgress:{value:0,type:"f32"},uSoftness:{value:.001,type:"f32"},uMaskMix:{value:0,type:"f32"},uMaskInvert:{value:0,type:"f32"},uMaskDirectReveal:{value:0,type:"f32"},uMaskChannelWeights:{value:new Float32Array([1,0,0,0]),type:"vec4<f32>"},uSecondaryMatrix:{value:new V,type:"mat3x3<f32>"},uSecondaryClamp:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"}});return{filter:Br.from({gpu:{vertex:{source:FF,entryPoint:"mainVertex"},fragment:{source:FF,entryPoint:"mainFragment"}},gl:{vertex:LF,fragment:p4,name:"replace-mask-filter"},resources:{replaceMaskUniforms:t,uNextTexture:B.EMPTY.source,uMaskTextureA:B.EMPTY.source,uMaskTextureB:B.EMPTY.source}}),replaceMaskUniforms:t}},_4=({progress:t=0,frames:e=[],sampleMode:r="hold"}={})=>{if(e.length<=1)return{fromIndex:0,toIndex:0,mix:0};let i=Db(t);if(r==="linear"){if(i<=e[0].at)return{fromIndex:0,toIndex:0,mix:0};let o=e.length-1;if(i>=e[o].at)return{fromIndex:o,toIndex:o,mix:0};for(let n=0;n<e.length-1;n++){let a=e[n],l=e[n+1];if(i<=l.at){let c=l.at-a.at;return{fromIndex:n,toIndex:n+1,mix:c===0?0:(i-a.at)/c}}}return{fromIndex:o,toIndex:o,mix:0}}let s=0;for(let o=1;o<e.length&&!(i<e[o].at);o++)s=o;return{fromIndex:s,toIndex:s,mix:0}},b4=(t,e,r,i,s)=>{let o=d4(e),n=Aa([{timeline:o}]),a=Math.max(e?.softness??.001,1e-4),{textures:l,channelWeights:c,invert:u,destroy:h}=x4(t,e,r,i),d=s.resources.replaceMaskUniforms,f=-1,p=-1;return{duration:n,progressTimeline:o,apply:m=>{let x=e?.kind==="sequence"?_4({progress:m,frames:e.frames,sampleMode:e.sample??"hold"}):{fromIndex:0,toIndex:0,mix:0};x.fromIndex!==f&&(s.resources.uMaskTextureA=l[x.fromIndex]??B.EMPTY.source,f=x.fromIndex),x.toIndex!==p&&(s.resources.uMaskTextureB=l[x.toIndex]??B.EMPTY.source,p=x.toIndex),d.uniforms.uProgress=Db(m),d.uniforms.uSoftness=a,d.uniforms.uMaskMix=x.mix,d.uniforms.uMaskInvert=u,d.uniforms.uMaskDirectReveal=e?.kind==="sequence"?1:0,d.uniforms.uMaskChannelWeights=c,d.update()},destroy:h}},GF=(t,e)=>{let r=Math.max(1,t),i=Math.max(1,e);return new Float32Array([.5/r,.5/i,1-.5/r,1-.5/i])},v4=t=>{let e=new ie;for(let r of t)r?.wrapper&&e.addChild(r.wrapper);return Vb(Nb(e))},DF=(t,e)=>{let r=t.filter(o=>o?.wrapper);if(r.length===0)return v4(t);let i=new ie;for(let o of r)i.addChild(o.wrapper);let s=[];for(let o of u4(e)){for(let n of e)n.apply(o);s.push(Nb(i))}for(let o of e)o.apply(0);for(let o of r)o.wrapper.parent===i&&i.removeChild(o.wrapper);return i.destroy(),Vb(h4(s))},Us=({app:t,container:e,target:r,frame:i})=>{t.renderer.render({container:e,target:r,clear:!0,clearColor:[0,0,0,0],transform:new V(1,0,0,1,-i.x,-i.y)})},T4=(t,e)=>{!t||t.parent!==e||e.removeChild(t)},Ai=(t,e)=>{t?.wrapper&&!t.wrapper.destroyed&&(Yt({app:e,root:t.wrapper}),t.wrapper.destroy({children:!0})),t?.ownsTexture&&t.texture?.destroy(!0)},S4=({prevElement:t,nextElement:e,animation:r,prevSubject:i,nextSubject:s})=>{if(!i||!s||t?.id!==e?.id)return{prevSubject:i,nextSubject:s};let o=i,n=s;return r.mask!==void 0||r.compositor!==void 0?{prevSubject:o,nextSubject:n}:(r.prev===void 0&&(o=null),r.next===void 0&&(n=null),{prevSubject:o,nextSubject:n})},w4=({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s})=>{let o=new ie;o.zIndex=s,r?.wrapper&&o.addChild(r.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=Pa(r,e.prev?.tween),a=Pa(i,e.next?.tween);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),Yt({app:t,root:o}),o.destroy({children:!0}),Ai(r,t),Ai(i,t)}}},E4=({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s})=>{let o=Pa(r,e.prev?.tween),n=Pa(i,e.next?.tween),a=f4(e),l=Aa([{timeline:a}]),c=DF([r,i],[o,n]),u=new ie,h=new ie;r?.wrapper&&u.addChild(r.wrapper),i?.wrapper&&h.addChild(i.wrapper);let d=vu(c.width,c.height),f=vu(c.width,c.height),p=new ie;p.zIndex=s;let m=new ke(d);m.x=c.x,m.y=c.y,m.filterArea=new te(0,0,c.width,c.height),p.addChild(m);let x=gb({shader:e.compositor,width:c.width,height:c.height,progress:Bo(a,0),nextTextureSource:f.source,name:`route-graphics-transition-compositor-${e.id}`});m.filters=[x];let v=GF(c.width,c.height),y=typeof x.apply=="function"?x.apply.bind(x):(_,S,E,P)=>{_.applyFilter(x,S,E,P)};x.apply=(_,S,E,P)=>{let C=x.resources.shaderUniforms;C?.uniforms?.uNextTextureMatrix&&(_.calculateSpriteMatrix(C.uniforms.uNextTextureMatrix,m),C.uniforms.uNextTextureClamp=v,C.update()),y(_,S,E,P)};let g=!1,b=!1;return r?.wrapper||(Us({app:t,container:u,target:d,frame:c}),g=!0),i?.wrapper||(Us({app:t,container:h,target:f,frame:c}),b=!0),{overlay:p,duration:Math.max(o.duration,n.duration,l),apply:_=>{o.apply(_),n.apply(_),r?.wrapper&&(o.duration>0||!g)&&(Us({app:t,container:u,target:d,frame:c}),g=!0),i?.wrapper&&(n.duration>0||!b)&&(Us({app:t,container:h,target:f,frame:c}),b=!0),mb(x,c.width,c.height),rp(x,Bo(a,_))},destroy:()=>{p.removeFromParent(),m.filters=[],x.destroy(),Yt({app:t,root:p}),Yt({app:t,root:u}),Yt({app:t,root:h}),p.destroy({children:!0}),u.destroy({children:!0}),h.destroy({children:!0}),d.destroy(!0),f.destroy(!0),Ai(r,t),Ai(i,t)}}},A4=({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s})=>{let o=Pa(r,e.prev?.tween),n=Pa(i,e.next?.tween),a=DF([r,i],[o,n]),l=new ie,c=new ie;r?.wrapper&&l.addChild(r.wrapper),i?.wrapper&&c.addChild(i.wrapper);let u=vu(a.width,a.height),h=vu(a.width,a.height),d=new ie;d.zIndex=s;let f=new ke(u);f.x=a.x,f.y=a.y,f.filterArea=new te(0,0,a.width,a.height),d.addChild(f);let{filter:p}=y4();p.resources.uNextTexture=h.source,f.filters=[p];let m=GF(a.width,a.height),x=typeof p.apply=="function"?p.apply.bind(p):(b,_,S,E)=>{b.applyFilter(p,_,S,E)};p.apply=(b,_,S,E)=>{let P=p.resources.replaceMaskUniforms;b.calculateSpriteMatrix(P.uniforms.uSecondaryMatrix,f),P.uniforms.uSecondaryClamp=m,P.update(),x(b,_,S,E)};let v=b4(t,e.mask,a.width,a.height,p),y=!1,g=!1;return r?.wrapper||Us({app:t,container:l,target:u,frame:a}),i?.wrapper||Us({app:t,container:c,target:h,frame:a}),{overlay:d,duration:Math.max(o.duration,n.duration,v.duration),apply:b=>{o.apply(b),n.apply(b),r?.wrapper&&(o.duration>0||!y)&&(Us({app:t,container:l,target:u,frame:a}),y=!0),i?.wrapper&&(n.duration>0||!g)&&(Us({app:t,container:c,target:h,frame:a}),g=!0);let _=Db(Bo(v.progressTimeline,b));v.apply(_)},destroy:()=>{d.removeFromParent(),f.filters=[],p.destroy(),Yt({app:t,root:d}),Yt({app:t,root:l}),Yt({app:t,root:c}),d.destroy({children:!0}),l.destroy({children:!0}),c.destroy({children:!0}),u.destroy(!0),h.destroy(!0),Ai(r,t),Ai(i,t),v.destroy()}}},P4=({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s})=>e.compositor?E4({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s}):e.mask?A4({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s}):w4({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s}),C4=({app:t,parent:e,nextElement:r,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h})=>{if(!r)return null;let d=i.add({app:t,parent:e,element:r,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h});return d&&typeof d.then=="function"?d.then(()=>h?.aborted||e.destroyed?null:e.children.find(f=>f.label===r.id)??null):h?.aborted||e.destroyed?null:e.children.find(f=>f.label===r.id)??null},R4=async t=>t&&typeof t.then=="function"?t:t??null,Sp=({app:t,parent:e,prevElement:r,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,plugin:h,zIndex:d,signal:f})=>{if(!r&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||e.destroyed)return;let p=r?e.children.find(z=>z.label===r.id)??null:null;if(r&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${r.id}".`);let m=p?BF(t,p):null,x=s.playback?.continuity==="persistent",v=K_(s),y=x?new AbortController:null,g=y?.signal??f,b=new ie,_=Xf({suppressAnimations:!0}),S=!x,E=S?a.getVersion():null,P=!1,C=d,M=()=>{!S||P||(a.track(E),P=!0)},R=()=>{P&&(a.complete(E),P=!1)},F={value:null},U={value:null},W=!1,N=()=>{typeof n?.removePending=="function"&&n.removePending(s.id)},G=({zIndex:z}={})=>{typeof z=="number"&&(C=z,F.value&&!F.value.destroyed&&(F.value.zIndex=C),U.value?.overlay&&!U.value.overlay.destroyed&&(U.value.overlay.zIndex=C))},X=({flushDeferredEffects:z})=>{if(!W){if(W=!0,F.value&&!F.value.destroyed&&(F.value.visible=!0),U.value?.destroy(),z){LI(_);return}pu(_)}};x&&typeof n?.registerPending=="function"&&n.registerPending({id:s.id,animationType:s.type,targetId:s.targetId,signature:v,continuity:"persistent",playbackSpeed:s.playback?.speed,onCancel:()=>{y?.abort(),pu(_),Yt({app:t,root:b}),b.destroy({children:!0}),Ai(m,t),R()},onContinuationUpdate:G}),M();let $=z=>{if(g?.aborted||e.destroyed){N(),pu(_),Yt({app:t,root:b}),b.destroy({children:!0}),Ai(m,t),R();return}if(i&&!z)throw N(),pu(_),R(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);F.value=z;let le=z?BF(t,z):null,de=S4({prevElement:r,nextElement:i,animation:s,prevSubject:m,nextSubject:le});de.prevSubject!==m&&Ai(m,t),de.nextSubject!==le&&Ai(le,t),T4(z,b),Yt({app:t,root:b}),b.destroy({children:!0}),p&&h.delete({app:t,parent:e,element:r,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,signal:g}),z&&(z.zIndex=C,e.addChild(z),z.visible=!1);let be=P4({app:t,animation:s,prevSubject:de.prevSubject,nextSubject:de.nextSubject,zIndex:C});U.value=be,e.addChild(be.overlay);let Se={id:s.id,driver:"custom",animationType:s.type,targetId:s.targetId,signature:v,continuity:x?"persistent":"render",playbackSpeed:s.playback?.speed,onContinuationUpdate:G,duration:be.duration,deferCompletionUntilNextFrame:s.compositor!==void 0,applyFrame:be.apply,applyTargetState:()=>{X({flushDeferredEffects:!1})},onComplete:()=>{try{X({flushDeferredEffects:!0})}finally{R()}},onCancel:()=>{R()},isValid:()=>!!be.overlay&&!be.overlay.destroyed&&(!z||!z.destroyed)};x&&typeof n?.activatePending=="function"&&n.activatePending(s.id,Se)||(N(),n.dispatch({type:"START",payload:Se}))},D=i?C4({app:t,parent:b,nextElement:i,plugin:h,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:g}):null;if(D&&typeof D.then=="function"){R4(D).then($);return}$(D??null)};var Fo=({app:t,parent:e,prevComputedTree:r,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=Xf(),signal:u})=>{e.sortableChildren=!0;let h=new Map(l.map(_=>[_.type,_])),d=DI(s),f=new Map,p=new Map;for(let _ of r)f.set(_.id,_);for(let _=0;_<i.length;_++)p.set(i[_].id,_);let{toAddElement:m,toDeleteElement:x,toUpdateElement:v}=MF(r,i,s),y=new Set(v.map(({next:_})=>_.id)),g=_=>{let S=h.get(_);if(!S)throw new Error(`No plugin found for element type: ${_}`);return S},b=_=>e.children.find(S=>S.label===_)?.zIndex??-1;for(let _ of i){let S=f.get(_.id);!S||y.has(_.id)||!ye(S,_)||g(_.type).shouldUpdateUnchanged?.({app:t,parent:e,prevElement:S,nextElement:_,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(_.id)??-1,signal:u})!==!0||(v.push({prev:S,next:_}),y.add(_.id))}for(let _ of e.children){let S=p.get(_.label);S!==void 0&&(_.zIndex=S)}for(let _ of x){let S=c.suppressAnimations?null:qf(d,_.id),E=S&&typeof o?.hasContext=="function"&&o.hasContext(S.id),P=g(_.type);if(!E){if(S){Sp({app:t,parent:e,prevElement:_,nextElement:null,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:P,zIndex:b(_.id),signal:u});continue}P.delete({app:t,parent:e,element:_,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:u})}}for(let _ of m){let S=c.suppressAnimations?null:qf(d,_.id),E=S&&typeof o?.hasContext=="function"&&o.hasContext(S.id),P=g(_.type),C=p.get(_.id)??-1;if(E){typeof o?.updateContinuation=="function"&&o.updateContinuation(S.id,{zIndex:C});continue}if(S){Sp({app:t,parent:e,prevElement:null,nextElement:_,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:P,zIndex:C,signal:u});continue}P.add({app:t,parent:e,element:_,animations:d,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:C,signal:u})}for(let{prev:_,next:S}of v){let E=g(S.type),P=p.get(S.id)??-1,C=c.suppressAnimations?null:qf(d,S.id);if(C&&typeof o?.hasContext=="function"&&o.hasContext(C.id))typeof o?.updateContinuation=="function"&&o.updateContinuation(C.id,{zIndex:P});else if(C){Sp({app:t,parent:e,prevElement:_,nextElement:S,animation:C,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:P,signal:u});continue}E.update({app:t,parent:e,prevElement:_,nextElement:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:P,signal:u})}};var M4=(t=[])=>{let e=new Set;for(let r of t)if(r?.id){if(e.has(r.id))return!0;e.add(r.id)}return!1},I4=({app:t,container:e,children:r,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of r){let u=o.find(h=>h.type===c.type);if(!u)throw new Error(`No plugin found for child element type: ${c.type}`);u.add({app:t,parent:e,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},NF=({app:t,parent:e,element:r,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:u})=>{let{id:h,children:d,scroll:f,alpha:p}=r,m=new ie;m.label=h,m.zIndex=l,m.alpha=p,Ur(m,r);let x=zt(i,h);gt(m,r.blur,{force:x});let v=Qe(i,h);Oe(m,r.filters,{width:r.width,height:r.height,force:v}),e.addChild(m),d&&d.length>0&&(M4(d)?I4({app:t,container:m,children:d,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:u}):Fo({app:t,parent:m,prevComputedTree:[],nextComputedTree:d,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:u})),(f||r.anchorToBottom)&&bu({container:m,element:r,interactive:!!f,allowViewportWithoutScroll:!!r.anchorToBottom}),_p({app:t,container:m,element:r,eventHandler:s}),oe({animations:i,targetId:h,animationBus:o,completionTracker:c,element:m,targetState:{...Or(r,{alpha:p}),...Xt(r,{force:x}),...st(r,{force:v})},renderContext:a})};var VF=({app:t,parent:e,prevElement:r,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:u,signal:h})=>{let d=e.children.find(y=>y.label===r.id);if(!d)return;d.zIndex=c;let{alpha:f}=i,p=zt(o,r.id);p&>(d,r.blur,{force:!0});let m=Qe(o,r.id);m?Oe(d,r.filters,{width:r.width,height:r.height,force:!0}):Dr(d);let x=()=>{if(!ye(r,i)){d.label=i.id,d.alpha=f,d.scale.x=1,d.scale.y=1,Ur(d,i),gt(d,i.blur,{force:p}),Oe(d,i.filters,{width:i.width,height:i.height,force:m});let P=r.scroll||r.anchorToBottom,C=i.scroll||i.anchorToBottom,M=C?EF({container:d}):null;P!==C?C?bu({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:M}):Ob({container:d}):C&&(Ob({container:d}),bu({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:M})),_p({app:t,container:d,element:i,eventHandler:s})}let y=!ye(r.children,i.children),g=To({children:i.children}),b=Array.from(g).some(P=>jf(o,P).length>0),S=d.children.find(P=>P.label===`${i.id}-content`)||d,E=yb({parent:S,elements:i.children,animations:o});(y||b||E)&&(Fo({app:t,parent:S,nextComputedTree:i.children,prevComputedTree:r.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:u,renderContext:l,signal:h}),PF({container:d}),CF({container:d}),RF({container:d}))};oe({animations:o,targetId:r.id,animationBus:n,completionTracker:u,element:d,targetState:{...Or(i,{alpha:f}),...Xt(i,{force:p}),...st(i,{force:m})},onComplete:()=>{x()}})||x()};var HF=({app:t,parent:e,element:r,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=e.getChildByLabel(r.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(ub({root:a}),Yt({app:t,root:a}),e.removeChild(a),a.destroy({children:!0}))};oe({animations:s,targetId:r.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var WF=({state:t,parserPlugins:e=[]})=>{let r=t.direction==="horizontal"||t.direction==="vertical"?t.direction:"absolute",i=!!t.scroll,s=t.gapX??0,o=t.gapY??0,n=structuredClone(t.children||[]),a=[];if(t.gap!==void 0)throw new Error("Input Error: container.gap is no longer supported. Use gapX and gapY.");let l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,x=0,v=0;for(let b=0;b<n.length;b++){let _=n[b];b>0?r==="horizontal"?(_.x=u,_.y=p):r==="vertical"&&(_.x=m,_.y=h):(r==="horizontal"||r==="vertical")&&(_.x=0,_.y=0);let S=e.find(E=>E.type===_.type);if(S){let E=_.scaleX!==void 0||t.scaleX!==void 0,P=_.scaleY!==void 0||t.scaleY!==void 0,C=(_.scaleX??1)*(t.scaleX??1),M=(_.scaleY??1)*(t.scaleY??1);_=S.parse({state:{..._,...E?{scaleX:C}:{},...P?{scaleY:M}:{}},parserPlugins:e})}if(r==="horizontal"){let E=b<n.length-1?s:0;t.width&&_.width+x>t.width&&!i&&!t.anchorToBottom?(u=0,x=0,p+=d+o,d=_.height,_.x=0,_.y=p):d=Math.max(d,_.height),u+=_.width+E,x=_.x+_.width,l=Math.max(u,l),c=Math.max(_.height+_.y,c)}else if(r==="vertical"){let E=b<n.length-1?o:0;t.height&&_.height+v>t.height&&!i&&!t.anchorToBottom?(h=0,v=0,m+=f+s,f=_.width,_.x=m,_.y=0):f=Math.max(f,_.width),h+=_.height+E,v=_.y+_.height,l=Math.max(_.width+_.x,l),c=Math.max(h,c)}else l=Math.max(_.width+_.x,l),c=Math.max(_.height+_.y,c);a.push(_)}let g={...Et({...t,width:t.width?t.width:l,height:t.height?t.height:c}),children:a,direction:r,gapX:s,gapY:o,scroll:i,...t.anchorToBottom&&{anchorToBottom:!0},...t.scrollbar&&{scrollbar:structuredClone(t.scrollbar)},...t.blur!==void 0&&{blur:Is(t.blur)},rotation:t.rotation??0};return t.rightClick&&(g.rightClick=t.rightClick),t.scrollUp&&(g.scrollUp=t.scrollUp),t.scrollDown&&(g.scrollDown=t.scrollDown),g};var B4=dt({type:"container",add:NF,update:VF,delete:HF,parse:WF,shouldUpdateUnchanged:Nr});var $F=async({app:t,parent:e,element:r,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=new ie;if(c.label=r.id,c.zIndex=a,r.x!==void 0&&(c.x=Math.round(r.x)),r.y!==void 0&&(c.y=Math.round(r.y)),r.alpha!==void 0&&(c.alpha=r.alpha),e.addChild(c),oe({animations:i,targetId:r.id,animationBus:s,completionTracker:n,element:c,targetState:{x:r.x??c.x,y:r.y??c.y,alpha:r.alpha??c.alpha},renderContext:o}),o?.suppressAnimations&&!ua(r)){await ji({container:c,element:r,completionTracker:n,animationBus:s,zIndex:a,signal:l,app:t,playback:"paused-initial"}),Yf(o,{container:c,element:r,completionTracker:n,animationBus:s,zIndex:a,signal:l,app:t});return}await ji({container:c,element:r,completionTracker:n,animationBus:s,zIndex:a,signal:l,app:t,playback:"autoplay"})};var zF=(t={})=>JSON.stringify({content:t.content??null,revealEffect:t.revealEffect??"typewriter",softWipe:(t.revealEffect??"typewriter")==="softWipe"?bo(t.softWipe):null,speed:t.speed??50,initialRevealedCharacters:t.initialRevealedCharacters??0,width:t.width??null,indicator:t.indicator??null,x:t.x??null,y:t.y??null,alpha:t.alpha??1}),F4=(t,e)=>zF(t)!==zF(e),XF=async({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,renderContext:n,completionTracker:a,zIndex:l,signal:c})=>{if(c?.aborted)return;let u=e.children.find(f=>f.label===r.id);if(!u)return;let h=async()=>{if(i.x!==void 0&&(u.x=i.x),i.y!==void 0&&(u.y=i.y),i.alpha!==void 0&&(u.alpha=i.alpha),!F4(r,i)){n?.suppressAnimations!==!0&&!ua(i)&&await ji({container:u,element:i,completionTracker:a,animationBus:o,zIndex:l,signal:c,app:t,playback:"resume"});return}if(n?.suppressAnimations===!0&&!ua(i)){await ji({container:u,element:i,completionTracker:a,animationBus:o,zIndex:l,signal:c,app:t,playback:"paused-initial"}),Yf(n,{container:u,element:i,completionTracker:a,animationBus:o,zIndex:l,signal:c,app:t});return}await ji({container:u,element:i,completionTracker:a,animationBus:o,zIndex:l,signal:c,app:t,playback:"autoplay"})};oe({animations:s,targetId:r.id,animationBus:o,completionTracker:a,element:u,targetState:{x:i.x??u.x,y:i.y??u.y,alpha:i.alpha??u.alpha},onComplete:()=>{h()}})||await h()};var YF=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.getChildByLabel(e.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(Y_(o),o.destroy({children:!0}))};oe({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var k4=dt({type:"text-revealing",add:$F,update:XF,delete:YF,parse:RB,shouldUpdateUnchanged:({parent:t,nextElement:e})=>PI(t.children.find(r=>r.label===e.id))});var jF=async({app:t,parent:e,element:r,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let{id:c,x:u,y:h,width:d,height:f,src:p,atlas:m,clips:x,playback:v,alpha:y}=r,g=Qr(m),b=Jr(x,m?.animations,m?.meta,Object.keys(g.frames??{})),_=Lr({atlas:g,clips:b,playback:v}),S=n?.getVersion?.();n?.track?.(S);try{let E=new pi(B.from(p),g);if(await E.parse(),l?.aborted||e.destroyed)return;let{frameTextures:P}=aa({spritesheet:E,atlas:g,clips:b,playback:_}),C=new ws(P);C.label=c,C.zIndex=a,C.animationSpeed=la(_.fps),C.loop=_.loop,t.debug?na(C,c,t.debug,()=>{typeof t.render=="function"&&t.render()}):_.autoplay&&FI(o,C),C.x=Math.round(u),C.y=Math.round(h),C.width=Math.round(d),C.height=Math.round(f),C.alpha=y;let M=zt(i,c);gt(C,r.blur,{force:M});let R=Qe(i,c);Oe(C,r.filters,{width:d,height:f,force:R}),e.addChild(C),oe({animations:i,targetId:c,animationBus:s,completionTracker:n,element:C,targetState:{x:u,y:h,width:d,height:f,alpha:y,...Xt(r,{force:M}),...st(r,{force:R})},renderContext:o}),typeof t.render=="function"&&t.render()}finally{n?.complete?.(S)}};var qF=async({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=e.children.find(de=>de.label===r.id);if(!c)return;c.zIndex=a;let u=zt(s,r.id);u&>(c,r.blur,{force:!0});let h=Qe(s,r.id);h?Oe(c,r.filters,{width:r.width,height:r.height,force:!0}):Dr(c);let d=Qr(r.atlas),f=Jr(r.clips,r.atlas?.animations,r.atlas?.meta,Object.keys(d.frames??{})),p=Lr({atlas:d,clips:f,playback:r.playback}),m=i.src,x=Qr(i.atlas),v=Jr(i.clips,i.atlas?.animations,i.atlas?.meta,Object.keys(x.frames??{})),y=Lr({atlas:x,clips:v,playback:i.playback}),g=!ye(r.playback,i.playback),b=!ye(r.clips,i.clips),_=r.src!==m||!ye(r.atlas,i.atlas),S=!ye(p.frames,y.frames),E=_||b||S,P=g||b||_,C=!1,M=async({completeOnFinish:de=!0,renderAfterSync:be=!0}={})=>{if(l?.aborted||c.destroyed)return{synced:!1,completionVersion:void 0};if(c.animationSpeed=la(y.fps),c.loop=y.loop,!P||C)return{synced:!0,completionVersion:void 0};let Se=n?.getVersion?.();n?.track?.(Se);try{let et=new pi(B.from(m),x);if(await et.parse(),l?.aborted||c.destroyed)return{synced:!1,completionVersion:Se};let{frameTextures:I}=aa({spritesheet:et,atlas:x,clips:v,playback:y});c.textures=I,C=!0,be&&typeof t.render=="function"&&t.render(),!t.debug&&y.autoplay?c.play():(t.debug||c.stop?.(),r.id!==i.id&&(vo(c),na(c,i.id,t.debug,()=>{typeof t.render=="function"&&t.render()})))}finally{de&&n?.complete?.(Se)}return{synced:!0,completionVersion:Se}},R=async()=>{l?.aborted||c.destroyed||ye(r,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(c,i.blur,{force:u}),Oe(c,i.filters,{width:i.width,height:i.height,force:h}),await M())},{x:F,y:U,width:W,height:N,alpha:G}=i,X=da(s,r.id),$=X.length>0,D=de=>X.some(be=>Object.prototype.hasOwnProperty.call(be.tween??{},de)),z;if(E&&$){let de=c.width,be=c.height,Se=await M({completeOnFinish:!1,renderAfterSync:!1});if(!Se?.synced){n?.complete?.(Se?.completionVersion);return}c.width=Math.round(D("width")?de:W),c.height=Math.round(D("height")?be:N),typeof t.render=="function"&&t.render(),z=Se.completionVersion}let le=oe({animations:s,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{x:F,y:U,width:W,height:N,alpha:G,...Xt(i,{force:u}),...st(i,{force:h})},onComplete:()=>{R()}});z!==void 0&&n?.complete?.(z),le||await R()};var KF=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o})=>{let n=e.children.find(c=>c.label===r.id);if(!n)return;let a=()=>{t.debug&&vo(n),n&&!n.destroyed&&(n.stop(),n.destroy())};oe({animations:i,targetId:r.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var ZF=({state:t})=>{let e=Et(t),r=t.atlas,i=Qr(r),s=Jr(t.clips,r?.animations,r?.meta,Object.keys(i.frames??{})),o=Lr({atlas:i,clips:s,playback:t.playback});return{...e,type:"spritesheet-animation",src:t.src??"",atlas:i,clips:s,playback:o,alpha:t.alpha??1,...t.blur!==void 0&&{blur:Is(t.blur)}}};var QF=dt({type:"spritesheet-animation",add:jF,update:qF,delete:KF,parse:ZF,shouldUpdateUnchanged:Nr}),U4=QF;var O4=M_({type:"tween"});var ko=new Map,L4=t=>({id:t.id,url:t.src,loop:t.loop??!1,volume:je(t.volume,100)}),JF=t=>ko.has(t),Tu=t=>{let e=ko.get(t);e!==void 0&&(clearTimeout(e),ko.delete(t))},Hb=({app:t,element:e})=>{let r=L4(e);if(Tu(r.id),e.startDelayMs&&e.startDelayMs>0){let i=setTimeout(()=>{ko.delete(r.id),t.audioStage.add(r)},e.startDelayMs);ko.set(r.id,i);return}t.audioStage.add(r)},Wb=()=>{for(let t of ko.values())clearTimeout(t);ko.clear()},ek=({app:t,element:e})=>{Hb({app:t,element:e})};var tk=({app:t,prevElement:e,nextElement:r})=>{let i=e.id;if((r.startDelayMs??0)>0){t.audioStage.remove(i),Hb({app:t,element:r});return}if(JF(i)){Tu(i),t.audioStage.add({id:i,url:r.src,loop:r.loop??!1,volume:je(r.volume,100)});return}let o=t.audioStage.getById(i);if(!o){t.audioStage.add({id:i,url:r.src,loop:r.loop??!1,volume:je(r.volume,100)});return}o.url=r.src,o.loop=r.loop??!1,o.volume=je(r.volume,100)};var rk=({app:t,element:e})=>{Tu(e.id),t.audioStage.remove(e.id)};var G4=I_({type:"sound",add:ek,update:tk,delete:rk});var Su=class extends ke{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(e){super(),this.emitter=e,this.anchor.set(.5,.5)}init(e){this.maxLife=e,this.age=0,this.oneOverLife=1/e,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(e){this.destroyed||(this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy(e))}};function $b(t){let e=new Ze;return e.circle(0,0,3),e.fill({color:16777215}),t.renderer.generateTexture(e)}function zb(t){let e=new Ze;return e.rect(0,0,1,8),e.fill({color:8965375}),t.renderer.generateTexture(e)}function Xb(t){let e=new Ze;return e.circle(0,0,4),e.fill({color:16777215}),t.renderer.generateTexture(e)}function wu(t,e,r){return t+(e-t)*r}function Ep(t){if(typeof t=="number")return t;let e=t.replace(/^(#|0x)/,"");return parseInt(e,16)}function ik(t,e,r){let i=t>>16&255,s=t>>8&255,o=t&255,n=e>>16&255,a=e>>8&255,l=e&255,c=Math.round(wu(i,n,r)),u=Math.round(wu(s,a,r)),h=Math.round(wu(o,l,r));return c<<16|u<<8|h}var wp=class t{constructor(e,r,i=!1){this.value=i?Ep(e):e,this.time=r,this.next=null}static createList(e,r=!1){let i=[...e].sort((n,a)=>n.time-a.time),s=new t(i[0].value,i[0].time,r),o=s;for(let n=1;n<i.length;n++)o.next=new t(i[n].value,i[n].time,r),o=o.next;return s}},ei=class{constructor(e=!1){this.first=null,this.isColor=e,this.ease=null}reset(e){Array.isArray(e)?this.first=wp.createList(e,this.isColor):this.first=e}getValue(e){if(this.ease&&(e=this.ease(e)),!this.first.next||e<=this.first.time)return this.first.value;let r=this.first;for(;r.next&&r.next.time<e;)r=r.next;if(!r.next||e>=r.next.time)return r.next?r.next.value:r.value;let i=(e-r.time)/(r.next.time-r.time);return this.isColor?ik(r.value,r.next.value,i):wu(r.value,r.next.value,i)}};var Ap=class{static type="alpha";constructor(e){this.list=new ei(!1),this.list.reset(e.list)}initParticles(e){let r=e,i=this.list.getValue(0);for(;r;)r.alpha=i,r=r.next}updateParticle(e,r){e.alpha=this.list.getValue(e.agePercent)}},Pp=class{static type="alphaStatic";constructor(e){this.alpha=e.alpha}initParticles(e){let r=e;for(;r;)r.alpha=this.alpha,r=r.next}updateParticle(e,r){}};function sk(t,e,r){return Math.min(Math.max(t,e),r)}function jt(t,e){if(typeof e=="number")return e;let r=e.min,i=e.max??e.min;if(r===i)return r;let s=e.distribution;return!s||s.kind==="uniform"?r+t()*(i-r):s.kind==="bias"?r+D4(t,s)*(i-r):s.kind==="normal"?N4(t,r,i,s):r+t()*(i-r)}function D4(t,e){let r=e.toward??"min",i=sk(e.strength??.5,0,1),s=1+i*4;if(r==="max")return 1-Math.pow(1-t(),s);if(r==="center"){let o=(t()+t())/2;return t()*(1-i)+o*i}return Math.pow(t(),s)}function N4(t,e,r,i){let s=i.mean??(e+r)/2,o=i.deviation??(r-e)/6,n=Math.max(t(),1e-7),a=t(),l=Math.sqrt(-2*Math.log(n))*Math.cos(2*Math.PI*a);return sk(s+l*o,e,r)}var Cp=class{static type="scale";constructor(e){this.list=new ei(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let r=e;for(;r;){let i=this.minMult<1?r.emitter.random()*(1-this.minMult)+this.minMult:1;r.config.scaleMult=i;let s=this.list.getValue(0)*i;r.scale.set(s,s),r=r.next}}updateParticle(e,r){let i=this.list.getValue(e.agePercent)*e.config.scaleMult;e.scale.set(i,i)}},Rp=class{static type="scaleStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let r=e;for(;r;){let i=jt(r.emitter.random.bind(r.emitter),{min:this.min,max:this.max,distribution:this.distribution});r.scale.set(i,i),r=r.next}}updateParticle(e,r){}};var V4=Math.PI/180,Mp=class{static type="speed";constructor(e){this.list=new ei(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let r=e;for(;r;){let i=this.minMult<1?r.emitter.random()*(1-this.minMult)+this.minMult:1;r.config.speedMult=i;let s=this.list.getValue(0)*i;r.velocity.x=Math.cos(r.rotation)*s,r.velocity.y=Math.sin(r.rotation)*s,r=r.next}}updateParticle(e,r){let i=this.list.getValue(e.agePercent)*e.config.speedMult,s=Math.sqrt(e.velocity.x*e.velocity.x+e.velocity.y*e.velocity.y);s>0&&(e.velocity.x=e.velocity.x/s*i,e.velocity.y=e.velocity.y/s*i),e.x+=e.velocity.x*r,e.y+=e.velocity.y*r}},Ip=class{static type="speedStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let r=e;for(;r;){let i=jt(r.emitter.random.bind(r.emitter),{min:this.min,max:this.max,distribution:this.distribution});r.velocity.x=Math.cos(r.rotation)*i,r.velocity.y=Math.sin(r.rotation)*i,r=r.next}}updateParticle(e,r){e.x+=e.velocity.x*r,e.y+=e.velocity.y*r}},Bp=class{static type="movePoint";constructor(e){this.speed={min:e.speed.min,max:e.speed.max??e.speed.min,distribution:e.speed.distribution},this.direction=e.direction}initParticles(e){let r=e;for(;r;){let i=jt(r.emitter.random.bind(r.emitter),this.speed),s=jt(r.emitter.random.bind(r.emitter),this.direction)*V4;r.velocity.x=Math.cos(s)*i,r.velocity.y=Math.sin(s)*i,r=r.next}}updateParticle(e,r){e.x+=e.velocity.x*r,e.y+=e.velocity.y*r}};var PEe=Math.PI/180,Fp=class{static type="acceleration";constructor(e){this.accelX=e.accel.x,this.accelY=e.accel.y,this.minStart=e.minStart,this.maxStart=e.maxStart,this.rotate=e.rotate??!1,this.maxSpeed=e.maxSpeed??0}initParticles(e){let r=e;for(;r;){let i=r.emitter.random()*(this.maxStart-this.minStart)+this.minStart;r.velocity.x=Math.cos(r.rotation)*i,r.velocity.y=Math.sin(r.rotation)*i,r=r.next}}updateParticle(e,r){let i=e.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*r,i.y+=this.accelY*r,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}}e.x+=(s+i.x)/2*r,e.y+=(o+i.y)/2*r,this.rotate&&(e.rotation=Math.atan2(i.y,i.x))}},kp=class{static type="gravity";constructor(e){this.gravity=e.gravity}initParticles(e){}updateParticle(e,r){e.velocity.y+=this.gravity*r,e.x+=e.velocity.x*r,e.y+=e.velocity.y*r}};var Eu=Math.PI/180,Up=class{static type="rotation";constructor(e){this.startRange={min:e.minStart,max:e.maxStart??e.minStart,distribution:e.startDistribution},this.speedRange={min:e.minSpeed,max:e.maxSpeed??e.minSpeed,distribution:e.speedDistribution},this.accel=(e.accel??0)*Eu}initParticles(e){let r=e;for(;r;)r.rotation=jt(r.emitter.random.bind(r.emitter),this.startRange)*Eu,r.rotationSpeed=jt(r.emitter.random.bind(r.emitter),this.speedRange)*Eu,r=r.next}updateParticle(e,r){if(this.accel!==0){let i=e.rotationSpeed;e.rotationSpeed+=this.accel*r,e.rotation+=(i+e.rotationSpeed)/2*r}else e.rotation+=e.rotationSpeed*r}},Op=class{static type="rotationStatic";constructor(e){this.range={min:e.min,max:e.max??e.min,distribution:e.distribution}}initParticles(e){let r=e;for(;r;)r.rotation=jt(r.emitter.random.bind(r.emitter),this.range)*Eu,r=r.next}updateParticle(e,r){}},Lp=class{static type="noRotation";constructor(e){this.rotation=(e.rotation??0)*Eu}initParticles(e){let r=e;for(;r;)r.rotation=this.rotation,r=r.next}updateParticle(e,r){e.rotation=this.rotation}};var Gp=class{static type="color";constructor(e){this.list=new ei(!0),this.list.reset(e.list)}initParticles(e){let r=e,i=this.list.getValue(0);for(;r;)r.tint=i,r=r.next}updateParticle(e,r){e.tint=this.list.getValue(e.agePercent)}},Dp=class{static type="colorStatic";constructor(e){this.color=Ep(e.color)}initParticles(e){let r=e;for(;r;)r.tint=this.color,r=r.next}updateParticle(e,r){}};var Np=class{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}getRandPos(e,r){e.x=this.x+r.random()*this.w,e.y=this.y+r.random()*this.h}},Vp=class{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius,this.innerRadius=e.innerRadius??0,this.affectRotation=e.affectRotation??!1}getRandPos(e,r){let i=r.random()*Math.PI*2,s=this.radius-this.innerRadius,o=r.random()*s+this.innerRadius;e.x=this.x+Math.cos(i)*o,e.y=this.y+Math.sin(i)*o,this.affectRotation&&(e.rotation=i)}},Yb=class{constructor(e){this.x=e.x,this.y=e.y}getRandPos(e,r){e.x=this.x,e.y=this.y}},jb=class{constructor(e){this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2}getRandPos(e,r){let i=r.random();e.x=this.x1+(this.x2-this.x1)*i,e.y=this.y1+(this.y2-this.y1)*i}},H4={rect:Np,rectangle:Np,torus:Vp,circle:Vp,point:Yb,line:jb};var Hp=class{static type="spawnShape";constructor(e){let r=H4[e.type];if(!r)throw new Error(`Unknown spawn shape type: ${e.type}`);this.shape=new r(e.data)}initParticles(e){let r=e,i={x:0,y:0,rotation:void 0};for(;r;)this.shape.getRandPos(i,r.emitter),r.x=i.x,r.y=i.y,i.rotation!==void 0&&(r.rotation=i.rotation),r=r.next}updateParticle(e,r){}},Wp=class{static type="spawnBurst";constructor(e){this.x=e.x,this.y=e.y,this.spacing=(e.spacing??0)*Math.PI/180,this.startAngle=(e.startAngle??0)*Math.PI/180}initParticles(e){let r=e,i=this.startAngle;for(;r;)r.x=this.x,r.y=this.y,r.rotation=i,i+=this.spacing,r=r.next}updateParticle(e,r){}};var ok=Math.PI/180,$p=class{static type="movement";constructor(e={}){this.velocity=e.velocity??null,this.accelX=e.acceleration?.x??0,this.accelY=e.acceleration?.y??0,this.maxSpeed=e.maxSpeed??0,this.faceVelocity=e.faceVelocity??!1}initParticles(e){let r=e;for(;r;){if(this.velocity){let i=this.#t(r.emitter.random.bind(r.emitter)),s=jt(r.emitter.random.bind(r.emitter),this.velocity.speed);r.velocity.x=Math.cos(i)*s,r.velocity.y=Math.sin(i)*s,this.faceVelocity&&s>0&&(r.rotation=i)}r=r.next}}updateParticle(e,r){let i=e.velocity;if(this.accelX!==0||this.accelY!==0){let o=i.x,n=i.y;i.x+=this.accelX*r,i.y+=this.accelY*r,this.#e(i),e.x+=(o+i.x)/2*r,e.y+=(n+i.y)/2*r}else this.#e(i),e.x+=i.x*r,e.y+=i.y*r;this.faceVelocity&&Math.sqrt(i.x*i.x+i.y*i.y)>0&&(e.rotation=Math.atan2(i.y,i.x))}#t(e){return this.velocity?this.velocity.kind==="radial"?jt(e,this.velocity.angle??{min:0,max:360})*ok:jt(e,this.velocity.direction??0)*ok:0}#e(e){if(this.maxSpeed<=0)return;let r=Math.sqrt(e.x*e.x+e.y*e.y);if(r>this.maxSpeed&&r>0){let i=this.maxSpeed/r;e.x*=i,e.y*=i}}};var nk=new Map,ak=new Map;function qb(t,e){nk.set(t,e)}function Lt(t){ak.set(t.type,t)}function lk(t,e){let r=nk.get(t);return r?r(e):null}function ck(t){return ak.get(t)}qb("circle",Xb);qb("snowflake",$b);qb("raindrop",zb);Lt(Ap);Lt(Pp);Lt(Cp);Lt(Rp);Lt(Mp);Lt(Ip);Lt(Bp);Lt(Fp);Lt(kp);Lt(Up);Lt(Op);Lt(Lp);Lt(Gp);Lt(Dp);Lt(Hp);Lt(Wp);Lt($p);var zp=class{constructor(e){this.seed=e,this.state=e}next(){let e=this.state+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};function W4(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t.mode=="string"&&Array.isArray(t.items)}var Au=class{container=null;texture=null;textureSelector=null;_textureCycleIndex=0;_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(e,r){this.container=e,this.init(r)}init(e){if(this.rng=e.seed!==void 0&&e.seed!==null?new zp(e.seed):null,e.texture&&(W4(e.texture)?(this.textureSelector=e.texture,this.texture=e.texture.items[0]?.texture??null):(this.textureSelector=null,this.texture=e.texture)),this._textureCycleIndex=0,e.lifetime&&(this.lifetime.min=e.lifetime.min??1,this.lifetime.max=e.lifetime.max??e.lifetime.min??2,this.lifetime.distribution=e.lifetime.distribution),this.frequency=e.frequency??.1,this.particlesPerWave=e.particlesPerWave??1,this.maxParticles=e.maxParticles??1e3,this.emitterLifetime=e.emitterLifetime??-1,this.spawnBounds=null,this.recycleOnBounds=!1,e.spawnBounds&&(this.spawnBounds=e.spawnBounds,this.recycleOnBounds=e.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],e.behaviors)for(let r of e.behaviors){let i=ck(r.type);if(!i){console.warn(`Unknown behavior type: ${r.type}`);continue}let s=new i(r.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=e.emit??!0}_createParticle(){let e;return this._poolFirst?(e=this._poolFirst,this._poolFirst=e.next,e.next=null):e=new Su(this),e}_unlinkActiveParticle(e){return!e||!(e===this._activeFirst||e===this._activeLast||e.prev!==null||e.next!==null)?!1:(e.prev?e.prev.next=e.next:this._activeFirst=e.next,e.next?e.next.prev=e.prev:this._activeLast=e.prev,e.prev=null,e.next=null,this._activeFirst?this.particleCount=Math.max(0,this.particleCount-1):(this._activeLast=null,this.particleCount=0),!0)}spawn(e){if(this.destroyed||e<=0)return null;let r=this.maxParticles-this.particleCount;if(e=Math.min(e,r),e<=0)return null;let i=this.textureSelector?.pick==="perWave"?this._pickTexture():null,s=null,o=null;for(let n=0;n<e;n++){let a=this._createParticle();a.texture=i??this._pickTexture();let l=jt(this.random.bind(this),this.lifetime);a.init(l),s||(s=a),o&&(o.next=a,a.prev=o),o=a,this.container.addChild(a)}for(let n of this.initBehaviors)n.initParticles(s);return this._activeLast?(this._activeLast.next=s,s.prev=this._activeLast):this._activeFirst=s,this._activeLast=o,this.particleCount+=e,s}emitNow(){this.spawn(this.particlesPerWave)}recycle(e){if(!e||e.destroyed){this._unlinkActiveParticle(e);return}for(let r of this.recycleBehaviors)r.recycleParticle(e);this._unlinkActiveParticle(e)&&(e.parent&&e.parent.removeChild(e),e.next=this._poolFirst,this._poolFirst=e)}update(e){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=e,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=e;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let r=this._activeFirst;for(;r;){let i=r.next;if(r.destroyed||!r.position){this._unlinkActiveParticle(r),r=i;continue}if(r.age+=e,r.age>=r.maxLife){this.recycle(r),r=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(r.x<s.x||r.x>s.x+s.width||r.y<s.y||r.y>s.y+s.height){this.recycle(r),r=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(r,e);r=i}}stop(e=!1){if(this.emit=!1,e)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()}_pickTexture(){if(!this.textureSelector)return this.texture;let{mode:e,items:r}=this.textureSelector;if(!r.length)return this.texture;if(e==="cycle"){let i=r[this._textureCycleIndex%r.length];return this._textureCycleIndex+=1,i.texture}if(e==="random"){let i=r.reduce((o,n)=>o+(n.weight??1),0),s=this.random()*i;for(let o of r)if(s-=o.weight??1,s<=0)return o.texture;return r[r.length-1].texture}return r[0].texture}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let e=this._activeFirst;for(;e;){let r=e.next;e.destroy(),e=r}for(e=this._poolFirst;e;){let r=e.next;e.destroy(),e=r}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function $4(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t.mode=="string"&&Array.isArray(t.items)}function z4(t,e){let r=new Ze,i=e.color??"#ffffff";switch(e.shape){case"circle":{let s=e.radius??3;r.circle(0,0,s),r.fill({color:i});break}case"ellipse":{let s=e.width??2,o=e.height??6;r.ellipse(0,0,s/2,o/2),r.fill({color:i});break}case"rect":{let s=e.width??4,o=e.height??4;r.rect(-s/2,-o/2,s,o),r.fill({color:i});break}default:r.circle(0,0,3),r.fill({color:i})}return t.renderer.generateTexture(r)}function uk(t,e){if(typeof e=="object"&&e?.shape)return z4(t,e);let r=e??"circle",i=lk(r,t);if(!i)try{i=B.from(r)}catch{return console.warn(`Failed to load particle texture: ${r}`),null}return i}function X4(t,e){let r=[];for(let i of e.items){let s=i.src?i.src:i,o=uk(t,s);if(!o)return null;r.push(i.weight===void 0?{texture:o}:{texture:o,weight:i.weight})}return{mode:e.mode,pick:e.pick??"perParticle",items:r}}var Pu=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o,renderContext:n,zIndex:a})=>{let l=new ie;l.label=r.id,l.zIndex=a,e.addChild(l);let c=r.width,u=r.height;l.x=r.x??0,l.y=r.y??0;let h={lifetime:r.emitter?.lifetime??{min:1,max:2},frequency:r.emitter?.frequency??.1,particlesPerWave:r.emitter?.particlesPerWave??1,maxParticles:r.emitter?.maxParticles??r.count??100,emitterLifetime:r.emitter?.emitterLifetime??-1,spawnBounds:r.emitter?.spawnBounds,recycleOnBounds:r.emitter?.recycleOnBounds??!1,seed:r.emitter?.seed,behaviors:r.behaviors},d=$4(r.texture)?X4(t,r.texture):uk(t,r.texture);if(!d)return;h.texture=d;let f=new Au(l,h);l.emitter=f;let p=h.frequency<=0;if(p){f.emitNow(),f.emit=!1;let x=v=>{if(!v.length)return;let[y,...g]=v;(y===0&&typeof requestAnimationFrame=="function"?requestAnimationFrame:_=>setTimeout(_,y))(()=>{f.destroyed||f.particleCount>0||(f.emitNow(),x(g))})};x([0,50,150])}if(h.recycleOnBounds&&!p){let x=Math.min(r.count??100,h.maxParticles);f.spawn(x);let v=f._activeFirst;for(;v;)v.y=f.random()*u,v.age=f.random()*v.maxLife*.8,v=v.next}let m=x=>{if(f.destroyed){t.ticker.remove(m);return}let v=Math.min(typeof x.deltaMS=="number"?x.deltaMS/1e3:x.deltaTime/60,.1);f.update(v)};l.tickerCallback=m,UI(n,{app:t,emitter:f,container:l,tickerCallback:m}),r.alpha!==void 0&&(l.alpha=r.alpha),oe({animations:i,targetId:r.id,animationBus:s,completionTracker:o,element:l,targetState:{x:r.x??0,y:r.y??0,alpha:r.alpha??l.alpha},renderContext:n})};var Xp=({app:t,parent:e,element:r,animationBus:i,animations:s,completionTracker:o})=>{let n=e.getChildByLabel(r.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(Gb({app:t,particleElement:n}),n.destroy({children:!0}))};oe({animations:s,targetId:r.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var hk=({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=e.children.find(h=>h.label===r.id);if(!c){Pu({app:t,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});return}if(c.zIndex=l,Y4(r,i))Xp({app:t,parent:e,element:r,animations:s,animationBus:o,completionTracker:n}),Pu({app:t,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});else{let h=()=>{i.alpha!==void 0&&(c.alpha=i.alpha),i.x!==void 0&&(c.x=i.x),i.y!==void 0&&(c.y=i.y)};oe({animations:s,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{x:i.x??c.x,y:i.y??c.y,alpha:i.alpha??c.alpha},onComplete:h})||h()}};function Y4(t,e){return t.count!==e.count||!ye(t.texture,e.texture)||!ye(t.behaviors,e.behaviors)||!ye(t.emitter,e.emitter)||t.width!==e.width||t.height!==e.height}function Kb(t){if(!t.id)throw new Error("Input Error: Id is missing");if(!Object.values(Tr).includes(t.type))throw new Error("Input Error: Type must be one of "+Object.values(Tr).join(", "));if(typeof t.width!="number"||typeof t.height!="number")throw new Error("Input Error: Width and height must be numbers");if(t.width<=0||t.height<=0)throw new Error("Input Error: Width and height must be positive")}function dk(t){if(!t.texture)throw new Error("Input Error: Particles require 'texture'");let e=typeof t.texture=="string",r=typeof t.texture=="object"&&t.texture!==null&&!Array.isArray(t.texture);if(!e&&!r)throw new Error("Input Error: texture must be a string or shape object");if(r){if(!t.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(t.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${t.texture.shape}'`)}}function fk(t){if(!t.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(t.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(t.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let e=0;e<t.behaviors.length;e++){let r=t.behaviors[e];if(typeof r!="object"||r===null||Array.isArray(r))throw new Error(`Input Error: behaviors[${e}] must be an object`);if(!r.type||typeof r.type!="string")throw new Error(`Input Error: behaviors[${e}] must have a 'type' string property`)}}function pk(t){if(!t.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof t.emitter!="object"||Array.isArray(t.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!t.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof t.emitter.lifetime!="object"||Array.isArray(t.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof t.emitter.lifetime.min!="number"||typeof t.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(t.emitter.lifetime.min<0||t.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(t.emitter.lifetime.min>t.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function mk(t){if(t.emitter.frequency!==void 0){if(typeof t.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(t.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(t.emitter.particlesPerWave!==void 0){if(typeof t.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(t.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(t.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(t.emitter.maxParticles!==void 0){if(typeof t.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(t.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(t.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function gk(t){if(t.count!==void 0){if(typeof t.count!="number")throw new Error("Input Error: count must be a number");if(t.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(t.count))throw new Error("Input Error: count must be an integer")}if(t.alpha!==void 0){if(typeof t.alpha!="number")throw new Error("Input Error: alpha must be a number");if(t.alpha<0||t.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(t.x!==void 0&&typeof t.x!="number")throw new Error("Input Error: x must be a number");if(t.y!==void 0&&typeof t.y!="number")throw new Error("Input Error: y must be a number")}var j4=new Set(["continuous","burst"]),q4=new Set(["point","rect","circle","line"]),K4=new Set(["single","random","cycle"]),Z4=new Set(["perParticle","perWave"]),xk=new Set(["uniform","normal","bias"]),yk=new Set(["min","max","center"]),Q4=new Set(["none","fixed","random","spin"]);function Tk(t){if(J4(t),!t.modules||typeof t.modules!="object"||Array.isArray(t.modules))throw new Error("Input Error: Particles require 'modules'");let{emission:e,movement:r,appearance:i,bounds:s}=t.modules;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Input Error: modules.emission must be an object");if(!i||typeof i!="object"||Array.isArray(i))throw new Error("Input Error: modules.appearance must be an object");eW(e),rW(r,i),iW(i),lW(s)}function J4(t){if(t.texture!==void 0||t.behaviors!==void 0||t.emitter!==void 0)throw new Error("Input Error: Structured particles cannot mix 'modules' with legacy texture/behaviors/emitter fields");if(t.count!==void 0)throw new Error("Input Error: Structured particles do not support legacy 'count'");if(t.alpha!==void 0&&(_e(t.alpha,"alpha"),t.alpha<0||t.alpha>1))throw new Error("Input Error: alpha must be between 0 and 1");t.x!==void 0&&_e(t.x,"x"),t.y!==void 0&&_e(t.y,"y"),t.seed!==void 0&&_e(t.seed,"seed")}function eW(t){if(!j4.has(t.mode))throw new Error("Input Error: modules.emission.mode must be 'continuous' or 'burst'");if(t.mode==="continuous"){if(_e(t.rate,"modules.emission.rate"),t.rate<=0)throw new Error("Input Error: modules.emission.rate must be positive")}else if(vk(t.burstCount,"modules.emission.burstCount"),t.burstCount<=0)throw new Error("Input Error: modules.emission.burstCount must be positive");if(t.maxActive!==void 0&&(vk(t.maxActive,"modules.emission.maxActive"),t.maxActive<=0))throw new Error("Input Error: modules.emission.maxActive must be positive");if(t.duration!==void 0&&t.duration!=="infinite"&&(_e(t.duration,"modules.emission.duration"),t.duration<0))throw new Error("Input Error: modules.emission.duration must be non-negative");if(Os(t.particleLifetime,"modules.emission.particleLifetime",{allowNegative:!1}),!t.source||typeof t.source!="object"||Array.isArray(t.source))throw new Error("Input Error: modules.emission.source must be an object");if(!q4.has(t.source.kind))throw new Error("Input Error: modules.emission.source.kind must be one of point, rect, circle, line");if(!t.source.data||typeof t.source.data!="object"||Array.isArray(t.source.data))throw new Error("Input Error: modules.emission.source.data must be an object");tW(t.source.kind,t.source.data)}function tW(t,e){if(t==="point"){_e(e.x,"modules.emission.source.data.x"),_e(e.y,"modules.emission.source.data.y");return}if(t==="rect"){if(_e(e.x,"modules.emission.source.data.x"),_e(e.y,"modules.emission.source.data.y"),_e(e.width,"modules.emission.source.data.width"),_e(e.height,"modules.emission.source.data.height"),e.width<=0||e.height<=0)throw new Error("Input Error: modules.emission.source.data.width and height must be positive");return}if(t==="circle"){if(_e(e.x,"modules.emission.source.data.x"),_e(e.y,"modules.emission.source.data.y"),_e(e.radius,"modules.emission.source.data.radius"),e.radius<=0)throw new Error("Input Error: modules.emission.source.data.radius must be positive");if(e.innerRadius!==void 0&&(_e(e.innerRadius,"modules.emission.source.data.innerRadius"),e.innerRadius<0||e.innerRadius>e.radius))throw new Error("Input Error: modules.emission.source.data.innerRadius must be between 0 and radius");if(e.affectRotation!==void 0&&typeof e.affectRotation!="boolean")throw new Error("Input Error: modules.emission.source.data.affectRotation must be a boolean");return}_e(e.x1,"modules.emission.source.data.x1"),_e(e.y1,"modules.emission.source.data.y1"),_e(e.x2,"modules.emission.source.data.x2"),_e(e.y2,"modules.emission.source.data.y2")}function rW(t,e){if(t!==void 0){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Input Error: modules.movement must be an object");if(t.velocity!==void 0){if(!t.velocity||typeof t.velocity!="object"||Array.isArray(t.velocity))throw new Error("Input Error: modules.movement.velocity must be an object");let{velocity:r}=t;if(r.kind!=="directional"&&r.kind!=="radial")throw new Error("Input Error: modules.movement.velocity.kind must be 'directional' or 'radial'");Os(r.speed,"modules.movement.velocity.speed",{allowNegative:!1}),r.kind==="directional"?Os(r.direction,"modules.movement.velocity.direction",{allowNegative:!0}):r.angle!==void 0&&Os(r.angle,"modules.movement.velocity.angle",{allowNegative:!0})}if(t.acceleration!==void 0){if(!t.acceleration||typeof t.acceleration!="object"||Array.isArray(t.acceleration))throw new Error("Input Error: modules.movement.acceleration must be an object");_e(t.acceleration.x,"modules.movement.acceleration.x"),_e(t.acceleration.y,"modules.movement.acceleration.y")}if(t.maxSpeed!==void 0&&(_e(t.maxSpeed,"modules.movement.maxSpeed"),t.maxSpeed<0))throw new Error("Input Error: modules.movement.maxSpeed must be non-negative");if(t.faceVelocity!==void 0&&typeof t.faceVelocity!="boolean")throw new Error("Input Error: modules.movement.faceVelocity must be a boolean");if(!t.velocity&&!t.acceleration)throw new Error("Input Error: modules.movement must define velocity, acceleration, or both");if(t.faceVelocity&&e?.rotation&&e.rotation.mode!=="none")throw new Error("Input Error: modules.appearance.rotation cannot be combined with modules.movement.faceVelocity")}}function iW(t){sW(t.texture),t.scale!==void 0&&_k(t.scale,"modules.appearance.scale",{allowNegative:!1,modes:["single","range","curve"]}),t.alpha!==void 0&&_k(t.alpha,"modules.appearance.alpha",{min:0,max:1,modes:["single","curve"]}),t.color!==void 0&&nW(t.color,"modules.appearance.color"),t.rotation!==void 0&&aW(t.rotation)}function sW(t){if(t===void 0)throw new Error("Input Error: modules.appearance.texture is required");if(typeof t!="string"){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Input Error: modules.appearance.texture must be a string or object");if(t.shape){Sk(t,"modules.appearance.texture");return}if(!K4.has(t.mode))throw new Error("Input Error: modules.appearance.texture.mode must be 'single', 'random', or 'cycle'");if(t.pick!==void 0&&!Z4.has(t.pick))throw new Error("Input Error: modules.appearance.texture.pick must be 'perParticle' or 'perWave'");if(!Array.isArray(t.items)||t.items.length===0)throw new Error("Input Error: modules.appearance.texture.items must be a non-empty array");if(t.mode==="single"&&t.items.length!==1)throw new Error("Input Error: modules.appearance.texture.mode 'single' requires exactly one item");for(let e=0;e<t.items.length;e++){let r=t.items[e];oW(r,`modules.appearance.texture.items[${e}]`)}}}function oW(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be an object`);if(t.src!==void 0){if(typeof t.src!="string"||t.src.length===0)throw new Error(`Input Error: ${e}.src must be a non-empty string`)}else if(t.shape)Sk(t,e);else throw new Error(`Input Error: ${e} must define either 'src' or shape fields`);if(t.weight!==void 0&&(_e(t.weight,`${e}.weight`),t.weight<=0))throw new Error(`Input Error: ${e}.weight must be positive`)}function Sk(t,e){if(!["circle","ellipse","rect"].includes(t.shape))throw new Error(`Input Error: ${e}.shape must be 'circle', 'ellipse', or 'rect'`);if(t.radius!==void 0&&_e(t.radius,`${e}.radius`),t.width!==void 0&&_e(t.width,`${e}.width`),t.height!==void 0&&_e(t.height,`${e}.height`),t.color!==void 0&&typeof t.color!="string"&&typeof t.color!="number")throw new Error(`Input Error: ${e}.color must be a string or number`)}function _k(t,e,r){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be an object`);if(!r.modes.includes(t.mode))throw new Error(`Input Error: ${e}.mode must be one of ${r.modes.join(", ")}`);if(t.mode==="single"){Cu(t.value,`${e}.value`,r);return}if(t.mode==="range"){Os(t,e,r);return}if(!Array.isArray(t.keys)||t.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let i=-1/0;for(let s=0;s<t.keys.length;s++){let o=t.keys[s];if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`Input Error: ${e}.keys[${s}] must be an object`);if(_e(o.time,`${e}.keys[${s}].time`),o.time<0||o.time>1)throw new Error(`Input Error: ${e}.keys[${s}].time must be between 0 and 1`);if(o.time<i)throw new Error(`Input Error: ${e}.keys must be sorted by time`);i=o.time,Cu(o.value,`${e}.keys[${s}].value`,r)}}function nW(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be an object`);if(t.mode==="single"){bk(t.value,`${e}.value`);return}if(t.mode!=="gradient")throw new Error("Input Error: modules.appearance.color.mode must be 'single' or 'gradient'");if(!Array.isArray(t.keys)||t.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let r=-1/0;for(let i=0;i<t.keys.length;i++){let s=t.keys[i];if(!s||typeof s!="object"||Array.isArray(s))throw new Error(`Input Error: ${e}.keys[${i}] must be an object`);if(_e(s.time,`${e}.keys[${i}].time`),s.time<0||s.time>1)throw new Error(`Input Error: ${e}.keys[${i}].time must be between 0 and 1`);if(s.time<r)throw new Error(`Input Error: ${e}.keys must be sorted by time`);r=s.time,bk(s.value,`${e}.keys[${i}].value`)}}function bk(t,e){if(typeof t!="string"&&typeof t!="number")throw new Error(`Input Error: ${e} must be a string or number`)}function aW(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Input Error: modules.appearance.rotation must be an object");if(!Q4.has(t.mode))throw new Error("Input Error: modules.appearance.rotation.mode must be 'none', 'fixed', 'random', or 'spin'");if(t.mode!=="none"){if(t.mode==="fixed"){_e(t.value,"modules.appearance.rotation.value");return}if(t.mode==="random"){Os(t,"modules.appearance.rotation",{allowNegative:!0});return}Os(t.start,"modules.appearance.rotation.start",{allowNegative:!0}),Os(t.speed,"modules.appearance.rotation.speed",{allowNegative:!0})}}function lW(t){if(t!==void 0){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Input Error: modules.bounds must be an object");if(t.mode!=="none"&&t.mode!=="recycle")throw new Error("Input Error: modules.bounds.mode must be 'none' or 'recycle'");if(t.mode!=="none"){if(t.source!=="area"&&t.source!=="custom")throw new Error("Input Error: modules.bounds.source must be 'area' or 'custom'");if(t.padding!==void 0&&cW(t.padding,"modules.bounds.padding"),t.source==="custom"){if(!t.custom||typeof t.custom!="object"||Array.isArray(t.custom))throw new Error("Input Error: modules.bounds.custom must be an object");_e(t.custom.x,"modules.bounds.custom.x"),_e(t.custom.y,"modules.bounds.custom.y"),_e(t.custom.width,"modules.bounds.custom.width"),_e(t.custom.height,"modules.bounds.custom.height")}}}}function cW(t,e){if(typeof t!="number"){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be a number or object`);for(let r of["top","right","bottom","left"])_e(t[r],`${e}.${r}`)}}function Os(t,e,r={}){if(typeof t=="number"){Cu(t,e,r);return}if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be a number or range object`);if(_e(t.min,`${e}.min`),_e(t.max??t.min,`${e}.max`),Cu(t.min,`${e}.min`,r),Cu(t.max??t.min,`${e}.max`,r),t.min>(t.max??t.min))throw new Error(`Input Error: ${e}.min cannot be greater than max`);t.distribution!==void 0&&uW(t.distribution,`${e}.distribution`)}function Cu(t,e,r={}){if(_e(t,e),!r.allowNegative&&t<0)throw new Error(`Input Error: ${e} must be non-negative`);if(r.min!==void 0&&t<r.min)throw new Error(`Input Error: ${e} must be at least ${r.min}`);if(r.max!==void 0&&t>r.max)throw new Error(`Input Error: ${e} must be at most ${r.max}`)}function uW(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be an object`);if(!xk.has(t.kind))throw new Error(`Input Error: ${e}.kind must be one of ${[...xk].join(", ")}`);if(t.kind==="bias"){if(!yk.has(t.toward??"min"))throw new Error(`Input Error: ${e}.toward must be one of ${[...yk].join(", ")}`);t.strength!==void 0&&_e(t.strength,`${e}.strength`)}t.kind==="normal"&&(t.mean!==void 0&&_e(t.mean,`${e}.mean`),t.deviation!==void 0&&_e(t.deviation,`${e}.deviation`))}function _e(t,e){if(typeof t!="number"||Number.isNaN(t))throw new Error(`Input Error: ${e} must be a number`)}function vk(t,e){if(_e(t,e),!Number.isInteger(t))throw new Error(`Input Error: ${e} must be an integer`)}function wk(t){let e=hW(t),r=[];r.push(dW(t.modules.emission.source));let i=pW(t.modules.movement);i&&r.push(i),r.push(...mW(t.modules.appearance));let s=TW(t.modules.bounds,t.width,t.height);s&&(e.spawnBounds=s.spawnBounds,e.recycleOnBounds=!0);let o=gW(t.modules.appearance.texture),n=e.maxParticles;return{id:t.id,type:t.type,count:n,texture:o,behaviors:r,emitter:e,x:t.x??0,y:t.y??0,width:t.width,height:t.height,alpha:t.alpha??1}}function hW(t){let{emission:e}=t.modules,r={lifetime:Ls(e.particleLifetime),maxParticles:e.mode==="burst"?Math.max(e.maxActive??e.burstCount,e.burstCount):e.maxActive??100,emitterLifetime:e.duration===void 0||e.duration==="infinite"?-1:e.duration,seed:t.seed};return e.mode==="continuous"?(r.frequency=1/e.rate,r.particlesPerWave=1):(r.frequency=0,r.particlesPerWave=e.burstCount),r}function dW(t){return{type:"spawnShape",config:{type:t.kind,data:fW(t.kind,t.data)}}}function fW(t,e){return t==="rect"?{x:e.x,y:e.y,w:e.width,h:e.height}:{...e}}function pW(t){if(!t)return null;let e={maxSpeed:t.maxSpeed??0,faceVelocity:t.faceVelocity??!1};return t.velocity&&(e.velocity={kind:t.velocity.kind,speed:Ls(t.velocity.speed)},t.velocity.kind==="directional"?e.velocity.direction=Ls(t.velocity.direction):e.velocity.angle=Ls(t.velocity.angle??{min:0,max:360})),t.acceleration&&(e.acceleration={x:t.acceleration.x,y:t.acceleration.y}),{type:"movement",config:e}}function mW(t){let e=[];if(t.scale&&e.push(yW(t.scale)),t.alpha&&e.push(_W(t.alpha)),t.color&&e.push(bW(t.color)),t.rotation){let r=vW(t.rotation);r&&e.push(r)}return e}function gW(t){if(typeof t=="string")return t;if(t.shape)return{...t};let e={mode:t.mode,pick:t.pick??"perParticle",items:t.items.map(xW)};if(e.mode==="single"&&e.items.length===1){let[r]=e.items;return r.src??Ek(r)}return e}function xW(t){if(t.src)return t.weight===void 0?{src:t.src}:{src:t.src,weight:t.weight};let e=Ek(t);return t.weight!==void 0&&(e.weight=t.weight),e}function Ek(t){return{shape:t.shape,...t.radius!==void 0?{radius:t.radius}:{},...t.width!==void 0?{width:t.width}:{},...t.height!==void 0?{height:t.height}:{},...t.color!==void 0?{color:t.color}:{}}}function yW(t){return t.mode==="curve"?{type:"scale",config:{list:Zb(t.keys)}}:{type:"scaleStatic",config:t.mode==="single"?{min:t.value,max:t.value}:Ls(t)}}function _W(t){return t.mode==="curve"?{type:"alpha",config:{list:Zb(t.keys)}}:{type:"alphaStatic",config:{alpha:t.value}}}function bW(t){return t.mode==="gradient"?{type:"color",config:{list:Zb(t.keys)}}:{type:"colorStatic",config:{color:t.value}}}function vW(t){if(t.mode==="none")return null;if(t.mode==="fixed")return{type:"noRotation",config:{rotation:t.value}};if(t.mode==="random"){let i=Ls(t);return{type:"rotationStatic",config:{min:i.min,max:i.max,distribution:i.distribution}}}let e=Ls(t.start),r=Ls(t.speed);return{type:"rotation",config:{minStart:e.min,maxStart:e.max,startDistribution:e.distribution,minSpeed:r.min,maxSpeed:r.max,speedDistribution:r.distribution,accel:t.accel??0}}}function TW(t,e,r){if(!t||t.mode==="none")return null;if(t.source==="custom")return{spawnBounds:{...t.custom}};let i=SW(t.padding??0);return{spawnBounds:{x:-i.left,y:-i.top,width:e+i.left+i.right,height:r+i.top+i.bottom}}}function SW(t){return typeof t=="number"?{top:t,right:t,bottom:t,left:t}:{top:t.top,right:t.right,bottom:t.bottom,left:t.left}}function Zb(t){return t.map(e=>({time:e.time,value:e.value}))}function Ls(t){return typeof t=="number"?{min:t,max:t}:{min:t.min,max:t.max??t.min,...t.distribution!==void 0?{distribution:{...t.distribution}}:{}}}var Ak=({state:t})=>{if(t.modules)return Kb(t),Tk(t),wk(t);Kb(t),dk(t),fk(t),pk(t),mk(t),gk(t);let e=t.emitter?.maxParticles??t.count??100,r=t.emitter;return r&&r.maxParticles===void 0&&t.count!==void 0&&(r={...r,maxParticles:e}),{id:t.id,type:t.type,count:e,texture:t.texture,behaviors:t.behaviors,emitter:r,x:t.x??0,y:t.y??0,width:t.width,height:t.height,alpha:t.alpha??1}};var wW=dt({type:"particles",add:Pu,update:hk,delete:Xp,parse:Ak});var Pk=(t=[],e=[])=>{let r=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of t)r.add(l.id),i.set(l.id,l);for(let l of e)r.add(l.id),s.set(l.id,l);for(let l of r){let c=i.get(l),u=s.get(l);!c&&u?o.push(u):c&&!u?n.push(c):ye(c,u)||a.push({prev:c,next:u})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Ck=new Set(["audio-channel","sound"]),Rk="audio-transition",Mk="audioTransition",EW=new Set([Rk,Mk]),AW=new Set(["enter","exit","update"]),PW=new Set(["volume"]),CW=new Set(["linear"]),RW={enter:new Set(["from","duration","easing"]),exit:new Set(["to","duration","easing"]),update:new Set(["duration","easing"])},MW=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Ra=(t,e)=>{if(!MW(t))throw new Error(`Input error: ${e} must be an object.`)},Ma=(t,e)=>{if(typeof t!="string"||t.length===0)throw new Error(`Input error: ${e} must be a non-empty string.`)},Ru=(t,e,{min:r,max:i}={})=>{if(typeof t!="number"||Number.isNaN(t))throw new Error(`Input error: ${e} must be a number.`);if(r!==void 0&&t<r)throw new Error(`Input error: ${e} must be greater than or equal to ${r}.`);if(i!==void 0&&t>i)throw new Error(`Input error: ${e} must be less than or equal to ${i}.`)},Qb=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new Error(`Input error: ${e} must be a boolean.`)},Ca=(t,e,r)=>{t!=null&&Ru(t,e,r)},Ik=(t,e)=>t==null?100:(Ru(t,e),Math.max(0,Math.min(100,t))),Yp=(t,e,r)=>{if(t.has(e))throw new Error(`Input error: duplicate audio render-state id "${e}" at ${r}.`);t.add(e)},Bk=(t,e,r,i,s=null)=>{if(Ma(t.id,`${e}.id`),Yp(r,t.id,`${e}.id`),Ma(t.src,`${e}.src`),t.delay!==void 0)throw new Error(`Input error: ${e}.delay is not supported. Use ${e}.startDelayMs instead.`);let o=Ik(t.volume,`${e}.volume`);if(Qb(t.muted,`${e}.muted`),Ca(t.pan,`${e}.pan`,{min:-1,max:1}),Qb(t.loop,`${e}.loop`),Ca(t.startDelayMs,`${e}.startDelayMs`,{min:0}),Ca(t.playbackRate,`${e}.playbackRate`,{min:0}),Ca(t.startAt,`${e}.startAt`,{min:0}),Ca(t.endAt,`${e}.endAt`,{min:0}),t.endAt!==void 0&&t.endAt!==null&&t.startAt!==void 0&&t.endAt<t.startAt)throw new Error(`Input error: ${e}.endAt must be greater than or equal to startAt.`);i.push({id:t.id,type:"sound",src:t.src,volume:o,muted:t.muted??!1,pan:t.pan??0,loop:t.loop??!1,startDelayMs:t.startDelayMs??0,playbackRate:t.playbackRate??1,startAt:t.startAt??0,endAt:t.endAt??null,channelId:s})},IW=(t,e,r,i,s)=>{Ma(t.id,`${e}.id`),Yp(r,t.id,`${e}.id`);let o=Ik(t.volume,`${e}.volume`);if(Qb(t.muted,`${e}.muted`),Ca(t.pan,`${e}.pan`,{min:-1,max:1}),t.children!==void 0&&!Array.isArray(t.children))throw new Error(`Input error: ${e}.children must be an array.`);i.push({id:t.id,type:"audio-channel",volume:o,muted:t.muted??!1,pan:t.pan??0});for(let[n,a]of(t.children??[]).entries()){let l=`${e}.children[${n}]`;if(Ra(a,l),a.type==="audio-channel")throw new Error(`Input error: nested audio-channel nodes are not supported at ${l}.`);if(a.type!=="sound")throw new Error(`Input error: ${l}.type must be "sound".`);Bk(a,l,r,s,t.id)}},BW=(t,e)=>{if(!Array.isArray(t))throw new Error("Input error: `audio` must be an array.");let r=[],i=[],s=new Set;for(let[o,n]of t.entries()){let a=`audio[${o}]`;if(Ra(n,a),!Ck.has(n.type)){Ma(n.id,`${a}.id`),Yp(e,n.id,`${a}.id`);continue}if(n.type==="audio-channel"){IW(n,a,e,r,i),s.add(n.id);for(let l of i)l.channelId===n.id&&s.add(l.id)}else Bk(n,a,e,i),s.add(n.id)}return{channels:r,sounds:i,builtinNodeIds:s}},FW=(t,e,r,i)=>{Ra(t,r);for(let s of Object.keys(t))if(!RW[e].has(s))throw new Error(`Input error: unsupported audio transition field "${s}" at ${r}.`);if(t.duration===void 0)throw new Error(`Input error: ${r}.duration is required.`);if(Ru(t.duration,`${r}.duration`,{min:0}),t.easing===void 0)throw new Error(`Input error: ${r}.easing is required.`);if(!CW.has(t.easing))throw new Error(`Input error: ${r}.easing "${t.easing}" is not supported.`);if(e==="enter"){if(t.from===void 0)throw new Error(`Input error: ${r}.from is required.`);Ru(t.from,`${r}.from`,{min:0,max:100})}if(e==="exit"){if(t.to===void 0)throw new Error(`Input error: ${r}.to is required.`);Ru(t.to,`${r}.to`,{min:0,max:100})}if(i!=="volume")throw new Error(`Input error: unsupported audio transition property "${i}" at ${r}.`)},kW=(t,e,r)=>{if(Ma(t.targetId,`${e}.targetId`),!r.has(t.targetId))throw new Error(`Input error: ${e}.targetId "${t.targetId}" does not resolve to an audio node.`);Ra(t.properties,`${e}.properties`);for(let[i,s]of Object.entries(t.properties)){if(!PW.has(i))throw new Error(`Input error: unsupported audio transition property "${i}" at ${e}.properties.`);Ra(s,`${e}.properties.${i}`);for(let[o,n]of Object.entries(s)){if(!AW.has(o))throw new Error(`Input error: unsupported audio transition phase "${o}" at ${e}.properties.${i}.`);FW(n,o,`${e}.properties.${i}.${o}`,i)}}},UW=(t,e,r)=>{if(!Array.isArray(t))throw new Error("Input error: `audioEffects` must be an array.");for(let[i,s]of t.entries()){let o=`audioEffects[${i}]`;if(Ra(s,o),Ma(s.id,`${o}.id`),Yp(e,s.id,`${o}.id`),!EW.has(s.type))throw new Error(`Input error: unsupported audio effect type "${s.type}" at ${o}.`);(s.type===Rk||s.type===Mk)&&kW(s,o,r)}};var Gs=({audio:t=[],audioEffects:e=[]}={})=>{let r=new Set,i=BW(t,r);return UW(e,r,i.builtinNodeIds),{audio:t,audioEffects:e,channels:i.channels,sounds:i.sounds}},Fk=t=>Ck.has(t?.type),Jb=(t=[])=>t.filter(Fk),ev=(t=[])=>t.filter(e=>!Fk(e));var kk=({app:t,prevAudioTree:e,nextAudioTree:r,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=Pk(e,r);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:t,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:t,element:a})}for(let{prev:a,next:l}of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);c.update({app:t,prevElement:a,nextElement:l})}},tv=({app:t,prevAudioTree:e,nextAudioTree:r,prevAudioEffects:i=[],nextAudioEffects:s=[],audioPlugins:o})=>{if(Gs({audio:e,audioEffects:i}),Gs({audio:r,audioEffects:s}),typeof t.audioStage?.renderGraph=="function"){t.audioStage.renderGraph({prevAudio:Jb(e),nextAudio:Jb(r),prevAudioEffects:i,nextAudioEffects:s}),kk({app:t,prevAudioTree:ev(e),nextAudioTree:ev(r),audioPlugins:o});return}kk({app:t,prevAudioTree:e,nextAudioTree:r,audioPlugins:o})};var Sr=(t=>(t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2",t))(Sr||{}),rv=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS",t))(rv||{}),jp=(t=>(t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL",t))(jp||{}),he=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR",t))(he||{}),Ia=(t=>(t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t))(Ia||{}),j=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(j||{}),Ki=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(Ki||{}),ge=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(ge||{}),Q=(t=>(t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT",t))(Q||{}),Vr=(t=>(t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR",t))(Vr||{}),Mu=(t=>(t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t))(Mu||{}),ti=(t=>(t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL",t))(ti||{}),wr=(t=>(t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",t))(wr||{}),Ds=(t=>(t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT",t))(Ds||{}),qp=(t=>(t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL",t))(qp||{}),or=(t=>(t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp",t))(or||{}),xt=(t=>(t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE",t[t.COLOR=4]="COLOR",t))(xt||{});var He=(t=>(t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH",t))(He||{}),pr=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(pr||{});var iv={createCanvas:(t,e)=>{let r=document.createElement("canvas");return r.width=t,r.height=e,r},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")};var ne={ADAPTER:iv,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Pg();var OW=cs.default??cs,ri=OW(globalThis.navigator);ne.RETINA_PREFIX=/@([0-9\.]+)x/;ne.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Vo=Xs(Ok(),1),PX=Xs(Td(),1);var Lv=Xs(QU(),1);var JU={};function we(t,e,r=3){if(JU[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
1581
|
+
`,Tp=(t="red")=>{switch(t){case"green":return new Float32Array([0,1,0,0]);case"blue":return new Float32Array([0,0,1,0]);case"alpha":return new Float32Array([0,0,0,1]);default:return new Float32Array([1,0,0,0])}},UF=Tp("red"),vu=(t,e)=>xo.create({width:t,height:e,resolution:1}),b4=(t,e)=>{let r=new Ce({uMaskInvert:{value:e?1:0,type:"f32"},uMaskChannelWeights:{value:t,type:"vec4<f32>"}});return{filter:Br.from({gpu:{vertex:{source:kF,entryPoint:"mainVertex"},fragment:{source:kF,entryPoint:"mainFragment"}},gl:{vertex:LF,fragment:_4,name:"replace-mask-channel-filter"},resources:{maskChannelUniforms:r}}),maskChannelUniforms:r}},OF=({app:t,texture:e,width:r,height:i,channelWeights:s,invert:o=!1})=>{let n=B.from(e),a=new ke(n);a.width=r,a.height=i,a.filterArea=new te(0,0,r,i);let l=new ie;l.addChild(a);let c=vu(r,i),{filter:u}=b4(s,o);return a.filters=[u],t.renderer.render({container:l,target:c,clear:!0}),a.filters=[],l.destroy({children:!0}),u.destroy(),c},v4=(t,e,r,i)=>{if(!e)return{textures:[B.WHITE.source],channelWeights:Tp("red"),invert:0,destroy:()=>{}};if(e.kind==="single"){let s=OF({app:t,texture:e.texture,width:r,height:i,channelWeights:Tp(e.channel??"red"),invert:e.invert??!1});return{textures:[s.source],channelWeights:UF,invert:0,destroy:()=>{s.destroy(!0)}}}if(e.kind==="sequence"){let s=e.frames.map(o=>OF({app:t,texture:o.texture,width:r,height:i,channelWeights:Tp(e.channel??"red"),invert:e.invert??!1}));return{textures:s.map(o=>o.source),channelWeights:UF,invert:0,destroy:()=>{for(let o of s)o.destroy(!0)}}}throw new Error(`Unsupported replace mask kind: ${e.kind}.`)},T4=()=>{let t=new Ce({uProgress:{value:0,type:"f32"},uSoftness:{value:.001,type:"f32"},uMaskMix:{value:0,type:"f32"},uMaskInvert:{value:0,type:"f32"},uMaskDirectReveal:{value:0,type:"f32"},uMaskChannelWeights:{value:new Float32Array([1,0,0,0]),type:"vec4<f32>"},uSecondaryMatrix:{value:new V,type:"mat3x3<f32>"},uSecondaryClamp:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"}});return{filter:Br.from({gpu:{vertex:{source:FF,entryPoint:"mainVertex"},fragment:{source:FF,entryPoint:"mainFragment"}},gl:{vertex:LF,fragment:y4,name:"replace-mask-filter"},resources:{replaceMaskUniforms:t,uNextTexture:B.EMPTY.source,uMaskTextureA:B.EMPTY.source,uMaskTextureB:B.EMPTY.source}}),replaceMaskUniforms:t}},S4=({progress:t=0,frames:e=[],sampleMode:r="hold"}={})=>{if(e.length<=1)return{fromIndex:0,toIndex:0,mix:0};let i=Db(t);if(r==="linear"){if(i<=e[0].at)return{fromIndex:0,toIndex:0,mix:0};let o=e.length-1;if(i>=e[o].at)return{fromIndex:o,toIndex:o,mix:0};for(let n=0;n<e.length-1;n++){let a=e[n],l=e[n+1];if(i<=l.at){let c=l.at-a.at;return{fromIndex:n,toIndex:n+1,mix:c===0?0:(i-a.at)/c}}}return{fromIndex:o,toIndex:o,mix:0}}let s=0;for(let o=1;o<e.length&&!(i<e[o].at);o++)s=o;return{fromIndex:s,toIndex:s,mix:0}},w4=(t,e,r,i,s)=>{let o=g4(e),n=Aa([{timeline:o}]),a=Math.max(e?.softness??.001,1e-4),{textures:l,channelWeights:c,invert:u,destroy:h}=v4(t,e,r,i),d=s.resources.replaceMaskUniforms,f=-1,p=-1;return{duration:n,progressTimeline:o,apply:m=>{let x=e?.kind==="sequence"?S4({progress:m,frames:e.frames,sampleMode:e.sample??"hold"}):{fromIndex:0,toIndex:0,mix:0};x.fromIndex!==f&&(s.resources.uMaskTextureA=l[x.fromIndex]??B.EMPTY.source,f=x.fromIndex),x.toIndex!==p&&(s.resources.uMaskTextureB=l[x.toIndex]??B.EMPTY.source,p=x.toIndex),d.uniforms.uProgress=Db(m),d.uniforms.uSoftness=a,d.uniforms.uMaskMix=x.mix,d.uniforms.uMaskInvert=u,d.uniforms.uMaskDirectReveal=e?.kind==="sequence"?1:0,d.uniforms.uMaskChannelWeights=c,d.update()},destroy:h}},GF=(t,e)=>{let r=Math.max(1,t),i=Math.max(1,e);return new Float32Array([.5/r,.5/i,1-.5/r,1-.5/i])},E4=t=>{let e=new ie;for(let r of t)r?.wrapper&&e.addChild(r.wrapper);return Vb(Nb(e))},DF=(t,e)=>{let r=t.filter(o=>o?.wrapper);if(r.length===0)return E4(t);let i=new ie;for(let o of r)i.addChild(o.wrapper);let s=[];for(let o of p4(e)){for(let n of e)n.apply(o);s.push(Nb(i))}for(let o of e)o.apply(0);for(let o of r)o.wrapper.parent===i&&i.removeChild(o.wrapper);return i.destroy(),Vb(m4(s))},Us=({app:t,container:e,target:r,frame:i})=>{t.renderer.render({container:e,target:r,clear:!0,clearColor:[0,0,0,0],transform:new V(1,0,0,1,-i.x,-i.y)})},A4=(t,e)=>{!t||t.parent!==e||e.removeChild(t)},Ai=(t,e)=>{t?.wrapper&&!t.wrapper.destroyed&&(Yt({app:e,root:t.wrapper}),t.wrapper.destroy({children:!0})),t?.ownsTexture&&t.texture?.destroy(!0)},P4=({prevElement:t,nextElement:e,animation:r,prevSubject:i,nextSubject:s})=>{if(!i||!s||t?.id!==e?.id)return{prevSubject:i,nextSubject:s};let o=i,n=s;return r.mask!==void 0||r.compositor!==void 0?{prevSubject:o,nextSubject:n}:(r.prev===void 0&&(o=null),r.next===void 0&&(n=null),{prevSubject:o,nextSubject:n})},C4=({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s})=>{let o=new ie;o.zIndex=s,r?.wrapper&&o.addChild(r.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=Pa(r,e.prev?.tween),a=Pa(i,e.next?.tween);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),Yt({app:t,root:o}),o.destroy({children:!0}),Ai(r,t),Ai(i,t)}}},R4=({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s})=>{let o=Pa(r,e.prev?.tween),n=Pa(i,e.next?.tween),a=x4(e),l=Aa([{timeline:a}]),c=DF([r,i],[o,n]),u=new ie,h=new ie;r?.wrapper&&u.addChild(r.wrapper),i?.wrapper&&h.addChild(i.wrapper);let d=vu(c.width,c.height),f=vu(c.width,c.height),p=new ie;p.zIndex=s;let m=new ke(d);m.x=c.x,m.y=c.y,m.filterArea=new te(0,0,c.width,c.height),p.addChild(m);let x=gb({shader:e.compositor,width:c.width,height:c.height,progress:Bo(a,0),nextTextureSource:f.source,name:`route-graphics-transition-compositor-${e.id}`});m.filters=[x];let v=GF(c.width,c.height),y=typeof x.apply=="function"?x.apply.bind(x):(_,S,E,P)=>{_.applyFilter(x,S,E,P)};x.apply=(_,S,E,P)=>{let C=x.resources.shaderUniforms;C?.uniforms?.uNextTextureMatrix&&(_.calculateSpriteMatrix(C.uniforms.uNextTextureMatrix,m),C.uniforms.uNextTextureClamp=v,C.update()),y(_,S,E,P)};let g=!1,b=!1;return r?.wrapper||(Us({app:t,container:u,target:d,frame:c}),g=!0),i?.wrapper||(Us({app:t,container:h,target:f,frame:c}),b=!0),{overlay:p,duration:Math.max(o.duration,n.duration,l),apply:_=>{o.apply(_),n.apply(_),r?.wrapper&&(o.duration>0||!g)&&(Us({app:t,container:u,target:d,frame:c}),g=!0),i?.wrapper&&(n.duration>0||!b)&&(Us({app:t,container:h,target:f,frame:c}),b=!0),mb(x,c.width,c.height),rp(x,Bo(a,_))},destroy:()=>{p.removeFromParent(),m.filters=[],x.destroy(),Yt({app:t,root:p}),Yt({app:t,root:u}),Yt({app:t,root:h}),p.destroy({children:!0}),u.destroy({children:!0}),h.destroy({children:!0}),d.destroy(!0),f.destroy(!0),Ai(r,t),Ai(i,t)}}},M4=({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s})=>{let o=Pa(r,e.prev?.tween),n=Pa(i,e.next?.tween),a=DF([r,i],[o,n]),l=new ie,c=new ie;r?.wrapper&&l.addChild(r.wrapper),i?.wrapper&&c.addChild(i.wrapper);let u=vu(a.width,a.height),h=vu(a.width,a.height),d=new ie;d.zIndex=s;let f=new ke(u);f.x=a.x,f.y=a.y,f.filterArea=new te(0,0,a.width,a.height),d.addChild(f);let{filter:p}=T4();p.resources.uNextTexture=h.source,f.filters=[p];let m=GF(a.width,a.height),x=typeof p.apply=="function"?p.apply.bind(p):(b,_,S,E)=>{b.applyFilter(p,_,S,E)};p.apply=(b,_,S,E)=>{let P=p.resources.replaceMaskUniforms;b.calculateSpriteMatrix(P.uniforms.uSecondaryMatrix,f),P.uniforms.uSecondaryClamp=m,P.update(),x(b,_,S,E)};let v=w4(t,e.mask,a.width,a.height,p),y=!1,g=!1;return r?.wrapper||Us({app:t,container:l,target:u,frame:a}),i?.wrapper||Us({app:t,container:c,target:h,frame:a}),{overlay:d,duration:Math.max(o.duration,n.duration,v.duration),apply:b=>{o.apply(b),n.apply(b),r?.wrapper&&(o.duration>0||!y)&&(Us({app:t,container:l,target:u,frame:a}),y=!0),i?.wrapper&&(n.duration>0||!g)&&(Us({app:t,container:c,target:h,frame:a}),g=!0);let _=Db(Bo(v.progressTimeline,b));v.apply(_)},destroy:()=>{d.removeFromParent(),f.filters=[],p.destroy(),Yt({app:t,root:d}),Yt({app:t,root:l}),Yt({app:t,root:c}),d.destroy({children:!0}),l.destroy({children:!0}),c.destroy({children:!0}),u.destroy(!0),h.destroy(!0),Ai(r,t),Ai(i,t),v.destroy()}}},I4=({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s})=>e.compositor?R4({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s}):e.mask?M4({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s}):C4({app:t,animation:e,prevSubject:r,nextSubject:i,zIndex:s}),B4=({app:t,parent:e,nextElement:r,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h})=>{if(!r)return null;let d=i.add({app:t,parent:e,element:r,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h});return d&&typeof d.then=="function"?d.then(()=>h?.aborted||e.destroyed?null:e.children.find(f=>f.label===r.id)??null):h?.aborted||e.destroyed?null:e.children.find(f=>f.label===r.id)??null},F4=async t=>t&&typeof t.then=="function"?t:t??null,Sp=({app:t,parent:e,prevElement:r,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,plugin:h,zIndex:d,signal:f})=>{if(!r&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||e.destroyed)return;let p=r?e.children.find(z=>z.label===r.id)??null:null;if(r&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${r.id}".`);let m=p?BF(t,p):null,x=s.playback?.continuity==="persistent",v=K_(s),y=x?new AbortController:null,g=y?.signal??f,b=new ie,_=Xf({suppressAnimations:!0}),S=!x,E=S?a.getVersion():null,P=!1,C=d,M=()=>{!S||P||(a.track(E),P=!0)},R=()=>{P&&(a.complete(E),P=!1)},F={value:null},U={value:null},W=!1,N=()=>{typeof n?.removePending=="function"&&n.removePending(s.id)},G=({zIndex:z}={})=>{typeof z=="number"&&(C=z,F.value&&!F.value.destroyed&&(F.value.zIndex=C),U.value?.overlay&&!U.value.overlay.destroyed&&(U.value.overlay.zIndex=C))},X=({flushDeferredEffects:z})=>{if(!W){if(W=!0,F.value&&!F.value.destroyed&&(F.value.visible=!0),U.value?.destroy(),z){LI(_);return}pu(_)}};x&&typeof n?.registerPending=="function"&&n.registerPending({id:s.id,animationType:s.type,targetId:s.targetId,signature:v,continuity:"persistent",playbackSpeed:s.playback?.speed,onCancel:()=>{y?.abort(),pu(_),Yt({app:t,root:b}),b.destroy({children:!0}),Ai(m,t),R()},onContinuationUpdate:G}),M();let $=z=>{if(g?.aborted||e.destroyed){N(),pu(_),Yt({app:t,root:b}),b.destroy({children:!0}),Ai(m,t),R();return}if(i&&!z)throw N(),pu(_),R(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);F.value=z;let le=z?BF(t,z):null,de=P4({prevElement:r,nextElement:i,animation:s,prevSubject:m,nextSubject:le});de.prevSubject!==m&&Ai(m,t),de.nextSubject!==le&&Ai(le,t),A4(z,b),Yt({app:t,root:b}),b.destroy({children:!0}),p&&h.delete({app:t,parent:e,element:r,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,signal:g}),z&&(z.zIndex=C,e.addChild(z),z.visible=!1);let be=I4({app:t,animation:s,prevSubject:de.prevSubject,nextSubject:de.nextSubject,zIndex:C});U.value=be,e.addChild(be.overlay);let Se={id:s.id,driver:"custom",animationType:s.type,targetId:s.targetId,signature:v,continuity:x?"persistent":"render",playbackSpeed:s.playback?.speed,onContinuationUpdate:G,duration:be.duration,deferCompletionUntilNextFrame:s.compositor!==void 0,applyFrame:be.apply,applyTargetState:()=>{X({flushDeferredEffects:!1})},onComplete:()=>{try{X({flushDeferredEffects:!0})}finally{R()}},onCancel:()=>{R()},isValid:()=>!!be.overlay&&!be.overlay.destroyed&&(!z||!z.destroyed)};x&&typeof n?.activatePending=="function"&&n.activatePending(s.id,Se)||(N(),n.dispatch({type:"START",payload:Se}))},D=i?B4({app:t,parent:b,nextElement:i,plugin:h,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:g}):null;if(D&&typeof D.then=="function"){F4(D).then($);return}$(D??null)};var Fo=({app:t,parent:e,prevComputedTree:r,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=Xf(),signal:u})=>{e.sortableChildren=!0;let h=new Map(l.map(_=>[_.type,_])),d=DI(s),f=new Map,p=new Map;for(let _ of r)f.set(_.id,_);for(let _=0;_<i.length;_++)p.set(i[_].id,_);let{toAddElement:m,toDeleteElement:x,toUpdateElement:v}=MF(r,i,s),y=new Set(v.map(({next:_})=>_.id)),g=_=>{let S=h.get(_);if(!S)throw new Error(`No plugin found for element type: ${_}`);return S},b=_=>e.children.find(S=>S.label===_)?.zIndex??-1;for(let _ of i){let S=f.get(_.id);!S||y.has(_.id)||!ye(S,_)||g(_.type).shouldUpdateUnchanged?.({app:t,parent:e,prevElement:S,nextElement:_,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(_.id)??-1,signal:u})!==!0||(v.push({prev:S,next:_}),y.add(_.id))}for(let _ of e.children){let S=p.get(_.label);S!==void 0&&(_.zIndex=S)}for(let _ of x){let S=c.suppressAnimations?null:qf(d,_.id),E=S&&typeof o?.hasContext=="function"&&o.hasContext(S.id),P=g(_.type);if(!E){if(S){Sp({app:t,parent:e,prevElement:_,nextElement:null,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:P,zIndex:b(_.id),signal:u});continue}P.delete({app:t,parent:e,element:_,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:u})}}for(let _ of m){let S=c.suppressAnimations?null:qf(d,_.id),E=S&&typeof o?.hasContext=="function"&&o.hasContext(S.id),P=g(_.type),C=p.get(_.id)??-1;if(E){typeof o?.updateContinuation=="function"&&o.updateContinuation(S.id,{zIndex:C});continue}if(S){Sp({app:t,parent:e,prevElement:null,nextElement:_,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:P,zIndex:C,signal:u});continue}P.add({app:t,parent:e,element:_,animations:d,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:C,signal:u})}for(let{prev:_,next:S}of v){let E=g(S.type),P=p.get(S.id)??-1,C=c.suppressAnimations?null:qf(d,S.id);if(C&&typeof o?.hasContext=="function"&&o.hasContext(C.id))typeof o?.updateContinuation=="function"&&o.updateContinuation(C.id,{zIndex:P});else if(C){Sp({app:t,parent:e,prevElement:_,nextElement:S,animation:C,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:P,signal:u});continue}E.update({app:t,parent:e,prevElement:_,nextElement:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:P,signal:u})}};var k4=(t=[])=>{let e=new Set;for(let r of t)if(r?.id){if(e.has(r.id))return!0;e.add(r.id)}return!1},U4=({app:t,container:e,children:r,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of r){let u=o.find(h=>h.type===c.type);if(!u)throw new Error(`No plugin found for child element type: ${c.type}`);u.add({app:t,parent:e,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},NF=({app:t,parent:e,element:r,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:u})=>{let{id:h,children:d,scroll:f,alpha:p}=r,m=new ie;m.label=h,m.zIndex=l,m.alpha=p,Ur(m,r);let x=zt(i,h);gt(m,r.blur,{force:x});let v=Qe(i,h);Oe(m,r.filters,{width:r.width,height:r.height,force:v}),e.addChild(m),d&&d.length>0&&(k4(d)?U4({app:t,container:m,children:d,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:u}):Fo({app:t,parent:m,prevComputedTree:[],nextComputedTree:d,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:u})),(f||r.anchorToBottom)&&bu({container:m,element:r,interactive:!!f,allowViewportWithoutScroll:!!r.anchorToBottom}),_p({app:t,container:m,element:r,eventHandler:s}),oe({animations:i,targetId:h,animationBus:o,completionTracker:c,element:m,targetState:{...Or(r,{alpha:p}),...Xt(r,{force:x}),...st(r,{force:v})},renderContext:a})};var VF=({app:t,parent:e,prevElement:r,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:u,signal:h})=>{let d=e.children.find(y=>y.label===r.id);if(!d)return;d.zIndex=c;let{alpha:f}=i,p=zt(o,r.id);p&>(d,r.blur,{force:!0});let m=Qe(o,r.id);m?Oe(d,r.filters,{width:r.width,height:r.height,force:!0}):Dr(d);let x=()=>{if(!ye(r,i)){d.label=i.id,d.alpha=f,d.scale.x=1,d.scale.y=1,Ur(d,i),gt(d,i.blur,{force:p}),Oe(d,i.filters,{width:i.width,height:i.height,force:m});let P=r.scroll||r.anchorToBottom,C=i.scroll||i.anchorToBottom,M=C?EF({container:d}):null;P!==C?C?bu({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:M}):Ob({container:d}):C&&(Ob({container:d}),bu({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:M})),_p({app:t,container:d,element:i,eventHandler:s})}let y=!ye(r.children,i.children),g=To({children:i.children}),b=Array.from(g).some(P=>jf(o,P).length>0),S=d.children.find(P=>P.label===`${i.id}-content`)||d,E=yb({parent:S,elements:i.children,animations:o});(y||b||E)&&(Fo({app:t,parent:S,nextComputedTree:i.children,prevComputedTree:r.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:u,renderContext:l,signal:h}),PF({container:d}),CF({container:d}),RF({container:d}))};oe({animations:o,targetId:r.id,animationBus:n,completionTracker:u,element:d,targetState:{...Or(i,{alpha:f}),...Xt(i,{force:p}),...st(i,{force:m})},onComplete:()=>{x()}})||x()};var HF=({app:t,parent:e,element:r,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=e.getChildByLabel(r.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(ub({root:a}),Yt({app:t,root:a}),e.removeChild(a),a.destroy({children:!0}))};oe({animations:s,targetId:r.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var WF=({state:t,parserPlugins:e=[]})=>{let r=t.direction==="horizontal"||t.direction==="vertical"?t.direction:"absolute",i=!!t.scroll,s=t.gapX??0,o=t.gapY??0,n=structuredClone(t.children||[]),a=[];if(t.gap!==void 0)throw new Error("Input Error: container.gap is no longer supported. Use gapX and gapY.");let l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,x=0,v=0;for(let b=0;b<n.length;b++){let _=n[b];b>0?r==="horizontal"?(_.x=u,_.y=p):r==="vertical"&&(_.x=m,_.y=h):(r==="horizontal"||r==="vertical")&&(_.x=0,_.y=0);let S=e.find(E=>E.type===_.type);if(S){let E=_.scaleX!==void 0||t.scaleX!==void 0,P=_.scaleY!==void 0||t.scaleY!==void 0,C=(_.scaleX??1)*(t.scaleX??1),M=(_.scaleY??1)*(t.scaleY??1);_=S.parse({state:{..._,...E?{scaleX:C}:{},...P?{scaleY:M}:{}},parserPlugins:e})}if(r==="horizontal"){let E=b<n.length-1?s:0;t.width&&_.width+x>t.width&&!i&&!t.anchorToBottom?(u=0,x=0,p+=d+o,d=_.height,_.x=0,_.y=p):d=Math.max(d,_.height),u+=_.width+E,x=_.x+_.width,l=Math.max(u,l),c=Math.max(_.height+_.y,c)}else if(r==="vertical"){let E=b<n.length-1?o:0;t.height&&_.height+v>t.height&&!i&&!t.anchorToBottom?(h=0,v=0,m+=f+s,f=_.width,_.x=m,_.y=0):f=Math.max(f,_.width),h+=_.height+E,v=_.y+_.height,l=Math.max(_.width+_.x,l),c=Math.max(h,c)}else l=Math.max(_.width+_.x,l),c=Math.max(_.height+_.y,c);a.push(_)}let g={...Et({...t,width:t.width?t.width:l,height:t.height?t.height:c}),children:a,direction:r,gapX:s,gapY:o,scroll:i,...t.anchorToBottom&&{anchorToBottom:!0},...t.scrollbar&&{scrollbar:structuredClone(t.scrollbar)},...t.blur!==void 0&&{blur:Is(t.blur)},rotation:t.rotation??0};return t.rightClick&&(g.rightClick=t.rightClick),t.scrollUp&&(g.scrollUp=t.scrollUp),t.scrollDown&&(g.scrollDown=t.scrollDown),g};var O4=dt({type:"container",add:NF,update:VF,delete:HF,parse:WF,shouldUpdateUnchanged:Nr});var $F=async({app:t,parent:e,element:r,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=new ie;if(c.label=r.id,c.zIndex=a,r.x!==void 0&&(c.x=Math.round(r.x)),r.y!==void 0&&(c.y=Math.round(r.y)),r.alpha!==void 0&&(c.alpha=r.alpha),e.addChild(c),oe({animations:i,targetId:r.id,animationBus:s,completionTracker:n,element:c,targetState:{x:r.x??c.x,y:r.y??c.y,alpha:r.alpha??c.alpha},renderContext:o}),o?.suppressAnimations&&!ua(r)){await ji({container:c,element:r,completionTracker:n,animationBus:s,zIndex:a,signal:l,app:t,playback:"paused-initial"}),Yf(o,{container:c,element:r,completionTracker:n,animationBus:s,zIndex:a,signal:l,app:t});return}await ji({container:c,element:r,completionTracker:n,animationBus:s,zIndex:a,signal:l,app:t,playback:"autoplay"})};var zF=(t={})=>JSON.stringify({content:t.content??null,revealEffect:t.revealEffect??"typewriter",softWipe:(t.revealEffect??"typewriter")==="softWipe"?bo(t.softWipe):null,speed:t.speed??50,initialRevealedCharacters:t.initialRevealedCharacters??0,width:t.width??null,indicator:t.indicator??null,x:t.x??null,y:t.y??null,alpha:t.alpha??1}),L4=(t,e)=>zF(t)!==zF(e),XF=async({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,renderContext:n,completionTracker:a,zIndex:l,signal:c})=>{if(c?.aborted)return;let u=e.children.find(f=>f.label===r.id);if(!u)return;let h=async()=>{if(i.x!==void 0&&(u.x=i.x),i.y!==void 0&&(u.y=i.y),i.alpha!==void 0&&(u.alpha=i.alpha),!L4(r,i)){n?.suppressAnimations!==!0&&!ua(i)&&await ji({container:u,element:i,completionTracker:a,animationBus:o,zIndex:l,signal:c,app:t,playback:"resume"});return}if(n?.suppressAnimations===!0&&!ua(i)){await ji({container:u,element:i,completionTracker:a,animationBus:o,zIndex:l,signal:c,app:t,playback:"paused-initial"}),Yf(n,{container:u,element:i,completionTracker:a,animationBus:o,zIndex:l,signal:c,app:t});return}await ji({container:u,element:i,completionTracker:a,animationBus:o,zIndex:l,signal:c,app:t,playback:"autoplay"})};oe({animations:s,targetId:r.id,animationBus:o,completionTracker:a,element:u,targetState:{x:i.x??u.x,y:i.y??u.y,alpha:i.alpha??u.alpha},onComplete:()=>{h()}})||await h()};var YF=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.getChildByLabel(e.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(Y_(o),o.destroy({children:!0}))};oe({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var G4=dt({type:"text-revealing",add:$F,update:XF,delete:YF,parse:RB,shouldUpdateUnchanged:({parent:t,nextElement:e})=>PI(t.children.find(r=>r.label===e.id))});var jF=async({app:t,parent:e,element:r,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let{id:c,x:u,y:h,width:d,height:f,src:p,atlas:m,clips:x,playback:v,alpha:y}=r,g=Qr(m),b=Jr(x,m?.animations,m?.meta,Object.keys(g.frames??{})),_=Lr({atlas:g,clips:b,playback:v}),S=n?.getVersion?.();n?.track?.(S);try{let E=new pi(B.from(p),g);if(await E.parse(),l?.aborted||e.destroyed)return;let{frameTextures:P}=aa({spritesheet:E,atlas:g,clips:b,playback:_}),C=new ws(P);C.label=c,C.zIndex=a,C.animationSpeed=la(_.fps),C.loop=_.loop,t.debug?na(C,c,t.debug,()=>{typeof t.render=="function"&&t.render()}):_.autoplay&&FI(o,C),C.x=Math.round(u),C.y=Math.round(h),C.width=Math.round(d),C.height=Math.round(f),C.alpha=y;let M=zt(i,c);gt(C,r.blur,{force:M});let R=Qe(i,c);Oe(C,r.filters,{width:d,height:f,force:R}),e.addChild(C),oe({animations:i,targetId:c,animationBus:s,completionTracker:n,element:C,targetState:{x:u,y:h,width:d,height:f,alpha:y,...Xt(r,{force:M}),...st(r,{force:R})},renderContext:o}),typeof t.render=="function"&&t.render()}finally{n?.complete?.(S)}};var qF=async({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=e.children.find(de=>de.label===r.id);if(!c)return;c.zIndex=a;let u=zt(s,r.id);u&>(c,r.blur,{force:!0});let h=Qe(s,r.id);h?Oe(c,r.filters,{width:r.width,height:r.height,force:!0}):Dr(c);let d=Qr(r.atlas),f=Jr(r.clips,r.atlas?.animations,r.atlas?.meta,Object.keys(d.frames??{})),p=Lr({atlas:d,clips:f,playback:r.playback}),m=i.src,x=Qr(i.atlas),v=Jr(i.clips,i.atlas?.animations,i.atlas?.meta,Object.keys(x.frames??{})),y=Lr({atlas:x,clips:v,playback:i.playback}),g=!ye(r.playback,i.playback),b=!ye(r.clips,i.clips),_=r.src!==m||!ye(r.atlas,i.atlas),S=!ye(p.frames,y.frames),E=_||b||S,P=g||b||_,C=!1,M=async({completeOnFinish:de=!0,renderAfterSync:be=!0}={})=>{if(l?.aborted||c.destroyed)return{synced:!1,completionVersion:void 0};if(c.animationSpeed=la(y.fps),c.loop=y.loop,!P||C)return{synced:!0,completionVersion:void 0};let Se=n?.getVersion?.();n?.track?.(Se);try{let et=new pi(B.from(m),x);if(await et.parse(),l?.aborted||c.destroyed)return{synced:!1,completionVersion:Se};let{frameTextures:I}=aa({spritesheet:et,atlas:x,clips:v,playback:y});c.textures=I,C=!0,be&&typeof t.render=="function"&&t.render(),!t.debug&&y.autoplay?c.play():(t.debug||c.stop?.(),r.id!==i.id&&(vo(c),na(c,i.id,t.debug,()=>{typeof t.render=="function"&&t.render()})))}finally{de&&n?.complete?.(Se)}return{synced:!0,completionVersion:Se}},R=async()=>{l?.aborted||c.destroyed||ye(r,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(c,i.blur,{force:u}),Oe(c,i.filters,{width:i.width,height:i.height,force:h}),await M())},{x:F,y:U,width:W,height:N,alpha:G}=i,X=da(s,r.id),$=X.length>0,D=de=>X.some(be=>Object.prototype.hasOwnProperty.call(be.tween??{},de)),z;if(E&&$){let de=c.width,be=c.height,Se=await M({completeOnFinish:!1,renderAfterSync:!1});if(!Se?.synced){n?.complete?.(Se?.completionVersion);return}c.width=Math.round(D("width")?de:W),c.height=Math.round(D("height")?be:N),typeof t.render=="function"&&t.render(),z=Se.completionVersion}let le=oe({animations:s,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{x:F,y:U,width:W,height:N,alpha:G,...Xt(i,{force:u}),...st(i,{force:h})},onComplete:()=>{R()}});z!==void 0&&n?.complete?.(z),le||await R()};var KF=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o})=>{let n=e.children.find(c=>c.label===r.id);if(!n)return;let a=()=>{t.debug&&vo(n),n&&!n.destroyed&&(n.stop(),n.destroy())};oe({animations:i,targetId:r.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var ZF=({state:t})=>{let e=Et(t),r=t.atlas,i=Qr(r),s=Jr(t.clips,r?.animations,r?.meta,Object.keys(i.frames??{})),o=Lr({atlas:i,clips:s,playback:t.playback});return{...e,type:"spritesheet-animation",src:t.src??"",atlas:i,clips:s,playback:o,alpha:t.alpha??1,...t.blur!==void 0&&{blur:Is(t.blur)}}};var QF=dt({type:"spritesheet-animation",add:jF,update:qF,delete:KF,parse:ZF,shouldUpdateUnchanged:Nr}),D4=QF;var N4=M_({type:"tween"});var ko=new Map,V4=t=>({id:t.id,url:t.src,loop:t.loop??!1,volume:je(t.volume,100)}),JF=t=>ko.has(t),Tu=t=>{let e=ko.get(t);e!==void 0&&(clearTimeout(e),ko.delete(t))},Hb=({app:t,element:e})=>{let r=V4(e);if(Tu(r.id),e.startDelayMs&&e.startDelayMs>0){let i=setTimeout(()=>{ko.delete(r.id),t.audioStage.add(r)},e.startDelayMs);ko.set(r.id,i);return}t.audioStage.add(r)},Wb=()=>{for(let t of ko.values())clearTimeout(t);ko.clear()},ek=({app:t,element:e})=>{Hb({app:t,element:e})};var tk=({app:t,prevElement:e,nextElement:r})=>{let i=e.id;if((r.startDelayMs??0)>0){t.audioStage.remove(i),Hb({app:t,element:r});return}if(JF(i)){Tu(i),t.audioStage.add({id:i,url:r.src,loop:r.loop??!1,volume:je(r.volume,100)});return}let o=t.audioStage.getById(i);if(!o){t.audioStage.add({id:i,url:r.src,loop:r.loop??!1,volume:je(r.volume,100)});return}o.url=r.src,o.loop=r.loop??!1,o.volume=je(r.volume,100)};var rk=({app:t,element:e})=>{Tu(e.id),t.audioStage.remove(e.id)};var H4=I_({type:"sound",add:ek,update:tk,delete:rk});var Su=class extends ke{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(e){super(),this.emitter=e,this.anchor.set(.5,.5)}init(e){this.maxLife=e,this.age=0,this.oneOverLife=1/e,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(e){this.destroyed||(this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy(e))}};function $b(t){let e=new Ze;return e.circle(0,0,3),e.fill({color:16777215}),t.renderer.generateTexture(e)}function zb(t){let e=new Ze;return e.rect(0,0,1,8),e.fill({color:8965375}),t.renderer.generateTexture(e)}function Xb(t){let e=new Ze;return e.circle(0,0,4),e.fill({color:16777215}),t.renderer.generateTexture(e)}function wu(t,e,r){return t+(e-t)*r}function Ep(t){if(typeof t=="number")return t;let e=t.replace(/^(#|0x)/,"");return parseInt(e,16)}function ik(t,e,r){let i=t>>16&255,s=t>>8&255,o=t&255,n=e>>16&255,a=e>>8&255,l=e&255,c=Math.round(wu(i,n,r)),u=Math.round(wu(s,a,r)),h=Math.round(wu(o,l,r));return c<<16|u<<8|h}var wp=class t{constructor(e,r,i=!1){this.value=i?Ep(e):e,this.time=r,this.next=null}static createList(e,r=!1){let i=[...e].sort((n,a)=>n.time-a.time),s=new t(i[0].value,i[0].time,r),o=s;for(let n=1;n<i.length;n++)o.next=new t(i[n].value,i[n].time,r),o=o.next;return s}},ei=class{constructor(e=!1){this.first=null,this.isColor=e,this.ease=null}reset(e){Array.isArray(e)?this.first=wp.createList(e,this.isColor):this.first=e}getValue(e){if(this.ease&&(e=this.ease(e)),!this.first.next||e<=this.first.time)return this.first.value;let r=this.first;for(;r.next&&r.next.time<e;)r=r.next;if(!r.next||e>=r.next.time)return r.next?r.next.value:r.value;let i=(e-r.time)/(r.next.time-r.time);return this.isColor?ik(r.value,r.next.value,i):wu(r.value,r.next.value,i)}};var Ap=class{static type="alpha";constructor(e){this.list=new ei(!1),this.list.reset(e.list)}initParticles(e){let r=e,i=this.list.getValue(0);for(;r;)r.alpha=i,r=r.next}updateParticle(e,r){e.alpha=this.list.getValue(e.agePercent)}},Pp=class{static type="alphaStatic";constructor(e){this.alpha=e.alpha}initParticles(e){let r=e;for(;r;)r.alpha=this.alpha,r=r.next}updateParticle(e,r){}};function sk(t,e,r){return Math.min(Math.max(t,e),r)}function jt(t,e){if(typeof e=="number")return e;let r=e.min,i=e.max??e.min;if(r===i)return r;let s=e.distribution;return!s||s.kind==="uniform"?r+t()*(i-r):s.kind==="bias"?r+W4(t,s)*(i-r):s.kind==="normal"?$4(t,r,i,s):r+t()*(i-r)}function W4(t,e){let r=e.toward??"min",i=sk(e.strength??.5,0,1),s=1+i*4;if(r==="max")return 1-Math.pow(1-t(),s);if(r==="center"){let o=(t()+t())/2;return t()*(1-i)+o*i}return Math.pow(t(),s)}function $4(t,e,r,i){let s=i.mean??(e+r)/2,o=i.deviation??(r-e)/6,n=Math.max(t(),1e-7),a=t(),l=Math.sqrt(-2*Math.log(n))*Math.cos(2*Math.PI*a);return sk(s+l*o,e,r)}var Cp=class{static type="scale";constructor(e){this.list=new ei(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let r=e;for(;r;){let i=this.minMult<1?r.emitter.random()*(1-this.minMult)+this.minMult:1;r.config.scaleMult=i;let s=this.list.getValue(0)*i;r.scale.set(s,s),r=r.next}}updateParticle(e,r){let i=this.list.getValue(e.agePercent)*e.config.scaleMult;e.scale.set(i,i)}},Rp=class{static type="scaleStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let r=e;for(;r;){let i=jt(r.emitter.random.bind(r.emitter),{min:this.min,max:this.max,distribution:this.distribution});r.scale.set(i,i),r=r.next}}updateParticle(e,r){}};var z4=Math.PI/180,Mp=class{static type="speed";constructor(e){this.list=new ei(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let r=e;for(;r;){let i=this.minMult<1?r.emitter.random()*(1-this.minMult)+this.minMult:1;r.config.speedMult=i;let s=this.list.getValue(0)*i;r.velocity.x=Math.cos(r.rotation)*s,r.velocity.y=Math.sin(r.rotation)*s,r=r.next}}updateParticle(e,r){let i=this.list.getValue(e.agePercent)*e.config.speedMult,s=Math.sqrt(e.velocity.x*e.velocity.x+e.velocity.y*e.velocity.y);s>0&&(e.velocity.x=e.velocity.x/s*i,e.velocity.y=e.velocity.y/s*i),e.x+=e.velocity.x*r,e.y+=e.velocity.y*r}},Ip=class{static type="speedStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let r=e;for(;r;){let i=jt(r.emitter.random.bind(r.emitter),{min:this.min,max:this.max,distribution:this.distribution});r.velocity.x=Math.cos(r.rotation)*i,r.velocity.y=Math.sin(r.rotation)*i,r=r.next}}updateParticle(e,r){e.x+=e.velocity.x*r,e.y+=e.velocity.y*r}},Bp=class{static type="movePoint";constructor(e){this.speed={min:e.speed.min,max:e.speed.max??e.speed.min,distribution:e.speed.distribution},this.direction=e.direction}initParticles(e){let r=e;for(;r;){let i=jt(r.emitter.random.bind(r.emitter),this.speed),s=jt(r.emitter.random.bind(r.emitter),this.direction)*z4;r.velocity.x=Math.cos(s)*i,r.velocity.y=Math.sin(s)*i,r=r.next}}updateParticle(e,r){e.x+=e.velocity.x*r,e.y+=e.velocity.y*r}};var IEe=Math.PI/180,Fp=class{static type="acceleration";constructor(e){this.accelX=e.accel.x,this.accelY=e.accel.y,this.minStart=e.minStart,this.maxStart=e.maxStart,this.rotate=e.rotate??!1,this.maxSpeed=e.maxSpeed??0}initParticles(e){let r=e;for(;r;){let i=r.emitter.random()*(this.maxStart-this.minStart)+this.minStart;r.velocity.x=Math.cos(r.rotation)*i,r.velocity.y=Math.sin(r.rotation)*i,r=r.next}}updateParticle(e,r){let i=e.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*r,i.y+=this.accelY*r,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}}e.x+=(s+i.x)/2*r,e.y+=(o+i.y)/2*r,this.rotate&&(e.rotation=Math.atan2(i.y,i.x))}},kp=class{static type="gravity";constructor(e){this.gravity=e.gravity}initParticles(e){}updateParticle(e,r){e.velocity.y+=this.gravity*r,e.x+=e.velocity.x*r,e.y+=e.velocity.y*r}};var Eu=Math.PI/180,Up=class{static type="rotation";constructor(e){this.startRange={min:e.minStart,max:e.maxStart??e.minStart,distribution:e.startDistribution},this.speedRange={min:e.minSpeed,max:e.maxSpeed??e.minSpeed,distribution:e.speedDistribution},this.accel=(e.accel??0)*Eu}initParticles(e){let r=e;for(;r;)r.rotation=jt(r.emitter.random.bind(r.emitter),this.startRange)*Eu,r.rotationSpeed=jt(r.emitter.random.bind(r.emitter),this.speedRange)*Eu,r=r.next}updateParticle(e,r){if(this.accel!==0){let i=e.rotationSpeed;e.rotationSpeed+=this.accel*r,e.rotation+=(i+e.rotationSpeed)/2*r}else e.rotation+=e.rotationSpeed*r}},Op=class{static type="rotationStatic";constructor(e){this.range={min:e.min,max:e.max??e.min,distribution:e.distribution}}initParticles(e){let r=e;for(;r;)r.rotation=jt(r.emitter.random.bind(r.emitter),this.range)*Eu,r=r.next}updateParticle(e,r){}},Lp=class{static type="noRotation";constructor(e){this.rotation=(e.rotation??0)*Eu}initParticles(e){let r=e;for(;r;)r.rotation=this.rotation,r=r.next}updateParticle(e,r){e.rotation=this.rotation}};var Gp=class{static type="color";constructor(e){this.list=new ei(!0),this.list.reset(e.list)}initParticles(e){let r=e,i=this.list.getValue(0);for(;r;)r.tint=i,r=r.next}updateParticle(e,r){e.tint=this.list.getValue(e.agePercent)}},Dp=class{static type="colorStatic";constructor(e){this.color=Ep(e.color)}initParticles(e){let r=e;for(;r;)r.tint=this.color,r=r.next}updateParticle(e,r){}};var Np=class{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}getRandPos(e,r){e.x=this.x+r.random()*this.w,e.y=this.y+r.random()*this.h}},Vp=class{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius,this.innerRadius=e.innerRadius??0,this.affectRotation=e.affectRotation??!1}getRandPos(e,r){let i=r.random()*Math.PI*2,s=this.radius-this.innerRadius,o=r.random()*s+this.innerRadius;e.x=this.x+Math.cos(i)*o,e.y=this.y+Math.sin(i)*o,this.affectRotation&&(e.rotation=i)}},Yb=class{constructor(e){this.x=e.x,this.y=e.y}getRandPos(e,r){e.x=this.x,e.y=this.y}},jb=class{constructor(e){this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2}getRandPos(e,r){let i=r.random();e.x=this.x1+(this.x2-this.x1)*i,e.y=this.y1+(this.y2-this.y1)*i}},X4={rect:Np,rectangle:Np,torus:Vp,circle:Vp,point:Yb,line:jb};var Hp=class{static type="spawnShape";constructor(e){let r=X4[e.type];if(!r)throw new Error(`Unknown spawn shape type: ${e.type}`);this.shape=new r(e.data)}initParticles(e){let r=e,i={x:0,y:0,rotation:void 0};for(;r;)this.shape.getRandPos(i,r.emitter),r.x=i.x,r.y=i.y,i.rotation!==void 0&&(r.rotation=i.rotation),r=r.next}updateParticle(e,r){}},Wp=class{static type="spawnBurst";constructor(e){this.x=e.x,this.y=e.y,this.spacing=(e.spacing??0)*Math.PI/180,this.startAngle=(e.startAngle??0)*Math.PI/180}initParticles(e){let r=e,i=this.startAngle;for(;r;)r.x=this.x,r.y=this.y,r.rotation=i,i+=this.spacing,r=r.next}updateParticle(e,r){}};var ok=Math.PI/180,$p=class{static type="movement";constructor(e={}){this.velocity=e.velocity??null,this.accelX=e.acceleration?.x??0,this.accelY=e.acceleration?.y??0,this.maxSpeed=e.maxSpeed??0,this.faceVelocity=e.faceVelocity??!1}initParticles(e){let r=e;for(;r;){if(this.velocity){let i=this.#t(r.emitter.random.bind(r.emitter)),s=jt(r.emitter.random.bind(r.emitter),this.velocity.speed);r.velocity.x=Math.cos(i)*s,r.velocity.y=Math.sin(i)*s,this.faceVelocity&&s>0&&(r.rotation=i)}r=r.next}}updateParticle(e,r){let i=e.velocity;if(this.accelX!==0||this.accelY!==0){let o=i.x,n=i.y;i.x+=this.accelX*r,i.y+=this.accelY*r,this.#e(i),e.x+=(o+i.x)/2*r,e.y+=(n+i.y)/2*r}else this.#e(i),e.x+=i.x*r,e.y+=i.y*r;this.faceVelocity&&Math.sqrt(i.x*i.x+i.y*i.y)>0&&(e.rotation=Math.atan2(i.y,i.x))}#t(e){return this.velocity?this.velocity.kind==="radial"?jt(e,this.velocity.angle??{min:0,max:360})*ok:jt(e,this.velocity.direction??0)*ok:0}#e(e){if(this.maxSpeed<=0)return;let r=Math.sqrt(e.x*e.x+e.y*e.y);if(r>this.maxSpeed&&r>0){let i=this.maxSpeed/r;e.x*=i,e.y*=i}}};var nk=new Map,ak=new Map;function qb(t,e){nk.set(t,e)}function Lt(t){ak.set(t.type,t)}function lk(t,e){let r=nk.get(t);return r?r(e):null}function ck(t){return ak.get(t)}qb("circle",Xb);qb("snowflake",$b);qb("raindrop",zb);Lt(Ap);Lt(Pp);Lt(Cp);Lt(Rp);Lt(Mp);Lt(Ip);Lt(Bp);Lt(Fp);Lt(kp);Lt(Up);Lt(Op);Lt(Lp);Lt(Gp);Lt(Dp);Lt(Hp);Lt(Wp);Lt($p);var zp=class{constructor(e){this.seed=e,this.state=e}next(){let e=this.state+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};function Y4(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t.mode=="string"&&Array.isArray(t.items)}var Au=class{container=null;texture=null;textureSelector=null;_textureCycleIndex=0;_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(e,r){this.container=e,this.init(r)}init(e){if(this.rng=e.seed!==void 0&&e.seed!==null?new zp(e.seed):null,e.texture&&(Y4(e.texture)?(this.textureSelector=e.texture,this.texture=e.texture.items[0]?.texture??null):(this.textureSelector=null,this.texture=e.texture)),this._textureCycleIndex=0,e.lifetime&&(this.lifetime.min=e.lifetime.min??1,this.lifetime.max=e.lifetime.max??e.lifetime.min??2,this.lifetime.distribution=e.lifetime.distribution),this.frequency=e.frequency??.1,this.particlesPerWave=e.particlesPerWave??1,this.maxParticles=e.maxParticles??1e3,this.emitterLifetime=e.emitterLifetime??-1,this.spawnBounds=null,this.recycleOnBounds=!1,e.spawnBounds&&(this.spawnBounds=e.spawnBounds,this.recycleOnBounds=e.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],e.behaviors)for(let r of e.behaviors){let i=ck(r.type);if(!i){console.warn(`Unknown behavior type: ${r.type}`);continue}let s=new i(r.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=e.emit??!0}_createParticle(){let e;return this._poolFirst?(e=this._poolFirst,this._poolFirst=e.next,e.next=null):e=new Su(this),e}_unlinkActiveParticle(e){return!e||!(e===this._activeFirst||e===this._activeLast||e.prev!==null||e.next!==null)?!1:(e.prev?e.prev.next=e.next:this._activeFirst=e.next,e.next?e.next.prev=e.prev:this._activeLast=e.prev,e.prev=null,e.next=null,this._activeFirst?this.particleCount=Math.max(0,this.particleCount-1):(this._activeLast=null,this.particleCount=0),!0)}spawn(e){if(this.destroyed||e<=0)return null;let r=this.maxParticles-this.particleCount;if(e=Math.min(e,r),e<=0)return null;let i=this.textureSelector?.pick==="perWave"?this._pickTexture():null,s=null,o=null;for(let n=0;n<e;n++){let a=this._createParticle();a.texture=i??this._pickTexture();let l=jt(this.random.bind(this),this.lifetime);a.init(l),s||(s=a),o&&(o.next=a,a.prev=o),o=a,this.container.addChild(a)}for(let n of this.initBehaviors)n.initParticles(s);return this._activeLast?(this._activeLast.next=s,s.prev=this._activeLast):this._activeFirst=s,this._activeLast=o,this.particleCount+=e,s}emitNow(){this.spawn(this.particlesPerWave)}recycle(e){if(!e||e.destroyed){this._unlinkActiveParticle(e);return}for(let r of this.recycleBehaviors)r.recycleParticle(e);this._unlinkActiveParticle(e)&&(e.parent&&e.parent.removeChild(e),e.next=this._poolFirst,this._poolFirst=e)}update(e){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=e,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=e;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let r=this._activeFirst;for(;r;){let i=r.next;if(r.destroyed||!r.position){this._unlinkActiveParticle(r),r=i;continue}if(r.age+=e,r.age>=r.maxLife){this.recycle(r),r=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(r.x<s.x||r.x>s.x+s.width||r.y<s.y||r.y>s.y+s.height){this.recycle(r),r=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(r,e);r=i}}stop(e=!1){if(this.emit=!1,e)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()}_pickTexture(){if(!this.textureSelector)return this.texture;let{mode:e,items:r}=this.textureSelector;if(!r.length)return this.texture;if(e==="cycle"){let i=r[this._textureCycleIndex%r.length];return this._textureCycleIndex+=1,i.texture}if(e==="random"){let i=r.reduce((o,n)=>o+(n.weight??1),0),s=this.random()*i;for(let o of r)if(s-=o.weight??1,s<=0)return o.texture;return r[r.length-1].texture}return r[0].texture}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let e=this._activeFirst;for(;e;){let r=e.next;e.destroy(),e=r}for(e=this._poolFirst;e;){let r=e.next;e.destroy(),e=r}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function j4(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t.mode=="string"&&Array.isArray(t.items)}function q4(t,e){let r=new Ze,i=e.color??"#ffffff";switch(e.shape){case"circle":{let s=e.radius??3;r.circle(0,0,s),r.fill({color:i});break}case"ellipse":{let s=e.width??2,o=e.height??6;r.ellipse(0,0,s/2,o/2),r.fill({color:i});break}case"rect":{let s=e.width??4,o=e.height??4;r.rect(-s/2,-o/2,s,o),r.fill({color:i});break}default:r.circle(0,0,3),r.fill({color:i})}return t.renderer.generateTexture(r)}function uk(t,e){if(typeof e=="object"&&e?.shape)return q4(t,e);let r=e??"circle",i=lk(r,t);if(!i)try{i=B.from(r)}catch{return console.warn(`Failed to load particle texture: ${r}`),null}return i}function K4(t,e){let r=[];for(let i of e.items){let s=i.src?i.src:i,o=uk(t,s);if(!o)return null;r.push(i.weight===void 0?{texture:o}:{texture:o,weight:i.weight})}return{mode:e.mode,pick:e.pick??"perParticle",items:r}}var Pu=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o,renderContext:n,zIndex:a})=>{let l=new ie;l.label=r.id,l.zIndex=a,e.addChild(l);let c=r.width,u=r.height;l.x=r.x??0,l.y=r.y??0;let h={lifetime:r.emitter?.lifetime??{min:1,max:2},frequency:r.emitter?.frequency??.1,particlesPerWave:r.emitter?.particlesPerWave??1,maxParticles:r.emitter?.maxParticles??r.count??100,emitterLifetime:r.emitter?.emitterLifetime??-1,spawnBounds:r.emitter?.spawnBounds,recycleOnBounds:r.emitter?.recycleOnBounds??!1,seed:r.emitter?.seed,behaviors:r.behaviors},d=j4(r.texture)?K4(t,r.texture):uk(t,r.texture);if(!d)return;h.texture=d;let f=new Au(l,h);l.emitter=f;let p=h.frequency<=0;if(p){f.emitNow(),f.emit=!1;let x=v=>{if(!v.length)return;let[y,...g]=v;(y===0&&typeof requestAnimationFrame=="function"?requestAnimationFrame:_=>setTimeout(_,y))(()=>{f.destroyed||f.particleCount>0||(f.emitNow(),x(g))})};x([0,50,150])}if(h.recycleOnBounds&&!p){let x=Math.min(r.count??100,h.maxParticles);f.spawn(x);let v=f._activeFirst;for(;v;)v.y=f.random()*u,v.age=f.random()*v.maxLife*.8,v=v.next}let m=x=>{if(f.destroyed){t.ticker.remove(m);return}let v=Math.min(typeof x.deltaMS=="number"?x.deltaMS/1e3:x.deltaTime/60,.1);f.update(v)};l.tickerCallback=m,UI(n,{app:t,emitter:f,container:l,tickerCallback:m}),r.alpha!==void 0&&(l.alpha=r.alpha),oe({animations:i,targetId:r.id,animationBus:s,completionTracker:o,element:l,targetState:{x:r.x??0,y:r.y??0,alpha:r.alpha??l.alpha},renderContext:n})};var Xp=({app:t,parent:e,element:r,animationBus:i,animations:s,completionTracker:o})=>{let n=e.getChildByLabel(r.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(Gb({app:t,particleElement:n}),n.destroy({children:!0}))};oe({animations:s,targetId:r.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var hk=({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=e.children.find(h=>h.label===r.id);if(!c){Pu({app:t,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});return}if(c.zIndex=l,Z4(r,i))Xp({app:t,parent:e,element:r,animations:s,animationBus:o,completionTracker:n}),Pu({app:t,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});else{let h=()=>{i.alpha!==void 0&&(c.alpha=i.alpha),i.x!==void 0&&(c.x=i.x),i.y!==void 0&&(c.y=i.y)};oe({animations:s,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{x:i.x??c.x,y:i.y??c.y,alpha:i.alpha??c.alpha},onComplete:h})||h()}};function Z4(t,e){return t.count!==e.count||!ye(t.texture,e.texture)||!ye(t.behaviors,e.behaviors)||!ye(t.emitter,e.emitter)||t.width!==e.width||t.height!==e.height}function Kb(t){if(!t.id)throw new Error("Input Error: Id is missing");if(!Object.values(Tr).includes(t.type))throw new Error("Input Error: Type must be one of "+Object.values(Tr).join(", "));if(typeof t.width!="number"||typeof t.height!="number")throw new Error("Input Error: Width and height must be numbers");if(t.width<=0||t.height<=0)throw new Error("Input Error: Width and height must be positive")}function dk(t){if(!t.texture)throw new Error("Input Error: Particles require 'texture'");let e=typeof t.texture=="string",r=typeof t.texture=="object"&&t.texture!==null&&!Array.isArray(t.texture);if(!e&&!r)throw new Error("Input Error: texture must be a string or shape object");if(r){if(!t.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(t.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${t.texture.shape}'`)}}function fk(t){if(!t.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(t.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(t.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let e=0;e<t.behaviors.length;e++){let r=t.behaviors[e];if(typeof r!="object"||r===null||Array.isArray(r))throw new Error(`Input Error: behaviors[${e}] must be an object`);if(!r.type||typeof r.type!="string")throw new Error(`Input Error: behaviors[${e}] must have a 'type' string property`)}}function pk(t){if(!t.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof t.emitter!="object"||Array.isArray(t.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!t.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof t.emitter.lifetime!="object"||Array.isArray(t.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof t.emitter.lifetime.min!="number"||typeof t.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(t.emitter.lifetime.min<0||t.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(t.emitter.lifetime.min>t.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function mk(t){if(t.emitter.frequency!==void 0){if(typeof t.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(t.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(t.emitter.particlesPerWave!==void 0){if(typeof t.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(t.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(t.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(t.emitter.maxParticles!==void 0){if(typeof t.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(t.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(t.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function gk(t){if(t.count!==void 0){if(typeof t.count!="number")throw new Error("Input Error: count must be a number");if(t.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(t.count))throw new Error("Input Error: count must be an integer")}if(t.alpha!==void 0){if(typeof t.alpha!="number")throw new Error("Input Error: alpha must be a number");if(t.alpha<0||t.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(t.x!==void 0&&typeof t.x!="number")throw new Error("Input Error: x must be a number");if(t.y!==void 0&&typeof t.y!="number")throw new Error("Input Error: y must be a number")}var Q4=new Set(["continuous","burst"]),J4=new Set(["point","rect","circle","line"]),eW=new Set(["single","random","cycle"]),tW=new Set(["perParticle","perWave"]),xk=new Set(["uniform","normal","bias"]),yk=new Set(["min","max","center"]),rW=new Set(["none","fixed","random","spin"]);function Tk(t){if(iW(t),!t.modules||typeof t.modules!="object"||Array.isArray(t.modules))throw new Error("Input Error: Particles require 'modules'");let{emission:e,movement:r,appearance:i,bounds:s}=t.modules;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Input Error: modules.emission must be an object");if(!i||typeof i!="object"||Array.isArray(i))throw new Error("Input Error: modules.appearance must be an object");sW(e),nW(r,i),aW(i),dW(s)}function iW(t){if(t.texture!==void 0||t.behaviors!==void 0||t.emitter!==void 0)throw new Error("Input Error: Structured particles cannot mix 'modules' with legacy texture/behaviors/emitter fields");if(t.count!==void 0)throw new Error("Input Error: Structured particles do not support legacy 'count'");if(t.alpha!==void 0&&(_e(t.alpha,"alpha"),t.alpha<0||t.alpha>1))throw new Error("Input Error: alpha must be between 0 and 1");t.x!==void 0&&_e(t.x,"x"),t.y!==void 0&&_e(t.y,"y"),t.seed!==void 0&&_e(t.seed,"seed")}function sW(t){if(!Q4.has(t.mode))throw new Error("Input Error: modules.emission.mode must be 'continuous' or 'burst'");if(t.mode==="continuous"){if(_e(t.rate,"modules.emission.rate"),t.rate<=0)throw new Error("Input Error: modules.emission.rate must be positive")}else if(vk(t.burstCount,"modules.emission.burstCount"),t.burstCount<=0)throw new Error("Input Error: modules.emission.burstCount must be positive");if(t.maxActive!==void 0&&(vk(t.maxActive,"modules.emission.maxActive"),t.maxActive<=0))throw new Error("Input Error: modules.emission.maxActive must be positive");if(t.duration!==void 0&&t.duration!=="infinite"&&(_e(t.duration,"modules.emission.duration"),t.duration<0))throw new Error("Input Error: modules.emission.duration must be non-negative");if(Os(t.particleLifetime,"modules.emission.particleLifetime",{allowNegative:!1}),!t.source||typeof t.source!="object"||Array.isArray(t.source))throw new Error("Input Error: modules.emission.source must be an object");if(!J4.has(t.source.kind))throw new Error("Input Error: modules.emission.source.kind must be one of point, rect, circle, line");if(!t.source.data||typeof t.source.data!="object"||Array.isArray(t.source.data))throw new Error("Input Error: modules.emission.source.data must be an object");oW(t.source.kind,t.source.data)}function oW(t,e){if(t==="point"){_e(e.x,"modules.emission.source.data.x"),_e(e.y,"modules.emission.source.data.y");return}if(t==="rect"){if(_e(e.x,"modules.emission.source.data.x"),_e(e.y,"modules.emission.source.data.y"),_e(e.width,"modules.emission.source.data.width"),_e(e.height,"modules.emission.source.data.height"),e.width<=0||e.height<=0)throw new Error("Input Error: modules.emission.source.data.width and height must be positive");return}if(t==="circle"){if(_e(e.x,"modules.emission.source.data.x"),_e(e.y,"modules.emission.source.data.y"),_e(e.radius,"modules.emission.source.data.radius"),e.radius<=0)throw new Error("Input Error: modules.emission.source.data.radius must be positive");if(e.innerRadius!==void 0&&(_e(e.innerRadius,"modules.emission.source.data.innerRadius"),e.innerRadius<0||e.innerRadius>e.radius))throw new Error("Input Error: modules.emission.source.data.innerRadius must be between 0 and radius");if(e.affectRotation!==void 0&&typeof e.affectRotation!="boolean")throw new Error("Input Error: modules.emission.source.data.affectRotation must be a boolean");return}_e(e.x1,"modules.emission.source.data.x1"),_e(e.y1,"modules.emission.source.data.y1"),_e(e.x2,"modules.emission.source.data.x2"),_e(e.y2,"modules.emission.source.data.y2")}function nW(t,e){if(t!==void 0){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Input Error: modules.movement must be an object");if(t.velocity!==void 0){if(!t.velocity||typeof t.velocity!="object"||Array.isArray(t.velocity))throw new Error("Input Error: modules.movement.velocity must be an object");let{velocity:r}=t;if(r.kind!=="directional"&&r.kind!=="radial")throw new Error("Input Error: modules.movement.velocity.kind must be 'directional' or 'radial'");Os(r.speed,"modules.movement.velocity.speed",{allowNegative:!1}),r.kind==="directional"?Os(r.direction,"modules.movement.velocity.direction",{allowNegative:!0}):r.angle!==void 0&&Os(r.angle,"modules.movement.velocity.angle",{allowNegative:!0})}if(t.acceleration!==void 0){if(!t.acceleration||typeof t.acceleration!="object"||Array.isArray(t.acceleration))throw new Error("Input Error: modules.movement.acceleration must be an object");_e(t.acceleration.x,"modules.movement.acceleration.x"),_e(t.acceleration.y,"modules.movement.acceleration.y")}if(t.maxSpeed!==void 0&&(_e(t.maxSpeed,"modules.movement.maxSpeed"),t.maxSpeed<0))throw new Error("Input Error: modules.movement.maxSpeed must be non-negative");if(t.faceVelocity!==void 0&&typeof t.faceVelocity!="boolean")throw new Error("Input Error: modules.movement.faceVelocity must be a boolean");if(!t.velocity&&!t.acceleration)throw new Error("Input Error: modules.movement must define velocity, acceleration, or both");if(t.faceVelocity&&e?.rotation&&e.rotation.mode!=="none")throw new Error("Input Error: modules.appearance.rotation cannot be combined with modules.movement.faceVelocity")}}function aW(t){lW(t.texture),t.scale!==void 0&&_k(t.scale,"modules.appearance.scale",{allowNegative:!1,modes:["single","range","curve"]}),t.alpha!==void 0&&_k(t.alpha,"modules.appearance.alpha",{min:0,max:1,modes:["single","curve"]}),t.color!==void 0&&uW(t.color,"modules.appearance.color"),t.rotation!==void 0&&hW(t.rotation)}function lW(t){if(t===void 0)throw new Error("Input Error: modules.appearance.texture is required");if(typeof t!="string"){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Input Error: modules.appearance.texture must be a string or object");if(t.shape){Sk(t,"modules.appearance.texture");return}if(!eW.has(t.mode))throw new Error("Input Error: modules.appearance.texture.mode must be 'single', 'random', or 'cycle'");if(t.pick!==void 0&&!tW.has(t.pick))throw new Error("Input Error: modules.appearance.texture.pick must be 'perParticle' or 'perWave'");if(!Array.isArray(t.items)||t.items.length===0)throw new Error("Input Error: modules.appearance.texture.items must be a non-empty array");if(t.mode==="single"&&t.items.length!==1)throw new Error("Input Error: modules.appearance.texture.mode 'single' requires exactly one item");for(let e=0;e<t.items.length;e++){let r=t.items[e];cW(r,`modules.appearance.texture.items[${e}]`)}}}function cW(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be an object`);if(t.src!==void 0){if(typeof t.src!="string"||t.src.length===0)throw new Error(`Input Error: ${e}.src must be a non-empty string`)}else if(t.shape)Sk(t,e);else throw new Error(`Input Error: ${e} must define either 'src' or shape fields`);if(t.weight!==void 0&&(_e(t.weight,`${e}.weight`),t.weight<=0))throw new Error(`Input Error: ${e}.weight must be positive`)}function Sk(t,e){if(!["circle","ellipse","rect"].includes(t.shape))throw new Error(`Input Error: ${e}.shape must be 'circle', 'ellipse', or 'rect'`);if(t.radius!==void 0&&_e(t.radius,`${e}.radius`),t.width!==void 0&&_e(t.width,`${e}.width`),t.height!==void 0&&_e(t.height,`${e}.height`),t.color!==void 0&&typeof t.color!="string"&&typeof t.color!="number")throw new Error(`Input Error: ${e}.color must be a string or number`)}function _k(t,e,r){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be an object`);if(!r.modes.includes(t.mode))throw new Error(`Input Error: ${e}.mode must be one of ${r.modes.join(", ")}`);if(t.mode==="single"){Cu(t.value,`${e}.value`,r);return}if(t.mode==="range"){Os(t,e,r);return}if(!Array.isArray(t.keys)||t.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let i=-1/0;for(let s=0;s<t.keys.length;s++){let o=t.keys[s];if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`Input Error: ${e}.keys[${s}] must be an object`);if(_e(o.time,`${e}.keys[${s}].time`),o.time<0||o.time>1)throw new Error(`Input Error: ${e}.keys[${s}].time must be between 0 and 1`);if(o.time<i)throw new Error(`Input Error: ${e}.keys must be sorted by time`);i=o.time,Cu(o.value,`${e}.keys[${s}].value`,r)}}function uW(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be an object`);if(t.mode==="single"){bk(t.value,`${e}.value`);return}if(t.mode!=="gradient")throw new Error("Input Error: modules.appearance.color.mode must be 'single' or 'gradient'");if(!Array.isArray(t.keys)||t.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let r=-1/0;for(let i=0;i<t.keys.length;i++){let s=t.keys[i];if(!s||typeof s!="object"||Array.isArray(s))throw new Error(`Input Error: ${e}.keys[${i}] must be an object`);if(_e(s.time,`${e}.keys[${i}].time`),s.time<0||s.time>1)throw new Error(`Input Error: ${e}.keys[${i}].time must be between 0 and 1`);if(s.time<r)throw new Error(`Input Error: ${e}.keys must be sorted by time`);r=s.time,bk(s.value,`${e}.keys[${i}].value`)}}function bk(t,e){if(typeof t!="string"&&typeof t!="number")throw new Error(`Input Error: ${e} must be a string or number`)}function hW(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Input Error: modules.appearance.rotation must be an object");if(!rW.has(t.mode))throw new Error("Input Error: modules.appearance.rotation.mode must be 'none', 'fixed', 'random', or 'spin'");if(t.mode!=="none"){if(t.mode==="fixed"){_e(t.value,"modules.appearance.rotation.value");return}if(t.mode==="random"){Os(t,"modules.appearance.rotation",{allowNegative:!0});return}Os(t.start,"modules.appearance.rotation.start",{allowNegative:!0}),Os(t.speed,"modules.appearance.rotation.speed",{allowNegative:!0})}}function dW(t){if(t!==void 0){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Input Error: modules.bounds must be an object");if(t.mode!=="none"&&t.mode!=="recycle")throw new Error("Input Error: modules.bounds.mode must be 'none' or 'recycle'");if(t.mode!=="none"){if(t.source!=="area"&&t.source!=="custom")throw new Error("Input Error: modules.bounds.source must be 'area' or 'custom'");if(t.padding!==void 0&&fW(t.padding,"modules.bounds.padding"),t.source==="custom"){if(!t.custom||typeof t.custom!="object"||Array.isArray(t.custom))throw new Error("Input Error: modules.bounds.custom must be an object");_e(t.custom.x,"modules.bounds.custom.x"),_e(t.custom.y,"modules.bounds.custom.y"),_e(t.custom.width,"modules.bounds.custom.width"),_e(t.custom.height,"modules.bounds.custom.height")}}}}function fW(t,e){if(typeof t!="number"){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be a number or object`);for(let r of["top","right","bottom","left"])_e(t[r],`${e}.${r}`)}}function Os(t,e,r={}){if(typeof t=="number"){Cu(t,e,r);return}if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be a number or range object`);if(_e(t.min,`${e}.min`),_e(t.max??t.min,`${e}.max`),Cu(t.min,`${e}.min`,r),Cu(t.max??t.min,`${e}.max`,r),t.min>(t.max??t.min))throw new Error(`Input Error: ${e}.min cannot be greater than max`);t.distribution!==void 0&&pW(t.distribution,`${e}.distribution`)}function Cu(t,e,r={}){if(_e(t,e),!r.allowNegative&&t<0)throw new Error(`Input Error: ${e} must be non-negative`);if(r.min!==void 0&&t<r.min)throw new Error(`Input Error: ${e} must be at least ${r.min}`);if(r.max!==void 0&&t>r.max)throw new Error(`Input Error: ${e} must be at most ${r.max}`)}function pW(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be an object`);if(!xk.has(t.kind))throw new Error(`Input Error: ${e}.kind must be one of ${[...xk].join(", ")}`);if(t.kind==="bias"){if(!yk.has(t.toward??"min"))throw new Error(`Input Error: ${e}.toward must be one of ${[...yk].join(", ")}`);t.strength!==void 0&&_e(t.strength,`${e}.strength`)}t.kind==="normal"&&(t.mean!==void 0&&_e(t.mean,`${e}.mean`),t.deviation!==void 0&&_e(t.deviation,`${e}.deviation`))}function _e(t,e){if(typeof t!="number"||Number.isNaN(t))throw new Error(`Input Error: ${e} must be a number`)}function vk(t,e){if(_e(t,e),!Number.isInteger(t))throw new Error(`Input Error: ${e} must be an integer`)}function wk(t){let e=mW(t),r=[];r.push(gW(t.modules.emission.source));let i=yW(t.modules.movement);i&&r.push(i),r.push(..._W(t.modules.appearance));let s=AW(t.modules.bounds,t.width,t.height);s&&(e.spawnBounds=s.spawnBounds,e.recycleOnBounds=!0);let o=bW(t.modules.appearance.texture),n=e.maxParticles;return{id:t.id,type:t.type,count:n,texture:o,behaviors:r,emitter:e,x:t.x??0,y:t.y??0,width:t.width,height:t.height,alpha:t.alpha??1}}function mW(t){let{emission:e}=t.modules,r={lifetime:Ls(e.particleLifetime),maxParticles:e.mode==="burst"?Math.max(e.maxActive??e.burstCount,e.burstCount):e.maxActive??100,emitterLifetime:e.duration===void 0||e.duration==="infinite"?-1:e.duration,seed:t.seed};return e.mode==="continuous"?(r.frequency=1/e.rate,r.particlesPerWave=1):(r.frequency=0,r.particlesPerWave=e.burstCount),r}function gW(t){return{type:"spawnShape",config:{type:t.kind,data:xW(t.kind,t.data)}}}function xW(t,e){return t==="rect"?{x:e.x,y:e.y,w:e.width,h:e.height}:{...e}}function yW(t){if(!t)return null;let e={maxSpeed:t.maxSpeed??0,faceVelocity:t.faceVelocity??!1};return t.velocity&&(e.velocity={kind:t.velocity.kind,speed:Ls(t.velocity.speed)},t.velocity.kind==="directional"?e.velocity.direction=Ls(t.velocity.direction):e.velocity.angle=Ls(t.velocity.angle??{min:0,max:360})),t.acceleration&&(e.acceleration={x:t.acceleration.x,y:t.acceleration.y}),{type:"movement",config:e}}function _W(t){let e=[];if(t.scale&&e.push(TW(t.scale)),t.alpha&&e.push(SW(t.alpha)),t.color&&e.push(wW(t.color)),t.rotation){let r=EW(t.rotation);r&&e.push(r)}return e}function bW(t){if(typeof t=="string")return t;if(t.shape)return{...t};let e={mode:t.mode,pick:t.pick??"perParticle",items:t.items.map(vW)};if(e.mode==="single"&&e.items.length===1){let[r]=e.items;return r.src??Ek(r)}return e}function vW(t){if(t.src)return t.weight===void 0?{src:t.src}:{src:t.src,weight:t.weight};let e=Ek(t);return t.weight!==void 0&&(e.weight=t.weight),e}function Ek(t){return{shape:t.shape,...t.radius!==void 0?{radius:t.radius}:{},...t.width!==void 0?{width:t.width}:{},...t.height!==void 0?{height:t.height}:{},...t.color!==void 0?{color:t.color}:{}}}function TW(t){return t.mode==="curve"?{type:"scale",config:{list:Zb(t.keys)}}:{type:"scaleStatic",config:t.mode==="single"?{min:t.value,max:t.value}:Ls(t)}}function SW(t){return t.mode==="curve"?{type:"alpha",config:{list:Zb(t.keys)}}:{type:"alphaStatic",config:{alpha:t.value}}}function wW(t){return t.mode==="gradient"?{type:"color",config:{list:Zb(t.keys)}}:{type:"colorStatic",config:{color:t.value}}}function EW(t){if(t.mode==="none")return null;if(t.mode==="fixed")return{type:"noRotation",config:{rotation:t.value}};if(t.mode==="random"){let i=Ls(t);return{type:"rotationStatic",config:{min:i.min,max:i.max,distribution:i.distribution}}}let e=Ls(t.start),r=Ls(t.speed);return{type:"rotation",config:{minStart:e.min,maxStart:e.max,startDistribution:e.distribution,minSpeed:r.min,maxSpeed:r.max,speedDistribution:r.distribution,accel:t.accel??0}}}function AW(t,e,r){if(!t||t.mode==="none")return null;if(t.source==="custom")return{spawnBounds:{...t.custom}};let i=PW(t.padding??0);return{spawnBounds:{x:-i.left,y:-i.top,width:e+i.left+i.right,height:r+i.top+i.bottom}}}function PW(t){return typeof t=="number"?{top:t,right:t,bottom:t,left:t}:{top:t.top,right:t.right,bottom:t.bottom,left:t.left}}function Zb(t){return t.map(e=>({time:e.time,value:e.value}))}function Ls(t){return typeof t=="number"?{min:t,max:t}:{min:t.min,max:t.max??t.min,...t.distribution!==void 0?{distribution:{...t.distribution}}:{}}}var Ak=({state:t})=>{if(t.modules)return Kb(t),Tk(t),wk(t);Kb(t),dk(t),fk(t),pk(t),mk(t),gk(t);let e=t.emitter?.maxParticles??t.count??100,r=t.emitter;return r&&r.maxParticles===void 0&&t.count!==void 0&&(r={...r,maxParticles:e}),{id:t.id,type:t.type,count:e,texture:t.texture,behaviors:t.behaviors,emitter:r,x:t.x??0,y:t.y??0,width:t.width,height:t.height,alpha:t.alpha??1}};var CW=dt({type:"particles",add:Pu,update:hk,delete:Xp,parse:Ak});var Pk=(t=[],e=[])=>{let r=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of t)r.add(l.id),i.set(l.id,l);for(let l of e)r.add(l.id),s.set(l.id,l);for(let l of r){let c=i.get(l),u=s.get(l);!c&&u?o.push(u):c&&!u?n.push(c):ye(c,u)||a.push({prev:c,next:u})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Ck=new Set(["audio-channel","sound"]),Rk="audio-transition",Mk="audioTransition",RW=new Set([Rk,Mk]),MW=new Set(["enter","exit","update"]),IW=new Set(["volume"]),BW=new Set(["linear"]),FW={enter:new Set(["from","duration","easing"]),exit:new Set(["to","duration","easing"]),update:new Set(["duration","easing"])},kW=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Ra=(t,e)=>{if(!kW(t))throw new Error(`Input error: ${e} must be an object.`)},Ma=(t,e)=>{if(typeof t!="string"||t.length===0)throw new Error(`Input error: ${e} must be a non-empty string.`)},Ru=(t,e,{min:r,max:i}={})=>{if(typeof t!="number"||Number.isNaN(t))throw new Error(`Input error: ${e} must be a number.`);if(r!==void 0&&t<r)throw new Error(`Input error: ${e} must be greater than or equal to ${r}.`);if(i!==void 0&&t>i)throw new Error(`Input error: ${e} must be less than or equal to ${i}.`)},Qb=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new Error(`Input error: ${e} must be a boolean.`)},Ca=(t,e,r)=>{t!=null&&Ru(t,e,r)},Ik=(t,e)=>t==null?100:(Ru(t,e),Math.max(0,Math.min(100,t))),Yp=(t,e,r)=>{if(t.has(e))throw new Error(`Input error: duplicate audio render-state id "${e}" at ${r}.`);t.add(e)},Bk=(t,e,r,i,s=null)=>{if(Ma(t.id,`${e}.id`),Yp(r,t.id,`${e}.id`),Ma(t.src,`${e}.src`),t.delay!==void 0)throw new Error(`Input error: ${e}.delay is not supported. Use ${e}.startDelayMs instead.`);let o=Ik(t.volume,`${e}.volume`);if(Qb(t.muted,`${e}.muted`),Ca(t.pan,`${e}.pan`,{min:-1,max:1}),Qb(t.loop,`${e}.loop`),Ca(t.startDelayMs,`${e}.startDelayMs`,{min:0}),Ca(t.playbackRate,`${e}.playbackRate`,{min:0}),Ca(t.startAt,`${e}.startAt`,{min:0}),Ca(t.endAt,`${e}.endAt`,{min:0}),t.endAt!==void 0&&t.endAt!==null&&t.startAt!==void 0&&t.endAt<t.startAt)throw new Error(`Input error: ${e}.endAt must be greater than or equal to startAt.`);i.push({id:t.id,type:"sound",src:t.src,volume:o,muted:t.muted??!1,pan:t.pan??0,loop:t.loop??!1,startDelayMs:t.startDelayMs??0,playbackRate:t.playbackRate??1,startAt:t.startAt??0,endAt:t.endAt??null,channelId:s})},UW=(t,e,r,i,s)=>{Ma(t.id,`${e}.id`),Yp(r,t.id,`${e}.id`);let o=Ik(t.volume,`${e}.volume`);if(Qb(t.muted,`${e}.muted`),Ca(t.pan,`${e}.pan`,{min:-1,max:1}),t.children!==void 0&&!Array.isArray(t.children))throw new Error(`Input error: ${e}.children must be an array.`);i.push({id:t.id,type:"audio-channel",volume:o,muted:t.muted??!1,pan:t.pan??0});for(let[n,a]of(t.children??[]).entries()){let l=`${e}.children[${n}]`;if(Ra(a,l),a.type==="audio-channel")throw new Error(`Input error: nested audio-channel nodes are not supported at ${l}.`);if(a.type!=="sound")throw new Error(`Input error: ${l}.type must be "sound".`);Bk(a,l,r,s,t.id)}},OW=(t,e)=>{if(!Array.isArray(t))throw new Error("Input error: `audio` must be an array.");let r=[],i=[],s=new Set;for(let[o,n]of t.entries()){let a=`audio[${o}]`;if(Ra(n,a),!Ck.has(n.type)){Ma(n.id,`${a}.id`),Yp(e,n.id,`${a}.id`);continue}if(n.type==="audio-channel"){UW(n,a,e,r,i),s.add(n.id);for(let l of i)l.channelId===n.id&&s.add(l.id)}else Bk(n,a,e,i),s.add(n.id)}return{channels:r,sounds:i,builtinNodeIds:s}},LW=(t,e,r,i)=>{Ra(t,r);for(let s of Object.keys(t))if(!FW[e].has(s))throw new Error(`Input error: unsupported audio transition field "${s}" at ${r}.`);if(t.duration===void 0)throw new Error(`Input error: ${r}.duration is required.`);if(Ru(t.duration,`${r}.duration`,{min:0}),t.easing===void 0)throw new Error(`Input error: ${r}.easing is required.`);if(!BW.has(t.easing))throw new Error(`Input error: ${r}.easing "${t.easing}" is not supported.`);if(e==="enter"){if(t.from===void 0)throw new Error(`Input error: ${r}.from is required.`);Ru(t.from,`${r}.from`,{min:0,max:100})}if(e==="exit"){if(t.to===void 0)throw new Error(`Input error: ${r}.to is required.`);Ru(t.to,`${r}.to`,{min:0,max:100})}if(i!=="volume")throw new Error(`Input error: unsupported audio transition property "${i}" at ${r}.`)},GW=(t,e,r)=>{if(Ma(t.targetId,`${e}.targetId`),!r.has(t.targetId))throw new Error(`Input error: ${e}.targetId "${t.targetId}" does not resolve to an audio node.`);Ra(t.properties,`${e}.properties`);for(let[i,s]of Object.entries(t.properties)){if(!IW.has(i))throw new Error(`Input error: unsupported audio transition property "${i}" at ${e}.properties.`);Ra(s,`${e}.properties.${i}`);for(let[o,n]of Object.entries(s)){if(!MW.has(o))throw new Error(`Input error: unsupported audio transition phase "${o}" at ${e}.properties.${i}.`);LW(n,o,`${e}.properties.${i}.${o}`,i)}}},DW=(t,e,r)=>{if(!Array.isArray(t))throw new Error("Input error: `audioEffects` must be an array.");for(let[i,s]of t.entries()){let o=`audioEffects[${i}]`;if(Ra(s,o),Ma(s.id,`${o}.id`),Yp(e,s.id,`${o}.id`),!RW.has(s.type))throw new Error(`Input error: unsupported audio effect type "${s.type}" at ${o}.`);(s.type===Rk||s.type===Mk)&&GW(s,o,r)}};var Gs=({audio:t=[],audioEffects:e=[]}={})=>{let r=new Set,i=OW(t,r);return DW(e,r,i.builtinNodeIds),{audio:t,audioEffects:e,channels:i.channels,sounds:i.sounds}},Fk=t=>Ck.has(t?.type),Jb=(t=[])=>t.filter(Fk),ev=(t=[])=>t.filter(e=>!Fk(e));var kk=({app:t,prevAudioTree:e,nextAudioTree:r,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=Pk(e,r);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:t,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:t,element:a})}for(let{prev:a,next:l}of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);c.update({app:t,prevElement:a,nextElement:l})}},tv=({app:t,prevAudioTree:e,nextAudioTree:r,prevAudioEffects:i=[],nextAudioEffects:s=[],audioPlugins:o})=>{if(Gs({audio:e,audioEffects:i}),Gs({audio:r,audioEffects:s}),typeof t.audioStage?.renderGraph=="function"){t.audioStage.renderGraph({prevAudio:Jb(e),nextAudio:Jb(r),prevAudioEffects:i,nextAudioEffects:s}),kk({app:t,prevAudioTree:ev(e),nextAudioTree:ev(r),audioPlugins:o});return}kk({app:t,prevAudioTree:e,nextAudioTree:r,audioPlugins:o})};var Sr=(t=>(t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2",t))(Sr||{}),rv=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS",t))(rv||{}),jp=(t=>(t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL",t))(jp||{}),he=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR",t))(he||{}),Ia=(t=>(t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t))(Ia||{}),j=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(j||{}),Ki=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(Ki||{}),ge=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(ge||{}),Q=(t=>(t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT",t))(Q||{}),Vr=(t=>(t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR",t))(Vr||{}),Mu=(t=>(t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t))(Mu||{}),ti=(t=>(t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL",t))(ti||{}),wr=(t=>(t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",t))(wr||{}),Ds=(t=>(t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT",t))(Ds||{}),qp=(t=>(t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL",t))(qp||{}),or=(t=>(t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp",t))(or||{}),xt=(t=>(t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE",t[t.COLOR=4]="COLOR",t))(xt||{});var We=(t=>(t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH",t))(We||{}),pr=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(pr||{});var iv={createCanvas:(t,e)=>{let r=document.createElement("canvas");return r.width=t,r.height=e,r},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")};var ne={ADAPTER:iv,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Pg();var NW=cs.default??cs,ri=NW(globalThis.navigator);ne.RETINA_PREFIX=/@([0-9\.]+)x/;ne.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Vo=Xs(Ok(),1),IX=Xs(Td(),1);var Lv=Xs(QU(),1);var JU={};function we(t,e,r=3){if(JU[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
1582
1582
|
Deprecated since v${t}`):(i=i.split(`
|
|
1583
1583
|
`).splice(r).join(`
|
|
1584
1584
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}
|
|
1585
1585
|
Deprecated since v${t}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
1586
|
-
Deprecated since v${t}`),console.warn(i))),JU[e]=!0}var Gv;function Dv(){return typeof Gv>"u"&&(Gv=function(){let t={stencil:!0,failIfMajorPerformanceCaveat:ne.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!ne.ADAPTER.getWebGLRenderingContext())return!1;let e=ne.ADAPTER.createCanvas(),r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),i=!!r?.getContextAttributes()?.stencil;if(r){let s=r.getExtension("WEBGL_lose_context");s&&s.loseContext()}return r=null,i}catch{return!1}}()),Gv}Jm();eg();Fh([kh]);var Ha=class hm{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}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(e){return this.value=e,this}set value(e){if(e instanceof hm)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,e))&&(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}isSourceEqual(e,r){let i=typeof e;if(i!==typeof r)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===r;if(Array.isArray(e)&&Array.isArray(r)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(r))return e.length!==r.length?!1:e.every((s,o)=>s===r[o]);if(e!==null&&r!==null){let s=Object.keys(e),o=Object.keys(r);return s.length!==o.length?!1:s.every(n=>e[n]===r[n])}return e===r}toRgba(){let[e,r,i,s]=this._components;return{r:e,g:r,b:i,a:s}}toRgb(){let[e,r,i]=this._components;return{r:e,g:r,b:i}}toRgbaString(){let[e,r,i]=this.toUint8RgbArray();return`rgba(${e},${r},${i},${this.alpha})`}toUint8RgbArray(e){let[r,i,s]=this._components;return e=e??[],e[0]=Math.round(r*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toRgbArray(e){e=e??[];let[r,i,s]=this._components;return e[0]=r,e[1]=i,e[2]=s,e}toNumber(){return this._int}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[r,i,s,o]=hm.temp.setValue(e)._components;return this._components[0]*=r,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(e,r=!0){return r&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,r=!0){if(e===1)return(255<<24)+this._int;if(e===0)return r?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return r&&(i=i*e+.5|0,s=s*e+.5|0,o=o*e+.5|0),(e*255<<24)+(i<<16)+(s<<8)+o}toHex(){let e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}round(e){let[r,i,s]=this._components;return this._components[0]=Math.round(r*e)/e,this._components[1]=Math.round(i*e)/e,this._components[2]=Math.round(s*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e=e??[];let[r,i,s,o]=this._components;return e[0]=r,e[1]=i,e[2]=s,e[3]=o,e}normalize(e){let r,i,s,o;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let n=e;r=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[r,i,s,o=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[r,i,s,o=255]=e,r/=255,i/=255,s/=255,o/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let a=hm.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}let n=mr(e);n.isValid()&&({r,g:i,b:s,a:o}=n.rgba,r/=255,i/=255,s/=255)}if(r!==void 0)this._components[0]=r,this._components[1]=i,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${e}`)}refreshInt(){this._clamp(this._components);let[e,r,i]=this._components;this._int=(e*255<<16)+(r*255<<8)+(i*255|0)}_clamp(e,r=0,i=1){return typeof e=="number"?Math.min(Math.max(e,r),i):(e.forEach((s,o)=>{e[o]=Math.min(Math.max(s,r),i)}),e)}};Ha.shared=new Ha,Ha.temp=new Ha,Ha.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var ii=Ha;function
|
|
1587
|
-
`);function
|
|
1588
|
-
else `),r<t-1&&(e+=`if(test == ${r}.0){}`);return e}function gm(t,e){if(t===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let r=e.createShader(e.FRAGMENT_SHADER);for(;;){let i=CX.replace(/%forloop%/gi,RX(t));if(e.shaderSource(r,i),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))t=t/2|0;else break}return t}var $v=0,zv=1,Xv=2,Yv=3,jv=4,qv=5,Ii=class t{constructor(){this.data=0,this.blendMode=he.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<$v)}set blend(e){!!(this.data&1<<$v)!==e&&(this.data^=1<<$v)}get offsets(){return!!(this.data&1<<zv)}set offsets(e){!!(this.data&1<<zv)!==e&&(this.data^=1<<zv)}get culling(){return!!(this.data&1<<Xv)}set culling(e){!!(this.data&1<<Xv)!==e&&(this.data^=1<<Xv)}get depthTest(){return!!(this.data&1<<Yv)}set depthTest(e){!!(this.data&1<<Yv)!==e&&(this.data^=1<<Yv)}get depthMask(){return!!(this.data&1<<qv)}set depthMask(e){!!(this.data&1<<qv)!==e&&(this.data^=1<<qv)}get clockwiseFrontFace(){return!!(this.data&1<<jv)}set clockwiseFrontFace(e){!!(this.data&1<<jv)!==e&&(this.data^=1<<jv)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==he.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){let e=new t;return e.depthTest=!1,e.blend=!0,e}};Ii.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var zu=[];function $a(t,e){if(!t)return null;let r="";if(typeof t=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);i&&(r=i[1].toLowerCase())}for(let i=zu.length-1;i>=0;--i){let s=zu[i];if(s.test&&s.test(t,r))return new s(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var pt=class{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,r,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:c,items:u}=this;this._aliasCount++;for(let h=0,d=u.length;h<d;h++)u[h][c](e,r,i,s,o,n,a,l);return u===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this}remove(e){let r=this.items.indexOf(e);return r!==-1&&(this.ensureNonAliasedItems(),this.items.splice(r,1)),this}contains(e){return this.items.includes(e)}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(pt.prototype,{dispatch:{value:pt.prototype.emit},run:{value:pt.prototype.emit}});var Ar=class{constructor(e=0,r=0){this._width=e,this._height=r,this.destroyed=!1,this.internal=!1,this.onResize=new pt("setRealSize"),this.onUpdate=new pt("update"),this.onError=new pt("onError")}bind(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)}resize(e,r){(e!==this._width||r!==this._height)&&(this._width=e,this._height=r,this.onResize.emit(e,r))}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(e,r,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(e,r){return!1}};var Ho=class extends Ar{constructor(e,r){let{width:i,height:s}=r||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=e,this.unpackAlignment=r.unpackAlignment??4}upload(e,r,i){let s=e.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===wr.UNPACK);let o=r.realWidth,n=r.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(r.target,0,0,0,o,n,r.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(r.target,0,i.internalFormat,o,n,0,r.format,i.type,this.data)),!0}dispose(){this.data=null}static test(e){return e===null||e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}};var MX={scaleMode:Vr.NEAREST,alphaMode:wr.NPM},Kv=class za extends Vo.default{constructor(e=null,r=null){super(),r=Object.assign({},za.defaultOptions,r);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:c,format:u,type:h,target:d,resolution:f,resourceOptions:p}=r;e&&!(e instanceof Ar)&&(e=$a(e,p),e.internal=!0),this.resolution=f||ne.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=u,this.type=h,this.target=d,this.alphaMode=i,this.uid=Qi(),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(e)}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(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)}setStyle(e,r){let i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),r!==void 0&&r!==this.mipmap&&(this.mipmap=r,i=!0),i&&this.dirtyStyleId++,this}setSize(e,r,i){return i=i||this.resolution,this.setRealSize(e*i,r*i,i)}setRealSize(e,r,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(r)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=dm(this.realWidth)&&dm(this.realHeight)}setResolution(e){let r=this.resolution;return r===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*r)/e,this.height=Math.round(this.height*r)/e,this.emit("update",this)),this._refreshPOT(),this)}setResource(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,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(e){this.emit("error",this,e)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Mi[this.cacheId],delete Er[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),za.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,r,i=ne.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else{if(!e._pixiId){let a=r?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Qi()}`}o=e._pixiId}let n=Mi[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new za(e,r),n.cacheId=o,za.addToCache(n,o)),n}static fromBuffer(e,r,i,s){e=e||new Float32Array(r*i*4);let o=new Ho(e,{width:r,height:i,...s?.resourceOptions}),n,a;return e instanceof Float32Array?(n=j.RGBA,a=ge.FLOAT):e instanceof Int32Array?(n=j.RGBA_INTEGER,a=ge.INT):e instanceof Uint32Array?(n=j.RGBA_INTEGER,a=ge.UNSIGNED_INT):e instanceof Int16Array?(n=j.RGBA_INTEGER,a=ge.SHORT):e instanceof Uint16Array?(n=j.RGBA_INTEGER,a=ge.UNSIGNED_SHORT):e instanceof Int8Array?(n=j.RGBA,a=ge.BYTE):(n=j.RGBA,a=ge.UNSIGNED_BYTE),o.internal=!0,new za(o,Object.assign({},MX,{type:a,format:n},s))}static addToCache(e,r){r&&(e.textureCacheIds.includes(r)||e.textureCacheIds.push(r),Mi[r]&&Mi[r]!==e&&console.warn(`BaseTexture added to the cache with an id [${r}] that already had an entry`),Mi[r]=e)}static removeFromCache(e){if(typeof e=="string"){let r=Mi[e];if(r){let i=r.textureCacheIds.indexOf(e);return i>-1&&r.textureCacheIds.splice(i,1),delete Mi[e],r}}else if(e?.textureCacheIds){for(let r=0;r<e.textureCacheIds.length;++r)delete Mi[e.textureCacheIds[r]];return e.textureCacheIds.length=0,e}return null}};Kv.defaultOptions={mipmap:ti.POW2,anisotropicLevel:0,scaleMode:Vr.LINEAR,wrapMode:Mu.CLAMP,alphaMode:wr.UNPACK,target:Ki.TEXTURE_2D,format:j.RGBA,type:ge.UNSIGNED_BYTE},Kv._globalBatch=0;var Pe=Kv;var Xu=class{constructor(){this.texArray=null,this.blend=0,this.type=Ia.TRIANGLES,this.start=0,this.size=0,this.data=null}};var IX=0,yt=class t{constructor(e,r=!0,i=!1){this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=r,this.id=IX++,this.disposeRunner=new pt("disposeBuffer")}update(e){e instanceof Array&&(e=new Float32Array(e)),this.data=e||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(e){this.type=e?pr.ELEMENT_ARRAY_BUFFER:pr.ARRAY_BUFFER}get index(){return this.type===pr.ELEMENT_ARRAY_BUFFER}static from(e){return e instanceof Array&&(e=new Float32Array(e)),new t(e)}};var Xa=class t{constructor(e,r=0,i=!1,s=ge.FLOAT,o,n,a,l=1){this.buffer=e,this.size=r,this.normalized=i,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=l}destroy(){this.buffer=null}static from(e,r,i,s,o){return new t(e,r,i,s,o)}};var BX={Float32Array,Uint32Array,Int32Array,Uint8Array};function iO(t,e){let r=0,i=0,s={};for(let l=0;l<t.length;l++)i+=e[l],r+=t[l].length;let o=new ArrayBuffer(r*4),n=null,a=0;for(let l=0;l<t.length;l++){let c=e[l],u=t[l],h=Wa(u);s[h]||(s[h]=new BX[h](o)),n=s[h];for(let d=0;d<u.length;d++){let f=(d/c|0)*i+a,p=d%c;n[f+p]=u[d]}a+=c}return new Float32Array(o)}var sO={5126:4,5123:2,5121:1},FX=0,kX={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},Ji=class t{constructor(e=[],r={}){this.buffers=e,this.indexBuffer=null,this.attributes=r,this.glVertexArrayObjects={},this.id=FX++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new pt("disposeGeometry"),this.refCount=0}addAttribute(e,r,i=0,s=!1,o,n,a,l=!1){if(!r)throw new Error("You must pass a buffer when creating an attribute");r instanceof yt||(r instanceof Array&&(r=new Float32Array(r)),r=new yt(r));let c=e.split("|");if(c.length>1){for(let h=0;h<c.length;h++)this.addAttribute(c[h],r,i,s,o);return this}let u=this.buffers.indexOf(r);return u===-1&&(this.buffers.push(r),u=this.buffers.length-1),this.attributes[e]=new Xa(u,i,s,o,n,a,l),this.instanced=this.instanced||l,this}getAttribute(e){return this.attributes[e]}getBuffer(e){return this.buffers[this.getAttribute(e).buffer]}addIndex(e){return e instanceof yt||(e instanceof Array&&(e=new Uint16Array(e)),e=new yt(e)),e.type=pr.ELEMENT_ARRAY_BUFFER,this.indexBuffer=e,this.buffers.includes(e)||this.buffers.push(e),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let e=[],r=[],i=new yt,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];e.push(n.data),r.push(o.size*sO[o.type]/4),o.buffer=0}for(i.data=iO(e,r),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 e in this.attributes){let r=this.attributes[e];return this.buffers[r.buffer].data.length/(r.stride/4||r.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let e=new t;for(let r=0;r<this.buffers.length;r++)e.buffers[r]=new yt(this.buffers[r].data.slice(0));for(let r in this.attributes){let i=this.attributes[r];e.attributes[r]=new Xa(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=pr.ELEMENT_ARRAY_BUFFER),e}static merge(e){let r=new t,i=[],s=[],o=[],n;for(let a=0;a<e.length;a++){n=e[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 kX[Wa(n.buffers[a].data)](s[a]),r.buffers[a]=new yt(i[a]);for(let a=0;a<e.length;a++){n=e[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(r.attributes=n.attributes,n.indexBuffer){r.indexBuffer=r.buffers[n.buffers.indexOf(n.indexBuffer)],r.indexBuffer.type=pr.ELEMENT_ARRAY_BUFFER;let a=0,l=0,c=0,u=0;for(let h=0;h<n.buffers.length;h++)if(n.buffers[h]!==n.indexBuffer){u=h;break}for(let h in n.attributes){let d=n.attributes[h];(d.buffer|0)===u&&(l+=d.size*sO[d.type]/4)}for(let h=0;h<e.length;h++){let d=e[h].indexBuffer.data;for(let f=0;f<d.length;f++)r.indexBuffer.data[f+c]+=a;a+=e[h].buffers[u].data.length/l,c+=d.length}}return r}};var Yu=class extends Ji{constructor(e=!1){super(),this._buffer=new yt(null,e,!1),this._indexBuffer=new yt(null,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ge.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ge.FLOAT).addAttribute("aColor",this._buffer,4,!0,ge.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ge.FLOAT).addIndex(this._indexBuffer)}};var Zv=Math.PI*2,UX=180/Math.PI,OX=Math.PI/180,Wr=(t=>(t[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC",t))(Wr||{});var _t=class t{constructor(e=0,r=0){this.x=0,this.y=0,this.x=e,this.y=r}clone(){return new t(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,r=e){return this.x=e,this.y=r,this}};_t.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var xm=[new _t,new _t,new _t,new _t],Ie=class t{constructor(e=0,r=0,i=0,s=0){this.x=Number(e),this.y=Number(r),this.width=Number(i),this.height=Number(s),this.type=Wr.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 t(0,0,0,0)}clone(){return new t(this.x,this.y,this.width,this.height)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}contains(e,r){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height}intersects(e,r){if(!r){let P=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=P)return!1;let C=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.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=xm[0].set(e.left,e.top),l=xm[1].set(e.left,e.bottom),c=xm[2].set(e.right,e.top),u=xm[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(r.a*r.d-r.b*r.c);if(h===0||(r.apply(a,a),r.apply(l,l),r.apply(c,c),r.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=i||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=o||Math.min(a.y,l.y,c.y,u.y)>=n))return!1;let d=h*(l.y-a.y),f=h*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,x=d*i+f*n,v=d*s+f*n;if(Math.max(p,m,x,v)<=d*a.x+f*a.y||Math.min(p,m,x,v)>=d*u.x+f*u.y)return!1;let y=h*(a.y-c.y),g=h*(c.x-a.x),b=y*i+g*o,_=y*s+g*o,S=y*i+g*n,E=y*s+g*n;return!(Math.max(b,_,S,E)<=y*a.x+g*a.y||Math.min(b,_,S,E)>=y*u.x+g*u.y)}pad(e=0,r=e){return this.x-=e,this.y-=r,this.width+=e*2,this.height+=r*2,this}fit(e){let r=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=r,this.width=Math.max(i-r,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,r=.001){let i=Math.ceil((this.x+this.width-r)*e)/e,s=Math.ceil((this.y+this.height-r)*e)/e;return this.x=Math.floor((this.x+r)*e)/e,this.y=Math.floor((this.y+r)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let r=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=r,this.width=i-r,this.y=s,this.height=o-s,this}};Ie.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var ym=class t{constructor(e=0,r=0,i=0){this.x=e,this.y=r,this.radius=i,this.type=Wr.CIRC}clone(){return new t(this.x,this.y,this.radius)}contains(e,r){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-r;return s*=s,o*=o,s+o<=i}getBounds(){return new Ie(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};ym.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var _m=class t{constructor(e=0,r=0,i=0,s=0){this.x=e,this.y=r,this.width=i,this.height=s,this.type=Wr.ELIP}clone(){return new t(this.x,this.y,this.width,this.height)}contains(e,r){if(this.width<=0||this.height<=0)return!1;let i=(e-this.x)/this.width,s=(r-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new Ie(this.x-this.width,this.y-this.height,this.width,this.height)}};_m.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var bm=class t{constructor(...e){let r=Array.isArray(e[0])?e[0]:e;if(typeof r[0]!="number"){let i=[];for(let s=0,o=r.length;s<o;s++)i.push(r[s].x,r[s].y);r=i}this.points=r,this.type=Wr.POLY,this.closeStroke=!0}clone(){let e=this.points.slice(),r=new t(e);return r.closeStroke=this.closeStroke,r}contains(e,r){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],u=this.points[n*2+1];l>r!=u>r&&e<(c-a)*((r-l)/(u-l))+a&&(i=!i)}return i}};bm.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`};var vm=class t{constructor(e=0,r=0,i=0,s=0,o=20){this.x=e,this.y=r,this.width=i,this.height=s,this.radius=o,this.type=Wr.RREC}clone(){return new t(this.x,this.y,this.width,this.height,this.radius)}contains(e,r){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&r>=this.y&&r<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(r>=this.y+i&&r<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=r-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=e-(this.x+this.width-i),s*s+o*o<=n)||(o=r-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}};vm.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var qe=class t{constructor(e=1,r=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=r,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,r,i,s,o,n){return this.a=e,this.b=r,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,r){this.array||(this.array=new Float32Array(9));let i=r||this.array;return e?(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(e,r){r=r||new _t;let i=e.x,s=e.y;return r.x=this.a*i+this.c*s+this.tx,r.y=this.b*i+this.d*s+this.ty,r}applyInverse(e,r){r=r||new _t;let i=1/(this.a*this.d+this.c*-this.b),s=e.x,o=e.y;return r.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,r.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,r}translate(e,r){return this.tx+=e,this.ty+=r,this}scale(e,r){return this.a*=e,this.d*=r,this.c*=e,this.b*=r,this.tx*=e,this.ty*=r,this}rotate(e){let r=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*r-this.b*i,this.b=s*i+this.b*r,this.c=o*r-this.d*i,this.d=o*i+this.d*r,this.tx=n*r-this.ty*i,this.ty=n*i+this.ty*r,this}append(e){let r=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*r+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*r+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*r+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}setTransform(e,r,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=e-(i*this.a+s*this.c),this.ty=r-(i*this.b+s*this.d),this}prepend(e){let r=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let i=this.a,s=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=r*e.a+this.ty*e.c+e.tx,this.ty=r*e.b+this.ty*e.d+e.ty,this}decompose(e){let r=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,r),c=Math.abs(a+l);return c<1e-5||Math.abs(Zv-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(r*r+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*r+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,r=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-r*i;return this.a=s/n,this.b=-r/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-r*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 e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}static get IDENTITY(){return new t}static get TEMP_MATRIX(){return new t}};qe.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 Wo=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],$o=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],zo=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Xo=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Qv=[],oO=[],Tm=Math.sign;function LX(){for(let t=0;t<16;t++){let e=[];Qv.push(e);for(let r=0;r<16;r++){let i=Tm(Wo[t]*Wo[r]+zo[t]*$o[r]),s=Tm($o[t]*Wo[r]+Xo[t]*$o[r]),o=Tm(Wo[t]*zo[r]+zo[t]*Xo[r]),n=Tm($o[t]*zo[r]+Xo[t]*Xo[r]);for(let a=0;a<16;a++)if(Wo[a]===i&&$o[a]===s&&zo[a]===o&&Xo[a]===n){e.push(a);break}}}for(let t=0;t<16;t++){let e=new qe;e.set(Wo[t],$o[t],zo[t],Xo[t],0,0),oO.push(e)}}LX();var Je={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:t=>Wo[t],uY:t=>$o[t],vX:t=>zo[t],vY:t=>Xo[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Qv[t][e],sub:(t,e)=>Qv[t][Je.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?Je.S:Je.N:Math.abs(e)*2<=Math.abs(t)?t>0?Je.E:Je.W:e>0?t>0?Je.SE:Je.SW:t>0?Je.NE:Je.NW,matrixAppendRotationInv:(t,e,r=0,i=0)=>{let s=oO[Je.inv(e)];s.tx=r,s.ty=i,t.append(s)}};var es=class t{constructor(e,r,i=0,s=0){this._x=i,this._y=s,this.cb=e,this.scope=r}clone(e=this.cb,r=this.scope){return new t(e,r,this._x,this._y)}set(e=0,r=e){return(this._x!==e||this._y!==r)&&(this._x=e,this._y=r,this.cb.call(this.scope)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))}};es.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Jv=class{constructor(){this.worldTransform=new qe,this.localTransform=new qe,this.position=new es(this.onChange,this,0,0),this.scale=new es(this.onChange,this,1,1),this.pivot=new es(this.onChange,this,0,0),this.skew=new es(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 t=this.localTransform;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)}updateTransform(t){let e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){let r=t.worldTransform,i=this.worldTransform;i.a=e.a*r.a+e.b*r.c,i.b=e.a*r.b+e.b*r.d,i.c=e.c*r.a+e.d*r.c,i.d=e.c*r.b+e.d*r.d,i.tx=e.tx*r.a+e.ty*r.c+r.tx,i.ty=e.tx*r.b+e.ty*r.d+r.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};Jv.IDENTITY=new Jv;var Sm=Jv;Sm.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 nO=`varying vec2 vTextureCoord;
|
|
1586
|
+
Deprecated since v${t}`),console.warn(i))),JU[e]=!0}var Gv;function Dv(){return typeof Gv>"u"&&(Gv=function(){let t={stencil:!0,failIfMajorPerformanceCaveat:ne.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!ne.ADAPTER.getWebGLRenderingContext())return!1;let e=ne.ADAPTER.createCanvas(),r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),i=!!r?.getContextAttributes()?.stencil;if(r){let s=r.getExtension("WEBGL_lose_context");s&&s.loseContext()}return r=null,i}catch{return!1}}()),Gv}Jm();eg();Fh([kh]);var Ha=class hm{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}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(e){return this.value=e,this}set value(e){if(e instanceof hm)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,e))&&(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}isSourceEqual(e,r){let i=typeof e;if(i!==typeof r)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===r;if(Array.isArray(e)&&Array.isArray(r)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(r))return e.length!==r.length?!1:e.every((s,o)=>s===r[o]);if(e!==null&&r!==null){let s=Object.keys(e),o=Object.keys(r);return s.length!==o.length?!1:s.every(n=>e[n]===r[n])}return e===r}toRgba(){let[e,r,i,s]=this._components;return{r:e,g:r,b:i,a:s}}toRgb(){let[e,r,i]=this._components;return{r:e,g:r,b:i}}toRgbaString(){let[e,r,i]=this.toUint8RgbArray();return`rgba(${e},${r},${i},${this.alpha})`}toUint8RgbArray(e){let[r,i,s]=this._components;return e=e??[],e[0]=Math.round(r*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toRgbArray(e){e=e??[];let[r,i,s]=this._components;return e[0]=r,e[1]=i,e[2]=s,e}toNumber(){return this._int}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[r,i,s,o]=hm.temp.setValue(e)._components;return this._components[0]*=r,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(e,r=!0){return r&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,r=!0){if(e===1)return(255<<24)+this._int;if(e===0)return r?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return r&&(i=i*e+.5|0,s=s*e+.5|0,o=o*e+.5|0),(e*255<<24)+(i<<16)+(s<<8)+o}toHex(){let e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}round(e){let[r,i,s]=this._components;return this._components[0]=Math.round(r*e)/e,this._components[1]=Math.round(i*e)/e,this._components[2]=Math.round(s*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e=e??[];let[r,i,s,o]=this._components;return e[0]=r,e[1]=i,e[2]=s,e[3]=o,e}normalize(e){let r,i,s,o;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let n=e;r=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[r,i,s,o=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[r,i,s,o=255]=e,r/=255,i/=255,s/=255,o/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let a=hm.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}let n=mr(e);n.isValid()&&({r,g:i,b:s,a:o}=n.rgba,r/=255,i/=255,s/=255)}if(r!==void 0)this._components[0]=r,this._components[1]=i,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${e}`)}refreshInt(){this._clamp(this._components);let[e,r,i]=this._components;this._int=(e*255<<16)+(r*255<<8)+(i*255|0)}_clamp(e,r=0,i=1){return typeof e=="number"?Math.min(Math.max(e,r),i):(e.forEach((s,o)=>{e[o]=Math.min(Math.max(s,r),i)}),e)}};Ha.shared=new Ha,Ha.temp=new Ha,Ha.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var ii=Ha;function AX(){let t=[],e=[];for(let i=0;i<32;i++)t[i]=i,e[i]=i;t[he.NORMAL_NPM]=he.NORMAL,t[he.ADD_NPM]=he.ADD,t[he.SCREEN_NPM]=he.SCREEN,e[he.NORMAL]=he.NORMAL_NPM,e[he.ADD]=he.ADD_NPM,e[he.SCREEN]=he.SCREEN_NPM;let r=[];return r.push(e),r.push(t),r}var Nv=AX();function Wa(t){if(t.BYTES_PER_ELEMENT===4)return t instanceof Float32Array?"Float32Array":t instanceof Uint32Array?"Uint32Array":"Int32Array";if(t.BYTES_PER_ELEMENT===2){if(t instanceof Uint16Array)return"Uint16Array"}else if(t.BYTES_PER_ELEMENT===1&&t instanceof Uint8Array)return"Uint8Array";return null}function No(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function dm(t){return!(t&t-1)&&!!t}function fm(t){let e=(t>65535?1:0)<<4;t>>>=e;let r=(t>255?1:0)<<3;return t>>>=r,e|=r,r=(t>15?1:0)<<2,t>>>=r,e|=r,r=(t>3?1:0)<<1,t>>>=r,e|=r,e|t>>1}function Vv(t,e,r){let i=t.length,s;if(e>=i||r===0)return;r=e+r>i?i-e:r;let o=i-r;for(s=e;s<o;++s)t[s]=t[s+r];t.length=o}var PX=0;function Qi(){return++PX}var eO=class{constructor(t,e,r,i){this.left=t,this.top=e,this.right=r,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}};eO.EMPTY=new eO(0,0,0,0);var pm={},Er=Object.create(null),Mi=Object.create(null);function Hv(t,e=globalThis.location){if(t.startsWith("data:"))return"";e=e||globalThis.location;let r=new URL(t,document.baseURI);return r.hostname!==e.hostname||r.port!==e.port||r.protocol!==e.protocol?"anonymous":""}function mm(t,e=1){let r=ne.RETINA_PREFIX?.exec(t);return r?parseFloat(r[1]):e}var ee=(t=>(t.Renderer="renderer",t.Application="application",t.RendererSystem="renderer-webgl-system",t.RendererPlugin="renderer-webgl-plugin",t.CanvasRendererSystem="renderer-canvas-system",t.CanvasRendererPlugin="renderer-canvas-plugin",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t))(ee||{}),Wv=t=>{if(typeof t=="function"||typeof t=="object"&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={...typeof t.extension!="object"?{type:t.extension}:t.extension,ref:t}}if(typeof t=="object")t={...t};else throw new Error("Invalid extension type");return typeof t.type=="string"&&(t.type=[t.type]),t},rO=(t,e)=>Wv(t).priority??e,ae={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Wv).forEach(e=>{e.type.forEach(r=>this._removeHandlers[r]?.(e))}),this},add(...t){return t.map(Wv).forEach(e=>{e.type.forEach(r=>{let i=this._addHandlers,s=this._queue;i[r]?i[r]?.(e):(s[r]=s[r]||[],s[r]?.push(e))})}),this},handle(t,e,r){let i=this._addHandlers,s=this._removeHandlers;if(i[t]||s[t])throw new Error(`Extension type ${t} already has a handler`);i[t]=e,s[t]=r;let o=this._queue;return o[t]&&(o[t]?.forEach(n=>e(n)),delete o[t]),this},handleByMap(t,e){return this.handle(t,r=>{r.name&&(e[r.name]=r.ref)},r=>{r.name&&delete e[r.name]})},handleByList(t,e,r=-1){return this.handle(t,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,o)=>rO(o,r)-rO(s,r)))},i=>{let s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})}};var $u=class{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,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(e){return this[`${e}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(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}};var BX=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
1587
|
+
`);function FX(t){let e="";for(let r=0;r<t;++r)r>0&&(e+=`
|
|
1588
|
+
else `),r<t-1&&(e+=`if(test == ${r}.0){}`);return e}function gm(t,e){if(t===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let r=e.createShader(e.FRAGMENT_SHADER);for(;;){let i=BX.replace(/%forloop%/gi,FX(t));if(e.shaderSource(r,i),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))t=t/2|0;else break}return t}var $v=0,zv=1,Xv=2,Yv=3,jv=4,qv=5,Ii=class t{constructor(){this.data=0,this.blendMode=he.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<$v)}set blend(e){!!(this.data&1<<$v)!==e&&(this.data^=1<<$v)}get offsets(){return!!(this.data&1<<zv)}set offsets(e){!!(this.data&1<<zv)!==e&&(this.data^=1<<zv)}get culling(){return!!(this.data&1<<Xv)}set culling(e){!!(this.data&1<<Xv)!==e&&(this.data^=1<<Xv)}get depthTest(){return!!(this.data&1<<Yv)}set depthTest(e){!!(this.data&1<<Yv)!==e&&(this.data^=1<<Yv)}get depthMask(){return!!(this.data&1<<qv)}set depthMask(e){!!(this.data&1<<qv)!==e&&(this.data^=1<<qv)}get clockwiseFrontFace(){return!!(this.data&1<<jv)}set clockwiseFrontFace(e){!!(this.data&1<<jv)!==e&&(this.data^=1<<jv)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==he.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){let e=new t;return e.depthTest=!1,e.blend=!0,e}};Ii.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var zu=[];function $a(t,e){if(!t)return null;let r="";if(typeof t=="string"){let i=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);i&&(r=i[1].toLowerCase())}for(let i=zu.length-1;i>=0;--i){let s=zu[i];if(s.test&&s.test(t,r))return new s(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var pt=class{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,r,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:c,items:u}=this;this._aliasCount++;for(let h=0,d=u.length;h<d;h++)u[h][c](e,r,i,s,o,n,a,l);return u===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this}remove(e){let r=this.items.indexOf(e);return r!==-1&&(this.ensureNonAliasedItems(),this.items.splice(r,1)),this}contains(e){return this.items.includes(e)}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(pt.prototype,{dispatch:{value:pt.prototype.emit},run:{value:pt.prototype.emit}});var Ar=class{constructor(e=0,r=0){this._width=e,this._height=r,this.destroyed=!1,this.internal=!1,this.onResize=new pt("setRealSize"),this.onUpdate=new pt("update"),this.onError=new pt("onError")}bind(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)}resize(e,r){(e!==this._width||r!==this._height)&&(this._width=e,this._height=r,this.onResize.emit(e,r))}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(e,r,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(e,r){return!1}};var Ho=class extends Ar{constructor(e,r){let{width:i,height:s}=r||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=e,this.unpackAlignment=r.unpackAlignment??4}upload(e,r,i){let s=e.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===wr.UNPACK);let o=r.realWidth,n=r.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(r.target,0,0,0,o,n,r.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(r.target,0,i.internalFormat,o,n,0,r.format,i.type,this.data)),!0}dispose(){this.data=null}static test(e){return e===null||e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}};var kX={scaleMode:Vr.NEAREST,alphaMode:wr.NPM},Kv=class za extends Vo.default{constructor(e=null,r=null){super(),r=Object.assign({},za.defaultOptions,r);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:c,format:u,type:h,target:d,resolution:f,resourceOptions:p}=r;e&&!(e instanceof Ar)&&(e=$a(e,p),e.internal=!0),this.resolution=f||ne.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=u,this.type=h,this.target=d,this.alphaMode=i,this.uid=Qi(),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(e)}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(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)}setStyle(e,r){let i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),r!==void 0&&r!==this.mipmap&&(this.mipmap=r,i=!0),i&&this.dirtyStyleId++,this}setSize(e,r,i){return i=i||this.resolution,this.setRealSize(e*i,r*i,i)}setRealSize(e,r,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(r)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=dm(this.realWidth)&&dm(this.realHeight)}setResolution(e){let r=this.resolution;return r===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*r)/e,this.height=Math.round(this.height*r)/e,this.emit("update",this)),this._refreshPOT(),this)}setResource(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,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(e){this.emit("error",this,e)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Mi[this.cacheId],delete Er[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),za.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,r,i=ne.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else{if(!e._pixiId){let a=r?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Qi()}`}o=e._pixiId}let n=Mi[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new za(e,r),n.cacheId=o,za.addToCache(n,o)),n}static fromBuffer(e,r,i,s){e=e||new Float32Array(r*i*4);let o=new Ho(e,{width:r,height:i,...s?.resourceOptions}),n,a;return e instanceof Float32Array?(n=j.RGBA,a=ge.FLOAT):e instanceof Int32Array?(n=j.RGBA_INTEGER,a=ge.INT):e instanceof Uint32Array?(n=j.RGBA_INTEGER,a=ge.UNSIGNED_INT):e instanceof Int16Array?(n=j.RGBA_INTEGER,a=ge.SHORT):e instanceof Uint16Array?(n=j.RGBA_INTEGER,a=ge.UNSIGNED_SHORT):e instanceof Int8Array?(n=j.RGBA,a=ge.BYTE):(n=j.RGBA,a=ge.UNSIGNED_BYTE),o.internal=!0,new za(o,Object.assign({},kX,{type:a,format:n},s))}static addToCache(e,r){r&&(e.textureCacheIds.includes(r)||e.textureCacheIds.push(r),Mi[r]&&Mi[r]!==e&&console.warn(`BaseTexture added to the cache with an id [${r}] that already had an entry`),Mi[r]=e)}static removeFromCache(e){if(typeof e=="string"){let r=Mi[e];if(r){let i=r.textureCacheIds.indexOf(e);return i>-1&&r.textureCacheIds.splice(i,1),delete Mi[e],r}}else if(e?.textureCacheIds){for(let r=0;r<e.textureCacheIds.length;++r)delete Mi[e.textureCacheIds[r]];return e.textureCacheIds.length=0,e}return null}};Kv.defaultOptions={mipmap:ti.POW2,anisotropicLevel:0,scaleMode:Vr.LINEAR,wrapMode:Mu.CLAMP,alphaMode:wr.UNPACK,target:Ki.TEXTURE_2D,format:j.RGBA,type:ge.UNSIGNED_BYTE},Kv._globalBatch=0;var Pe=Kv;var Xu=class{constructor(){this.texArray=null,this.blend=0,this.type=Ia.TRIANGLES,this.start=0,this.size=0,this.data=null}};var UX=0,yt=class t{constructor(e,r=!0,i=!1){this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=r,this.id=UX++,this.disposeRunner=new pt("disposeBuffer")}update(e){e instanceof Array&&(e=new Float32Array(e)),this.data=e||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(e){this.type=e?pr.ELEMENT_ARRAY_BUFFER:pr.ARRAY_BUFFER}get index(){return this.type===pr.ELEMENT_ARRAY_BUFFER}static from(e){return e instanceof Array&&(e=new Float32Array(e)),new t(e)}};var Xa=class t{constructor(e,r=0,i=!1,s=ge.FLOAT,o,n,a,l=1){this.buffer=e,this.size=r,this.normalized=i,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=l}destroy(){this.buffer=null}static from(e,r,i,s,o){return new t(e,r,i,s,o)}};var OX={Float32Array,Uint32Array,Int32Array,Uint8Array};function iO(t,e){let r=0,i=0,s={};for(let l=0;l<t.length;l++)i+=e[l],r+=t[l].length;let o=new ArrayBuffer(r*4),n=null,a=0;for(let l=0;l<t.length;l++){let c=e[l],u=t[l],h=Wa(u);s[h]||(s[h]=new OX[h](o)),n=s[h];for(let d=0;d<u.length;d++){let f=(d/c|0)*i+a,p=d%c;n[f+p]=u[d]}a+=c}return new Float32Array(o)}var sO={5126:4,5123:2,5121:1},LX=0,GX={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},Ji=class t{constructor(e=[],r={}){this.buffers=e,this.indexBuffer=null,this.attributes=r,this.glVertexArrayObjects={},this.id=LX++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new pt("disposeGeometry"),this.refCount=0}addAttribute(e,r,i=0,s=!1,o,n,a,l=!1){if(!r)throw new Error("You must pass a buffer when creating an attribute");r instanceof yt||(r instanceof Array&&(r=new Float32Array(r)),r=new yt(r));let c=e.split("|");if(c.length>1){for(let h=0;h<c.length;h++)this.addAttribute(c[h],r,i,s,o);return this}let u=this.buffers.indexOf(r);return u===-1&&(this.buffers.push(r),u=this.buffers.length-1),this.attributes[e]=new Xa(u,i,s,o,n,a,l),this.instanced=this.instanced||l,this}getAttribute(e){return this.attributes[e]}getBuffer(e){return this.buffers[this.getAttribute(e).buffer]}addIndex(e){return e instanceof yt||(e instanceof Array&&(e=new Uint16Array(e)),e=new yt(e)),e.type=pr.ELEMENT_ARRAY_BUFFER,this.indexBuffer=e,this.buffers.includes(e)||this.buffers.push(e),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let e=[],r=[],i=new yt,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];e.push(n.data),r.push(o.size*sO[o.type]/4),o.buffer=0}for(i.data=iO(e,r),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 e in this.attributes){let r=this.attributes[e];return this.buffers[r.buffer].data.length/(r.stride/4||r.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let e=new t;for(let r=0;r<this.buffers.length;r++)e.buffers[r]=new yt(this.buffers[r].data.slice(0));for(let r in this.attributes){let i=this.attributes[r];e.attributes[r]=new Xa(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=pr.ELEMENT_ARRAY_BUFFER),e}static merge(e){let r=new t,i=[],s=[],o=[],n;for(let a=0;a<e.length;a++){n=e[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 GX[Wa(n.buffers[a].data)](s[a]),r.buffers[a]=new yt(i[a]);for(let a=0;a<e.length;a++){n=e[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(r.attributes=n.attributes,n.indexBuffer){r.indexBuffer=r.buffers[n.buffers.indexOf(n.indexBuffer)],r.indexBuffer.type=pr.ELEMENT_ARRAY_BUFFER;let a=0,l=0,c=0,u=0;for(let h=0;h<n.buffers.length;h++)if(n.buffers[h]!==n.indexBuffer){u=h;break}for(let h in n.attributes){let d=n.attributes[h];(d.buffer|0)===u&&(l+=d.size*sO[d.type]/4)}for(let h=0;h<e.length;h++){let d=e[h].indexBuffer.data;for(let f=0;f<d.length;f++)r.indexBuffer.data[f+c]+=a;a+=e[h].buffers[u].data.length/l,c+=d.length}}return r}};var Yu=class extends Ji{constructor(e=!1){super(),this._buffer=new yt(null,e,!1),this._indexBuffer=new yt(null,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ge.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ge.FLOAT).addAttribute("aColor",this._buffer,4,!0,ge.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ge.FLOAT).addIndex(this._indexBuffer)}};var Zv=Math.PI*2,DX=180/Math.PI,NX=Math.PI/180,Wr=(t=>(t[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC",t))(Wr||{});var _t=class t{constructor(e=0,r=0){this.x=0,this.y=0,this.x=e,this.y=r}clone(){return new t(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,r=e){return this.x=e,this.y=r,this}};_t.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var xm=[new _t,new _t,new _t,new _t],Ie=class t{constructor(e=0,r=0,i=0,s=0){this.x=Number(e),this.y=Number(r),this.width=Number(i),this.height=Number(s),this.type=Wr.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 t(0,0,0,0)}clone(){return new t(this.x,this.y,this.width,this.height)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}contains(e,r){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height}intersects(e,r){if(!r){let P=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=P)return!1;let C=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.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=xm[0].set(e.left,e.top),l=xm[1].set(e.left,e.bottom),c=xm[2].set(e.right,e.top),u=xm[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(r.a*r.d-r.b*r.c);if(h===0||(r.apply(a,a),r.apply(l,l),r.apply(c,c),r.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=i||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=o||Math.min(a.y,l.y,c.y,u.y)>=n))return!1;let d=h*(l.y-a.y),f=h*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,x=d*i+f*n,v=d*s+f*n;if(Math.max(p,m,x,v)<=d*a.x+f*a.y||Math.min(p,m,x,v)>=d*u.x+f*u.y)return!1;let y=h*(a.y-c.y),g=h*(c.x-a.x),b=y*i+g*o,_=y*s+g*o,S=y*i+g*n,E=y*s+g*n;return!(Math.max(b,_,S,E)<=y*a.x+g*a.y||Math.min(b,_,S,E)>=y*u.x+g*u.y)}pad(e=0,r=e){return this.x-=e,this.y-=r,this.width+=e*2,this.height+=r*2,this}fit(e){let r=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=r,this.width=Math.max(i-r,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,r=.001){let i=Math.ceil((this.x+this.width-r)*e)/e,s=Math.ceil((this.y+this.height-r)*e)/e;return this.x=Math.floor((this.x+r)*e)/e,this.y=Math.floor((this.y+r)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let r=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=r,this.width=i-r,this.y=s,this.height=o-s,this}};Ie.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var ym=class t{constructor(e=0,r=0,i=0){this.x=e,this.y=r,this.radius=i,this.type=Wr.CIRC}clone(){return new t(this.x,this.y,this.radius)}contains(e,r){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-r;return s*=s,o*=o,s+o<=i}getBounds(){return new Ie(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};ym.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var _m=class t{constructor(e=0,r=0,i=0,s=0){this.x=e,this.y=r,this.width=i,this.height=s,this.type=Wr.ELIP}clone(){return new t(this.x,this.y,this.width,this.height)}contains(e,r){if(this.width<=0||this.height<=0)return!1;let i=(e-this.x)/this.width,s=(r-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new Ie(this.x-this.width,this.y-this.height,this.width,this.height)}};_m.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var bm=class t{constructor(...e){let r=Array.isArray(e[0])?e[0]:e;if(typeof r[0]!="number"){let i=[];for(let s=0,o=r.length;s<o;s++)i.push(r[s].x,r[s].y);r=i}this.points=r,this.type=Wr.POLY,this.closeStroke=!0}clone(){let e=this.points.slice(),r=new t(e);return r.closeStroke=this.closeStroke,r}contains(e,r){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],u=this.points[n*2+1];l>r!=u>r&&e<(c-a)*((r-l)/(u-l))+a&&(i=!i)}return i}};bm.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`};var vm=class t{constructor(e=0,r=0,i=0,s=0,o=20){this.x=e,this.y=r,this.width=i,this.height=s,this.radius=o,this.type=Wr.RREC}clone(){return new t(this.x,this.y,this.width,this.height,this.radius)}contains(e,r){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&r>=this.y&&r<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(r>=this.y+i&&r<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=r-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=e-(this.x+this.width-i),s*s+o*o<=n)||(o=r-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}};vm.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var qe=class t{constructor(e=1,r=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=r,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,r,i,s,o,n){return this.a=e,this.b=r,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,r){this.array||(this.array=new Float32Array(9));let i=r||this.array;return e?(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(e,r){r=r||new _t;let i=e.x,s=e.y;return r.x=this.a*i+this.c*s+this.tx,r.y=this.b*i+this.d*s+this.ty,r}applyInverse(e,r){r=r||new _t;let i=1/(this.a*this.d+this.c*-this.b),s=e.x,o=e.y;return r.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,r.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,r}translate(e,r){return this.tx+=e,this.ty+=r,this}scale(e,r){return this.a*=e,this.d*=r,this.c*=e,this.b*=r,this.tx*=e,this.ty*=r,this}rotate(e){let r=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*r-this.b*i,this.b=s*i+this.b*r,this.c=o*r-this.d*i,this.d=o*i+this.d*r,this.tx=n*r-this.ty*i,this.ty=n*i+this.ty*r,this}append(e){let r=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*r+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*r+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*r+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}setTransform(e,r,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=e-(i*this.a+s*this.c),this.ty=r-(i*this.b+s*this.d),this}prepend(e){let r=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let i=this.a,s=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=r*e.a+this.ty*e.c+e.tx,this.ty=r*e.b+this.ty*e.d+e.ty,this}decompose(e){let r=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,r),c=Math.abs(a+l);return c<1e-5||Math.abs(Zv-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(r*r+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*r+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,r=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-r*i;return this.a=s/n,this.b=-r/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-r*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 e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}static get IDENTITY(){return new t}static get TEMP_MATRIX(){return new t}};qe.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 Wo=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],$o=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],zo=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Xo=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Qv=[],oO=[],Tm=Math.sign;function VX(){for(let t=0;t<16;t++){let e=[];Qv.push(e);for(let r=0;r<16;r++){let i=Tm(Wo[t]*Wo[r]+zo[t]*$o[r]),s=Tm($o[t]*Wo[r]+Xo[t]*$o[r]),o=Tm(Wo[t]*zo[r]+zo[t]*Xo[r]),n=Tm($o[t]*zo[r]+Xo[t]*Xo[r]);for(let a=0;a<16;a++)if(Wo[a]===i&&$o[a]===s&&zo[a]===o&&Xo[a]===n){e.push(a);break}}}for(let t=0;t<16;t++){let e=new qe;e.set(Wo[t],$o[t],zo[t],Xo[t],0,0),oO.push(e)}}VX();var Je={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:t=>Wo[t],uY:t=>$o[t],vX:t=>zo[t],vY:t=>Xo[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Qv[t][e],sub:(t,e)=>Qv[t][Je.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?Je.S:Je.N:Math.abs(e)*2<=Math.abs(t)?t>0?Je.E:Je.W:e>0?t>0?Je.SE:Je.SW:t>0?Je.NE:Je.NW,matrixAppendRotationInv:(t,e,r=0,i=0)=>{let s=oO[Je.inv(e)];s.tx=r,s.ty=i,t.append(s)}};var es=class t{constructor(e,r,i=0,s=0){this._x=i,this._y=s,this.cb=e,this.scope=r}clone(e=this.cb,r=this.scope){return new t(e,r,this._x,this._y)}set(e=0,r=e){return(this._x!==e||this._y!==r)&&(this._x=e,this._y=r,this.cb.call(this.scope)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))}};es.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Jv=class{constructor(){this.worldTransform=new qe,this.localTransform=new qe,this.position=new es(this.onChange,this,0,0),this.scale=new es(this.onChange,this,1,1),this.pivot=new es(this.onChange,this,0,0),this.skew=new es(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 t=this.localTransform;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)}updateTransform(t){let e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){let r=t.worldTransform,i=this.worldTransform;i.a=e.a*r.a+e.b*r.c,i.b=e.a*r.b+e.b*r.d,i.c=e.c*r.a+e.d*r.c,i.d=e.c*r.b+e.d*r.d,i.tx=e.tx*r.a+e.ty*r.c+r.tx,i.ty=e.tx*r.b+e.ty*r.d+r.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};Jv.IDENTITY=new Jv;var Sm=Jv;Sm.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 nO=`varying vec2 vTextureCoord;
|
|
1589
1589
|
|
|
1590
1590
|
uniform sampler2D uSampler;
|
|
1591
1591
|
|
|
@@ -1722,7 +1722,7 @@ void main(void){
|
|
|
1722
1722
|
cv[3] = v[3];
|
|
1723
1723
|
|
|
1724
1724
|
gl.uniform4f(ud["${t}"].location, v[0], v[1], v[2], v[3])
|
|
1725
|
-
}`}];var
|
|
1725
|
+
}`}];var HX={float:`
|
|
1726
1726
|
if (cv !== v)
|
|
1727
1727
|
{
|
|
1728
1728
|
cu.value = v;
|
|
@@ -1858,7 +1858,7 @@ void main(void){
|
|
|
1858
1858
|
cu.value = v;
|
|
1859
1859
|
|
|
1860
1860
|
gl.uniform1i(location, v);
|
|
1861
|
-
}`},
|
|
1861
|
+
}`},WX={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 t0(t,e){let r=[`
|
|
1862
1862
|
var v = null;
|
|
1863
1863
|
var cv = null;
|
|
1864
1864
|
var cu = null;
|
|
@@ -1868,7 +1868,7 @@ void main(void){
|
|
|
1868
1868
|
renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');
|
|
1869
1869
|
`):r.push(`
|
|
1870
1870
|
renderer.shader.syncUniformGroup(uv.${i}, syncData);
|
|
1871
|
-
`));continue}let o=t.uniforms[i],n=!1;for(let a=0;a<Bi.length;a++)if(Bi[a].test(s,o)){r.push(Bi[a].code(i,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?
|
|
1871
|
+
`));continue}let o=t.uniforms[i],n=!1;for(let a=0;a<Bi.length;a++)if(Bi[a].test(s,o)){r.push(Bi[a].code(i,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?HX:WX)[s.type].replace("location",`ud["${i}"].location`);r.push(`
|
|
1872
1872
|
cu = ud["${i}"];
|
|
1873
1873
|
cv = cu.value;
|
|
1874
1874
|
v = uv["${i}"];
|
|
@@ -1876,10 +1876,10 @@ void main(void){
|
|
|
1876
1876
|
`))}var lO={},Em=lO;function Am(){if(Em===lO||Em?.isContextLost()){let t=ne.ADAPTER.createCanvas(),e;ne.PREFER_ENV>=Sr.WEBGL2&&(e=t.getContext("webgl2",{})),e||(e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),Em=e}return Em}var Pm;function r0(){if(!Pm){Pm=or.MEDIUM;let t=Am();if(t&&t.getShaderPrecisionFormat){let e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);e&&(Pm=e.precision?or.HIGH:or.MEDIUM)}}return Pm}function cO(t,e){let r=t.getShaderSource(e).split(`
|
|
1877
1877
|
`).map((c,u)=>`${u}: ${c}`),i=t.getShaderInfoLog(e),s=i.split(`
|
|
1878
1878
|
`),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=>{r[c-1]=`%c${r[c-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=r.join(`
|
|
1879
|
-
`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function i0(t,e,r,i){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||cO(t,r),t.getShaderParameter(i,t.COMPILE_STATUS)||cO(t,i),console.error("PixiJS Error: Could not initialize shader."),t.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}var
|
|
1880
|
-
${t}`}else if(r!==or.HIGH&&t.substring(0,15)==="precision highp")return t.replace("precision highp","precision mediump");return t}var Zu;function Mm(){if(typeof Zu=="boolean")return Zu;try{Zu=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Zu=!1}return Zu}var
|
|
1879
|
+
`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function i0(t,e,r,i){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||cO(t,r),t.getShaderParameter(i,t.COMPILE_STATUS)||cO(t,i),console.error("PixiJS Error: Could not initialize shader."),t.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}var $X={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 qu(t){return $X[t]}var Cm=null,uO={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 Ku(t,e){if(!Cm){let r=Object.keys(uO);Cm={};for(let i=0;i<r.length;++i){let s=r[i];Cm[t[s]]=uO[s]}}return Cm[e]}function Rm(t,e,r){if(t.substring(0,9)!=="precision"){let i=e;return e===or.HIGH&&r!==or.HIGH&&(i=or.MEDIUM),`precision ${i} float;
|
|
1880
|
+
${t}`}else if(r!==or.HIGH&&t.substring(0,15)==="precision highp")return t.replace("precision highp","precision mediump");return t}var Zu;function Mm(){if(typeof Zu=="boolean")return Zu;try{Zu=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Zu=!1}return Zu}var zX=0,Im={},s0=class Ya{constructor(e,r,i="pixi-shader",s={}){this.extra={},this.id=zX++,this.vertexSrc=e||Ya.defaultVertexSrc,this.fragmentSrc=r||Ya.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,"-"),Im[i]?(Im[i]++,i+=`-${Im[i]}`):Im[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
|
1881
1881
|
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
|
1882
|
-
${this.fragmentSrc}`,this.vertexSrc=Rm(this.vertexSrc,Ya.defaultVertexPrecision,or.HIGH),this.fragmentSrc=Rm(this.fragmentSrc,Ya.defaultFragmentPrecision,r0())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return aO}static get defaultFragmentSrc(){return nO}static from(e,r,i){let s=e+r,o=pm[s];return o||(pm[s]=o=new Ya(e,r,i)),o}};s0.defaultVertexPrecision=or.HIGH,s0.defaultFragmentPrecision=ri.apple.device?or.HIGH:or.MEDIUM;var $r=s0;var
|
|
1882
|
+
${this.fragmentSrc}`,this.vertexSrc=Rm(this.vertexSrc,Ya.defaultVertexPrecision,or.HIGH),this.fragmentSrc=Rm(this.fragmentSrc,Ya.defaultFragmentPrecision,r0())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return aO}static get defaultFragmentSrc(){return nO}static from(e,r,i){let s=e+r,o=pm[s];return o||(pm[s]=o=new Ya(e,r,i)),o}};s0.defaultVertexPrecision=or.HIGH,s0.defaultFragmentPrecision=ri.apple.device?or.HIGH:or.MEDIUM;var $r=s0;var XX=0,Pr=class t{constructor(e,r,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=XX++,this.static=!!r,this.ubo=!!i,e instanceof yt?(this.buffer=e,this.buffer.type=pr.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new yt(new Float32Array(1)),this.buffer.type=pr.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(e,r,i){if(!this.ubo)this.uniforms[e]=new t(r,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(e,r,i){return new t(e,r,i)}static uboFrom(e,r){return new t(e,r??!0,!0)}};var Yo=class t{constructor(e,r){this.uniformBindCount=0,this.program=e,r?r instanceof Pr?this.uniformGroup=r:this.uniformGroup=new Pr(r):this.uniformGroup=new Pr({}),this.disposeRunner=new pt("disposeShader")}checkUniformExists(e,r){if(r.uniforms[e])return!0;for(let i in r.uniforms){let s=r.uniforms[i];if(s.group===!0&&this.checkUniformExists(e,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(e,r,i){let s=$r.from(e,r);return new t(s,i)}};var Qu=class{constructor(e,r){if(this.vertexSrc=e,this.fragTemplate=r,this.programCache={},this.defaultGroupCache={},!r.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!r.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(e){if(!this.programCache[e]){let i=new Int32Array(e);for(let o=0;o<e;o++)i[o]=o;this.defaultGroupCache[e]=Pr.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${e}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(e)),this.programCache[e]=new $r(this.vertexSrc,s)}let r={tint:new Float32Array([1,1,1,1]),translationMatrix:new qe,default:this.defaultGroupCache[e]};return new Yo(this.programCache[e],r)}generateSampleSrc(e){let r="";r+=`
|
|
1883
1883
|
`,r+=`
|
|
1884
1884
|
`;for(let i=0;i<e;i++)i>0&&(r+=`
|
|
1885
1885
|
else `),i<e-1&&(r+=`if(vTextureId < ${i}.5)`),r+=`
|
|
@@ -1951,7 +1951,7 @@ void main(void)
|
|
|
1951
1951
|
gl_Position = filterVertexPosition();
|
|
1952
1952
|
vTextureCoord = filterTextureCoord();
|
|
1953
1953
|
}
|
|
1954
|
-
`;var o0=class th extends Yo{constructor(e,r,i){let s=$r.from(e||th.defaultVertexSrc,r||th.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=th.defaultResolution,this.multisample=th.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ii}apply(e,r,i,s,o){e.applyFilter(this,r,i,s)}get blendMode(){return this.state.blendMode}set blendMode(e){this.state.blendMode=e}get resolution(){return this._resolution}set resolution(e){this._resolution=e}static get defaultVertexSrc(){return gO}static get defaultFragmentSrc(){return mO}};o0.defaultResolution=1,o0.defaultMultisample=He.NONE;var Fi=o0;var rs=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ii(0),this.alpha=1}init(e){this.clearBeforeRender=e.clearBeforeRender;let{backgroundColor:r,background:i,backgroundAlpha:s}=e,o=i??r;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get backgroundColor(){return this._backgroundColor}destroy(){}};rs.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},rs.extension={type:[ee.RendererSystem,ee.CanvasRendererSystem],name:"background"};ae.add(rs);var ja=class{constructor(e){this.renderer=e,this.emptyRenderer=new jo(e),this.currentRenderer=this.emptyRenderer}setObjectRenderer(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(e,r){let{boundTextures:i}=this.renderer.texture;for(let s=r-1;s>=0;--s)e[s]=i[s]||null,e[s]&&(e[s]._batchLocation=s)}boundArray(e,r,i,s){let{elements:o,ids:n,count:a}=e,l=0;for(let c=0;c<a;c++){let u=o[c],h=u._batchLocation;if(h>=0&&h<s&&r[h]===u){n[c]=h;continue}for(;l<s;){let d=r[l];if(d&&d._batchEnabled===i&&d._batchLocation===l){l++;continue}n[c]=l,u._batchLocation=l,r[l]=u;break}}}destroy(){this.renderer=null}};ja.extension={type:ee.RendererSystem,name:"batch"};ae.add(ja);var xO=0,is=class{constructor(e){this.renderer=e,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(e){this.gl=e,this.renderer.gl=e,this.renderer.CONTEXT_UID=xO++}init(e){if(e.context)this.initFromContext(e.context);else{let r=this.renderer.background.alpha<1,i=e.premultipliedAlpha;this.preserveDrawingBuffer=e.preserveDrawingBuffer,this.useContextAlpha=e.useContextAlpha,this.powerPreference=e.powerPreference,this.initFromOptions({alpha:r,premultipliedAlpha:i,antialias:e.antialias,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference})}}initFromContext(e){this.gl=e,this.validateContext(e),this.renderer.gl=e,this.renderer.CONTEXT_UID=xO++,this.renderer.runners.contextChange.emit(e);let r=this.renderer.view;r.addEventListener!==void 0&&(r.addEventListener("webglcontextlost",this.handleContextLost,!1),r.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(e){let r=this.createContext(this.renderer.view,e);this.initFromContext(r)}createContext(e,r){let i;if(ne.PREFER_ENV>=Sr.WEBGL2&&(i=e.getContext("webgl2",r)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r),!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:e}=this,r={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,r,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,r,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})}handleContextLost(e){e.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let e=this.renderer.view;this.renderer=null,e.removeEventListener!==void 0&&(e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(e){let r=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),r&&!r.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=i||!!e.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")}};is.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},is.extension={type:ee.RendererSystem,name:"context"};ae.add(is);var Hs=class{constructor(e,r){if(this.width=Math.round(e),this.height=Math.round(r),!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 pt("disposeFramebuffer"),this.multisample=He.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,r){return this.colorTextures[e]=r||new Pe(null,{scaleMode:Vr.NEAREST,resolution:1,mipmap:ti.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new Pe(null,{scaleMode:Vr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:ti.OFF,format:j.DEPTH_COMPONENT,type:ge.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(e,r){if(e=Math.round(e),r=Math.round(r),!e||!r)throw new Error("Framebuffer width and height must not be zero");if(!(e===this.width&&r===this.height)){this.width=e,this.height=r,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){let s=this.colorTextures[i],o=s.resolution;s.setSize(e/o,r/o)}if(this.depthTexture){let i=this.depthTexture.resolution;this.depthTexture.setSize(e/i,r/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var qo=class extends Pe{constructor(e={}){if(typeof e=="number"){let r=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];e={width:r,height:i,scaleMode:s,resolution:o}}e.width=e.width??100,e.height=e.height??100,e.multisample??(e.multisample=He.NONE),super(null,e),this.mipmap=ti.OFF,this.valid=!0,this._clear=new ii([0,0,0,0]),this.framebuffer=new Hs(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=e.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(e){this._clear.setValue(e)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,r){this.framebuffer.resize(e*this.resolution,r*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 Pt=class extends Ar{constructor(e){let r=e,i=r.naturalWidth||r.videoWidth||r.displayWidth||r.width,s=r.naturalHeight||r.videoHeight||r.displayHeight||r.height;super(i,s),this.source=e,this.noSubImage=!1}static crossOrigin(e,r,i){i===void 0&&!r.startsWith("data:")?e.crossOrigin=Hv(r):i!==!1&&(e.crossOrigin=typeof i=="string"?i:"anonymous")}upload(e,r,i,s){let o=e.gl,n=r.realWidth,a=r.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,r.alphaMode===wr.UNPACK),!this.noSubImage&&r.target===o.TEXTURE_2D&&i.width===n&&i.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,r.format,i.type,s):(i.width=n,i.height=a,o.texImage2D(r.target,0,i.internalFormat,r.format,i.type,s)),!0}update(){if(this.destroyed)return;let e=this.source,r=e.naturalWidth||e.videoWidth||e.width,i=e.naturalHeight||e.videoHeight||e.height;this.resize(r,i),super.update()}dispose(){this.source=null}};var Ko=class extends Pt{constructor(e,r){if(r=r||{},typeof e=="string"){let i=new Image;Pt.crossOrigin(i,e,r.crossorigin),i.src=e,e=i}super(e),!e.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=e.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(r.createBitmap??ne.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof r.alphaMode=="number"?r.alphaMode:null,this.bitmap=null,this._load=null,r.autoLoad!==!1&&this.load()}load(e){return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise((r,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?r(this.process()):r(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{i(n),this.onError.emit(n)})}),this._load)}process(){let e=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let r=globalThis.createImageBitmap,i=!e.crossOrigin||e.crossOrigin==="anonymous";return this._process=fetch(e.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>r(s,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===wr.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,r,i){if(typeof this.alphaMode=="number"&&(r.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,r,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,r,i,this.bitmap),!this.preserveBitmap){let s=!0,o=r._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==r.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(e){return typeof HTMLImageElement<"u"&&(typeof e=="string"||e instanceof HTMLImageElement)}};var Zo=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(e,r,i){let s=r.width,o=r.height;if(i){let n=e.width/2/s,a=e.height/2/o,l=e.x/s+n,c=e.y/o+a;i=Je.add(i,Je.NW),this.x0=l+n*Je.uX(i),this.y0=c+a*Je.uY(i),i=Je.add(i,2),this.x1=l+n*Je.uX(i),this.y1=c+a*Je.uY(i),i=Je.add(i,2),this.x2=l+n*Je.uX(i),this.y2=c+a*Je.uY(i),i=Je.add(i,2),this.x3=l+n*Je.uX(i),this.y3=c+a*Je.uY(i)}else this.x0=e.x/s,this.y0=e.y/o,this.x1=(e.x+e.width)/s,this.y1=e.y/o,this.x2=(e.x+e.width)/s,this.y2=(e.y+e.height)/o,this.x3=e.x/s,this.y3=(e.y+e.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}};Zo.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 yO=new Zo;function Bm(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}var rh=class t extends Vo.default{constructor(e,r,i,s,o,n,a){if(super(),this.noFrame=!1,r||(this.noFrame=!0,r=new Ie(0,0,1,1)),e instanceof t&&(e=e.baseTexture),this.baseTexture=e,this._frame=r,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=yO,this.uvMatrix=null,this.orig=i||r,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 _t(n.x,n.y):new _t(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],e.valid?this.noFrame?e.valid&&this.onBaseTextureUpdated(e):this.frame=r:e.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&e.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(e){if(this.baseTexture){if(e){let{resource:r}=this.baseTexture;r?.url&&Er[r.url]&&t.removeFromCache(r.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,t.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let e=this._frame.clone(),r=this._frame===this.orig?e:this.orig.clone(),i=new t(this.baseTexture,!this.noFrame&&e,r,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===yO&&(this._uvs=new Zo),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,r={},i=ne.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else if(e instanceof Pe){if(!e.cacheId){let a=r?.pixiIdPrefix||"pixiid";e.cacheId=`${a}-${Qi()}`,Pe.addToCache(e,e.cacheId)}o=e.cacheId}else{if(!e._pixiId){let a=r?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Qi()}`}o=e._pixiId}let n=Er[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(e instanceof Pe)?(r.resolution||(r.resolution=mm(e)),n=new t(new Pe(e,r)),n.baseTexture.cacheId=o,Pe.addToCache(n.baseTexture,o),t.addToCache(n,o)):!n&&e instanceof Pe&&(n=new t(e),t.addToCache(n,o)),n}static fromURL(e,r){let i=Object.assign({autoLoad:!1},r?.resourceOptions),s=t.from(e,Object.assign({resourceOptions:i},r),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(e,r,i,s){return new t(Pe.fromBuffer(e,r,i,s))}static fromLoader(e,r,i,s){let o=new Pe(e,Object.assign({scaleMode:Pe.defaultOptions.scaleMode,resolution:mm(r)},s)),{resource:n}=o;n instanceof Ko&&(n.url=r);let a=new t(o);return i||(i=r),Pe.addToCache(a.baseTexture,i),t.addToCache(a,i),i!==r&&(Pe.addToCache(a.baseTexture,r),t.addToCache(a,r)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(e,r){r&&(e.textureCacheIds.includes(r)||e.textureCacheIds.push(r),Er[r]&&Er[r]!==e&&console.warn(`Texture added to the cache with an id [${r}] that already had an entry`),Er[r]=e)}static removeFromCache(e){if(typeof e=="string"){let r=Er[e];if(r){let i=r.textureCacheIds.indexOf(e);return i>-1&&r.textureCacheIds.splice(i,1),delete Er[e],r}}else if(e?.textureCacheIds){for(let r=0;r<e.textureCacheIds.length;++r)Er[e.textureCacheIds[r]]===e&&delete Er[e.textureCacheIds[r]];return e.textureCacheIds.length=0,e}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(e){this._frame=e,this.noFrame=!1;let{x:r,y:i,width:s,height:o}=e,n=r+s>this.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",c=`X: ${r} + ${s} = ${r+s} > ${this.baseTexture.width}`,u=`Y: ${i} + ${o} = ${i+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${c} ${l} ${u}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(e){this._rotate=e,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return t._EMPTY||(t._EMPTY=new t(new Pe),Bm(t._EMPTY),Bm(t._EMPTY.baseTexture)),t._EMPTY}static get WHITE(){if(!t._WHITE){let e=ne.ADAPTER.createCanvas(16,16),r=e.getContext("2d");e.width=16,e.height=16,r.fillStyle="white",r.fillRect(0,0,16,16),t._WHITE=new t(Pe.from(e)),Bm(t._WHITE),Bm(t._WHITE.baseTexture)}return t._WHITE}};var Qo=class t extends rh{constructor(e,r){super(e,r),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(e){this.framebuffer.multisample=e}resize(e,r,i=!0){let s=this.baseTexture.resolution,o=Math.round(e*s)/s,n=Math.round(r*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(e){let{baseTexture:r}=this;r.resolution!==e&&(r.setResolution(e),this.resize(r.width,r.height,!1))}static create(e){return new t(new qo(e))}};var qa=class{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,r,i=He.NONE){let s=new qo(Object.assign({width:e,height:r,resolution:1,multisample:i},this.textureOptions));return new Qo(s)}getOptimalTexture(e,r,i=1,s=He.NONE){let o;e=Math.max(Math.ceil(e*i-1e-6),1),r=Math.max(Math.ceil(r*i-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||r!==this._pixelsHeight?(e=No(e),r=No(r),o=((e&65535)<<16|r&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(e,r,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(e,r,i){let s=this.getOptimalTexture(e.width,e.height,r||e.resolution,i||He.NONE);return s.filterFrame=e.filterFrame,s}returnTexture(e){let r=e.filterPoolKey;e.filterFrame=null,this.texturePool[r].push(e)}returnFilterTexture(e){this.returnTexture(e)}clear(e){if(e=e!==!1,e)for(let r in this.texturePool){let i=this.texturePool[r];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(e){if(!(e.width===this._pixelsWidth&&e.height===this._pixelsHeight)){this.enableFullScreen=e.width>0&&e.height>0;for(let r in this.texturePool){if(!(Number(r)<0))continue;let i=this.texturePool[r];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[r]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}}};qa.SCREEN_KEY=-1;var ih=class extends Ji{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var sh=class extends Ji{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 yt(this.vertices),this.uvBuffer=new yt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(e,r){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+r.width/e.width,this.uvs[3]=s,this.uvs[4]=i+r.width/e.width,this.uvs[5]=s+r.height/e.height,this.uvs[6]=i,this.uvs[7]=s+r.height/e.height,i=r.x,s=r.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+r.width,this.vertices[3]=s,this.vertices[4]=i+r.width,this.vertices[5]=s+r.height,this.vertices[6]=i,this.vertices[7]=s+r.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var oh=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=He.NONE,this.sourceFrame=new Ie,this.destinationFrame=new Ie,this.bindingSourceFrame=new Ie,this.bindingDestinationFrame=new Ie,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Fm=[new _t,new _t,new _t,new _t],n0=new qe,Ka=class{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new qa,this.statePool=[],this.quad=new ih,this.quadUv=new sh,this.tempRect=new Ie,this.activeState={},this.globalUniforms=new Pr({outputFrame:new Ie,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(e,r){let i=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new oh,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=r[0].resolution||a,u=r[0].multisample??l,h=r[0].padding,d=r[0].autoFit,f=r[0].legacy??!0;for(let x=1;x<r.length;x++){let v=r[x];c=Math.min(c,v.resolution||a),u=Math.min(u,v.multisample??l),h=this.useMaxPadding?Math.max(h,v.padding):h+v.padding,d=d&&v.autoFit,f=f||(v.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=c,o.multisample=u,o.legacy=f,o.target=e,o.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),o.sourceFrame.pad(h);let p=this.tempRect.copyFrom(n.sourceFrame);i.projection.transform&&this.transformAABB(n0.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,u),o.filters=r,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 e=this.defaultFilterStack,r=e.pop(),i=r.filters;this.activeState=r;let s=this.globalUniforms.uniforms;s.outputFrame=r.sourceFrame,s.resolution=r.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=r.destinationFrame.width,o[1]=r.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*r.resolution),n[1]=Math.round(o[1]*r.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=r.sourceFrame.width*o[2]-.5*n[2],a[3]=r.sourceFrame.height*o[3]-.5*n[3],r.legacy){let c=s.filterArea;c[0]=r.destinationFrame.width,c[1]=r.destinationFrame.height,c[2]=r.sourceFrame.x,c[3]=r.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let l=e[e.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,r.renderTexture,l.renderTexture,Ds.BLEND,r),this.returnFilterTexture(r.renderTexture);else{let c=r.renderTexture,u=this.getOptimalFilterTexture(c.width,c.height,r.resolution);u.filterFrame=c.filterFrame;let h=0;for(h=0;h<i.length-1;++h){h===1&&r.multisample>1&&(u=this.getOptimalFilterTexture(c.width,c.height,r.resolution),u.filterFrame=c.filterFrame),i[h].apply(this,c,u,Ds.CLEAR,r);let d=c;c=u,u=d}i[h].apply(this,c,l.renderTexture,Ds.BLEND,r),h>1&&r.multisample>1&&this.returnFilterTexture(r.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(u)}r.clear(),this.statePool.push(r)}bindAndClear(e,r=Ds.CLEAR){let{renderTexture:i,state:s}=this.renderer;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=e.filterFrame.width,n.height=e.filterFrame.height,i.bind(e,e.filterFrame,n)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(r===Ds.CLEAR||r===Ds.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,r,i,s){let o=this.renderer;o.state.set(e.state),this.bindAndClear(i,s),e.uniforms.uSampler=r,e.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(r._frame,r.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Ia.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ia.TRIANGLE_STRIP))}calculateSpriteMatrix(e,r){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=r._texture,n=e.set(s.width,0,0,s.height,i.x,i.y),a=r.worldTransform.copyTo(qe.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(r.anchor.x,r.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,r,i=1,s=He.NONE){return this.texturePool.getOptimalTexture(e,r,i,s)}getFilterTexture(e,r,i){if(typeof e=="number"){let o=e;e=r,r=o}e=e||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(e.width,e.height,r||e.resolution,i||He.NONE);return s.filterFrame=e.filterFrame,s}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,r){let i=Fm[0],s=Fm[1],o=Fm[2],n=Fm[3];i.set(r.left,r.top),s.set(r.left,r.bottom),o.set(r.right,r.top),n.set(r.right,r.bottom),e.apply(i,i),e.apply(s,s),e.apply(o,o),e.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),u=Math.max(i.y,s.y,o.y,n.y);r.x=a,r.y=l,r.width=c-a,r.height=u-l}roundFrame(e,r,i,s,o){if(!(e.width<=0||e.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?n0.copyFrom(o):n0.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(o,e),e.ceil(r),this.transformAABB(o.invert(),e)}}};Ka.extension={type:ee.RendererSystem,name:"filter"};ae.add(Ka);var nh=class{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=He.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var WX=new Ie,Za=class{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Hs(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Ie,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let r=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;ne.PREFER_ENV===Sr.WEBGL_LEGACY&&(r=null,i=null),r?e.drawBuffers=s=>r.drawBuffersWEBGL(s):(this.hasMRT=!1,e.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,r,i=0){let{gl:s}=this;if(e){let o=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==i&&(e.dirtyId++,e.dirtyFormat++,o.mipLevel=i),o.dirtyId!==e.dirtyId&&(o.dirtyId=e.dirtyId,o.dirtyFormat!==e.dirtyFormat?(o.dirtyFormat=e.dirtyFormat,o.dirtySize=e.dirtySize,this.updateFramebuffer(e,i)):o.dirtySize!==e.dirtySize&&(o.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(let n=0;n<e.colorTextures.length;n++){let a=e.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),r){let n=r.width>>i,a=r.height>>i,l=n/r.width;this.setViewport(r.x*l,r.y*l,n,a)}else{let n=e.width>>i,a=e.height>>i;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),r?this.setViewport(r.x,r.y,r.width,r.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(e,r,i,s){let o=this.viewport;e=Math.round(e),r=Math.round(r),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==e||o.y!==r)&&(o.x=e,o.y=r,o.width=i,o.height=s,this.gl.viewport(e,r,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(e,r,i,s,o=jp.COLOR|jp.DEPTH){let{gl:n}=this;n.clearColor(e,r,i,s),n.clear(o)}initFramebuffer(e){let{gl:r}=this,i=new nh(r.createFramebuffer());return i.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(e),e.disposeRunner.add(this),i}resizeFramebuffer(e){let{gl:r}=this,i=e.glFramebuffers[this.CONTEXT_UID];if(i.stencil){r.bindRenderbuffer(r.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=r.DEPTH_STENCIL:e.depth&&e.stencil?n=r.DEPTH24_STENCIL8:e.depth?n=r.DEPTH_COMPONENT24:n=r.STENCIL_INDEX8,i.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,n,e.width,e.height):r.renderbufferStorage(r.RENDERBUFFER,n,e.width,e.height)}let s=e.colorTextures,o=s.length;r.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&&(r.bindRenderbuffer(r.RENDERBUFFER,i.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,l._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height))}e.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(e.depthTexture,0)}updateFramebuffer(e,r){let{gl:i}=this,s=e.glFramebuffers[this.CONTEXT_UID],o=e.colorTextures,n=o.length;i.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(e)?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],u=c.parentTextureArray||c;this.renderer.texture.bind(u,0),l===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,u._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,c.target,u._glTextures[this.CONTEXT_UID].texture,r),a.push(i.COLOR_ATTACHMENT0+l))}if(a.length>1&&i.drawBuffers(a),e.depthTexture&&this.writeDepthTexture){let l=e.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,r)}if((e.stencil||e.depth)&&!(e.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):e.depth&&e.stencil?(l=i.DEPTH_STENCIL_ATTACHMENT,c=i.DEPTH24_STENCIL8):e.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,e.width,e.height):i.renderbufferStorage(i.RENDERBUFFER,c,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){let{msaaSamples:r}=this,i=He.NONE;if(e<=1||r===null)return i;for(let s=0;s<r.length;s++)if(r[s]<=e){i=r[s];break}return i===1&&(i=He.NONE),i}blit(e,r,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(!e){if(!l.msaaBuffer)return;let u=s.colorTextures[0];if(!u)return;l.blitFramebuffer||(l.blitFramebuffer=new Hs(s.width,s.height),l.blitFramebuffer.addColorTexture(0,u)),e=l.blitFramebuffer,e.colorTextures[0]!==u&&(e.colorTextures[0]=u,e.dirtyId++,e.dirtyFormat++),(e.width!==s.width||e.height!==s.height)&&(e.width=s.width,e.height=s.height,e.dirtyId++,e.dirtySize++)}r||(r=WX,r.width=s.width,r.height=s.height),i||(i=r);let c=r.width===i.width&&r.height===i.height;this.bind(e),n.bindFramebuffer(n.READ_FRAMEBUFFER,l.framebuffer),n.blitFramebuffer(r.left,r.top,r.right,r.bottom,i.left,i.top,i.right,i.bottom,n.COLOR_BUFFER_BIT,c?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,e.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(e,r){let i=e.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete e.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(e);o>=0&&this.managedFramebuffers.splice(o,1),e.disposeRunner.remove(this),r||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,r)}disposeAll(e){let r=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<r.length;i++)this.disposeFramebuffer(r[i],e)}forceStencil(){let e=this.current;if(!e)return;let r=e.glFramebuffers[this.CONTEXT_UID];if(!r||r.stencil&&e.stencil)return;e.stencil=!0;let i=e.width,s=e.height,o=this.gl,n=r.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):e.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,l=o.STENCIL_INDEX8),r.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,r.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 Ie}destroy(){this.renderer=null}};Za.extension={type:ee.RendererSystem,name:"framebuffer"};ae.add(Za);var a0={5126:4,5123:2,5121:1},Qa=class{constructor(e){this.renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let e=this.gl=this.renderer.gl,r=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,r.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;ne.PREFER_ENV===Sr.WEBGL_LEGACY&&(i=null),i?(e.createVertexArray=()=>i.createVertexArrayOES(),e.bindVertexArray=s=>i.bindVertexArrayOES(s),e.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(r.webGLVersion!==2){let i=e.getExtension("ANGLE_instanced_arrays");i?(e.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o),e.drawElementsInstanced=(s,o,n,a,l)=>i.drawElementsInstancedANGLE(s,o,n,a,l),e.drawArraysInstanced=(s,o,n,a)=>i.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=r.webGLVersion===2||!!r.extensions.uint32ElementIndex}bind(e,r){r=r||this.renderer.shader.shader;let{gl:i}=this,s=e.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[r.program.id]||this.initGeometryVao(e,r,o);this._activeGeometry=e,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(e,r.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let e=this._activeGeometry,r=this.renderer.buffer;for(let i=0;i<e.buffers.length;i++){let s=e.buffers[i];r.update(s)}}checkCompatibility(e,r){let i=e.attributes,s=r.attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(e,r){let i=e.attributes,s=r.attributeData,o=["g",e.id];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(e,r,i=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=r.program;a.glPrograms[o]||this.renderer.shader.generateProgram(r),this.checkCompatibility(e,a);let l=this.getSignature(e,a),c=e.glVertexArrayObjects[this.CONTEXT_UID],u=c[l];if(u)return c[a.id]=u,u;let h=e.buffers,d=e.attributes,f={},p={};for(let m in h)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*a0[d[m].type];for(let m in d){let x=d[m],v=x.size;x.stride===void 0&&(f[x.buffer]===v*a0[x.type]?x.stride=0:x.stride=f[x.buffer]),x.start===void 0&&(x.start=p[x.buffer],p[x.buffer]+=v*a0[x.type])}u=s.createVertexArray(),s.bindVertexArray(u);for(let m=0;m<h.length;m++){let x=h[m];n.bind(x),i&&x._glBuffers[o].refCount++}return this.activateVao(e,a),c[a.id]=u,c[l]=u,s.bindVertexArray(null),n.unbind(pr.ARRAY_BUFFER),u}disposeGeometry(e,r){if(!this.managedGeometries[e.id])return;delete this.managedGeometries[e.id];let i=e.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=e.buffers,n=this.renderer?.buffer;if(e.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&&!r&&n.dispose(o[a],r))}if(!r){for(let a in i)if(a[0]==="g"){let l=i[a];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(e){let r=Object.keys(this.managedGeometries);for(let i=0;i<r.length;i++)this.disposeGeometry(this.managedGeometries[r[i]],e)}activateVao(e,r){let i=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=e.buffers,a=e.attributes;e.indexBuffer&&o.bind(e.indexBuffer);let l=null;for(let c in a){let u=a[c],h=n[u.buffer],d=h._glBuffers[s];if(r.attributeData[c]){l!==d&&(o.bind(h),l=d);let f=r.attributeData[c].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,u.size,u.type||i.FLOAT,u.normalized,u.stride,u.start),u.instance)if(this.hasInstance)i.vertexAttribDivisor(f,u.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,r,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(e,r||n.indexBuffer.data.length,l,(i||0)*a,s||1):o.drawElements(e,r||n.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(e,i,r||n.getSize(),s||1):o.drawArrays(e,i,r||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Qa.extension={type:ee.RendererSystem,name:"geometry"};ae.add(Qa);var _O=new qe,ah=class{constructor(e,r){this._texture=e,this.mapCoord=new qe,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof r>"u"?.5:r,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,r){r===void 0&&(r=e);let i=this.mapCoord;for(let s=0;s<e.length;s+=2){let o=e[s],n=e[s+1];r[s]=o*i.a+n*i.c+i.tx,r[s+1]=o*i.b+n*i.d+i.ty}return r}update(e){let r=this._texture;if(!r||!r.valid||!e&&this._textureID===r._updateID)return!1;this._textureID=r._updateID,this._updateID++;let i=r._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=r.orig,o=r.trim;o&&(_O.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(_O));let n=r.baseTexture,a=this.uClampFrame,l=this.clampMargin/n.resolution,c=this.clampOffset;return a[0]=(r._frame.x+l+c)/n.width,a[1]=(r._frame.y+l+c)/n.height,a[2]=(r._frame.x+r._frame.width-l+c)/n.width,a[3]=(r._frame.y+r._frame.height-l+c)/n.height,this.uClampOffset[0]=c/n.realWidth,this.uClampOffset[1]=c/n.realHeight,this.isSimple=r._frame.width===n.width&&r._frame.height===n.height&&r.rotate===0,!0}};var bO=`varying vec2 vMaskCoord;
|
|
1954
|
+
`;var o0=class th extends Yo{constructor(e,r,i){let s=$r.from(e||th.defaultVertexSrc,r||th.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=th.defaultResolution,this.multisample=th.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ii}apply(e,r,i,s,o){e.applyFilter(this,r,i,s)}get blendMode(){return this.state.blendMode}set blendMode(e){this.state.blendMode=e}get resolution(){return this._resolution}set resolution(e){this._resolution=e}static get defaultVertexSrc(){return gO}static get defaultFragmentSrc(){return mO}};o0.defaultResolution=1,o0.defaultMultisample=We.NONE;var Fi=o0;var rs=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ii(0),this.alpha=1}init(e){this.clearBeforeRender=e.clearBeforeRender;let{backgroundColor:r,background:i,backgroundAlpha:s}=e,o=i??r;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get backgroundColor(){return this._backgroundColor}destroy(){}};rs.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},rs.extension={type:[ee.RendererSystem,ee.CanvasRendererSystem],name:"background"};ae.add(rs);var ja=class{constructor(e){this.renderer=e,this.emptyRenderer=new jo(e),this.currentRenderer=this.emptyRenderer}setObjectRenderer(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(e,r){let{boundTextures:i}=this.renderer.texture;for(let s=r-1;s>=0;--s)e[s]=i[s]||null,e[s]&&(e[s]._batchLocation=s)}boundArray(e,r,i,s){let{elements:o,ids:n,count:a}=e,l=0;for(let c=0;c<a;c++){let u=o[c],h=u._batchLocation;if(h>=0&&h<s&&r[h]===u){n[c]=h;continue}for(;l<s;){let d=r[l];if(d&&d._batchEnabled===i&&d._batchLocation===l){l++;continue}n[c]=l,u._batchLocation=l,r[l]=u;break}}}destroy(){this.renderer=null}};ja.extension={type:ee.RendererSystem,name:"batch"};ae.add(ja);var xO=0,is=class{constructor(e){this.renderer=e,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(e){this.gl=e,this.renderer.gl=e,this.renderer.CONTEXT_UID=xO++}init(e){if(e.context)this.initFromContext(e.context);else{let r=this.renderer.background.alpha<1,i=e.premultipliedAlpha;this.preserveDrawingBuffer=e.preserveDrawingBuffer,this.useContextAlpha=e.useContextAlpha,this.powerPreference=e.powerPreference,this.initFromOptions({alpha:r,premultipliedAlpha:i,antialias:e.antialias,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference})}}initFromContext(e){this.gl=e,this.validateContext(e),this.renderer.gl=e,this.renderer.CONTEXT_UID=xO++,this.renderer.runners.contextChange.emit(e);let r=this.renderer.view;r.addEventListener!==void 0&&(r.addEventListener("webglcontextlost",this.handleContextLost,!1),r.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(e){let r=this.createContext(this.renderer.view,e);this.initFromContext(r)}createContext(e,r){let i;if(ne.PREFER_ENV>=Sr.WEBGL2&&(i=e.getContext("webgl2",r)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r),!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:e}=this,r={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,r,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,r,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})}handleContextLost(e){e.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let e=this.renderer.view;this.renderer=null,e.removeEventListener!==void 0&&(e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(e){let r=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),r&&!r.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=i||!!e.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")}};is.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},is.extension={type:ee.RendererSystem,name:"context"};ae.add(is);var Hs=class{constructor(e,r){if(this.width=Math.round(e),this.height=Math.round(r),!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 pt("disposeFramebuffer"),this.multisample=We.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,r){return this.colorTextures[e]=r||new Pe(null,{scaleMode:Vr.NEAREST,resolution:1,mipmap:ti.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new Pe(null,{scaleMode:Vr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:ti.OFF,format:j.DEPTH_COMPONENT,type:ge.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(e,r){if(e=Math.round(e),r=Math.round(r),!e||!r)throw new Error("Framebuffer width and height must not be zero");if(!(e===this.width&&r===this.height)){this.width=e,this.height=r,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){let s=this.colorTextures[i],o=s.resolution;s.setSize(e/o,r/o)}if(this.depthTexture){let i=this.depthTexture.resolution;this.depthTexture.setSize(e/i,r/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var qo=class extends Pe{constructor(e={}){if(typeof e=="number"){let r=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];e={width:r,height:i,scaleMode:s,resolution:o}}e.width=e.width??100,e.height=e.height??100,e.multisample??(e.multisample=We.NONE),super(null,e),this.mipmap=ti.OFF,this.valid=!0,this._clear=new ii([0,0,0,0]),this.framebuffer=new Hs(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=e.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(e){this._clear.setValue(e)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,r){this.framebuffer.resize(e*this.resolution,r*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 Pt=class extends Ar{constructor(e){let r=e,i=r.naturalWidth||r.videoWidth||r.displayWidth||r.width,s=r.naturalHeight||r.videoHeight||r.displayHeight||r.height;super(i,s),this.source=e,this.noSubImage=!1}static crossOrigin(e,r,i){i===void 0&&!r.startsWith("data:")?e.crossOrigin=Hv(r):i!==!1&&(e.crossOrigin=typeof i=="string"?i:"anonymous")}upload(e,r,i,s){let o=e.gl,n=r.realWidth,a=r.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,r.alphaMode===wr.UNPACK),!this.noSubImage&&r.target===o.TEXTURE_2D&&i.width===n&&i.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,r.format,i.type,s):(i.width=n,i.height=a,o.texImage2D(r.target,0,i.internalFormat,r.format,i.type,s)),!0}update(){if(this.destroyed)return;let e=this.source,r=e.naturalWidth||e.videoWidth||e.width,i=e.naturalHeight||e.videoHeight||e.height;this.resize(r,i),super.update()}dispose(){this.source=null}};var Ko=class extends Pt{constructor(e,r){if(r=r||{},typeof e=="string"){let i=new Image;Pt.crossOrigin(i,e,r.crossorigin),i.src=e,e=i}super(e),!e.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=e.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(r.createBitmap??ne.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof r.alphaMode=="number"?r.alphaMode:null,this.bitmap=null,this._load=null,r.autoLoad!==!1&&this.load()}load(e){return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise((r,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?r(this.process()):r(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{i(n),this.onError.emit(n)})}),this._load)}process(){let e=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let r=globalThis.createImageBitmap,i=!e.crossOrigin||e.crossOrigin==="anonymous";return this._process=fetch(e.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>r(s,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===wr.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,r,i){if(typeof this.alphaMode=="number"&&(r.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,r,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,r,i,this.bitmap),!this.preserveBitmap){let s=!0,o=r._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==r.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(e){return typeof HTMLImageElement<"u"&&(typeof e=="string"||e instanceof HTMLImageElement)}};var Zo=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(e,r,i){let s=r.width,o=r.height;if(i){let n=e.width/2/s,a=e.height/2/o,l=e.x/s+n,c=e.y/o+a;i=Je.add(i,Je.NW),this.x0=l+n*Je.uX(i),this.y0=c+a*Je.uY(i),i=Je.add(i,2),this.x1=l+n*Je.uX(i),this.y1=c+a*Je.uY(i),i=Je.add(i,2),this.x2=l+n*Je.uX(i),this.y2=c+a*Je.uY(i),i=Je.add(i,2),this.x3=l+n*Je.uX(i),this.y3=c+a*Je.uY(i)}else this.x0=e.x/s,this.y0=e.y/o,this.x1=(e.x+e.width)/s,this.y1=e.y/o,this.x2=(e.x+e.width)/s,this.y2=(e.y+e.height)/o,this.x3=e.x/s,this.y3=(e.y+e.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}};Zo.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 yO=new Zo;function Bm(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}var rh=class t extends Vo.default{constructor(e,r,i,s,o,n,a){if(super(),this.noFrame=!1,r||(this.noFrame=!0,r=new Ie(0,0,1,1)),e instanceof t&&(e=e.baseTexture),this.baseTexture=e,this._frame=r,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=yO,this.uvMatrix=null,this.orig=i||r,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 _t(n.x,n.y):new _t(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],e.valid?this.noFrame?e.valid&&this.onBaseTextureUpdated(e):this.frame=r:e.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&e.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(e){if(this.baseTexture){if(e){let{resource:r}=this.baseTexture;r?.url&&Er[r.url]&&t.removeFromCache(r.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,t.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let e=this._frame.clone(),r=this._frame===this.orig?e:this.orig.clone(),i=new t(this.baseTexture,!this.noFrame&&e,r,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===yO&&(this._uvs=new Zo),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,r={},i=ne.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else if(e instanceof Pe){if(!e.cacheId){let a=r?.pixiIdPrefix||"pixiid";e.cacheId=`${a}-${Qi()}`,Pe.addToCache(e,e.cacheId)}o=e.cacheId}else{if(!e._pixiId){let a=r?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Qi()}`}o=e._pixiId}let n=Er[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(e instanceof Pe)?(r.resolution||(r.resolution=mm(e)),n=new t(new Pe(e,r)),n.baseTexture.cacheId=o,Pe.addToCache(n.baseTexture,o),t.addToCache(n,o)):!n&&e instanceof Pe&&(n=new t(e),t.addToCache(n,o)),n}static fromURL(e,r){let i=Object.assign({autoLoad:!1},r?.resourceOptions),s=t.from(e,Object.assign({resourceOptions:i},r),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(e,r,i,s){return new t(Pe.fromBuffer(e,r,i,s))}static fromLoader(e,r,i,s){let o=new Pe(e,Object.assign({scaleMode:Pe.defaultOptions.scaleMode,resolution:mm(r)},s)),{resource:n}=o;n instanceof Ko&&(n.url=r);let a=new t(o);return i||(i=r),Pe.addToCache(a.baseTexture,i),t.addToCache(a,i),i!==r&&(Pe.addToCache(a.baseTexture,r),t.addToCache(a,r)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(e,r){r&&(e.textureCacheIds.includes(r)||e.textureCacheIds.push(r),Er[r]&&Er[r]!==e&&console.warn(`Texture added to the cache with an id [${r}] that already had an entry`),Er[r]=e)}static removeFromCache(e){if(typeof e=="string"){let r=Er[e];if(r){let i=r.textureCacheIds.indexOf(e);return i>-1&&r.textureCacheIds.splice(i,1),delete Er[e],r}}else if(e?.textureCacheIds){for(let r=0;r<e.textureCacheIds.length;++r)Er[e.textureCacheIds[r]]===e&&delete Er[e.textureCacheIds[r]];return e.textureCacheIds.length=0,e}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(e){this._frame=e,this.noFrame=!1;let{x:r,y:i,width:s,height:o}=e,n=r+s>this.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",c=`X: ${r} + ${s} = ${r+s} > ${this.baseTexture.width}`,u=`Y: ${i} + ${o} = ${i+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${c} ${l} ${u}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(e){this._rotate=e,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return t._EMPTY||(t._EMPTY=new t(new Pe),Bm(t._EMPTY),Bm(t._EMPTY.baseTexture)),t._EMPTY}static get WHITE(){if(!t._WHITE){let e=ne.ADAPTER.createCanvas(16,16),r=e.getContext("2d");e.width=16,e.height=16,r.fillStyle="white",r.fillRect(0,0,16,16),t._WHITE=new t(Pe.from(e)),Bm(t._WHITE),Bm(t._WHITE.baseTexture)}return t._WHITE}};var Qo=class t extends rh{constructor(e,r){super(e,r),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(e){this.framebuffer.multisample=e}resize(e,r,i=!0){let s=this.baseTexture.resolution,o=Math.round(e*s)/s,n=Math.round(r*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(e){let{baseTexture:r}=this;r.resolution!==e&&(r.setResolution(e),this.resize(r.width,r.height,!1))}static create(e){return new t(new qo(e))}};var qa=class{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,r,i=We.NONE){let s=new qo(Object.assign({width:e,height:r,resolution:1,multisample:i},this.textureOptions));return new Qo(s)}getOptimalTexture(e,r,i=1,s=We.NONE){let o;e=Math.max(Math.ceil(e*i-1e-6),1),r=Math.max(Math.ceil(r*i-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||r!==this._pixelsHeight?(e=No(e),r=No(r),o=((e&65535)<<16|r&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(e,r,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(e,r,i){let s=this.getOptimalTexture(e.width,e.height,r||e.resolution,i||We.NONE);return s.filterFrame=e.filterFrame,s}returnTexture(e){let r=e.filterPoolKey;e.filterFrame=null,this.texturePool[r].push(e)}returnFilterTexture(e){this.returnTexture(e)}clear(e){if(e=e!==!1,e)for(let r in this.texturePool){let i=this.texturePool[r];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(e){if(!(e.width===this._pixelsWidth&&e.height===this._pixelsHeight)){this.enableFullScreen=e.width>0&&e.height>0;for(let r in this.texturePool){if(!(Number(r)<0))continue;let i=this.texturePool[r];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[r]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}}};qa.SCREEN_KEY=-1;var ih=class extends Ji{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var sh=class extends Ji{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 yt(this.vertices),this.uvBuffer=new yt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(e,r){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+r.width/e.width,this.uvs[3]=s,this.uvs[4]=i+r.width/e.width,this.uvs[5]=s+r.height/e.height,this.uvs[6]=i,this.uvs[7]=s+r.height/e.height,i=r.x,s=r.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+r.width,this.vertices[3]=s,this.vertices[4]=i+r.width,this.vertices[5]=s+r.height,this.vertices[6]=i,this.vertices[7]=s+r.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var oh=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=We.NONE,this.sourceFrame=new Ie,this.destinationFrame=new Ie,this.bindingSourceFrame=new Ie,this.bindingDestinationFrame=new Ie,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Fm=[new _t,new _t,new _t,new _t],n0=new qe,Ka=class{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new qa,this.statePool=[],this.quad=new ih,this.quadUv=new sh,this.tempRect=new Ie,this.activeState={},this.globalUniforms=new Pr({outputFrame:new Ie,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(e,r){let i=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new oh,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=r[0].resolution||a,u=r[0].multisample??l,h=r[0].padding,d=r[0].autoFit,f=r[0].legacy??!0;for(let x=1;x<r.length;x++){let v=r[x];c=Math.min(c,v.resolution||a),u=Math.min(u,v.multisample??l),h=this.useMaxPadding?Math.max(h,v.padding):h+v.padding,d=d&&v.autoFit,f=f||(v.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=c,o.multisample=u,o.legacy=f,o.target=e,o.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),o.sourceFrame.pad(h);let p=this.tempRect.copyFrom(n.sourceFrame);i.projection.transform&&this.transformAABB(n0.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,u),o.filters=r,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 e=this.defaultFilterStack,r=e.pop(),i=r.filters;this.activeState=r;let s=this.globalUniforms.uniforms;s.outputFrame=r.sourceFrame,s.resolution=r.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=r.destinationFrame.width,o[1]=r.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*r.resolution),n[1]=Math.round(o[1]*r.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=r.sourceFrame.width*o[2]-.5*n[2],a[3]=r.sourceFrame.height*o[3]-.5*n[3],r.legacy){let c=s.filterArea;c[0]=r.destinationFrame.width,c[1]=r.destinationFrame.height,c[2]=r.sourceFrame.x,c[3]=r.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let l=e[e.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,r.renderTexture,l.renderTexture,Ds.BLEND,r),this.returnFilterTexture(r.renderTexture);else{let c=r.renderTexture,u=this.getOptimalFilterTexture(c.width,c.height,r.resolution);u.filterFrame=c.filterFrame;let h=0;for(h=0;h<i.length-1;++h){h===1&&r.multisample>1&&(u=this.getOptimalFilterTexture(c.width,c.height,r.resolution),u.filterFrame=c.filterFrame),i[h].apply(this,c,u,Ds.CLEAR,r);let d=c;c=u,u=d}i[h].apply(this,c,l.renderTexture,Ds.BLEND,r),h>1&&r.multisample>1&&this.returnFilterTexture(r.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(u)}r.clear(),this.statePool.push(r)}bindAndClear(e,r=Ds.CLEAR){let{renderTexture:i,state:s}=this.renderer;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=e.filterFrame.width,n.height=e.filterFrame.height,i.bind(e,e.filterFrame,n)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(r===Ds.CLEAR||r===Ds.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,r,i,s){let o=this.renderer;o.state.set(e.state),this.bindAndClear(i,s),e.uniforms.uSampler=r,e.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(r._frame,r.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Ia.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ia.TRIANGLE_STRIP))}calculateSpriteMatrix(e,r){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=r._texture,n=e.set(s.width,0,0,s.height,i.x,i.y),a=r.worldTransform.copyTo(qe.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(r.anchor.x,r.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,r,i=1,s=We.NONE){return this.texturePool.getOptimalTexture(e,r,i,s)}getFilterTexture(e,r,i){if(typeof e=="number"){let o=e;e=r,r=o}e=e||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(e.width,e.height,r||e.resolution,i||We.NONE);return s.filterFrame=e.filterFrame,s}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,r){let i=Fm[0],s=Fm[1],o=Fm[2],n=Fm[3];i.set(r.left,r.top),s.set(r.left,r.bottom),o.set(r.right,r.top),n.set(r.right,r.bottom),e.apply(i,i),e.apply(s,s),e.apply(o,o),e.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),u=Math.max(i.y,s.y,o.y,n.y);r.x=a,r.y=l,r.width=c-a,r.height=u-l}roundFrame(e,r,i,s,o){if(!(e.width<=0||e.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?n0.copyFrom(o):n0.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(o,e),e.ceil(r),this.transformAABB(o.invert(),e)}}};Ka.extension={type:ee.RendererSystem,name:"filter"};ae.add(Ka);var nh=class{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=We.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var YX=new Ie,Za=class{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Hs(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Ie,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let r=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;ne.PREFER_ENV===Sr.WEBGL_LEGACY&&(r=null,i=null),r?e.drawBuffers=s=>r.drawBuffersWEBGL(s):(this.hasMRT=!1,e.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,r,i=0){let{gl:s}=this;if(e){let o=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==i&&(e.dirtyId++,e.dirtyFormat++,o.mipLevel=i),o.dirtyId!==e.dirtyId&&(o.dirtyId=e.dirtyId,o.dirtyFormat!==e.dirtyFormat?(o.dirtyFormat=e.dirtyFormat,o.dirtySize=e.dirtySize,this.updateFramebuffer(e,i)):o.dirtySize!==e.dirtySize&&(o.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(let n=0;n<e.colorTextures.length;n++){let a=e.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),r){let n=r.width>>i,a=r.height>>i,l=n/r.width;this.setViewport(r.x*l,r.y*l,n,a)}else{let n=e.width>>i,a=e.height>>i;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),r?this.setViewport(r.x,r.y,r.width,r.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(e,r,i,s){let o=this.viewport;e=Math.round(e),r=Math.round(r),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==e||o.y!==r)&&(o.x=e,o.y=r,o.width=i,o.height=s,this.gl.viewport(e,r,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(e,r,i,s,o=jp.COLOR|jp.DEPTH){let{gl:n}=this;n.clearColor(e,r,i,s),n.clear(o)}initFramebuffer(e){let{gl:r}=this,i=new nh(r.createFramebuffer());return i.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(e),e.disposeRunner.add(this),i}resizeFramebuffer(e){let{gl:r}=this,i=e.glFramebuffers[this.CONTEXT_UID];if(i.stencil){r.bindRenderbuffer(r.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=r.DEPTH_STENCIL:e.depth&&e.stencil?n=r.DEPTH24_STENCIL8:e.depth?n=r.DEPTH_COMPONENT24:n=r.STENCIL_INDEX8,i.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,n,e.width,e.height):r.renderbufferStorage(r.RENDERBUFFER,n,e.width,e.height)}let s=e.colorTextures,o=s.length;r.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&&(r.bindRenderbuffer(r.RENDERBUFFER,i.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,l._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height))}e.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(e.depthTexture,0)}updateFramebuffer(e,r){let{gl:i}=this,s=e.glFramebuffers[this.CONTEXT_UID],o=e.colorTextures,n=o.length;i.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(e)?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],u=c.parentTextureArray||c;this.renderer.texture.bind(u,0),l===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,u._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,c.target,u._glTextures[this.CONTEXT_UID].texture,r),a.push(i.COLOR_ATTACHMENT0+l))}if(a.length>1&&i.drawBuffers(a),e.depthTexture&&this.writeDepthTexture){let l=e.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,r)}if((e.stencil||e.depth)&&!(e.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):e.depth&&e.stencil?(l=i.DEPTH_STENCIL_ATTACHMENT,c=i.DEPTH24_STENCIL8):e.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,e.width,e.height):i.renderbufferStorage(i.RENDERBUFFER,c,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){let{msaaSamples:r}=this,i=We.NONE;if(e<=1||r===null)return i;for(let s=0;s<r.length;s++)if(r[s]<=e){i=r[s];break}return i===1&&(i=We.NONE),i}blit(e,r,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(!e){if(!l.msaaBuffer)return;let u=s.colorTextures[0];if(!u)return;l.blitFramebuffer||(l.blitFramebuffer=new Hs(s.width,s.height),l.blitFramebuffer.addColorTexture(0,u)),e=l.blitFramebuffer,e.colorTextures[0]!==u&&(e.colorTextures[0]=u,e.dirtyId++,e.dirtyFormat++),(e.width!==s.width||e.height!==s.height)&&(e.width=s.width,e.height=s.height,e.dirtyId++,e.dirtySize++)}r||(r=YX,r.width=s.width,r.height=s.height),i||(i=r);let c=r.width===i.width&&r.height===i.height;this.bind(e),n.bindFramebuffer(n.READ_FRAMEBUFFER,l.framebuffer),n.blitFramebuffer(r.left,r.top,r.right,r.bottom,i.left,i.top,i.right,i.bottom,n.COLOR_BUFFER_BIT,c?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,e.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(e,r){let i=e.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete e.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(e);o>=0&&this.managedFramebuffers.splice(o,1),e.disposeRunner.remove(this),r||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,r)}disposeAll(e){let r=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<r.length;i++)this.disposeFramebuffer(r[i],e)}forceStencil(){let e=this.current;if(!e)return;let r=e.glFramebuffers[this.CONTEXT_UID];if(!r||r.stencil&&e.stencil)return;e.stencil=!0;let i=e.width,s=e.height,o=this.gl,n=r.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):e.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,l=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,l=o.STENCIL_INDEX8),r.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,r.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 Ie}destroy(){this.renderer=null}};Za.extension={type:ee.RendererSystem,name:"framebuffer"};ae.add(Za);var a0={5126:4,5123:2,5121:1},Qa=class{constructor(e){this.renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let e=this.gl=this.renderer.gl,r=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,r.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;ne.PREFER_ENV===Sr.WEBGL_LEGACY&&(i=null),i?(e.createVertexArray=()=>i.createVertexArrayOES(),e.bindVertexArray=s=>i.bindVertexArrayOES(s),e.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(r.webGLVersion!==2){let i=e.getExtension("ANGLE_instanced_arrays");i?(e.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o),e.drawElementsInstanced=(s,o,n,a,l)=>i.drawElementsInstancedANGLE(s,o,n,a,l),e.drawArraysInstanced=(s,o,n,a)=>i.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=r.webGLVersion===2||!!r.extensions.uint32ElementIndex}bind(e,r){r=r||this.renderer.shader.shader;let{gl:i}=this,s=e.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[r.program.id]||this.initGeometryVao(e,r,o);this._activeGeometry=e,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(e,r.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let e=this._activeGeometry,r=this.renderer.buffer;for(let i=0;i<e.buffers.length;i++){let s=e.buffers[i];r.update(s)}}checkCompatibility(e,r){let i=e.attributes,s=r.attributeData;for(let o in s)if(!i[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(e,r){let i=e.attributes,s=r.attributeData,o=["g",e.id];for(let n in i)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(e,r,i=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=r.program;a.glPrograms[o]||this.renderer.shader.generateProgram(r),this.checkCompatibility(e,a);let l=this.getSignature(e,a),c=e.glVertexArrayObjects[this.CONTEXT_UID],u=c[l];if(u)return c[a.id]=u,u;let h=e.buffers,d=e.attributes,f={},p={};for(let m in h)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*a0[d[m].type];for(let m in d){let x=d[m],v=x.size;x.stride===void 0&&(f[x.buffer]===v*a0[x.type]?x.stride=0:x.stride=f[x.buffer]),x.start===void 0&&(x.start=p[x.buffer],p[x.buffer]+=v*a0[x.type])}u=s.createVertexArray(),s.bindVertexArray(u);for(let m=0;m<h.length;m++){let x=h[m];n.bind(x),i&&x._glBuffers[o].refCount++}return this.activateVao(e,a),c[a.id]=u,c[l]=u,s.bindVertexArray(null),n.unbind(pr.ARRAY_BUFFER),u}disposeGeometry(e,r){if(!this.managedGeometries[e.id])return;delete this.managedGeometries[e.id];let i=e.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=e.buffers,n=this.renderer?.buffer;if(e.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&&!r&&n.dispose(o[a],r))}if(!r){for(let a in i)if(a[0]==="g"){let l=i[a];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(e){let r=Object.keys(this.managedGeometries);for(let i=0;i<r.length;i++)this.disposeGeometry(this.managedGeometries[r[i]],e)}activateVao(e,r){let i=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=e.buffers,a=e.attributes;e.indexBuffer&&o.bind(e.indexBuffer);let l=null;for(let c in a){let u=a[c],h=n[u.buffer],d=h._glBuffers[s];if(r.attributeData[c]){l!==d&&(o.bind(h),l=d);let f=r.attributeData[c].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,u.size,u.type||i.FLOAT,u.normalized,u.stride,u.start),u.instance)if(this.hasInstance)i.vertexAttribDivisor(f,u.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,r,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(e,r||n.indexBuffer.data.length,l,(i||0)*a,s||1):o.drawElements(e,r||n.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(e,i,r||n.getSize(),s||1):o.drawArrays(e,i,r||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Qa.extension={type:ee.RendererSystem,name:"geometry"};ae.add(Qa);var _O=new qe,ah=class{constructor(e,r){this._texture=e,this.mapCoord=new qe,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof r>"u"?.5:r,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,r){r===void 0&&(r=e);let i=this.mapCoord;for(let s=0;s<e.length;s+=2){let o=e[s],n=e[s+1];r[s]=o*i.a+n*i.c+i.tx,r[s+1]=o*i.b+n*i.d+i.ty}return r}update(e){let r=this._texture;if(!r||!r.valid||!e&&this._textureID===r._updateID)return!1;this._textureID=r._updateID,this._updateID++;let i=r._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=r.orig,o=r.trim;o&&(_O.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(_O));let n=r.baseTexture,a=this.uClampFrame,l=this.clampMargin/n.resolution,c=this.clampOffset;return a[0]=(r._frame.x+l+c)/n.width,a[1]=(r._frame.y+l+c)/n.height,a[2]=(r._frame.x+r._frame.width-l+c)/n.width,a[3]=(r._frame.y+r._frame.height-l+c)/n.height,this.uClampOffset[0]=c/n.realWidth,this.uClampOffset[1]=c/n.realHeight,this.isSimple=r._frame.width===n.width&&r._frame.height===n.height&&r.rotate===0,!0}};var bO=`varying vec2 vMaskCoord;
|
|
1955
1955
|
varying vec2 vTextureCoord;
|
|
1956
1956
|
|
|
1957
1957
|
uniform sampler2D uSampler;
|
|
@@ -1992,7 +1992,7 @@ void main(void)
|
|
|
1992
1992
|
vTextureCoord = aTextureCoord;
|
|
1993
1993
|
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
1994
1994
|
}
|
|
1995
|
-
`;var lh=class extends Fi{constructor(e,r,i){let s=null;typeof e!="string"&&r===void 0&&i===void 0&&(s=e,e=void 0,r=void 0,i=void 0),super(e||vO,r||bO,i),this.maskSprite=s,this.maskMatrix=new qe}get maskSprite(){return this._maskSprite}set maskSprite(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(e,r,i,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new ah(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,o).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,e.applyFilter(this,r,i,s))}};var ch=class{constructor(e=null){this.type=xt.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Fi.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(e){e?this._filters?this._filters[0]=e:this._filters=[e]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=xt.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(e){e?(this._stencilCounter=e._stencilCounter,this._scissorCounter=e._scissorCounter,this._scissorRect=e._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}};var Ja=class{constructor(e){this.renderer=e,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(e){this.maskStack=e,this.renderer.scissor.setMaskStack(e),this.renderer.stencil.setMaskStack(e)}push(e,r){let i=r;if(!i.isMaskData){let o=this.maskDataPool.pop()||new ch;o.pooled=!0,o.maskObject=r,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=e,i.type!==xt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case xt.SCISSOR:this.renderer.scissor.push(i);break;case xt.STENCIL:this.renderer.stencil.push(i);break;case xt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case xt.COLOR:this.pushColorMask(i);break;default:break}i.type===xt.SPRITE&&this.maskStack.push(i)}pop(e){let r=this.maskStack.pop();if(!(!r||r._target!==e)){if(r.enabled)switch(r.type){case xt.SCISSOR:this.renderer.scissor.pop(r);break;case xt.STENCIL:this.renderer.stencil.pop(r.maskObject);break;case xt.SPRITE:this.popSpriteMask(r);break;case xt.COLOR:this.popColorMask(r);break;default:break}if(r.reset(),r.pooled&&this.maskDataPool.push(r),this.maskStack.length!==0){let i=this.maskStack[this.maskStack.length-1];i.type===xt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(e){let r=e.maskObject;r?r.isSprite?e.type=xt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=xt.SCISSOR:e.type=xt.STENCIL:e.type=xt.COLOR}pushSpriteMask(e){let{maskObject:r}=e,i=e._target,s=e._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new lh])),s[0].resolution=e.resolution,s[0].multisample=e.multisample,s[0].maskSprite=r;let o=i.filterArea;i.filterArea=r.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=o,e._filters||this.alphaMaskIndex++}popSpriteMask(e){this.renderer.filter.pop(),e._filters?e._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(e){let r=e._colorMask,i=e._colorMask=r&e.colorMask;i!==r&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(e){let r=e._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==r&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};Ja.extension={type:ee.RendererSystem,name:"mask"};ae.add(Ja);var el=class{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){let{gl:r}=this.renderer,i=this.getStackLength();this.maskStack=e;let s=this.getStackLength();s!==i&&(s===0?r.disable(this.glConst):(r.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var TO=new qe,SO=[],wO=class km extends el{constructor(e){super(e),this.glConst=ne.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0}calcScissorRect(e){if(e._scissorRectLocal)return;let r=e._scissorRect,{maskObject:i}=e,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,SO.pop()??new Ie);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),r&&n.fit(r),e._scissorRectLocal=n}static isMatrixRotated(e){if(!e)return!1;let{a:r,b:i,c:s,d:o}=e;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(r)>1e-4||Math.abs(o)>1e-4)}testScissor(e){let{maskObject:r}=e;if(!r.isFastRect||!r.isFastRect()||km.isMatrixRotated(r.worldTransform)||km.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);let i=e._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(e,r,i,s,o){km.isMatrixRotated(o)||(o=o?TO.copyFrom(o):TO.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,e),e.fit(s),e.x=Math.round(e.x*r),e.y=Math.round(e.y*r),e.width=Math.round(e.width*r),e.height=Math.round(e.height*r))}push(e){e._scissorRectLocal||this.calcScissorRect(e);let{gl:r}=this.renderer;e._scissorRect||r.enable(r.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()}pop(e){let{gl:r}=this.renderer;e&&SO.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():r.disable(r.SCISSOR_TEST)}_useCurrent(){let e=this.maskStack[this.maskStack.length-1]._scissorRect,r;this.renderer.renderTexture.current?r=e.y:r=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,r,e.width,e.height)}};wO.extension={type:ee.RendererSystem,name:"scissor"};var l0=wO;ae.add(l0);var tl=class extends el{constructor(e){super(e),this.glConst=ne.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0}push(e){let r=e.maskObject,{gl:i}=this.renderer,s=e._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),e._stencilCounter++;let o=e._colorMask;o!==0&&(e._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),r.renderable=!0,r.render(this.renderer),this.renderer.batch.flush(),r.renderable=!1,o!==0&&(e._colorMask=o,i.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(e){let r=this.renderer.gl;if(this.getStackLength()===0)r.disable(r.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,r.colorMask(!1,!1,!1,!1)),r.stencilOp(r.KEEP,r.KEEP,r.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,s!==0&&(i._colorMask=s,r.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)}};tl.extension={type:ee.RendererSystem,name:"stencil"};ae.add(tl);var rl=class{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return we("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return we("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return we("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),e.events}}})}init(){let e=this.rendererPlugins;for(let r in e)this.plugins[r]=new e[r](this.renderer)}destroy(){for(let e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}};rl.extension={type:[ee.RendererSystem,ee.CanvasRendererSystem],name:"_plugin"};ae.add(rl);var il=class{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new qe,this.transform=null}update(e,r,i,s){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=r||this.sourceFrame||e,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(e,r,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/r.width*2,o.d=n*(1/r.height*2),o.tx=-1-r.x*o.a,o.ty=-n-r.y*o.d}setTransform(e){}destroy(){this.renderer=null}};il.extension={type:ee.RendererSystem,name:"projection"};ae.add(il);var $X=new Sm,EO=new Ie,sl=class{constructor(e){this.renderer=e,this._tempMatrix=new qe}generateTexture(e,r){let{region:i,...s}=r||{},o=i?.copyTo(EO)||e.getLocalBounds(EO,!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=Qo.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=e.transform;return e.transform=$X,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=l,a}destroy(){}};sl.extension={type:[ee.RendererSystem,ee.CanvasRendererSystem],name:"textureGenerator"};ae.add(sl);var Jo=new Ie,uh=new Ie,ol=class{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new Ie,this.destinationFrame=new Ie,this.viewportFrame=new Ie}contextChange(){let e=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,r,i){let s=this.renderer;this.current=e;let o,n,a;e?(o=e.baseTexture,a=o.resolution,r||(Jo.width=e.frame.width,Jo.height=e.frame.height,r=Jo),i||(uh.x=e.frame.x,uh.y=e.frame.y,uh.width=r.width,uh.height=r.height,i=uh),n=o.framebuffer):(a=s.resolution,r||(Jo.width=s._view.screen.width,Jo.height=s._view.screen.height,r=Jo),i||(i=Jo,i.width=r.width,i.height=r.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,e||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(n,l),this.renderer.projection.update(i,r,a,!n),e?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(r),this.destinationFrame.copyFrom(i)}clear(e,r){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=ii.shared.setValue(e||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:u,height:h}=this.viewportFrame;l=Math.round(l),c=Math.round(c),u=Math.round(u),h=Math.round(h),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,c,u,h)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,r),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};ol.extension={type:ee.RendererSystem,name:"renderTexture"};ae.add(ol);var hh=class{constructor(e,r){this.program=e,this.uniformData=r,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function AO(t,e){let r={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let o=e.getActiveAttrib(t,s);if(o.name.startsWith("gl_"))continue;let n=Ku(e,o.type),a={type:n,name:o.name,size:qu(n),location:e.getAttribLocation(t,o.name)};r[o.name]=a}return r}function PO(t,e){let r={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=e.getActiveUniform(t,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=Ku(e,o.type);r[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:ju(l,o.size)}}return r}function c0(t,e){let r=wm(t,t.VERTEX_SHADER,e.vertexSrc),i=wm(t,t.FRAGMENT_SHADER,e.fragmentSrc),s=t.createProgram();t.attachShader(s,r),t.attachShader(s,i);let o=e.extra?.transformFeedbackVaryings;if(o&&(typeof t.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS)||i0(t,s,r,i),e.attributeData=AO(s,t),e.uniformData=PO(s,t),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){let a=Object.keys(e.attributeData);a.sort((l,c)=>l>c?1:-1);for(let l=0;l<a.length;l++)e.attributeData[a[l]].location=l,t.bindAttribLocation(s,l,a[l]);t.linkProgram(s)}t.deleteShader(r),t.deleteShader(i);let n={};for(let a in e.uniformData){let l=e.uniformData[a];n[a]={location:t.getUniformLocation(s,a),value:ju(l.type,l.size)}}return new hh(s,n)}function zX(t,e,r,i,s){r.buffer.update(s)}var XX={float:`
|
|
1995
|
+
`;var lh=class extends Fi{constructor(e,r,i){let s=null;typeof e!="string"&&r===void 0&&i===void 0&&(s=e,e=void 0,r=void 0,i=void 0),super(e||vO,r||bO,i),this.maskSprite=s,this.maskMatrix=new qe}get maskSprite(){return this._maskSprite}set maskSprite(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(e,r,i,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new ah(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,o).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,e.applyFilter(this,r,i,s))}};var ch=class{constructor(e=null){this.type=xt.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Fi.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(e){e?this._filters?this._filters[0]=e:this._filters=[e]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=xt.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(e){e?(this._stencilCounter=e._stencilCounter,this._scissorCounter=e._scissorCounter,this._scissorRect=e._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}};var Ja=class{constructor(e){this.renderer=e,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(e){this.maskStack=e,this.renderer.scissor.setMaskStack(e),this.renderer.stencil.setMaskStack(e)}push(e,r){let i=r;if(!i.isMaskData){let o=this.maskDataPool.pop()||new ch;o.pooled=!0,o.maskObject=r,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=e,i.type!==xt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case xt.SCISSOR:this.renderer.scissor.push(i);break;case xt.STENCIL:this.renderer.stencil.push(i);break;case xt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case xt.COLOR:this.pushColorMask(i);break;default:break}i.type===xt.SPRITE&&this.maskStack.push(i)}pop(e){let r=this.maskStack.pop();if(!(!r||r._target!==e)){if(r.enabled)switch(r.type){case xt.SCISSOR:this.renderer.scissor.pop(r);break;case xt.STENCIL:this.renderer.stencil.pop(r.maskObject);break;case xt.SPRITE:this.popSpriteMask(r);break;case xt.COLOR:this.popColorMask(r);break;default:break}if(r.reset(),r.pooled&&this.maskDataPool.push(r),this.maskStack.length!==0){let i=this.maskStack[this.maskStack.length-1];i.type===xt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(e){let r=e.maskObject;r?r.isSprite?e.type=xt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=xt.SCISSOR:e.type=xt.STENCIL:e.type=xt.COLOR}pushSpriteMask(e){let{maskObject:r}=e,i=e._target,s=e._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new lh])),s[0].resolution=e.resolution,s[0].multisample=e.multisample,s[0].maskSprite=r;let o=i.filterArea;i.filterArea=r.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=o,e._filters||this.alphaMaskIndex++}popSpriteMask(e){this.renderer.filter.pop(),e._filters?e._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(e){let r=e._colorMask,i=e._colorMask=r&e.colorMask;i!==r&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(e){let r=e._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==r&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};Ja.extension={type:ee.RendererSystem,name:"mask"};ae.add(Ja);var el=class{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){let{gl:r}=this.renderer,i=this.getStackLength();this.maskStack=e;let s=this.getStackLength();s!==i&&(s===0?r.disable(this.glConst):(r.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var TO=new qe,SO=[],wO=class km extends el{constructor(e){super(e),this.glConst=ne.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0}calcScissorRect(e){if(e._scissorRectLocal)return;let r=e._scissorRect,{maskObject:i}=e,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,SO.pop()??new Ie);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),r&&n.fit(r),e._scissorRectLocal=n}static isMatrixRotated(e){if(!e)return!1;let{a:r,b:i,c:s,d:o}=e;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(r)>1e-4||Math.abs(o)>1e-4)}testScissor(e){let{maskObject:r}=e;if(!r.isFastRect||!r.isFastRect()||km.isMatrixRotated(r.worldTransform)||km.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);let i=e._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(e,r,i,s,o){km.isMatrixRotated(o)||(o=o?TO.copyFrom(o):TO.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,e),e.fit(s),e.x=Math.round(e.x*r),e.y=Math.round(e.y*r),e.width=Math.round(e.width*r),e.height=Math.round(e.height*r))}push(e){e._scissorRectLocal||this.calcScissorRect(e);let{gl:r}=this.renderer;e._scissorRect||r.enable(r.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()}pop(e){let{gl:r}=this.renderer;e&&SO.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():r.disable(r.SCISSOR_TEST)}_useCurrent(){let e=this.maskStack[this.maskStack.length-1]._scissorRect,r;this.renderer.renderTexture.current?r=e.y:r=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,r,e.width,e.height)}};wO.extension={type:ee.RendererSystem,name:"scissor"};var l0=wO;ae.add(l0);var tl=class extends el{constructor(e){super(e),this.glConst=ne.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0}push(e){let r=e.maskObject,{gl:i}=this.renderer,s=e._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),e._stencilCounter++;let o=e._colorMask;o!==0&&(e._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),r.renderable=!0,r.render(this.renderer),this.renderer.batch.flush(),r.renderable=!1,o!==0&&(e._colorMask=o,i.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(e){let r=this.renderer.gl;if(this.getStackLength()===0)r.disable(r.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,r.colorMask(!1,!1,!1,!1)),r.stencilOp(r.KEEP,r.KEEP,r.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,s!==0&&(i._colorMask=s,r.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)}};tl.extension={type:ee.RendererSystem,name:"stencil"};ae.add(tl);var rl=class{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return we("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return we("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return we("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),e.events}}})}init(){let e=this.rendererPlugins;for(let r in e)this.plugins[r]=new e[r](this.renderer)}destroy(){for(let e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}};rl.extension={type:[ee.RendererSystem,ee.CanvasRendererSystem],name:"_plugin"};ae.add(rl);var il=class{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new qe,this.transform=null}update(e,r,i,s){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=r||this.sourceFrame||e,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(e,r,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/r.width*2,o.d=n*(1/r.height*2),o.tx=-1-r.x*o.a,o.ty=-n-r.y*o.d}setTransform(e){}destroy(){this.renderer=null}};il.extension={type:ee.RendererSystem,name:"projection"};ae.add(il);var jX=new Sm,EO=new Ie,sl=class{constructor(e){this.renderer=e,this._tempMatrix=new qe}generateTexture(e,r){let{region:i,...s}=r||{},o=i?.copyTo(EO)||e.getLocalBounds(EO,!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=Qo.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=e.transform;return e.transform=jX,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=l,a}destroy(){}};sl.extension={type:[ee.RendererSystem,ee.CanvasRendererSystem],name:"textureGenerator"};ae.add(sl);var Jo=new Ie,uh=new Ie,ol=class{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new Ie,this.destinationFrame=new Ie,this.viewportFrame=new Ie}contextChange(){let e=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,r,i){let s=this.renderer;this.current=e;let o,n,a;e?(o=e.baseTexture,a=o.resolution,r||(Jo.width=e.frame.width,Jo.height=e.frame.height,r=Jo),i||(uh.x=e.frame.x,uh.y=e.frame.y,uh.width=r.width,uh.height=r.height,i=uh),n=o.framebuffer):(a=s.resolution,r||(Jo.width=s._view.screen.width,Jo.height=s._view.screen.height,r=Jo),i||(i=Jo,i.width=r.width,i.height=r.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,e||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(n,l),this.renderer.projection.update(i,r,a,!n),e?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(r),this.destinationFrame.copyFrom(i)}clear(e,r){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=ii.shared.setValue(e||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:u,height:h}=this.viewportFrame;l=Math.round(l),c=Math.round(c),u=Math.round(u),h=Math.round(h),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,c,u,h)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,r),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};ol.extension={type:ee.RendererSystem,name:"renderTexture"};ae.add(ol);var hh=class{constructor(e,r){this.program=e,this.uniformData=r,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function AO(t,e){let r={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let o=e.getActiveAttrib(t,s);if(o.name.startsWith("gl_"))continue;let n=Ku(e,o.type),a={type:n,name:o.name,size:qu(n),location:e.getAttribLocation(t,o.name)};r[o.name]=a}return r}function PO(t,e){let r={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){let o=e.getActiveUniform(t,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),l=Ku(e,o.type);r[n]={name:n,index:s,type:l,size:o.size,isArray:a,value:ju(l,o.size)}}return r}function c0(t,e){let r=wm(t,t.VERTEX_SHADER,e.vertexSrc),i=wm(t,t.FRAGMENT_SHADER,e.fragmentSrc),s=t.createProgram();t.attachShader(s,r),t.attachShader(s,i);let o=e.extra?.transformFeedbackVaryings;if(o&&(typeof t.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS)||i0(t,s,r,i),e.attributeData=AO(s,t),e.uniformData=PO(s,t),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){let a=Object.keys(e.attributeData);a.sort((l,c)=>l>c?1:-1);for(let l=0;l<a.length;l++)e.attributeData[a[l]].location=l,t.bindAttribLocation(s,l,a[l]);t.linkProgram(s)}t.deleteShader(r),t.deleteShader(i);let n={};for(let a in e.uniformData){let l=e.uniformData[a];n[a]={location:t.getUniformLocation(s,a),value:ju(l.type,l.size)}}return new hh(s,n)}function qX(t,e,r,i,s){r.buffer.update(s)}var KX={float:`
|
|
1996
1996
|
data[offset] = v;
|
|
1997
1997
|
`,vec2:`
|
|
1998
1998
|
data[offset] = v[0];
|
|
@@ -2030,7 +2030,7 @@ void main(void)
|
|
|
2030
2030
|
{
|
|
2031
2031
|
data[offset + i] = v[i];
|
|
2032
2032
|
}
|
|
2033
|
-
`},CO={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 RO(t){let e=t.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),r=0,i=0,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(r=CO[n.data.type],n.data.size>1&&(r=Math.max(r,16)*n.data.size),n.dataLen=r,i%r!==0&&i<16){let a=i%r%16;i+=a,s+=a}i+r>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=r,i=r):(n.offset=s,i+=r,s+=r)}return s=Math.ceil(s/16)*16,{uboElements:e,size:s}}function MO(t,e){let r=[];for(let i in t)e[i]&&r.push(e[i]);return r.sort((i,s)=>i.index-s.index),r}function u0(t,e){if(!t.autoManage)return{size:0,syncFunc:
|
|
2033
|
+
`},CO={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 RO(t){let e=t.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),r=0,i=0,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(r=CO[n.data.type],n.data.size>1&&(r=Math.max(r,16)*n.data.size),n.dataLen=r,i%r!==0&&i<16){let a=i%r%16;i+=a,s+=a}i+r>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=r,i=r):(n.offset=s,i+=r,s+=r)}return s=Math.ceil(s/16)*16,{uboElements:e,size:s}}function MO(t,e){let r=[];for(let i in t)e[i]&&r.push(e[i]);return r.sort((i,s)=>i.index-s.index),r}function u0(t,e){if(!t.autoManage)return{size:0,syncFunc:qX};let r=MO(t.uniforms,e),{uboElements:i,size:s}=RO(r),o=[`
|
|
2034
2034
|
var v = null;
|
|
2035
2035
|
var v2 = null;
|
|
2036
2036
|
var cv = null;
|
|
@@ -2054,7 +2054,7 @@ void main(void)
|
|
|
2054
2054
|
offset += ${p};
|
|
2055
2055
|
}
|
|
2056
2056
|
|
|
2057
|
-
`)}else{let h=
|
|
2057
|
+
`)}else{let h=KX[a.data.type];o.push(`
|
|
2058
2058
|
cv = ud.${c}.value;
|
|
2059
2059
|
v = uv.${c};
|
|
2060
2060
|
offset = ${a.offset/4};
|
|
@@ -2062,7 +2062,7 @@ void main(void)
|
|
|
2062
2062
|
`)}}return o.push(`
|
|
2063
2063
|
renderer.buffer.update(buffer);
|
|
2064
2064
|
`),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
|
|
2065
|
-
`))}}var YX=0,Um={textureCount:0,uboCount:0},Ws=class{constructor(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=YX++}systemCheck(){if(!Mm())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(e){this.gl=e,this.reset()}bind(e,r){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;let i=e.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),r||(Um.textureCount=0,Um.uboCount=0,this.syncUniformGroup(e.uniformGroup,Um)),s}setUniforms(e){let r=this.shader.program,i=r.glPrograms[this.renderer.CONTEXT_UID];r.syncUniforms(i.uniformData,e,this.renderer)}syncUniformGroup(e,r){let i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,r))}syncUniforms(e,r,i){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(r.uniformData,e.uniforms,this.renderer,i)}createSyncGroups(e){let r=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[r]||(this.cache[r]=t0(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[r],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,r){let i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;let s=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,r);e.buffer.update(),s(i.uniformData,e.uniforms,this.renderer,Um,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[r])}createSyncBufferGroup(e,r,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);let o=this.gl.getUniformBlockIndex(r.program,i);r.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(r.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(e,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=u0(e,this.shader.program.uniformData)),e.autoManage){let l=new Float32Array(a.size/4);e.buffer.update(l)}return r.uniformGroups[e.id]=a.syncFunc,r.uniformGroups[e.id]}getSignature(e,r,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),r[n]&&o.push(r[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){let r=this.gl,i=e.program,s=c0(r,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};Ws.extension={type:ee.RendererSystem,name:"shader"};ae.add(Ws);var ss=class{constructor(e){this.renderer=e}run(e){let{renderer:r}=this;r.runners.init.emit(r.options),e.hello&&console.log(`PixiJS 7.4.3 - ${r.rendererLogId} - https://pixijs.com`),r.resize(r.screen.width,r.screen.height)}destroy(){}};ss.defaultOptions={hello:!1},ss.extension={type:[ee.RendererSystem,ee.CanvasRendererSystem],name:"startup"};ae.add(ss);function IO(t,e=[]){return e[he.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.ADD]=[t.ONE,t.ONE],e[he.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.NONE]=[0,0],e[he.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.ADD_NPM]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e[he.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[he.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[he.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[he.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[he.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[he.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[he.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[he.XOR]=[t.ONE_MINUS_DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[he.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}var jX=0,qX=1,KX=2,ZX=3,QX=4,JX=5,BO=class h0{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=he.NONE,this._blendEq=!1,this.map=[],this.map[jX]=this.setBlend,this.map[qX]=this.setOffset,this.map[KX]=this.setCullFace,this.map[ZX]=this.setDepthTest,this.map[QX]=this.setFrontFace,this.map[JX]=this.setDepthMask,this.checks=[],this.defaultState=new Ii,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=IO(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let r=this.stateId^e.data,i=0;for(;r;)r&1&&this.map[i].call(this,!!(e.data&1<<i)),r=r>>1,i++;this.stateId=e.data}for(let r=0;r<this.checks.length;r++)this.checks[r](this,e)}forceState(e){e=e||this.defaultState;for(let r=0;r<this.map.length;r++)this.map[r].call(this,!!(e.data&1<<r));for(let r=0;r<this.checks.length;r++)this.checks[r](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(h0.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(h0.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])}setBlendMode(e){if(e===this.blendMode)return;this.blendMode=e;let r=this.blendModes[e],i=this.gl;r.length===2?i.blendFunc(r[0],r[1]):i.blendFuncSeparate(r[0],r[1],r[2],r[3]),r.length===6?(this._blendEq=!0,i.blendEquationSeparate(r[4],r[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,r){this.gl.polygonOffset(e,r)}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(e,r){let i=this.checks.indexOf(e);r&&i===-1?this.checks.push(e):!r&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(e,r){e.setBlendMode(r.blendMode)}static checkPolygonOffset(e,r){e.setPolygonOffset(1,r.polygonOffset)}destroy(){this.gl=null}};BO.extension={type:ee.RendererSystem,name:"state"};var d0=BO;ae.add(d0);var nl=class extends Vo.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);let r=(e.priority??[]).filter(s=>e.systems[s]),i=[...r,...Object.keys(e.systems).filter(s=>!r.includes(s))];for(let s of i)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(r=>{this.runners[r]=new pt(r)})}addSystem(e,r){let i=new e(this);if(this[r])throw new Error(`Whoops! The name "${r}" is already in use`);this[r]=i,this._systemsHash[r]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(e,r){let i=Object.keys(this._systemsHash);e.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[e.name](r[o])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}};var dh=class Om{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=Om.defaultMaxIdle,this.checkCountMax=Om.defaultCheckCountMax,this.mode=Om.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==qp.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this.renderer.texture,r=e.managedTextures,i=!1;for(let s=0;s<r.length;s++){let o=r[s];o.resource&&this.count-o.touched>this.maxIdle&&(e.destroyTexture(o,!0),r[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<r.length;o++)r[o]!==null&&(r[s++]=r[o]);r.length=s}}unload(e){let r=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&r.destroyTexture(i);for(let s=e.children.length-1;s>=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};dh.defaultMode=qp.AUTO,dh.defaultMaxIdle=60*60,dh.defaultCheckCountMax=60*10,dh.extension={type:ee.RendererSystem,name:"textureGC"};var ki=dh;ae.add(ki);var en=class{constructor(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=ge.UNSIGNED_BYTE,this.internalFormat=j.RGBA,this.samplerType=0}};function FO(t){let e;return"WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?e={[t.RGB]:Q.FLOAT,[t.RGBA]:Q.FLOAT,[t.ALPHA]:Q.FLOAT,[t.LUMINANCE]:Q.FLOAT,[t.LUMINANCE_ALPHA]:Q.FLOAT,[t.R8]:Q.FLOAT,[t.R8_SNORM]:Q.FLOAT,[t.RG8]:Q.FLOAT,[t.RG8_SNORM]:Q.FLOAT,[t.RGB8]:Q.FLOAT,[t.RGB8_SNORM]:Q.FLOAT,[t.RGB565]:Q.FLOAT,[t.RGBA4]:Q.FLOAT,[t.RGB5_A1]:Q.FLOAT,[t.RGBA8]:Q.FLOAT,[t.RGBA8_SNORM]:Q.FLOAT,[t.RGB10_A2]:Q.FLOAT,[t.RGB10_A2UI]:Q.FLOAT,[t.SRGB8]:Q.FLOAT,[t.SRGB8_ALPHA8]:Q.FLOAT,[t.R16F]:Q.FLOAT,[t.RG16F]:Q.FLOAT,[t.RGB16F]:Q.FLOAT,[t.RGBA16F]:Q.FLOAT,[t.R32F]:Q.FLOAT,[t.RG32F]:Q.FLOAT,[t.RGB32F]:Q.FLOAT,[t.RGBA32F]:Q.FLOAT,[t.R11F_G11F_B10F]:Q.FLOAT,[t.RGB9_E5]:Q.FLOAT,[t.R8I]:Q.INT,[t.R8UI]:Q.UINT,[t.R16I]:Q.INT,[t.R16UI]:Q.UINT,[t.R32I]:Q.INT,[t.R32UI]:Q.UINT,[t.RG8I]:Q.INT,[t.RG8UI]:Q.UINT,[t.RG16I]:Q.INT,[t.RG16UI]:Q.UINT,[t.RG32I]:Q.INT,[t.RG32UI]:Q.UINT,[t.RGB8I]:Q.INT,[t.RGB8UI]:Q.UINT,[t.RGB16I]:Q.INT,[t.RGB16UI]:Q.UINT,[t.RGB32I]:Q.INT,[t.RGB32UI]:Q.UINT,[t.RGBA8I]:Q.INT,[t.RGBA8UI]:Q.UINT,[t.RGBA16I]:Q.INT,[t.RGBA16UI]:Q.UINT,[t.RGBA32I]:Q.INT,[t.RGBA32UI]:Q.UINT,[t.DEPTH_COMPONENT16]:Q.FLOAT,[t.DEPTH_COMPONENT24]:Q.FLOAT,[t.DEPTH_COMPONENT32F]:Q.FLOAT,[t.DEPTH_STENCIL]:Q.FLOAT,[t.DEPTH24_STENCIL8]:Q.FLOAT,[t.DEPTH32F_STENCIL8]:Q.FLOAT}:e={[t.RGB]:Q.FLOAT,[t.RGBA]:Q.FLOAT,[t.ALPHA]:Q.FLOAT,[t.LUMINANCE]:Q.FLOAT,[t.LUMINANCE_ALPHA]:Q.FLOAT,[t.DEPTH_STENCIL]:Q.FLOAT},e}function kO(t){let e;return"WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?e={[ge.UNSIGNED_BYTE]:{[j.RGBA]:t.RGBA8,[j.RGB]:t.RGB8,[j.RG]:t.RG8,[j.RED]:t.R8,[j.RGBA_INTEGER]:t.RGBA8UI,[j.RGB_INTEGER]:t.RGB8UI,[j.RG_INTEGER]:t.RG8UI,[j.RED_INTEGER]:t.R8UI,[j.ALPHA]:t.ALPHA,[j.LUMINANCE]:t.LUMINANCE,[j.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[ge.BYTE]:{[j.RGBA]:t.RGBA8_SNORM,[j.RGB]:t.RGB8_SNORM,[j.RG]:t.RG8_SNORM,[j.RED]:t.R8_SNORM,[j.RGBA_INTEGER]:t.RGBA8I,[j.RGB_INTEGER]:t.RGB8I,[j.RG_INTEGER]:t.RG8I,[j.RED_INTEGER]:t.R8I},[ge.UNSIGNED_SHORT]:{[j.RGBA_INTEGER]:t.RGBA16UI,[j.RGB_INTEGER]:t.RGB16UI,[j.RG_INTEGER]:t.RG16UI,[j.RED_INTEGER]:t.R16UI,[j.DEPTH_COMPONENT]:t.DEPTH_COMPONENT16},[ge.SHORT]:{[j.RGBA_INTEGER]:t.RGBA16I,[j.RGB_INTEGER]:t.RGB16I,[j.RG_INTEGER]:t.RG16I,[j.RED_INTEGER]:t.R16I},[ge.UNSIGNED_INT]:{[j.RGBA_INTEGER]:t.RGBA32UI,[j.RGB_INTEGER]:t.RGB32UI,[j.RG_INTEGER]:t.RG32UI,[j.RED_INTEGER]:t.R32UI,[j.DEPTH_COMPONENT]:t.DEPTH_COMPONENT24},[ge.INT]:{[j.RGBA_INTEGER]:t.RGBA32I,[j.RGB_INTEGER]:t.RGB32I,[j.RG_INTEGER]:t.RG32I,[j.RED_INTEGER]:t.R32I},[ge.FLOAT]:{[j.RGBA]:t.RGBA32F,[j.RGB]:t.RGB32F,[j.RG]:t.RG32F,[j.RED]:t.R32F,[j.DEPTH_COMPONENT]:t.DEPTH_COMPONENT32F},[ge.HALF_FLOAT]:{[j.RGBA]:t.RGBA16F,[j.RGB]:t.RGB16F,[j.RG]:t.RG16F,[j.RED]:t.R16F},[ge.UNSIGNED_SHORT_5_6_5]:{[j.RGB]:t.RGB565},[ge.UNSIGNED_SHORT_4_4_4_4]:{[j.RGBA]:t.RGBA4},[ge.UNSIGNED_SHORT_5_5_5_1]:{[j.RGBA]:t.RGB5_A1},[ge.UNSIGNED_INT_2_10_10_10_REV]:{[j.RGBA]:t.RGB10_A2,[j.RGBA_INTEGER]:t.RGB10_A2UI},[ge.UNSIGNED_INT_10F_11F_11F_REV]:{[j.RGB]:t.R11F_G11F_B10F},[ge.UNSIGNED_INT_5_9_9_9_REV]:{[j.RGB]:t.RGB9_E5},[ge.UNSIGNED_INT_24_8]:{[j.DEPTH_STENCIL]:t.DEPTH24_STENCIL8},[ge.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[j.DEPTH_STENCIL]:t.DEPTH32F_STENCIL8}}:e={[ge.UNSIGNED_BYTE]:{[j.RGBA]:t.RGBA,[j.RGB]:t.RGB,[j.ALPHA]:t.ALPHA,[j.LUMINANCE]:t.LUMINANCE,[j.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[ge.UNSIGNED_SHORT_5_6_5]:{[j.RGB]:t.RGB},[ge.UNSIGNED_SHORT_4_4_4_4]:{[j.RGBA]:t.RGBA},[ge.UNSIGNED_SHORT_5_5_5_1]:{[j.RGBA]:t.RGBA}},e}var al=class{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Pe,this.hasIntegerTextures=!1}contextChange(){let e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=kO(e),this.samplerTypes=FO(e);let r=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=r;for(let s=0;s<r;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new en(e.createTexture());e.bindTexture(e.TEXTURE_2D,i.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=i,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new en(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(e,r=0){let{gl:i}=this;if(e=e?.castToBaseTexture(),e?.valid&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;let s=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[r]!==e&&(this.currentLocation!==r&&(this.currentLocation=r,i.activeTexture(i.TEXTURE0+r)),i.bindTexture(e.target,s.texture)),s.dirtyId!==e.dirtyId?(this.currentLocation!==r&&(this.currentLocation=r,i.activeTexture(i.TEXTURE0+r)),this.updateTexture(e)):s.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[r]=e}else this.currentLocation!==r&&(this.currentLocation=r,i.activeTexture(i.TEXTURE0+r)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[r]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture}unbind(e){let{gl:r,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]===e&&(this.currentLocation!==s&&(r.activeTexture(r.TEXTURE0+s),this.currentLocation=s),r.bindTexture(e.target,this.emptyTextures[e.target].texture),i[s]=null)}ensureSamplerType(e){let{boundTextures:r,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=e-1;o>=0;--o){let n=r[o];n&&n._glTextures[s].samplerType!==Q.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(e){let r=new en(this.gl.createTexture());return r.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=r,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),r}initTextureType(e,r){r.internalFormat=this.internalFormats[e.type]?.[e.format]??e.format,r.samplerType=this.samplerTypes[r.internalFormat]??Q.FLOAT,this.webGLVersion===2&&e.type===ge.HALF_FLOAT?r.type=this.gl.HALF_FLOAT:r.type=e.type}updateTexture(e){let r=e._glTextures[this.CONTEXT_UID];if(!r)return;let i=this.renderer;if(this.initTextureType(e,r),e.resource?.upload(i,e,r))r.samplerType!==Q.FLOAT&&(this.hasIntegerTextures=!0);else{let s=e.realWidth,o=e.realHeight,n=i.gl;(r.width!==s||r.height!==o||r.dirtyId<0)&&(r.width=s,r.height=o,n.texImage2D(e.target,0,r.internalFormat,s,o,0,e.format,r.type,null))}e.dirtyStyleId!==r.dirtyStyleId&&this.updateTextureStyle(e),r.dirtyId=e.dirtyId}destroyTexture(e,r){let{gl:i}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!r)){let s=this.managedTextures.indexOf(e);s!==-1&&Vv(this.managedTextures,s,1)}}updateTextureStyle(e){let r=e._glTextures[this.CONTEXT_UID];r&&((e.mipmap===ti.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?r.mipmap=!1:r.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?r.wrapMode=Mu.CLAMP:r.wrapMode=e.wrapMode,e.resource?.style(this.renderer,e,r)||this.setStyle(e,r),r.dirtyStyleId=e.dirtyStyleId)}setStyle(e,r){let i=this.gl;if(r.mipmap&&e.mipmap!==ti.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,r.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,r.wrapMode),r.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===Vr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===Vr.LINEAR){let o=Math.min(e.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===Vr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===Vr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};al.extension={type:ee.RendererSystem,name:"texture"};ae.add(al);var ll=class{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){let{gl:r,CONTEXT_UID:i}=this,s=e._glTransformFeedbacks[i]||this.createGLTransformFeedback(e);r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,r){let{gl:i,renderer:s}=this;r&&s.shader.bind(r),i.beginTransformFeedback(e)}endTransformFeedback(){let{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){let{gl:r,renderer:i,CONTEXT_UID:s}=this,o=r.createTransformFeedback();e._glTransformFeedbacks[s]=o,r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,o);for(let n=0;n<e.buffers.length;n++){let a=e.buffers[n];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),o}disposeTransformFeedback(e,r){let i=e._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<e.buffers.length;n++){let a=e.buffers[n];if(!a)continue;let l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!r&&o.dispose(a,r))}i&&(r||s.deleteTransformFeedback(i),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};ll.extension={type:ee.RendererSystem,name:"transformFeedback"};ae.add(ll);var os=class{constructor(e){this.renderer=e}init(e){this.screen=new Ie(0,0,e.width,e.height),this.element=e.view||ne.ADAPTER.createCanvas(),this.resolution=e.resolution||ne.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,r){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(r*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(e){e&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};os.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},os.extension={type:[ee.RendererSystem,ee.CanvasRendererSystem],name:"_view"};ae.add(os);ne.PREFER_ENV=Sr.WEBGL2;ne.STRICT_TEXTURE_CACHE=!1;ne.RENDER_OPTIONS={...is.defaultOptions,...rs.defaultOptions,...os.defaultOptions,...ss.defaultOptions};Object.defineProperties(ne,{WRAP_MODE:{get(){return Pe.defaultOptions.wrapMode},set(t){we("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),Pe.defaultOptions.wrapMode=t}},SCALE_MODE:{get(){return Pe.defaultOptions.scaleMode},set(t){we("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),Pe.defaultOptions.scaleMode=t}},MIPMAP_TEXTURES:{get(){return Pe.defaultOptions.mipmap},set(t){we("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),Pe.defaultOptions.mipmap=t}},ANISOTROPIC_LEVEL:{get(){return Pe.defaultOptions.anisotropicLevel},set(t){we("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),Pe.defaultOptions.anisotropicLevel=t}},FILTER_RESOLUTION:{get(){return we("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Fi.defaultResolution},set(t){Fi.defaultResolution=t}},FILTER_MULTISAMPLE:{get(){return we("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Fi.defaultMultisample},set(t){Fi.defaultMultisample=t}},SPRITE_MAX_TEXTURES:{get(){return ts.defaultMaxTextures},set(t){we("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ts.defaultMaxTextures=t}},SPRITE_BATCH_SIZE:{get(){return ts.defaultBatchSize},set(t){we("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ts.defaultBatchSize=t}},CAN_UPLOAD_SAME_BUFFER:{get(){return ts.canUploadSameBuffer},set(t){we("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ts.canUploadSameBuffer=t}},GC_MODE:{get(){return ki.defaultMode},set(t){we("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),ki.defaultMode=t}},GC_MAX_IDLE:{get(){return ki.defaultMaxIdle},set(t){we("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),ki.defaultMaxIdle=t}},GC_MAX_CHECK_COUNT:{get(){return ki.defaultCheckCountMax},set(t){we("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),ki.defaultCheckCountMax=t}},PRECISION_VERTEX:{get(){return $r.defaultVertexPrecision},set(t){we("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),$r.defaultVertexPrecision=t}},PRECISION_FRAGMENT:{get(){return $r.defaultFragmentPrecision},set(t){we("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),$r.defaultFragmentPrecision=t}}});var tn=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(tn||{});var cl=class{constructor(e,r=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=r,this.priority=i,this.once=s}match(e,r=null){return this.fn===e&&this.context===r}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));let r=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),r}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!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 r=this.next;return this.next=e?null:r,this.previous=null,r}};var UO=class Cr{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 cl(null,null,1/0),this.deltaMS=1/Cr.targetFPMS,this.elapsedMS=1/Cr.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,r,i=tn.NORMAL){return this._addListener(new cl(e,r,i))}addOnce(e,r,i=tn.NORMAL){return this._addListener(new cl(e,r,i,!0))}_addListener(e){let r=this._head.next,i=this._head;if(!r)e.connect(i);else{for(;r;){if(e.priority>r.priority){e.connect(i);break}i=r,r=r.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,r){let i=this._head.next;for(;i;)i.match(e,r)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,r=this._head;for(;r=r.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let r;if(e>this.lastTime){if(r=this.elapsedMS=e-this.lastTime,r>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){let o=e-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=e-o%this._minElapsedMS}this.deltaMS=r,this.deltaTime=this.deltaMS*Cr.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=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){let r=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,r)/1e3,Cr.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{let r=Math.max(this.minFPS,e);this._minElapsedMS=1/(r/1e3)}}static get shared(){if(!Cr._shared){let e=Cr._shared=new Cr;e.autoStart=!0,e._protected=!0}return Cr._shared}static get system(){if(!Cr._system){let e=Cr._system=new Cr;e.autoStart=!0,e._protected=!0}return Cr._system}};UO.targetFPMS=.06;var zr=UO;Object.defineProperties(ne,{TARGET_FPMS:{get(){return zr.targetFPMS},set(t){we("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),zr.targetFPMS=t}}});var fh=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(r){this._ticker&&this._ticker.remove(this.render,this),this._ticker=r,r&&r.add(this.render,this,tn.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?zr.shared:new zr,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};fh.extension=ee.Application;ae.add(fh);var e5=[];ae.handleByList(ee.Renderer,e5);var ph=class{constructor(e){this.renderer=e}contextChange(e){let r;if(this.renderer.context.webGLVersion===1){let i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),r=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{let i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),r=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}r>=He.HIGH?this.multisample=He.HIGH:r>=He.MEDIUM?this.multisample=He.MEDIUM:r>=He.LOW?this.multisample=He.LOW:this.multisample=He.NONE}destroy(){}};ph.extension={type:ee.RendererSystem,name:"_multisample"};ae.add(ph);var Lm=class{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var mh=class{constructor(e){this.renderer=e,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(e){let{gl:r,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);r.bindBuffer(e.type,s.buffer)}unbind(e){let{gl:r}=this;r.bindBuffer(e,null)}bindBufferBase(e,r){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[r]!==e){let o=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[r]=e,i.bindBufferBase(i.UNIFORM_BUFFER,r,o.buffer)}}bindBufferRange(e,r,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=e._glBuffers[o]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,r||0,n.buffer,i*256,256)}update(e){let{gl:r,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,r.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)r.bufferSubData(e.type,0,e.data);else{let o=e.static?r.STATIC_DRAW:r.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,r.bufferData(e.type,e.data,o)}}dispose(e,r){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];let i=e._glBuffers[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this),i&&(r||s.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){let r=Object.keys(this.managedBuffers);for(let i=0;i<r.length;i++)this.dispose(this.managedBuffers[r[i]],e)}createGLBuffer(e){let{CONTEXT_UID:r,gl:i}=this;return e._glBuffers[r]=new Lm(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[r]}};mh.extension={type:ee.RendererSystem,name:"buffer"};ae.add(mh);var gh=class{constructor(e){this.renderer=e}render(e,r){let i=this.renderer,s,o,n,a;if(r&&(s=r.renderTexture,o=r.clear,n=r.transform,a=r.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=e),!a){let l=e.enableTempParent();e.updateTransform(),e.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),e.render(i),i.batch.currentRenderer.flush(),s&&(r.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}};gh.extension={type:ee.RendererSystem,name:"objectRenderer"};ae.add(gh);var Gm=class f0 extends nl{constructor(e){super(),this.type=rv.WEBGL,e=Object.assign({},ne.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Pr({projectionMatrix:new qe},!0);let r={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:f0.__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(r),"useContextAlpha"in e&&(we("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=f0.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e?.forceCanvas?!1:Dv()}render(e,r){this.objectRenderer.render(e,r)}resize(e,r){this._view.resizeView(e,r)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),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(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}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 we("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return we("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return we("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return we("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){we("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return we("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){we("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return we("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,r){return this.textureGenerator.generateTexture(e,r)}};Gm.extension={type:ee.Renderer,priority:1},Gm.__plugins={},Gm.__systems={};var Dm=Gm;ae.handleByMap(ee.RendererPlugin,Dm.__plugins);ae.handleByMap(ee.RendererSystem,Dm.__systems);ae.add(Dm);var $s=class extends Ar{constructor(e,r){let{width:i,height:s}=r||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<e;o++){let n=new Pe;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=e,this._load=null,this.baseTexture=null}initFromArray(e,r){for(let i=0;i<this.length;i++)e[i]&&(e[i].castToBaseTexture?this.addBaseTextureAt(e[i].castToBaseTexture(),i):e[i]instanceof Ar?this.addResourceAt(e[i],i):this.addResourceAt($a(e[i],r),i))}dispose(){for(let e=0,r=this.length;e<r;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(e,r){if(!this.items[r])throw new Error(`Index ${r} is out of bounds`);return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[r].setResource(e),this}bind(e){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(e);for(let r=0;r<this.length;r++)this.items[r].parentTextureArray=e,this.items[r].on("update",e.update,e)}unbind(e){super.unbind(e);for(let r=0;r<this.length;r++)this.items[r].parentTextureArray=null,this.items[r].off("update",e.update,e)}load(){if(this._load)return this._load;let e=this.items.map(r=>r.resource).filter(r=>r).map(r=>r.load());return this._load=Promise.all(e).then(()=>{let{realWidth:r,realHeight:i}=this.items[0];return this.resize(r,i),this.update(),Promise.resolve(this)}),this._load}};var xh=class extends $s{constructor(e,r){let{width:i,height:s}=r||{},o,n;Array.isArray(e)?(o=e,n=e.length):n=e,super(n,{width:i,height:s}),o&&this.initFromArray(o,r)}addBaseTextureAt(e,r){if(e.resource)this.addResourceAt(e.resource,r);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=Ki.TEXTURE_2D_ARRAY}upload(e,r,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=e;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,r.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,r.format,i.type,c.resource.source))}return!0}};var yh=class extends Pt{constructor(e){super(e)}static test(e){let{OffscreenCanvas:r}=globalThis;return r&&e instanceof r?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}};var OO=class _h extends $s{constructor(e,r){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=r||{};if(e&&e.length!==_h.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<_h.SIDES;a++)this.items[a].target=Ki.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,e&&this.initFromArray(e,r),o!==!1&&this.load()}bind(e){super.bind(e),e.target=Ki.TEXTURE_CUBE_MAP}addBaseTextureAt(e,r,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[r])throw new Error(`Index ${r} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,r);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=Ki.TEXTURE_CUBE_MAP_POSITIVE_X+r,e.parentTextureArray=this.baseTexture,this.items[r]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[r]=e,this}upload(e,r,i){let s=this.itemDirtyIds;for(let o=0;o<_h.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<r.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(e,n,i),s[o]=n.dirtyId):s[o]<-1&&(e.gl.texImage2D(n.target,0,i.internalFormat,r.realWidth,r.realHeight,0,r.format,i.type,null),s[o]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===_h.SIDES}};OO.SIDES=6;var p0=OO;var bh=class t extends Pt{constructor(e,r){r=r||{};let i,s,o;typeof e=="string"?(i=t.EMPTY,s=e,o=!0):(i=e,s=null,o=!1),super(i),this.url=s,this.crossOrigin=r.crossOrigin??!0,this.alphaMode=typeof r.alphaMode=="number"?r.alphaMode:null,this.ownsImageBitmap=r.ownsImageBitmap??o,this._load=null,r.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(e,r)=>{if(this.url===null){e(this);return}try{let i=await ne.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===wr.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),e(this)}catch(i){if(this.destroyed)return;r(i),this.onError.emit(i)}}),this._load)}upload(e,r,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(r.alphaMode=this.alphaMode),super.upload(e,r,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof e=="string"||e instanceof ImageBitmap)}static get EMPTY(){return t._EMPTY=t._EMPTY??ne.ADAPTER.createCanvas(0,0),t._EMPTY}};var m0=class Nm extends Pt{constructor(e,r){r=r||{},super(ne.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=r.scale||1,this._overrideWidth=r.width,this._overrideHeight=r.height,this._resolve=null,this._crossorigin=r.crossorigin,this._load=null,r.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},Nm.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 e=new Image;Pt.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=r=>{this._resolve&&(e.onerror=null,this.onError.emit(r))},e.onload=()=>{if(!this._resolve)return;let r=e.width,i=e.height;if(!r||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=r*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*r,o=this._overrideHeight||this._overrideWidth/r*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${Qi()}`,n.getContext("2d").drawImage(e,0,0,r,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(e){let r=Nm.SVG_SIZE.exec(e),i={};return r&&(i[r[1]]=Math.round(parseFloat(r[3])),i[r[5]]=Math.round(parseFloat(r[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,r){return r==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&Nm.SVG_XML.test(e)}};m0.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,m0.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var g0=m0;var Vm=class extends Pt{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}};var x0=class y0 extends Pt{constructor(e,r){if(r=r||{},!(e instanceof HTMLVideoElement)){let i=document.createElement("video");r.autoLoad!==!1&&i.setAttribute("preload","auto"),r.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),r.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),r.loop===!0&&i.setAttribute("loop",""),r.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);let s=e[0].src||e[0];Pt.crossOrigin(i,s,r.crossorigin);for(let o=0;o<e.length;++o){let n=document.createElement("source"),{src:a,mime:l}=e[o];if(a=a||e[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let c=a.split("?").shift().toLowerCase(),u=c.slice(c.lastIndexOf(".")+1);l=l||y0.MIME_TYPES[u]||`video/${u}`}n.src=a,l&&(n.type=l),i.appendChild(n)}e=i}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=r.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=r.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),r.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){if(this._updateFPS){let r=zr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-r)}(!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 e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise((r,i)=>{this.valid?r(this):(this._resolve=r,this._reject=i,e.load())}),this._load}_onError(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.source;return!e.paused&&!e.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 e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);let r=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!r&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._configureAutoUpdate();let e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(zr.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||(zr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(zr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,r){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||y0.TYPES.includes(r)}};x0.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],x0.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var _0=x0;zu.push(bh,Ko,yh,_0,Vm,g0,Ho,p0,xh);var t5={vec3(t,e,r,i){(r[0]!==i[0]||r[1]!==i[1]||r[2]!==i[2])&&(r[0]=i[0],r[1]=i[1],r[2]=i[2],t.uniform3f(e,i[0],i[1],i[2]))},int(t,e,r,i){t.uniform1i(e,i)},ivec2(t,e,r,i){t.uniform2i(e,i[0],i[1])},ivec3(t,e,r,i){t.uniform3i(e,i[0],i[1],i[2])},ivec4(t,e,r,i){t.uniform4i(e,i[0],i[1],i[2],i[3])},uint(t,e,r,i){t.uniform1ui(e,i)},uvec2(t,e,r,i){t.uniform2ui(e,i[0],i[1])},uvec3(t,e,r,i){t.uniform3ui(e,i[0],i[1],i[2])},uvec4(t,e,r,i){t.uniform4ui(e,i[0],i[1],i[2],i[3])},bvec2(t,e,r,i){t.uniform2i(e,i[0],i[1])},bvec3(t,e,r,i){t.uniform3i(e,i[0],i[1],i[2])},bvec4(t,e,r,i){t.uniform4i(e,i[0],i[1],i[2],i[3])},mat2(t,e,r,i){t.uniformMatrix2fv(e,!1,i)},mat4(t,e,r,i){t.uniformMatrix4fv(e,!1,i)}},r5={float(t,e,r,i){t.uniform1fv(e,i)},vec2(t,e,r,i){t.uniform2fv(e,i)},vec3(t,e,r,i){t.uniform3fv(e,i)},vec4(t,e,r,i){t.uniform4fv(e,i)},int(t,e,r,i){t.uniform1iv(e,i)},ivec2(t,e,r,i){t.uniform2iv(e,i)},ivec3(t,e,r,i){t.uniform3iv(e,i)},ivec4(t,e,r,i){t.uniform4iv(e,i)},uint(t,e,r,i){t.uniform1uiv(e,i)},uvec2(t,e,r,i){t.uniform2uiv(e,i)},uvec3(t,e,r,i){t.uniform3uiv(e,i)},uvec4(t,e,r,i){t.uniform4uiv(e,i)},bool(t,e,r,i){t.uniform1iv(e,i)},bvec2(t,e,r,i){t.uniform2iv(e,i)},bvec3(t,e,r,i){t.uniform3iv(e,i)},bvec4(t,e,r,i){t.uniform4iv(e,i)},sampler2D(t,e,r,i){t.uniform1iv(e,i)},samplerCube(t,e,r,i){t.uniform1iv(e,i)},sampler2DArray(t,e,r,i){t.uniform1iv(e,i)}};function LO(t,e,r,i,s){let o=0,n=null,a=null,l=s.gl;for(let c in t.uniforms){let u=e[c],h=i[c],d=r[c],f=t.uniforms[c];if(!u){f.group===!0&&s.shader.syncUniformGroup(h);continue}u.type==="float"&&u.size===1&&!u.isArray?h!==d.value&&(d.value=h,l.uniform1f(d.location,h)):u.type==="bool"&&u.size===1&&!u.isArray?h!==d.value&&(d.value=h,l.uniform1i(d.location,Number(h))):(u.type==="sampler2D"||u.type==="samplerCube"||u.type==="sampler2DArray")&&u.size===1&&!u.isArray?(s.texture.bind(h,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):u.type==="mat3"&&u.size===1&&!u.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,h.toArray(!0)):l.uniformMatrix3fv(d.location,!1,h):u.type==="vec2"&&u.size===1&&!u.isArray?f.x!==void 0?(a=d.value,n=h,(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=h,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):u.type==="vec4"&&u.size===1&&!u.isArray?f.width!==void 0?(a=d.value,n=h,(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=h,(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]))):(u.size===1&&!u.isArray?t5:r5)[u.type].call(null,l,d.location,d.value,h)}}function i5(){Object.assign(Ws.prototype,{systemCheck(){},syncUniforms(t,e){let{shader:r,renderer:i}=this;LO(t,r.program.uniformData,e.uniformData,t.uniforms,i)}})}i5();var b0="__route_graphics_audio_root__",vh="__route_graphics_audio_direct__",Hm,ni=()=>{if(Hm)return Hm;let t=globalThis.window?.AudioContext??globalThis.window?.webkitAudioContext;if(!t)throw new Error("AudioContext is not available in this environment.");return Hm=new t,Hm},sn=(t,e)=>{t&&e&&typeof t.connect=="function"&&t.connect(e)},rn=t=>{t&&typeof t.disconnect=="function"&&t.disconnect()},Wm=(t,e=0)=>{let r=Number(t);return Number.isFinite(r)?r:e},HO=(t,e=0)=>Wm(t?.value,e),WO=(t=ni())=>{t.state==="suspended"&&typeof t.resume=="function"&&t.resume().catch(()=>{})},zs=(t,e,r=ni())=>{if(!t)return;let i=Wm(e,HO(t));typeof t.cancelScheduledValues=="function"&&t.cancelScheduledValues(r.currentTime),typeof t.setValueAtTime=="function"?t.setValueAtTime(i,r.currentTime):t.value=i},s5=(t,e,r,i=ni())=>{if(!t)return;let s=i.currentTime,o=Math.max(0,Wm(r,0))/1e3,n=HO(t),a=Wm(e,n);typeof t.cancelScheduledValues=="function"&&t.cancelScheduledValues(s),typeof t.setValueAtTime=="function"?t.setValueAtTime(n,s):t.value=n,o>0&&typeof t.linearRampToValueAtTime=="function"?t.linearRampToValueAtTime(a,s+o):typeof t.setValueAtTime=="function"?t.setValueAtTime(a,s+o):t.value=a},$O=(t=1)=>{let e=ni(),r=e.createGain();return zs(r.gain,t,e),r},zO=(t=0)=>{let e=ni();if(typeof e.createStereoPanner!="function")return null;let r=e.createStereoPanner();return zs(r.pan,t,e),r},oi=({volume:t,muted:e})=>e?0:je(t,100),o5=(t,e=1)=>{let r=Number(e),i=Number.isFinite(r)?r:1,s=Number(t??i),o=Number.isFinite(s)?s:i;return je(o*100,i*100)*100},Th=(t=[],e,r,i)=>t.find(o=>(o.type==="audio-transition"||o.type==="audioTransition")&&o.targetId===e)?.properties?.[r]?.[i]??null,ns=({gainNode:t,targetValue:e,transition:r})=>{if(!r)return zs(t.gain,e),0;let i=r.from!==void 0?je(r.from,100):void 0,s=r.to!==void 0?je(r.to,100):e;return i!==void 0&&zs(t.gain,i),s5(t.gain,s,r.duration),r.duration},v0=(t,e)=>{let r=$O(oi(t)),i=zO(t.pan??0);return sn(r,i??e),i&&sn(i,e),{id:t.id,gainNode:r,pannerNode:i,volume:t.volume??100,muted:t.muted??!1,pan:t.pan??0,outputNode:e,cleanupTimeoutId:null}},n5=({sound:t,channelNode:e,internalId:r})=>{let i=$O(oi(t)),s=zO(t.pan??0);return sn(i,s??e),s&&sn(s,e),{internalId:r,id:t.id,src:t.src,url:t.src,loop:t.loop??!1,volume:t.volume??100,muted:t.muted??!1,pan:t.pan??0,startDelayMs:t.startDelayMs??0,playbackRate:t.playbackRate??1,startAt:t.startAt??0,endAt:t.endAt??null,channelId:t.channelId??null,gainNode:i,pannerNode:s,source:null,pendingTimeoutId:null,cleanupTimeoutId:null}},a5=t=>{let e=ni();WO(e);let r=oa.getAsset(t.src);if(!r)return console.warn("AudioStage: asset not found",t.src),null;let i=e.createBufferSource();i.buffer=r,i.loop=t.loop??!1,i.playbackRate&&zs(i.playbackRate,t.playbackRate??1,e),sn(i,t.gainNode);let s=t.startAt??0,o=t.endAt!==null&&t.endAt!==void 0?Math.max(t.endAt-s,0):void 0;return i.loop&&t.endAt!==null&&t.endAt!==void 0?(i.loopStart=s,i.loopEnd=t.endAt,i.start(0,s)):o!==void 0?i.start(0,s,o):i.start(0,s),i},GO=t=>{t.pendingTimeoutId!==null&&(clearTimeout(t.pendingTimeoutId),t.pendingTimeoutId=null),WO(ni());let e=()=>{t.pendingTimeoutId=null,t.source=a5(t)};if(t.startDelayMs>0){t.pendingTimeoutId=setTimeout(e,t.startDelayMs);return}e()},XO=(t,e=0)=>{if(t.pendingTimeoutId!==null&&(clearTimeout(t.pendingTimeoutId),t.pendingTimeoutId=null),!t.source)return;let r=ni();try{t.source.stop(r.currentTime+e/1e3)}catch{}},DO=t=>{t.pendingTimeoutId!==null&&(clearTimeout(t.pendingTimeoutId),t.pendingTimeoutId=null),t.cleanupTimeoutId!==null&&(clearTimeout(t.cleanupTimeoutId),t.cleanupTimeoutId=null),XO(t),rn(t.source),rn(t.gainNode),rn(t.pannerNode)},NO=t=>{t.cleanupTimeoutId!==null&&(clearTimeout(t.cleanupTimeoutId),t.cleanupTimeoutId=null),rn(t.gainNode),rn(t.pannerNode)},VO=(t,e)=>e<=0?(t(),null):setTimeout(t,e);var YO=()=>{let t=new Map,e=new Map,r=new Map,i=new Map,s=0,o=g=>{let b=t.get(g);if(b)return b;let _=v0({id:g,volume:100,muted:!1,pan:0},ni().destination);return t.set(g,_),_},n=(g,b,_)=>{let S=t.get(g.id),E=Th(b,g.id,"volume",_);if(S&&S.cleanupTimeoutId!==null){let C=v0(g,ni().destination);return t.set(g.id,C),ns({gainNode:C.gainNode,targetValue:oi(g),transition:E}),C}if(S){let C=oi(S),M=oi(g),R=C!==M,F=S.pan!==(g.pan??0);return S.volume=g.volume,S.muted=g.muted,S.pan=g.pan,R&&E?ns({gainNode:S.gainNode,targetValue:M,transition:E}):R&&ns({gainNode:S.gainNode,targetValue:M,transition:null}),F&&S.pannerNode?.pan&&zs(S.pannerNode.pan,g.pan??0),S}let P=v0(g,ni().destination);return t.set(g.id,P),ns({gainNode:P.gainNode,targetValue:oi(g),transition:E}),P},a=g=>{let b=g.channelId!==null?t.get(g.channelId):o(b0);if(!b)throw new Error(`Input error: sound "${g.id}" references missing channel.`);return b},l=(g,b)=>{rn(g.gainNode),rn(g.pannerNode),sn(g.gainNode,g.pannerNode??b),g.pannerNode&&sn(g.pannerNode,b)},c=(g,b)=>{if(!g||g.id===b0||g.id===vh)return 0;let _=Th(b,g.id,"volume","exit");return ns({gainNode:g.gainNode,targetValue:oi(g),transition:_})},u=({sound:g,effects:b,phase:_,internalId:S})=>{let E=a(g),P=n5({sound:g,channelNode:E.gainNode,internalId:S});e.set(S,P),r.set(g.id,S);let C=Th(b,g.id,"volume",_);return ns({gainNode:P.gainNode,targetValue:oi(g),transition:C}),GO(P),P},h=(g,b,_=0)=>{if(!g)return 0;let S=Th(b,g.id,"volume","exit"),E=ns({gainNode:g.gainNode,targetValue:oi(g),transition:S}),P=Math.max(E,_);return XO(g,P),g.cleanupTimeoutId=VO(()=>{DO(g),e.delete(g.internalId)},P),P},d=({instance:g,sound:b,effects:_})=>{let S=oi(g),E=oi(b),P=S!==E,C=g.startDelayMs!==b.startDelayMs;if(g.channelId!==b.channelId){let R=a(b);l(g,R.gainNode)}g.loop=b.loop,g.volume=b.volume,g.muted=b.muted,g.pan=b.pan,g.startDelayMs=b.startDelayMs,g.playbackRate=b.playbackRate,g.startAt=b.startAt,g.endAt=b.endAt,g.channelId=b.channelId,g.source&&(g.source.loop=b.loop,g.source.playbackRate&&zs(g.source.playbackRate,b.playbackRate)),g.pannerNode?.pan&&zs(g.pannerNode.pan,b.pan);let M=Th(_,b.id,"volume","update");P&&M?ns({gainNode:g.gainNode,targetValue:E,transition:M}):P&&ns({gainNode:g.gainNode,targetValue:E,transition:null}),C&&g.pendingTimeoutId!==null&&GO(g)};return{add:g=>{let b={id:g.id,type:"sound",src:g.url??g.src,loop:g.loop??!1,volume:o5(g.volume),startDelayMs:g.startDelayMs??0};i.set(g.id,b)},remove:g=>{i.delete(g),r.delete(g);let b=`direct:${g}`,_=e.get(b);_&&h(_,[],0)},getById:g=>i.get(g),tick:()=>{let g=o(vh);for(let b of i.values()){let _=`direct:${b.id}`,S=e.get(_);if(!S){let E={...b,channelId:vh};u({sound:E,effects:[],phase:"enter",internalId:_});continue}if(S.src!==b.src){h(S,[],0);let E={...b,channelId:vh};u({sound:E,effects:[],phase:"enter",internalId:_});continue}d({instance:S,sound:{...b,channelId:vh},effects:[]})}for(let[b,_]of e)b.startsWith("direct:")&&!i.has(_.id)&&(h(_,[],0),r.delete(_.id));return g},renderGraph:({prevAudio:g=[],nextAudio:b=[],prevAudioEffects:_=[],nextAudioEffects:S=[]}={})=>{let E=Gs({audio:g,audioEffects:_}),P=Gs({audio:b,audioEffects:S}),C=new Map(E.channels.map(N=>[N.id,N])),M=new Map(P.channels.map(N=>[N.id,N])),R=new Map(E.sounds.map(N=>[N.id,N])),F=new Map(P.sounds.map(N=>[N.id,N]));o(b0);let U=new Map,W=new Map;for(let[N]of C)if(!M.has(N)){let G=c(t.get(N),_);U.set(N,t.get(N)),W.set(N,G)}for(let[N,G]of M)n(G,S,C.has(N)?"update":"enter");for(let[N,G]of R){let X=F.get(N),$=r.get(N),D=$?e.get($):null,z=G.channelId?W.get(G.channelId)??0:0;if(!X){let le=h(D,_,z);G.channelId&&W.set(G.channelId,Math.max(W.get(G.channelId)??0,le)),r.delete(N);continue}if(G.src!==X.src){let le=h(D,_,z);G.channelId&&W.set(G.channelId,Math.max(W.get(G.channelId)??0,le)),u({sound:X,effects:S,phase:"enter",internalId:`render:${N}:${++s}`})}}for(let[N,G]of F){if(!R.has(N)){u({sound:G,effects:S,phase:"enter",internalId:`render:${N}:${++s}`});continue}if(R.get(N).src!==G.src)continue;let $=r.get(N),D=$?e.get($):null;D&&d({instance:D,sound:G,effects:S})}for(let[N,G]of U){if(!G)continue;let X=W.get(N)??0;G.cleanupTimeoutId=VO(()=>{NO(G),t.get(N)===G&&t.delete(N)},X)}},destroy:()=>{for(let g of e.values())DO(g);for(let g of t.values())NO(g);e.clear(),r.clear(),t.clear(),i.clear()},_inspect:()=>({channels:t,sounds:e,currentSoundKeyById:r,directAudios:i})}};var l5=({JSONObject:t,parserPlugins:e=[]})=>t.map(i=>{let s=e.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:e})});var T0=l5;var jO=({type:t,parse:e})=>({type:t,parse:e});var S0=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function w0(t,e,r,i){t.addEventListener?t.addEventListener(e,r,i):t.attachEvent&&t.attachEvent(`on${e}`,r)}function Sh(t,e,r,i){t&&(t.removeEventListener?t.removeEventListener(e,r,i):t.detachEvent&&t.detachEvent(`on${e}`,r))}function ZO(t,e){let r=e.slice(0,e.length-1),i=[];for(let s=0;s<r.length;s++)i.push(t[r[s].toLowerCase()]);return i}function QO(t){typeof t!="string"&&(t=""),t=t.replace(/\s/g,"");let e=t.split(","),r=e.lastIndexOf("");for(;r>=0;)e[r-1]+=",",e.splice(r,1),r=e.lastIndexOf("");return e}function c5(t,e){let r=t.length>=e.length?t:e,i=t.length>=e.length?e:t,s=!0;for(let o=0;o<r.length;o++)i.indexOf(r[o])===-1&&(s=!1);return s}function JO(t){let e=t.keyCode||t.which||t.charCode;return t.code&&/^Key[A-Z]$/.test(t.code)&&(e=t.code.charCodeAt(3)),e}var Ah={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,"-":S0?173:189,"=":S0?61:187,";":S0?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},ai={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},wh={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Gt={16:!1,18:!1,17:!1,91:!1},at={};for(let t=1;t<20;t++)Ah[`f${t}`]=111+t;var ot=[],Eh=null,eL="all",as=new Map,ul=t=>Ah[t.toLowerCase()]||ai[t.toLowerCase()]||t.toUpperCase().charCodeAt(0),u5=t=>Object.keys(Ah).find(e=>Ah[e]===t),h5=t=>Object.keys(ai).find(e=>ai[e]===t),tL=t=>{eL=t||"all"},Ph=()=>eL||"all",d5=()=>ot.slice(0),f5=()=>ot.map(t=>u5(t)||h5(t)||String.fromCharCode(t)),p5=()=>{let t=[];return Object.keys(at).forEach(e=>{at[e].forEach(({key:r,scope:i,mods:s,shortcut:o})=>{t.push({scope:i,shortcut:o,mods:s,keys:r.split("+").map(n=>ul(n))})})}),t},rL=t=>{let e=t.target||t.srcElement,{tagName:r}=e,i=!0,s=r==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(e.type);return(e.isContentEditable||(s||r==="TEXTAREA"||r==="SELECT")&&!e.readOnly)&&(i=!1),i},m5=t=>(typeof t=="string"&&(t=ul(t)),ot.indexOf(t)!==-1),g5=(t,e)=>{let r,i;t||(t=Ph());for(let s in at)if(Object.prototype.hasOwnProperty.call(at,s))for(r=at[s],i=0;i<r.length;)r[i].scope===t?r.splice(i,1).forEach(({element:o})=>A0(o)):i++;Ph()===t&&tL(e||"all")};function x5(t){let e=JO(t);t.key&&t.key.toLowerCase()==="capslock"&&(e=ul(t.key));let r=ot.indexOf(e);if(r>=0&&ot.splice(r,1),t.key&&t.key.toLowerCase()==="meta"&&ot.splice(0,ot.length),(e===93||e===224)&&(e=91),e in Gt){Gt[e]=!1;for(let i in ai)ai[i]===e&&(bt[i]=!1)}}var iL=(t,...e)=>{if(typeof t>"u")Object.keys(at).forEach(r=>{Array.isArray(at[r])&&at[r].forEach(i=>$m(i)),delete at[r]}),A0(null);else if(Array.isArray(t))t.forEach(r=>{r.key&&$m(r)});else if(typeof t=="object")t.key&&$m(t);else if(typeof t=="string"){let[r,i]=e;typeof r=="function"&&(i=r,r=""),$m({key:t,scope:r,method:i,splitKey:"+"})}},$m=({key:t,scope:e,method:r,splitKey:i="+"})=>{QO(t).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":ul(a);if(!at[l])return;e||(e=Ph());let c=n>1?ZO(ai,o):[],u=[];at[l]=at[l].filter(h=>{let d=(r?h.method===r:!0)&&h.scope===e&&c5(h.mods,c);return d&&u.push(h.element),!d}),u.forEach(h=>A0(h))})};function qO(t,e,r,i){if(e.element!==i)return;let s;if(e.scope===r||e.scope==="all"){s=e.mods.length>0;for(let o in Gt)Object.prototype.hasOwnProperty.call(Gt,o)&&(!Gt[o]&&e.mods.indexOf(+o)>-1||Gt[o]&&e.mods.indexOf(+o)===-1)&&(s=!1);(e.mods.length===0&&!Gt[16]&&!Gt[18]&&!Gt[17]&&!Gt[91]||s||e.shortcut==="*")&&(e.keys=[],e.keys=e.keys.concat(ot),e.method(t,e)===!1&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0)))}}function KO(t,e){let r=at["*"],i=JO(t);if(t.key&&t.key.toLowerCase()==="capslock"||!(bt.filter||rL).call(this,t))return;if((i===93||i===224)&&(i=91),ot.indexOf(i)===-1&&i!==229&&ot.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=wh[a];t[a]&&ot.indexOf(l)===-1?ot.push(l):!t[a]&&ot.indexOf(l)>-1?ot.splice(ot.indexOf(l),1):a==="metaKey"&&t[a]&&(ot=ot.filter(c=>c in wh||c===i))}),i in Gt){Gt[i]=!0;for(let a in ai)if(Object.prototype.hasOwnProperty.call(ai,a)){let l=wh[ai[a]];bt[a]=t[l]}if(!r)return}for(let a in Gt)Object.prototype.hasOwnProperty.call(Gt,a)&&(Gt[a]=t[wh[a]]);t.getModifierState&&!(t.altKey&&!t.ctrlKey)&&t.getModifierState("AltGraph")&&(ot.indexOf(17)===-1&&ot.push(17),ot.indexOf(18)===-1&&ot.push(18),Gt[17]=!0,Gt[18]=!0);let s=Ph();if(r)for(let a=0;a<r.length;a++)r[a].scope===s&&(t.type==="keydown"&&r[a].keydown||t.type==="keyup"&&r[a].keyup)&&qO(t,r[a],s,e);if(!(i in at))return;let o=at[i],n=o.length;for(let a=0;a<n;a++)if((t.type==="keydown"&&o[a].keydown||t.type==="keyup"&&o[a].keyup)&&o[a].key){let l=o[a],{splitKey:c}=l,u=l.key.split(c),h=[];for(let d=0;d<u.length;d++)h.push(ul(u[d]));h.sort().join("")===ot.sort().join("")&&qO(t,l,s,e)}}var bt=function(t,e,r){ot=[];let i=QO(t),s=[],o="all",n=document,a=0,l=!1,c=!0,u="+",h=!1,d=!1;if(r===void 0&&typeof e=="function"&&(r=e),Object.prototype.toString.call(e)==="[object Object]"){let f=e;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&&(h=f.capture),typeof f.splitKey=="string"&&(u=f.splitKey),f.single===!0&&(d=!0)}for(typeof e=="string"&&(o=e),d&&iL(t,o);a<i.length;a++){let f=i[a].split(u);s=[],f.length>1&&(s=ZO(ai,f));let p=f[f.length-1];p=p==="*"?"*":ul(p),p in at||(at[p]=[]),at[p].push({keyup:l,keydown:c,scope:o,mods:s,shortcut:i[a],method:r,key:i[a],splitKey:u,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!as.has(n)){let f=(m=window.event)=>KO(m,n),p=(m=window.event)=>{KO(m,n),x5(m)};as.set(n,{keydownListener:f,keyupListenr:p,capture:h}),w0(n,"keydown",f,h),w0(n,"keyup",p,h)}if(!Eh){let f=()=>{ot=[]};Eh={listener:f,capture:h},w0(window,"focus",f,h)}}};function y5(t,e="all"){Object.keys(at).forEach(r=>{at[r].filter(i=>i.scope===e&&i.shortcut===t).forEach(i=>{i&&i.method&&i.method({},i)})})}function A0(t){let e=Object.values(at).flat();if(e.findIndex(({element:r})=>r===t)<0&&t){let{keydownListener:r,keyupListenr:i,capture:s}=as.get(t)||{};r&&i&&(Sh(t,"keyup",i,s),Sh(t,"keydown",r,s),as.delete(t))}if((e.length<=0||as.size<=0)&&(Array.from(as.keys()).forEach(r=>{let{keydownListener:i,keyupListenr:s,capture:o}=as.get(r)||{};i&&s&&(Sh(r,"keyup",s,o),Sh(r,"keydown",i,o),as.delete(r))}),as.clear(),Object.keys(at).forEach(r=>delete at[r]),Eh)){let{listener:r,capture:i}=Eh;Sh(window,"focus",r,i),Eh=null}}var E0={getPressedKeyString:f5,setScope:tL,getScope:Ph,deleteScope:g5,getPressedKeyCodes:d5,getAllKeyCodes:p5,isPressed:m5,filter:rL,trigger:y5,unbind:iL,keyMap:Ah,modifier:ai,modifierMap:wh};for(let t in E0){let e=t;Object.prototype.hasOwnProperty.call(E0,e)&&(bt[e]=E0[e])}if(typeof window<"u"){let t=window.hotkeys;bt.noConflict=e=>(e&&window.hotkeys===bt&&(window.hotkeys=t),bt),window.hotkeys=bt}var sL=",",_5="+",b5=new Set([93,224]),v5="\0",P0=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),oL=t=>P0(t)?{payload:P0(t.payload)?t.payload:{}}:null,cL=t=>{if(typeof t!="string"||t.length===0)return null;let e=t.toLowerCase();return typeof bt.modifier?.[e]=="number"?bt.modifier[e]:typeof bt.keyMap?.[e]=="number"?bt.keyMap[e]:t.length===1?t.toUpperCase().charCodeAt(0):null},uL=t=>b5.has(t)?91:t,nL=t=>{let e=null;return typeof t?.keyCode=="number"&&t.keyCode>0?e=t.keyCode:typeof t?.which=="number"&&t.which>0?e=t.which:typeof t?.charCode=="number"&&t.charCode>0&&(e=t.charCode),typeof t?.code=="string"&&/^Key[A-Z]$/.test(t.code)&&(e=t.code.charCodeAt(3)),typeof e=="number"?uL(e):cL(t?.key??"")},T5=t=>{if(typeof t!="string"||t.length===0)return[];let e=t.replace(/\s/g,"").split(sL),r=e.lastIndexOf("");for(;r>=0;)r>0&&(e[r-1]+=sL),e.splice(r,1),r=e.lastIndexOf("");return e.filter(Boolean)},S5=t=>typeof bt.modifierMap?.[t]=="string",w5=t=>T5(t).map(e=>{let r=new Set(e.split(_5).map(i=>cL(i)).filter(i=>typeof i=="number").map(i=>uL(i)));return r.size===0?null:{shortcut:e,releaseCodes:r,isModifierOnly:[...r].every(S5)}}).filter(Boolean),E5=(t,e)=>{for(let r of e)if(!t.has(r))return!1;return!0},aL=(t,e)=>`${t}${v5}${e.shortcut}`,lL=t=>{if(!t||typeof t!="object")return!1;let e=typeof t.tagName=="string"?t.tagName.toLowerCase():"";if(["input","textarea","select"].includes(e)||typeof HTMLInputElement<"u"&&t instanceof HTMLInputElement||typeof HTMLTextAreaElement<"u"&&t instanceof HTMLTextAreaElement||typeof HTMLSelectElement<"u"&&t instanceof HTMLSelectElement||t.isContentEditable===!0||t.contentEditable==="true"||t.contentEditable==="plaintext-only")return!0;if(typeof t.getAttribute=="function"){let i=t.getAttribute("contenteditable");if(i!==null&&i.toLowerCase()!=="false"||t.getAttribute("data-route-graphics-input-id")!==null)return!0}let r=typeof t.closest=="function"?t.closest.bind(t):typeof t.parentElement?.closest=="function"?t.parentElement.closest.bind(t.parentElement):null;return r?!!r('[data-route-graphics-input-id], [contenteditable]:not([contenteditable="false"])'):!1},A5=()=>typeof document>"u"?null:document.activeElement??null,C0=t=>lL(t?.target)?!0:lL(A5()),P5=t=>C0(t)?"editable-context":typeof bt.filter=="function"&&!bt.filter(t)?"hotkeys-filter":null,C5=({activeKeyupShortcuts:t,activeModifierShortcuts:e,pressedKeyCodes:r,releasedKeyCode:i})=>{for(let[s,o]of Array.from(t))o.releaseCodes.has(i)&&t.delete(s);for(let[s,o]of Array.from(e))o.releaseCodes.has(i)&&e.delete(s);r.delete(i)},R5=t=>{if(!P0(t))return null;let e={},r=oL(t.keydown),i=oL(t.keyup);return r&&(e.keydown=r),i&&(e.keyup=i),Object.keys(e).length>0?e:null},hL=t=>{let e=new Map,r=new Map,i=new Map,s=new Map,o=new Set,n=(x,v,y)=>{t&&t(x,{_event:{key:v},...y})},a=()=>{i.clear(),s.clear(),o.clear()},l=x=>{for(let[v,y]of Array.from(i))y.binding===x&&i.delete(v);for(let[v,y]of Array.from(s))y.binding===x&&s.delete(v);r.delete(x)},c=(x,v)=>{let y=r.get(x)??[],g=typeof v?.shortcut=="string"?v.shortcut:typeof v?.key=="string"?v.key:null;return y.find(b=>b.shortcut===g)??y[0]??null},u=(x,v)=>{!e.get(x)?.keyup||!v||i.set(aL(x,v),{binding:x,releaseCodes:new Set(v.releaseCodes)})},h=(x,v)=>{let y=aL(x,v),g=s.has(y);return s.set(y,{binding:x,releaseCodes:new Set(v.releaseCodes)}),g},d=x=>{if(P5(x)){a();return}let y=nL(x);if(typeof y=="number"){o.add(y);for(let[g,b]of e)(r.get(g)??[]).filter(S=>S.isModifierOnly).forEach(S=>{if(!E5(o,S.releaseCodes))return;let E=h(g,S);u(g,S),b.keydown&&!E&&n("keydown",g,b.keydown.payload)})}},f=x=>{let v=C0(x),y=nL(x);if(v){typeof y=="number"?C5({activeKeyupShortcuts:i,activeModifierShortcuts:s,pressedKeyCodes:o,releasedKeyCode:y}):a();return}if(typeof y=="number"){for(let[g,b]of Array.from(i)){let _=e.get(b.binding);!b.releaseCodes.has(y)||!_?.keyup||(i.delete(g),n("keyup",b.binding,_.keyup.payload))}for(let[g,b]of Array.from(s))b.releaseCodes.has(y)&&s.delete(g);o.delete(y)}};return typeof document<"u"&&(document.addEventListener("keydown",d),document.addEventListener("keyup",f)),typeof window<"u"&&window.addEventListener("blur",a),{registerHotkeys:(x={})=>{if(typeof x!="object"||x===null)return;let v=new Map,y=[],g=[],b=[];Object.keys(x).forEach(_=>{let S=R5(x[_]);S&&v.set(_,S)}),v.forEach((_,S)=>{let E=e.get(S);E?ye(E,_)||(g.push(S),bt.unbind(S)):y.push(S)}),e.forEach((_,S)=>{v.has(S)||b.push(S)}),b.forEach(_=>{bt.unbind(_),e.delete(_),l(_)}),[...y,...g].forEach(_=>{let S=v.get(_),E=w5(_);l(_),r.set(_,E),e.set(_,S),bt(_,(P,C)=>{if(C0(P)){a();return}let M=c(_,C);if(M?.isModifierOnly){let R=h(_,M);u(_,M),S.keydown&&!R&&n("keydown",_,S.keydown.payload);return}u(_,M),S.keydown&&n("keydown",_,S.keydown.payload)})})},destroy:()=>{typeof document<"u"&&(document.removeEventListener("keydown",d),document.removeEventListener("keyup",f)),typeof window<"u"&&window.removeEventListener("blur",a);for(let x of e.keys())bt.unbind(x);e.clear(),r.clear(),i.clear(),s.clear(),o.clear()}}};var R0=1,M5=(t={})=>Object.keys(t).some(Es),I5=(t,e,r)=>{if(!t||!Object.prototype.hasOwnProperty.call(t,e))throw new Error(`Animation "${r}" cannot auto-resolve property "${e}" from targetState.`);return t[e]},B5=(t,e,r,i,s,o)=>Object.entries(e).map(([n,a])=>{if(!Df[n])throw new Error(`${n} is not a supported property for animation.`);let l=hI({object:t,property:n,propertyPathMap:r,subjectState:o,defaultValue:0});if(a.auto){let h=I5(i,n,s);if(l===h)return null;let d=Io([{value:l},{duration:a.auto.duration,value:h,easing:a.auto.easing}]);return{property:n,timeline:d}}let c=a.initialValue??l,u=Io([{value:c},...a.keyframes]);return{property:n,timeline:u}}).filter(Boolean),dL=()=>{let t=[],e=new Map,r=new Map,i=new Map,s=0,o=null,n=!1,a=(I,A)=>Math.min(Math.max(I,0),Math.max(A??0,0)),l=(I,A)=>{let k=a(A*I.playbackSpeed,I.duration);return I.currentTime=k,I.applyFrame(k),k>=I.duration},c=(I,A)=>{if(I==null)return R0;if(typeof I!="number"||!Number.isFinite(I)||I<=0)throw new Error(`Animation "${A}" playback speed must be a finite number greater than 0.`);return I},u=(I,A)=>{i.get(I)?.forEach(k=>{try{k(A)}catch{}})},h=I=>{if(u("completed",{id:I.id}),I.onComplete)try{I.onComplete()}catch{}},d=(I,A={})=>(I.animationType=A.animationType??I.animationType,I.targetId=A.targetId??I.targetId,I.signature=A.signature??I.signature,I.continuity=A.continuity??I.continuity??"render",I.playbackSpeed=c(A.playbackSpeed??I.playbackSpeed,I.id),I.onContinuationUpdate=A.onContinuationUpdate??I.onContinuationUpdate,I),f=I=>({id:I.id,type:I.animationType??null,targetId:I.targetId??null,signature:I.signature??null,continuity:I.continuity??"render",pending:I.pending===!0}),p=I=>{I.applyFrame(0),r.delete(I.id),e.set(I.id,I);let A=o!==null&&l(I,o);u("started",{id:I.id}),A&&(h(I),e.delete(I.id))},m=I=>{let{id:A,element:k,properties:L,targetState:q,onComplete:H,onCancel:Y,propertyPathMap:pe=Nf,animationBaseState:Le}=I,Be=Le??(M5(L)?As(k):null),ci=()=>(Be||(Be=As(k)),Be),Xr=B5(k,L,pe,q,A,Be);if(Xr.length===0){h({id:A,onComplete:H});return}let Dt={id:A,kind:"property",element:k,timelines:Xr,duration:Aa(Xr),currentTime:0,playbackSpeed:R0,stateVersion:s,targetState:q,onComplete:H,onCancel:Y,applyFrame:pl=>{for(let{property:Rh,timeline:U0}of Xr){let wL=Bo(U0,pl);try{uu({object:k,property:Rh,propertyPathMap:pe,subjectState:Es(Rh)?ci():Be,value:wL})}catch{}}},applyTargetState:()=>{if(!(!k||k.destroyed)){if(q===null){k.destroy();return}if(q)for(let[pl,Rh]of Object.entries(q))try{uu({object:k,property:pl,propertyPathMap:pe,subjectState:Es(pl)?ci():Be,value:Rh})}catch{}}},isValid:()=>!!k&&!k.destroyed};p(d(Dt,I))},x=I=>{let A={id:I.id,kind:"custom",duration:I.duration??0,currentTime:0,playbackSpeed:R0,deferCompletionUntilNextFrame:I.deferCompletionUntilNextFrame===!0,pendingCompletion:!1,stateVersion:s,onComplete:I.onComplete,onCancel:I.onCancel,applyFrame:I.applyFrame??(()=>{}),applyTargetState:I.applyTargetState??(()=>{}),isValid:I.isValid??(()=>!0)};p(d(A,I))},v=I=>{if(I.driver==="custom"){x(I);return}m(I)},y=I=>{try{I.applyTargetState?.()}catch{}if(I.onCancel)try{I.onCancel()}catch{}},g=I=>{let A=r.get(I);A&&(y(A),r.delete(I),u("cancelled",{id:I}))},b=I=>{switch(I.type){case"START":v(I.payload);break;case"CANCEL":E(I.id);break}},_=()=>{let I=t.splice(0);for(let A of I)b(A)},S=()=>{o===null||n||(n=!0,queueMicrotask(()=>{n=!1,o!==null&&_()}))},E=I=>{let A=e.get(I);if(!A){g(I);return}y(A),e.delete(I),u("cancelled",{id:I})},P=I=>{t.push(I),S()},C=()=>{for(let[I,A]of e)y(A),u("cancelled",{id:I});for(let[I,A]of r)y(A),u("cancelled",{id:I});e.clear(),r.clear(),s++},M=(I=new Set)=>{let A=I instanceof Set?I:new Set(I??[]);for(let[k,L]of e)A.has(k)||(y(L),e.delete(k),u("cancelled",{id:k}));for(let[k,L]of r)A.has(k)||(y(L),r.delete(k),u("cancelled",{id:k}))},R=I=>{_();let A=[];for(let[k,L]of e){if(L.stateVersion!==s){A.push(k);continue}if(!L.isValid()){A.push(k);continue}if(L.pendingCompletion){h(L),A.push(k);continue}if(L.currentTime=a(L.currentTime+I*L.playbackSpeed,L.duration),L.currentTime>=L.duration){if(L.applyFrame(L.duration),L.deferCompletionUntilNextFrame===!0&&L.duration>0){L.pendingCompletion=!0;continue}h(L),A.push(k);continue}L.applyFrame(L.currentTime)}for(let k of A)e.delete(k)},F=I=>{o=I,_();let A=[];for(let[k,L]of e){if(L.stateVersion!==s){A.push(k);continue}if(!L.isValid()){A.push(k);continue}l(L,I)&&(h(L),A.push(k))}for(let k of A)e.delete(k)},U=()=>{o=null},W=()=>{_()},N=(I,A)=>(i.has(I)||i.set(I,new Set),i.get(I).add(A),()=>G(I,A)),G=(I,A)=>{i.get(I)?.delete(A)};return{dispatch:P,cancelAll:C,cancelAllExcept:M,flush:W,tick:R,setTime:F,clearTime:U,on:N,off:G,registerPending:I=>{let A=d({id:I.id,kind:"pending",pending:!0,applyTargetState:I.applyTargetState??(()=>{}),onCancel:I.onCancel},I);r.set(A.id,A)},activatePending:(I,A)=>{let k=r.get(I);return k?(r.delete(I),v({...A,id:I,animationType:k.animationType,targetId:k.targetId,signature:k.signature,continuity:k.continuity,playbackSpeed:k.playbackSpeed,onContinuationUpdate:A.onContinuationUpdate??k.onContinuationUpdate}),!0):!1},removePending:I=>{r.delete(I)},getContinuableAnimations:()=>{let I=new Map;for(let[A,k]of r)k.continuity==="persistent"&&I.set(A,f(k));for(let[A,k]of e)k.continuity==="persistent"&&I.set(A,f(k));return I},getState:()=>({stateVersion:s,activeCount:e.size,pendingCount:r.size,animations:Array.from(e.entries()).map(([I,A])=>({id:I,currentTime:A.currentTime,duration:A.duration,playbackSpeed:A.playbackSpeed,progress:A.duration>0?A.currentTime/A.duration:0}))}),isAnimating:I=>e.has(I),hasContext:I=>e.has(I)||r.has(I),updateContinuation:(I,A)=>{let k=e.get(I)??r.get(I);if(k?.onContinuationUpdate)try{k.onContinuationUpdate(A)}catch{}},destroy:()=>{C(),i.clear()}}};var fL=t=>{let e=0,r=0,i=null,s=!1,o=!1,n=d=>{o||(o=!0,t?.("renderComplete",d))};return{reset:d=>{e>0&&i!==null&&!o&&t?.("renderComplete",{id:i,aborted:!0}),r++,e=0,i=d,s=!0,o=!1},track:d=>{d===r&&e++},complete:d=>{d!==r||e===0||(e--,e===0&&!s&&n({id:i,aborted:!1}))},getVersion:()=>r,completeIfEmpty:()=>{s=!1,e===0&&n({id:i,aborted:!1})}}};var pL=new Set(["update","transition"]),mL=new Set(["render","persistent"]),F5="render",k5=1,U5=new Set(["alpha","x","y","translateX","translateY","scaleX","scaleY","rotation","blurX","blurY","uProgress"]),O5=new Set(["x","y","translateX","translateY","alpha","scaleX","scaleY","rotation"]),L5=new Set(["uProgress"]),gL=new Set(["single","sequence"]),xL=new Set(["red","green","blue","alpha"]),yL=new Set(["hold","linear"]),bL=new Set(vp),li=(t,e)=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object.`)},hl=(t,e)=>{if(typeof t!="string"||t.length===0)throw new Error(`${e} must be a non-empty string.`)},dl=(t,e)=>{if(typeof t!="number"||Number.isNaN(t))throw new Error(`${e} must be a number.`)},G5=(t,e)=>{if(typeof t!="number"||!Number.isFinite(t)||t<=0)throw new Error(`${e} must be a finite number greater than 0.`)},D5=(t,e)=>{li(t,e);let r=t.continuity??F5;if(!mL.has(r))throw new Error(`${e}.continuity must be one of: ${Array.from(mL).join(", ")}.`);let i={continuity:r};return t.speed!==void 0&&(G5(t.speed,`${e}.speed`),t.speed!==k5&&(i.speed=t.speed)),i},N5=(t,e)=>{if(li(t,e),dl(t.duration,`${e}.duration`),t.easing!==void 0&&typeof t.easing!="string")throw new Error(`${e}.easing must be a string.`);if(t.easing!==void 0&&!bL.has(t.easing))throw new Error(`${e}.easing must be one of: ${vp.join(", ")}.`);return{duration:t.duration,easing:t.easing??"linear"}},B0=(t,e)=>{li(t,e);let r={};if(t.initialValue!==void 0&&(dl(t.initialValue,`${e}.initialValue`),r.initialValue=t.initialValue),!Array.isArray(t.keyframes)||t.keyframes.length===0)throw new Error(`${e}.keyframes must be a non-empty array.`);return r.keyframes=t.keyframes.map((i,s)=>{let o=`${e}.keyframes[${s}]`;if(li(i,o),dl(i.value,`${o}.value`),dl(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&&!bL.has(i.easing))throw new Error(`${o}.easing must be one of: ${vp.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}:{}}}),r},V5=(t,e)=>{li(t,e);let r=t.keyframes!==void 0,i=t.auto!==void 0;if(r&&i)throw new Error(`${e} cannot define both keyframes and auto.`);if(!r&&!i)throw new Error(`${e} must define keyframes or auto.`);if(i){if(t.initialValue!==void 0)throw new Error(`${e}.initialValue is not valid when auto is defined.`);return{auto:N5(t.auto,`${e}.auto`)}}return B0(t,e)},I0=(t,e,r,i=B0)=>{if(li(t,e),t.x!==void 0&&t.translateX!==void 0)throw new Error(`${e} cannot define both x and translateX.`);if(t.y!==void 0&&t.translateY!==void 0)throw new Error(`${e} cannot define both y and translateY.`);let s=Object.entries(t).map(([o,n])=>{if(!r.has(o))throw new Error(`${e}.${o} is not a supported animation property.`);return[o,i(n,`${e}.${o}`)]});if(s.length===0)throw new Error(`${e} must define at least one property.`);return Object.fromEntries(s)},H5=(t,e)=>{if(li(t,e),hl(t.texture,`${e}.texture`),dl(t.at,`${e}.at`),t.at<0||t.at>1)throw new Error(`${e}.at must be between 0 and 1.`);return{at:t.at,texture:t.texture}},W5=(t,e)=>{if(!Array.isArray(t)||t.length<2)throw new Error(`${e} must be an array with at least two frames.`);let r=t.map((s,o)=>H5(s,`${e}[${o}]`));if(r[0].at!==0)throw new Error(`${e}[0].at must be 0.`);let i=r.length-1;if(r[i].at!==1)throw new Error(`${e}[${i}].at must be 1.`);for(let s=1;s<r.length;s++)if(r[s].at<=r[s-1].at)throw new Error(`${e} must be sorted by ascending unique at values.`);return r},$5=(t,e)=>{if(li(t,e),!gL.has(t.kind))throw new Error(`${e}.kind must be one of: ${Array.from(gL).join(", ")}.`);let r={kind:t.kind};if(t.channel!==void 0){if(!xL.has(t.channel))throw new Error(`${e}.channel must be one of: ${Array.from(xL).join(", ")}.`);r.channel=t.channel}if(t.softness!==void 0&&(dl(t.softness,`${e}.softness`),r.softness=t.softness),t.invert!==void 0){if(typeof t.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);r.invert=t.invert}if(t.progress!==void 0&&(r.progress=B0(t.progress,`${e}.progress`)),t.kind==="single"){if(t.frames!==void 0)throw new Error(`${e}.frames is only valid for sequence masks.`);if(t.sample!==void 0)throw new Error(`${e}.sample is only valid for sequence masks.`);if(t.items!==void 0)throw new Error(`${e}.items is not supported.`);if(t.combine!==void 0)throw new Error(`${e}.combine is not supported.`);hl(t.texture,`${e}.texture`),r.texture=t.texture}if(t.kind==="sequence"){if(t.texture!==void 0)throw new Error(`${e}.texture is not valid for sequence masks. Use ${e}.frames[].texture instead.`);if(t.items!==void 0)throw new Error(`${e}.items is not supported.`);if(t.combine!==void 0)throw new Error(`${e}.combine is not supported.`);if(t.textures!==void 0)throw new Error(`${e}.textures is no longer supported. Use ${e}.frames with texture and at entries instead.`);if(t.softness!==void 0)throw new Error(`${e}.softness is not valid for sequence masks. Author feathering into ${e}.frames[].texture instead.`);if(r.frames=W5(t.frames,`${e}.frames`),t.sample!==void 0&&(hl(t.sample,`${e}.sample`),!yL.has(t.sample)))throw new Error(`${e}.sample must be one of: ${Array.from(yL).join(", ")}.`);r.sample=t.sample??"hold"}return r.progress||(r.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),r},_L=(t,e)=>{if(li(t,e),t.mask!==void 0)throw new Error(`${e}.mask is not valid. Define mask on ${e}.`);let r={};if(t.tween!==void 0&&(r.tween=I0(t.tween,`${e}.tween`,O5)),Object.keys(r).length===0)throw new Error(`${e} must define tween.`);return r},z5=(t,e)=>{let r={};if(t.shader!==void 0)throw new Error(`${e}.shader is not supported.`);if(t.prev!==void 0&&(r.prev=_L(t.prev,`${e}.prev`)),t.next!==void 0&&(r.next=_L(t.next,`${e}.next`)),t.mask!==void 0&&(r.mask=$5(t.mask,`${e}.mask`)),t.compositor!==void 0&&(r.compositor=xB(t.compositor,`${e}.compositor`)),r.mask!==void 0&&r.compositor!==void 0)throw new Error(`${e}.compositor cannot be combined with ${e}.mask in v1.`);if(r.prev===void 0&&r.next===void 0&&r.mask===void 0&&r.compositor===void 0)throw new Error(`${e} must define prev, next, mask, or compositor.`);return r},M0=(t,e,r)=>{if(t!==void 0)throw new Error(`${e} ${r}`)},vL=(t=[])=>{if(!Array.isArray(t))throw new Error("Input error: `animations` must be an array.");let e=t.map((s,o)=>{let n=`animations[${o}]`;if(li(s,n),hl(s.id,`${n}.id`),hl(s.targetId,`${n}.targetId`),hl(s.type,`${n}.type`),!pL.has(s.type))throw new Error(`${n}.type must be one of: ${Array.from(pL).join(", ")}.`);let a={id:s.id,targetId:s.targetId,type:s.type};if(s.complete!==void 0&&(li(s.complete,`${n}.complete`),a.complete=s.complete),s.playback!==void 0&&(a.playback=D5(s.playback,`${n}.playback`)),M0(s.operation,`${n}.operation`,"is no longer supported. Use `type: update | transition` instead."),M0(s.properties,`${n}.properties`,"is no longer supported. Use `tween` instead."),M0(s.subjects,`${n}.subjects`,"is no longer supported. Use `prev` / `next` instead."),s.type==="update"){if(a.tween=I0(s.tween,`${n}.tween`,U5,V5),s.replace!==void 0)throw new Error(`${n}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(s.prev!==void 0)throw new Error(`${n}.prev is only valid for transition animations.`);if(s.next!==void 0)throw new Error(`${n}.next is only valid for transition animations.`);if(s.mask!==void 0)throw new Error(`${n}.mask is only valid for transition animations.`);if(s.compositor!==void 0)throw new Error(`${n}.compositor is only valid for transition animations.`);if(s.shader!==void 0)throw new Error(`${n}.shader is not supported.`);return a}if(s.tween!==void 0&&s.compositor===void 0)throw new Error(`${n}.tween is not valid for transition animations.`);if(s.replace!==void 0)throw new Error(`${n}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let l=z5(s,n);if(l.prev!==void 0&&(a.prev=l.prev),l.next!==void 0&&(a.next=l.next),l.mask!==void 0&&(a.mask=l.mask),l.compositor!==void 0){if(a.compositor=l.compositor,s.tween===void 0)throw new Error(`${n}.tween.uProgress is required when compositor is defined.`);a.tween=I0(s.tween,`${n}.tween`,L5)}return a}),r=new Map;for(let s of e){let o=r.get(s.targetId)??new Set;o.add(s.type),r.set(s.targetId,o)}for(let[s,o]of r)if(o.has("transition")&&o.size>1)throw new Error(`Animations targeting "${s}" cannot mix update and transition types in the same state.`);let i=new Set;for(let s of e)if(!(s.type!=="update"||s.tween?.uProgress===void 0)){if(i.has(s.targetId))throw new Error(`Animations targeting "${s.targetId}" cannot define multiple active uProgress update tweens in the same state.`);i.add(s.targetId)}return e};var F0=(t={})=>{if(t===null||typeof t!="object")throw new Error("Input error: render state must be an object.");if(t.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let e={...t,elements:t.elements??[],animations:t.animations??[],audio:t.audio??[],audioEffects:t.audioEffects??[]};if(!Array.isArray(e.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(e.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(e.audio))throw new Error("Input error: `audio` must be an array.");if(!Array.isArray(e.audioEffects))throw new Error("Input error: `audioEffects` must be an array.");return e.animations=vL(e.animations),Gs({audio:e.audio,audioEffects:e.audioEffects}),e};var X5="0",fl=(t,e)=>{let r=t?.[e];return typeof r=="number"?r:0},Rr=t=>({value:t.element.value??"",selectionStart:fl(t.element,"selectionStart"),selectionEnd:fl(t.element,"selectionEnd"),focused:document.activeElement===t.element,composing:t.composing===!0}),Y5=(t,e)=>!t||!e?!1:t.value===e.value&&t.selectionStart===e.selectionStart&&t.selectionEnd===e.selectionEnd&&t.focused===e.focused&&t.composing===e.composing,j5=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement,Ch=t=>{t.element.style.pointerEvents="none"},k0=(t,e,r)=>{if(typeof t?.setSelectionRange=="function")try{t.setSelectionRange(e,r)}catch{}},q5=({app:t,geometry:e})=>{let r=t.canvas;if(!e||!r||e.visible===!1)return null;let i=r.getBoundingClientRect(),s=t.renderer?.width||i.width||1,o=t.renderer?.height||i.height||1,n=i.width/s,a=i.height/o,l=e.clipInsets??{top:0,right:0,bottom:0,left:0},c=i.left+(e.x+l.left)*n,u=i.top+(e.y+l.top)*a,h=i.left+(e.x+e.width-l.right)*n,d=i.top+(e.y+e.height-l.bottom)*a;return h<=c||d<=u?null:{left:c,top:u,right:h,bottom:d}},K5=({app:t,entry:e,event:r})=>{let i=e.options.getGeometry?.(),s=q5({app:t,geometry:i}),o=r.clientX,n=r.clientY;return!!s&&Number.isFinite(o)&&Number.isFinite(n)&&o>=s.left&&o<=s.right&&n>=s.top&&n<=s.bottom},TL=({app:t})=>{let e=new Map,r,i=null,s=()=>{r||(r=document.createElement("div"),r.dataset.routeGraphicsInputBridge="true",r.style.position="fixed",r.style.left="0",r.style.top="0",r.style.pointerEvents="none",r.style.zIndex="1000",r.style.width="0",r.style.height="0");let g=t.canvas?.parentNode??document.body;r.isConnected||g.appendChild(r)},o=(g,b=g.lastSnapshot)=>{let _=Rr(g);_.focused&&i!==g.id?i=g.id:!_.focused&&i===g.id&&(i=null),Ch(g,i),b?.value!==_.value&&g.callbacks.onValueChange?.(_),(b?.selectionStart!==_.selectionStart||b?.selectionEnd!==_.selectionEnd||b?.focused!==_.focused||b?.composing!==_.composing)&&g.callbacks.onSelectionChange?.(_),g.lastSnapshot=_},n=g=>{let{disabled:b=!1,multiline:_=!1,maxLength:S,textStyle:E,padding:P,placeholder:C="",autocomplete:M="off",autocapitalize:R="off",spellcheck:F=!1}=g.options,{element:U}=g;U instanceof HTMLInputElement&&(U.type="text"),U.disabled=b,U.placeholder=C,U.autocomplete=M,U.autocapitalize=R,U.spellcheck=!!F,U.style.opacity=X5,U.style.color="transparent",U.style.caretColor="transparent",U.style.background="transparent",U.style.paddingTop=`${P.top}px`,U.style.paddingRight=`${P.right}px`,U.style.paddingBottom=`${P.bottom}px`,U.style.paddingLeft=`${P.left}px`,U.style.fontFamily=E?.fontFamily??"Arial",U.style.fontSize=`${E?.fontSize??16}px`,U.style.fontWeight=E?.fontWeight??"400",U.style.textAlign=E?.align??"left",U.style.lineHeight=typeof E?.lineHeight=="number"?`${E.lineHeight}px`:"normal",U.style.whiteSpace=_?"pre":"nowrap",U.style.overflowWrap="normal",U.style.resize="none",U.style.overflow="hidden",typeof S=="number"?U.maxLength=S:U.removeAttribute("maxLength"),U.tabIndex=-1,_&&U instanceof HTMLTextAreaElement&&(U.wrap="off",U.rows=1),Ch(g,i)},a=g=>{s();let b=t.canvas,_=g.options.getGeometry?.();if(!b||!_||_.visible===!1){g.element.style.display="none";return}let S=b.getBoundingClientRect(),E=t.renderer?.width||S.width||1,P=t.renderer?.height||S.height||1,C=S.width/E,M=S.height/P,R=_.clipInsets??{top:0,right:0,bottom:0,left:0},F={top:R.top*M,right:R.right*C,bottom:R.bottom*M,left:R.left*C};g.element.style.display="block",g.element.style.left=`${S.left+_.x*C}px`,g.element.style.top=`${S.top+_.y*M}px`,g.element.style.width=`${_.width*C}px`,g.element.style.height=`${_.height*M}px`;let U=Object.values(F).some(W=>W>0);g.element.style.clipPath=U?`inset(${F.top}px ${F.right}px ${F.bottom}px ${F.left}px)`:"none"},l=g=>{if(!i)return;let b=e.get(i),_=g.target;!b||_===b.element||b.element.contains(_)||j5(_)&&r?.contains(_)||K5({app:t,entry:b,event:g})||b.element.blur()},c=()=>{for(let g of e.values()){if(a(g),!g.lastSnapshot){g.lastSnapshot=Rr(g);continue}let b=Rr(g);Y5(b,g.lastSnapshot)||o(g,g.lastSnapshot)}},u=({id:g,options:b})=>{let _=b.multiline===!0?document.createElement("textarea"):document.createElement("input");return _.dataset.routeGraphicsInputId=g,_.style.position="fixed",_.style.border="none",_.style.outline="none",_.style.margin="0",_.style.boxSizing="border-box",_.style.borderRadius="0",_.style.transformOrigin="top left",_.style.appearance="none",_.style.boxShadow="none",_.style.userSelect="none",_.style.webkitUserSelect="none",_},h=g=>{let{id:b,element:_}=g,S=()=>{o(g)};_.addEventListener("focus",()=>{g.pendingBlurTimer&&(clearTimeout(g.pendingBlurTimer),g.pendingBlurTimer=null),i=b,Ch(g,i);let E=Rr(g);g.lastSnapshot=E,g.callbacks.onFocus?.(E),g.callbacks.onSelectionChange?.(E)}),_.addEventListener("blur",()=>{i===b&&(i=null),Ch(g,i),g.pendingBlurTimer=setTimeout(()=>{g.pendingBlurTimer=null;let E=Rr(g);if(E.focused){g.lastSnapshot=E;return}g.lastSnapshot=E,g.callbacks.onBlur?.(E),g.callbacks.onSelectionChange?.(E)},0)}),_.addEventListener("input",S),_.addEventListener("select",S),_.addEventListener("click",()=>queueMicrotask(S)),_.addEventListener("keyup",E=>{E.stopPropagation(),E.stopImmediatePropagation?.(),queueMicrotask(S)}),_.addEventListener("keydown",E=>{E.stopPropagation(),E.stopImmediatePropagation?.();let P=g.options.submitOnEnter!==!1,C=g.options.submitOnEnter===!1,M=typeof g.callbacks.onSubmit=="function",R=E.key==="Enter"&&g.options.multiline!==!0&&!E.shiftKey,F=R&&P&&M,U=E.key==="Enter"&&g.options.multiline===!0&&(E.ctrlKey||E.metaKey)&&P&&M;(R||U||E.key==="Enter"&&C)&&E.preventDefault(),(F||U)&&g.callbacks.onSubmit(Rr(g),E),E.key==="Escape"&&_.blur(),queueMicrotask(S)}),_.addEventListener("compositionstart",()=>{g.composing=!0;let E=Rr(g);g.lastSnapshot=E,g.callbacks.onCompositionStart?.(E),g.callbacks.onSelectionChange?.(E)}),_.addEventListener("compositionupdate",()=>{let E=Rr(g);g.lastSnapshot=E,g.callbacks.onCompositionUpdate?.(E),g.callbacks.onSelectionChange?.(E)}),_.addEventListener("compositionend",()=>{g.composing=!1,S(),g.callbacks.onCompositionEnd?.(Rr(g))})};document.addEventListener("pointerdown",l,!0),t.ticker?.add?.(c);let d=(g,b)=>{s();let _=e.get(g);if(_)return _.options=b,_.callbacks=b.callbacks??{},n(_),a(_),typeof b.value=="string"&&_.element.value!==b.value&&(_.element.value=b.value),_.lastSnapshot=Rr(_),_.element;let S={id:g,element:u({id:g,options:b}),options:b,callbacks:b.callbacks??{},composing:!1,pendingBlurTimer:null,lastSnapshot:null};return h(S),typeof b.value=="string"&&(S.element.value=b.value),n(S),r.appendChild(S.element),e.set(g,S),a(S),S.lastSnapshot=Rr(S),S.element};return{mount:d,update:(g,b)=>{let _=e.get(g);if(!_)return d(g,b);let S=b.multiline===!0!=_.element instanceof HTMLTextAreaElement;if(_.options=b,_.callbacks=b.callbacks??{},S){let E=_.element,P=document.activeElement===E,C=fl(E,"selectionStart"),M=fl(E,"selectionEnd");return _.element=u({id:g,options:b}),h(_),E.replaceWith(_.element),_.element.value=typeof b.value=="string"?b.value:E.value,n(_),a(_),_.lastSnapshot=Rr(_),P&&!b.disabled&&queueMicrotask(()=>{_.element.focus(),k0(_.element,C,M)}),_.element}return typeof b.value=="string"&&b.value!==_.element.value&&_.composing!==!0&&(_.element.value=b.value),n(_),a(_),_.lastSnapshot=Rr(_),_.element},focus:(g,{selectAll:b=!1,selectionStart:_,selectionEnd:S}={})=>{let E=e.get(g);if(!E||E.element.disabled)return;let P=document.activeElement===E.element;if(i=g,Ch(E,i),P||E.element.focus(),b){E.element.select?.(),o(E,E.lastSnapshot);return}if(typeof _=="number"||typeof S=="number"){let C=typeof _=="number"?_:fl(E.element,"selectionStart"),M=typeof S=="number"?S:typeof _=="number"?_:fl(E.element,"selectionEnd");k0(E.element,C,M)}o(E,E.lastSnapshot)},setSelection:(g,b,_=b,{focus:S=!1}={})=>{let E=e.get(g);if(!E||E.element.disabled)return;let P=()=>{k0(E.element,b,_),o(E,E.lastSnapshot)};if(S&&document.activeElement!==E.element){E.element.focus(),P();return}P()},blur:g=>{e.get(g)?.element.blur()},unmount:g=>{let b=e.get(g);b&&(i===g&&(i=null),b.pendingBlurTimer&&(clearTimeout(b.pendingBlurTimer),b.pendingBlurTimer=null),b.element.remove(),e.delete(g),e.size===0&&r?.remove())},destroy:()=>{document.removeEventListener("pointerdown",l,!0),t.ticker?.remove?.(c);for(let g of e.values())g.pendingBlurTimer&&(clearTimeout(g.pendingBlurTimer),g.pendingBlurTimer=null),g.element.remove();e.clear(),i=null,r?.remove(),r=void 0}}};var Z5=()=>{let t=A=>{if(A!=="auto"&&A!=="manual")throw new Error(`Invalid animation playback mode "${A}". Expected "auto" or "manual".`)},e,r=YO(),i={elements:[],animations:[],audio:[],audioEffects:[]},s,o={animations:[],elements:[],audio:[],parsers:[]},n,a,l,c,u=!1,h,d,f,p="auto",m=null,x=[],v,y=new Map,g,b=(A,k,L,q)=>{A.clear(),A.rect(0,0,k,L),A.fill(q??0)},_=A=>A?A.startsWith("audio/")?"audio":A.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(A)?"font":A.startsWith("video/")?"video":"texture":"texture",S=A=>A?typeof A=="string"?A:A.message||String(A):"Unknown error",E=(A,k=180)=>{if(typeof A=="string")return A.length<=k?A:`${A.slice(0,k-1)}...`},P=A=>A&&typeof A.byteLength=="number"?A.byteLength:0,C=(A,k={})=>A==="texture"?k.type?.startsWith("image/")?"image":"visual asset":A||"asset",M=A=>A.match(/HTTP\s+(\d{3})/)?.[1],R=({category:A,phase:k,error:L})=>{if(L?.rootCauseMessage)return L.rootCauseMessage;let q=S(L),H=M(q);return H==="404"?"File not found.":H==="401"||H==="403"?"Access denied.":H?.startsWith("5")?"File server error.":/URL is missing/i.test(q)?"Missing file URL.":/missing or empty/i.test(q)?"Missing file data.":A==="audio"||/decode/i.test(q)?"Unsupported or damaged audio file.":A==="font"?"Unsupported or damaged font file.":A==="video"?"Unsupported, damaged, or inaccessible video file.":A==="texture"&&k==="image bitmap creation"?"Unsupported or damaged image file.":A==="texture"?"Missing, inaccessible, or unsupported image file.":"File could not be loaded."},F=({key:A,kind:k,category:L,phase:q,asset:H,error:Y})=>{let pe={assetKey:A,assetKind:k,assetCategory:L,phase:q,cause:S(Y)};return H?.type&&(pe.type=H.type),H?.source&&(pe.source=H.source),H?.url&&(pe.url=E(H.url)),H?.buffer&&(pe.bufferBytes=P(H.buffer)),pe},U=({key:A,category:k,phase:L,asset:q,error:H})=>{let Y=C(k,q),pe=R({category:k,phase:L,error:H}),Le=`Could not load ${Y} "${A}". ${pe}`,Be=new Error(Le,{cause:H});return Be.userMessage=Le,Be.rootCauseMessage=pe,Be.details=F({key:A,kind:Y,category:k,phase:L,asset:q,error:H}),Be},W=async({key:A,category:k,phase:L,asset:q},H)=>{try{return await H()}catch(Y){throw U({key:A,category:k,phase:L,asset:q,error:Y})}},N=(A,k)=>{if(P(A?.buffer)===0)throw new Error(`${k} asset data is missing or empty.`)},G=A=>A?`"${String(A).replaceAll('"','\\"')}"`:"unknown",X=A=>{let{assetKind:k,assetKey:L}=A?.details||{};return L?k?`${k} ${G(L)}`:G(L):"unknown asset"},$=A=>{let L=A.slice(0,3).map(X),q=A.length-L.length,H=q>0?`, and ${q} more`:"";return`${L.join(", ")}${H}`},D=A=>{let k=A.filter(Y=>Y.status==="rejected").map(Y=>Y.reason);if(k.length===0)return;if(k.length===1)throw k[0];let L="Check that the files exist and are supported.",q=`Could not load ${k.length} assets: ${$(k)}. ${L}`,H=new AggregateError(k,q);throw H.userMessage=q,H.rootCauseMessage=L,H.details={failures:k.map(Y=>Y?.details||{cause:S(Y)})},H},z=(A,k,{revokable:L=!1}={})=>{y.set(A,{url:k,revokable:L})},le=()=>{for(let A of y.values())A?.revokable===!0&&typeof A?.url=="string"&&URL.revokeObjectURL(A.url);y.clear()},de=(A,k)=>new Promise((L,q)=>{let H=window.HTMLMediaElement?.HAVE_CURRENT_DATA??2;if(A.readyState>=H){L();return}let Y,pe=()=>{window.clearTimeout(Y),A.removeEventListener("loadeddata",Le),A.removeEventListener("canplay",Le),A.removeEventListener("error",Be)},Le=()=>{pe(),L()},Be=()=>{pe();let ci=[A.error?.code?`code=${A.error.code}`:null,A.error?.message?`message=${A.error.message}`:null,`networkState=${A.networkState}`,`readyState=${A.readyState}`,A.currentSrc?`src=${A.currentSrc}`:null].filter(Boolean).join(", ");q(new Error(`Failed to load video asset "${k}"${ci?` (${ci})`:""}.`))};Y=window.setTimeout(()=>{pe(),q(new Error(`Timed out loading video asset "${k}".`))},5e3),A.addEventListener("loadeddata",Le,{once:!0}),A.addEventListener("canplay",Le,{once:!0}),A.addEventListener("error",Be,{once:!0})}),be=async({key:A,sourceUrl:k,mimeType:L})=>{if($t.cache.has(A))return $t.cache.get(A);let q=document.createElement("video");q.crossOrigin="anonymous",q.preload="auto",q.playsInline=!0,q.setAttribute("playsinline",""),typeof L=="string"&&L.length>0&&(q.type=L);let H=de(q,A);q.src=k,q.load(),await H;let Y=B.from(q);return $t.cache.set(A,Y),Y},Se=(A,k,L)=>{n&&n.registerHotkeys(L?.keyboard??{}),A.renderer.events.cursorStyles||(A.renderer.events.cursorStyles={}),A.renderer.events.cursorStyles.default||(A.renderer.events.cursorStyles.default="default"),A.renderer.events.cursorStyles.hover||(A.renderer.events.cursorStyles.hover="pointer");let q=k?.cursorStyles,H=L?.cursorStyles;ye(q,H)||(H?(H.default&&(A.renderer.events.cursorStyles.default=H.default,A.canvas.style.cursor=H.default),H.hover&&(A.renderer.events.cursorStyles.hover=H.hover)):q&&(A.renderer.events.cursorStyles.default="default",A.renderer.events.cursorStyles.hover="pointer"))},et=(A,k,L,q)=>{if(ye(i,L)){typeof A.render=="function"&&A.render();return}let H=HI({prevState:i,nextState:L,activeAnimations:a.getContinuableAnimations()});h&&h.abort(),h=new AbortController;let Y=h.signal;l.reset(L.id),Se(A,i.global,L.global),a.cancelAllExcept(H.continuedAnimationIds),Fo({app:A,parent:k,prevComputedTree:i.elements,nextComputedTree:L.elements,animations:L.animations,elementPlugins:o.elements,animationBus:a,completionTracker:l,eventHandler:q,signal:Y}),a.flush(),p==="manual"&&m!==null&&a.setTime(m),tv({app:A,prevAudioTree:i.audio,nextAudioTree:L.audio,prevAudioEffects:i.audioEffects,nextAudioEffects:L.audioEffects,audioPlugins:o.audio}),i=L,typeof A.render=="function"&&A.render(),l.completeIfEmpty(),u||(u=!0,c&&c())},I={rendererName:"pixi",get canvas(){return e.canvas},findElementByLabel:A=>e.stage.getChildByLabel(A,!0)??null,extractBase64:async A=>{typeof e.render=="function"&&e.render();let k=new te(0,0,e.renderer.width,e.renderer.height);if(!A)return await e.renderer.extract.base64({target:e.stage,frame:k});let L=e.stage.getChildByLabel(A,!0);if(!L)throw new Error(`Element with label '${A}' not found`);return await e.renderer.extract.base64({target:L,frame:k})},assignStageEvent:(A,k)=>{e.stage.eventMode="static",e.stage.on(A,k)},setAnimationPlaybackMode:A=>{t(A),p=A,p!=="manual"&&(m=null,a?.clearTime?.())},setAnimationTime:A=>{let k=Number(A);if(!Number.isFinite(k))throw new Error("Animation time must be a finite number.");p==="manual"&&(m=k),a.flush(),a.setTime(k),p!=="manual"&&(m=null,a.clearTime()),typeof e.render=="function"&&e.render()},init:async A=>{let{eventHandler:k,plugins:L,width:q,height:H,backgroundColor:Y,debug:pe=!1,onFirstRender:Le,animationPlaybackMode:Be="auto"}=A;c=Le,t(Be),p=Be,m=null,x.forEach(Dt=>Dt()),x=[];let ci=[];L?.elements?.forEach(Dt=>{Dt?.parse&&ci.push(jO({type:Dt.type,parse:Dt.parse}))}),o={animations:L?.animations??[],elements:L?.elements??[],audio:L?.audio??[],parsers:ci},s=k,n=hL(k),l=fL(k),e=new nu,e.audioStage=r,await e.init({width:q,height:H,backgroundColor:Y,preference:"webgl",preserveDrawingBuffer:pe===!0}),typeof e.ticker?.remove=="function"&&e.ticker.remove(e.render,e),e.debug=pe,e.inputDomBridge=TL({app:e}),v=Dt=>{Dt.preventDefault()},e.canvas.addEventListener("contextmenu",v),g=new Ze,g.label="__route_graphics_background__",b(g,q,H,Y),e.stage.addChild(g),e.stage.width=q,e.stage.height=H,e.ticker.add(e.audioStage.tick),a=dL();let Xr=()=>{p==="manual"&&typeof e.render=="function"&&e.render()};return x=[a.on("started",Xr),a.on("completed",Xr),a.on("cancelled",Xr)],pe?(d=Dt=>{p==="auto"&&Dt?.detail?.deltaMS&&(a.tick(Number(Dt.detail.deltaMS)),typeof e.render=="function"&&e.render())},window.addEventListener("snapShotKeyFrame",d)):(f=Dt=>{p==="auto"&&(a.tick(Dt.deltaMS),typeof e.render=="function"&&e.render())},e.ticker.add(f)),I},destroy:()=>{h&&(h.abort(),h=void 0),d&&(window.removeEventListener("snapShotKeyFrame",d),d=void 0),f&&typeof e?.ticker?.remove=="function"&&(e.ticker.remove(f),f=void 0),v&&e?.canvas&&(e.canvas.removeEventListener("contextmenu",v),v=void 0),e?.inputDomBridge?.destroy?.(),n?.destroy(),Wb(),x.forEach(k=>k()),x=[],a&&a.destroy(),e?.audioStage&&e.audioStage.destroy();let A=k=>{for(let L of k.children){let q=L.texture?.source?.resource;q instanceof HTMLVideoElement&&q.pause(),L.children&&A(L)}};e?.stage&&(A(e.stage),Yt({app:e,root:e.stage})),e&&e.destroy(),p="auto",m=null,g=void 0,le()},loadAssets:async A=>{if(!A)throw new Error("assetBufferMap is required");let k={audio:{},font:{},video:{},texture:{}};for(let[H,Y]of Object.entries(A)){let pe=_(Y.type);k[pe][H]=Y}let L=[];Object.entries(k.audio).forEach(([H,Y])=>{L.push({includeInReturn:!1,promise:W({key:H,category:"audio",phase:"decode",asset:Y},async()=>(N(Y,"Audio"),oa.load(H,Y.buffer)))})}),Object.entries(k.font).forEach(([H,Y])=>{L.push({includeInReturn:!1,promise:W({key:H,category:"font",phase:"font face load",asset:Y},async()=>{N(Y,"Font");let pe=new Blob([Y.buffer],{type:Y.type}),Le=URL.createObjectURL(pe),Be=new FontFace(H,`url(${Le})`);try{await Be.load(),document.fonts.add(Be)}finally{URL.revokeObjectURL(Le)}})})}),Object.entries(k.texture).forEach(([H,Y])=>L.push({includeInReturn:!0,promise:W({key:H,category:"texture",phase:Y?.source==="url"&&typeof Y?.url=="string"?"Pixi URL load":"image bitmap creation",asset:Y},async()=>{if($t.cache.has(H))return $t.cache.get(H);if(Y?.source==="url"&&typeof Y?.url=="string")return $t.load({alias:H,src:Y.url});N(Y,"Texture");let pe=new Blob([Y.buffer],{type:Y.type}),Le=await createImageBitmap(pe),Be=B.from(Le);return $t.cache.set(H,Be),Be})})),Object.entries(k.video).forEach(([H,Y])=>{L.push({includeInReturn:!0,promise:W({key:H,category:"video",phase:"video texture load",asset:Y},async()=>{if($t.cache.has(H))return $t.cache.get(H);Y?.source!=="url"&&N(Y,"Video");let pe=Y?.source==="url"&&typeof Y?.url=="string"?Y.url:URL.createObjectURL(new Blob([Y.buffer],{type:Y.type})),Le=Y?.source!=="url";z(H,pe,{revokable:Le});try{return await be({key:H,sourceUrl:pe,mimeType:Y?.type})}catch(Be){throw y.delete(H),Le&&URL.revokeObjectURL(pe),Be}})})});let q=await Promise.allSettled(L.map(H=>H.promise));return D(q),q.map((H,Y)=>L[Y].includeInReturn&&H.status==="fulfilled"?H.value:void 0).filter(Boolean)},loadAudioAssets:async A=>Promise.all(A.map(async k=>{let q=await(await fetch(k)).arrayBuffer();return oa.load(k,q)})),updatedBackgroundColor:A=>{e.renderer.background.color=A,g&&b(g,e.renderer.width,e.renderer.height,A),typeof e.render=="function"&&e.render()},render:A=>{let k=F0(A),L=T0({JSONObject:k.elements,parserPlugins:o.parsers}),q={...k,elements:L};et(e,e.stage,q,s)},parse:A=>{let k=F0(A),L=T0({JSONObject:k.elements,parserPlugins:o.parsers});return{...k,elements:L}}};return I},SL=Z5;var lDe=SL;export{nu as Application,$t as Assets,oa as AudioAsset,U4 as animatedSpritePlugin,B4 as containerPlugin,M_ as createAnimationPlugin,IL as createAssetBufferManager,I_ as createAudioPlugin,dt as createElementPlugin,lDe as default,zH as inputPlugin,wW as particlesPlugin,aH as rectPlugin,tv as renderAudio,Fo as renderElements,MH as sliderPlugin,G4 as soundPlugin,fH as spritePlugin,QF as spritesheetAnimationPlugin,tH as textPlugin,k4 as textRevealingPlugin,O4 as tweenPlugin,mH as videoPlugin};
|
|
2065
|
+
`))}}var ZX=0,Um={textureCount:0,uboCount:0},Ws=class{constructor(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=ZX++}systemCheck(){if(!Mm())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(e){this.gl=e,this.reset()}bind(e,r){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;let i=e.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),r||(Um.textureCount=0,Um.uboCount=0,this.syncUniformGroup(e.uniformGroup,Um)),s}setUniforms(e){let r=this.shader.program,i=r.glPrograms[this.renderer.CONTEXT_UID];r.syncUniforms(i.uniformData,e,this.renderer)}syncUniformGroup(e,r){let i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,r))}syncUniforms(e,r,i){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(r.uniformData,e.uniforms,this.renderer,i)}createSyncGroups(e){let r=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[r]||(this.cache[r]=t0(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[r],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,r){let i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;let s=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,r);e.buffer.update(),s(i.uniformData,e.uniforms,this.renderer,Um,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[r])}createSyncBufferGroup(e,r,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);let o=this.gl.getUniformBlockIndex(r.program,i);r.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(r.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(e,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=u0(e,this.shader.program.uniformData)),e.autoManage){let l=new Float32Array(a.size/4);e.buffer.update(l)}return r.uniformGroups[e.id]=a.syncFunc,r.uniformGroups[e.id]}getSignature(e,r,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),r[n]&&o.push(r[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){let r=this.gl,i=e.program,s=c0(r,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};Ws.extension={type:ee.RendererSystem,name:"shader"};ae.add(Ws);var ss=class{constructor(e){this.renderer=e}run(e){let{renderer:r}=this;r.runners.init.emit(r.options),e.hello&&console.log(`PixiJS 7.4.3 - ${r.rendererLogId} - https://pixijs.com`),r.resize(r.screen.width,r.screen.height)}destroy(){}};ss.defaultOptions={hello:!1},ss.extension={type:[ee.RendererSystem,ee.CanvasRendererSystem],name:"startup"};ae.add(ss);function IO(t,e=[]){return e[he.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.ADD]=[t.ONE,t.ONE],e[he.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.NONE]=[0,0],e[he.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.ADD_NPM]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e[he.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[he.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[he.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[he.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[he.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[he.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[he.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[he.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[he.XOR]=[t.ONE_MINUS_DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[he.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}var QX=0,JX=1,e5=2,t5=3,r5=4,i5=5,BO=class h0{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=he.NONE,this._blendEq=!1,this.map=[],this.map[QX]=this.setBlend,this.map[JX]=this.setOffset,this.map[e5]=this.setCullFace,this.map[t5]=this.setDepthTest,this.map[r5]=this.setFrontFace,this.map[i5]=this.setDepthMask,this.checks=[],this.defaultState=new Ii,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=IO(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let r=this.stateId^e.data,i=0;for(;r;)r&1&&this.map[i].call(this,!!(e.data&1<<i)),r=r>>1,i++;this.stateId=e.data}for(let r=0;r<this.checks.length;r++)this.checks[r](this,e)}forceState(e){e=e||this.defaultState;for(let r=0;r<this.map.length;r++)this.map[r].call(this,!!(e.data&1<<r));for(let r=0;r<this.checks.length;r++)this.checks[r](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(h0.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(h0.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])}setBlendMode(e){if(e===this.blendMode)return;this.blendMode=e;let r=this.blendModes[e],i=this.gl;r.length===2?i.blendFunc(r[0],r[1]):i.blendFuncSeparate(r[0],r[1],r[2],r[3]),r.length===6?(this._blendEq=!0,i.blendEquationSeparate(r[4],r[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,r){this.gl.polygonOffset(e,r)}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(e,r){let i=this.checks.indexOf(e);r&&i===-1?this.checks.push(e):!r&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(e,r){e.setBlendMode(r.blendMode)}static checkPolygonOffset(e,r){e.setPolygonOffset(1,r.polygonOffset)}destroy(){this.gl=null}};BO.extension={type:ee.RendererSystem,name:"state"};var d0=BO;ae.add(d0);var nl=class extends Vo.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);let r=(e.priority??[]).filter(s=>e.systems[s]),i=[...r,...Object.keys(e.systems).filter(s=>!r.includes(s))];for(let s of i)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(r=>{this.runners[r]=new pt(r)})}addSystem(e,r){let i=new e(this);if(this[r])throw new Error(`Whoops! The name "${r}" is already in use`);this[r]=i,this._systemsHash[r]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(e,r){let i=Object.keys(this._systemsHash);e.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[e.name](r[o])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}};var dh=class Om{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=Om.defaultMaxIdle,this.checkCountMax=Om.defaultCheckCountMax,this.mode=Om.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==qp.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this.renderer.texture,r=e.managedTextures,i=!1;for(let s=0;s<r.length;s++){let o=r[s];o.resource&&this.count-o.touched>this.maxIdle&&(e.destroyTexture(o,!0),r[s]=null,i=!0)}if(i){let s=0;for(let o=0;o<r.length;o++)r[o]!==null&&(r[s++]=r[o]);r.length=s}}unload(e){let r=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&r.destroyTexture(i);for(let s=e.children.length-1;s>=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};dh.defaultMode=qp.AUTO,dh.defaultMaxIdle=60*60,dh.defaultCheckCountMax=60*10,dh.extension={type:ee.RendererSystem,name:"textureGC"};var ki=dh;ae.add(ki);var en=class{constructor(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=ge.UNSIGNED_BYTE,this.internalFormat=j.RGBA,this.samplerType=0}};function FO(t){let e;return"WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?e={[t.RGB]:Q.FLOAT,[t.RGBA]:Q.FLOAT,[t.ALPHA]:Q.FLOAT,[t.LUMINANCE]:Q.FLOAT,[t.LUMINANCE_ALPHA]:Q.FLOAT,[t.R8]:Q.FLOAT,[t.R8_SNORM]:Q.FLOAT,[t.RG8]:Q.FLOAT,[t.RG8_SNORM]:Q.FLOAT,[t.RGB8]:Q.FLOAT,[t.RGB8_SNORM]:Q.FLOAT,[t.RGB565]:Q.FLOAT,[t.RGBA4]:Q.FLOAT,[t.RGB5_A1]:Q.FLOAT,[t.RGBA8]:Q.FLOAT,[t.RGBA8_SNORM]:Q.FLOAT,[t.RGB10_A2]:Q.FLOAT,[t.RGB10_A2UI]:Q.FLOAT,[t.SRGB8]:Q.FLOAT,[t.SRGB8_ALPHA8]:Q.FLOAT,[t.R16F]:Q.FLOAT,[t.RG16F]:Q.FLOAT,[t.RGB16F]:Q.FLOAT,[t.RGBA16F]:Q.FLOAT,[t.R32F]:Q.FLOAT,[t.RG32F]:Q.FLOAT,[t.RGB32F]:Q.FLOAT,[t.RGBA32F]:Q.FLOAT,[t.R11F_G11F_B10F]:Q.FLOAT,[t.RGB9_E5]:Q.FLOAT,[t.R8I]:Q.INT,[t.R8UI]:Q.UINT,[t.R16I]:Q.INT,[t.R16UI]:Q.UINT,[t.R32I]:Q.INT,[t.R32UI]:Q.UINT,[t.RG8I]:Q.INT,[t.RG8UI]:Q.UINT,[t.RG16I]:Q.INT,[t.RG16UI]:Q.UINT,[t.RG32I]:Q.INT,[t.RG32UI]:Q.UINT,[t.RGB8I]:Q.INT,[t.RGB8UI]:Q.UINT,[t.RGB16I]:Q.INT,[t.RGB16UI]:Q.UINT,[t.RGB32I]:Q.INT,[t.RGB32UI]:Q.UINT,[t.RGBA8I]:Q.INT,[t.RGBA8UI]:Q.UINT,[t.RGBA16I]:Q.INT,[t.RGBA16UI]:Q.UINT,[t.RGBA32I]:Q.INT,[t.RGBA32UI]:Q.UINT,[t.DEPTH_COMPONENT16]:Q.FLOAT,[t.DEPTH_COMPONENT24]:Q.FLOAT,[t.DEPTH_COMPONENT32F]:Q.FLOAT,[t.DEPTH_STENCIL]:Q.FLOAT,[t.DEPTH24_STENCIL8]:Q.FLOAT,[t.DEPTH32F_STENCIL8]:Q.FLOAT}:e={[t.RGB]:Q.FLOAT,[t.RGBA]:Q.FLOAT,[t.ALPHA]:Q.FLOAT,[t.LUMINANCE]:Q.FLOAT,[t.LUMINANCE_ALPHA]:Q.FLOAT,[t.DEPTH_STENCIL]:Q.FLOAT},e}function kO(t){let e;return"WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?e={[ge.UNSIGNED_BYTE]:{[j.RGBA]:t.RGBA8,[j.RGB]:t.RGB8,[j.RG]:t.RG8,[j.RED]:t.R8,[j.RGBA_INTEGER]:t.RGBA8UI,[j.RGB_INTEGER]:t.RGB8UI,[j.RG_INTEGER]:t.RG8UI,[j.RED_INTEGER]:t.R8UI,[j.ALPHA]:t.ALPHA,[j.LUMINANCE]:t.LUMINANCE,[j.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[ge.BYTE]:{[j.RGBA]:t.RGBA8_SNORM,[j.RGB]:t.RGB8_SNORM,[j.RG]:t.RG8_SNORM,[j.RED]:t.R8_SNORM,[j.RGBA_INTEGER]:t.RGBA8I,[j.RGB_INTEGER]:t.RGB8I,[j.RG_INTEGER]:t.RG8I,[j.RED_INTEGER]:t.R8I},[ge.UNSIGNED_SHORT]:{[j.RGBA_INTEGER]:t.RGBA16UI,[j.RGB_INTEGER]:t.RGB16UI,[j.RG_INTEGER]:t.RG16UI,[j.RED_INTEGER]:t.R16UI,[j.DEPTH_COMPONENT]:t.DEPTH_COMPONENT16},[ge.SHORT]:{[j.RGBA_INTEGER]:t.RGBA16I,[j.RGB_INTEGER]:t.RGB16I,[j.RG_INTEGER]:t.RG16I,[j.RED_INTEGER]:t.R16I},[ge.UNSIGNED_INT]:{[j.RGBA_INTEGER]:t.RGBA32UI,[j.RGB_INTEGER]:t.RGB32UI,[j.RG_INTEGER]:t.RG32UI,[j.RED_INTEGER]:t.R32UI,[j.DEPTH_COMPONENT]:t.DEPTH_COMPONENT24},[ge.INT]:{[j.RGBA_INTEGER]:t.RGBA32I,[j.RGB_INTEGER]:t.RGB32I,[j.RG_INTEGER]:t.RG32I,[j.RED_INTEGER]:t.R32I},[ge.FLOAT]:{[j.RGBA]:t.RGBA32F,[j.RGB]:t.RGB32F,[j.RG]:t.RG32F,[j.RED]:t.R32F,[j.DEPTH_COMPONENT]:t.DEPTH_COMPONENT32F},[ge.HALF_FLOAT]:{[j.RGBA]:t.RGBA16F,[j.RGB]:t.RGB16F,[j.RG]:t.RG16F,[j.RED]:t.R16F},[ge.UNSIGNED_SHORT_5_6_5]:{[j.RGB]:t.RGB565},[ge.UNSIGNED_SHORT_4_4_4_4]:{[j.RGBA]:t.RGBA4},[ge.UNSIGNED_SHORT_5_5_5_1]:{[j.RGBA]:t.RGB5_A1},[ge.UNSIGNED_INT_2_10_10_10_REV]:{[j.RGBA]:t.RGB10_A2,[j.RGBA_INTEGER]:t.RGB10_A2UI},[ge.UNSIGNED_INT_10F_11F_11F_REV]:{[j.RGB]:t.R11F_G11F_B10F},[ge.UNSIGNED_INT_5_9_9_9_REV]:{[j.RGB]:t.RGB9_E5},[ge.UNSIGNED_INT_24_8]:{[j.DEPTH_STENCIL]:t.DEPTH24_STENCIL8},[ge.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[j.DEPTH_STENCIL]:t.DEPTH32F_STENCIL8}}:e={[ge.UNSIGNED_BYTE]:{[j.RGBA]:t.RGBA,[j.RGB]:t.RGB,[j.ALPHA]:t.ALPHA,[j.LUMINANCE]:t.LUMINANCE,[j.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[ge.UNSIGNED_SHORT_5_6_5]:{[j.RGB]:t.RGB},[ge.UNSIGNED_SHORT_4_4_4_4]:{[j.RGBA]:t.RGBA},[ge.UNSIGNED_SHORT_5_5_5_1]:{[j.RGBA]:t.RGBA}},e}var al=class{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Pe,this.hasIntegerTextures=!1}contextChange(){let e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=kO(e),this.samplerTypes=FO(e);let r=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=r;for(let s=0;s<r;s++)this.boundTextures[s]=null;this.emptyTextures={};let i=new en(e.createTexture());e.bindTexture(e.TEXTURE_2D,i.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=i,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new en(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(e,r=0){let{gl:i}=this;if(e=e?.castToBaseTexture(),e?.valid&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;let s=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[r]!==e&&(this.currentLocation!==r&&(this.currentLocation=r,i.activeTexture(i.TEXTURE0+r)),i.bindTexture(e.target,s.texture)),s.dirtyId!==e.dirtyId?(this.currentLocation!==r&&(this.currentLocation=r,i.activeTexture(i.TEXTURE0+r)),this.updateTexture(e)):s.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[r]=e}else this.currentLocation!==r&&(this.currentLocation=r,i.activeTexture(i.TEXTURE0+r)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[r]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture}unbind(e){let{gl:r,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]===e&&(this.currentLocation!==s&&(r.activeTexture(r.TEXTURE0+s),this.currentLocation=s),r.bindTexture(e.target,this.emptyTextures[e.target].texture),i[s]=null)}ensureSamplerType(e){let{boundTextures:r,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let o=e-1;o>=0;--o){let n=r[o];n&&n._glTextures[s].samplerType!==Q.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(e){let r=new en(this.gl.createTexture());return r.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=r,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),r}initTextureType(e,r){r.internalFormat=this.internalFormats[e.type]?.[e.format]??e.format,r.samplerType=this.samplerTypes[r.internalFormat]??Q.FLOAT,this.webGLVersion===2&&e.type===ge.HALF_FLOAT?r.type=this.gl.HALF_FLOAT:r.type=e.type}updateTexture(e){let r=e._glTextures[this.CONTEXT_UID];if(!r)return;let i=this.renderer;if(this.initTextureType(e,r),e.resource?.upload(i,e,r))r.samplerType!==Q.FLOAT&&(this.hasIntegerTextures=!0);else{let s=e.realWidth,o=e.realHeight,n=i.gl;(r.width!==s||r.height!==o||r.dirtyId<0)&&(r.width=s,r.height=o,n.texImage2D(e.target,0,r.internalFormat,s,o,0,e.format,r.type,null))}e.dirtyStyleId!==r.dirtyStyleId&&this.updateTextureStyle(e),r.dirtyId=e.dirtyId}destroyTexture(e,r){let{gl:i}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!r)){let s=this.managedTextures.indexOf(e);s!==-1&&Vv(this.managedTextures,s,1)}}updateTextureStyle(e){let r=e._glTextures[this.CONTEXT_UID];r&&((e.mipmap===ti.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?r.mipmap=!1:r.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?r.wrapMode=Mu.CLAMP:r.wrapMode=e.wrapMode,e.resource?.style(this.renderer,e,r)||this.setStyle(e,r),r.dirtyStyleId=e.dirtyStyleId)}setStyle(e,r){let i=this.gl;if(r.mipmap&&e.mipmap!==ti.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,r.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,r.wrapMode),r.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===Vr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===Vr.LINEAR){let o=Math.min(e.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===Vr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===Vr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};al.extension={type:ee.RendererSystem,name:"texture"};ae.add(al);var ll=class{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){let{gl:r,CONTEXT_UID:i}=this,s=e._glTransformFeedbacks[i]||this.createGLTransformFeedback(e);r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,r){let{gl:i,renderer:s}=this;r&&s.shader.bind(r),i.beginTransformFeedback(e)}endTransformFeedback(){let{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){let{gl:r,renderer:i,CONTEXT_UID:s}=this,o=r.createTransformFeedback();e._glTransformFeedbacks[s]=o,r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,o);for(let n=0;n<e.buffers.length;n++){let a=e.buffers[n];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),o}disposeTransformFeedback(e,r){let i=e._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<e.buffers.length;n++){let a=e.buffers[n];if(!a)continue;let l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!r&&o.dispose(a,r))}i&&(r||s.deleteTransformFeedback(i),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};ll.extension={type:ee.RendererSystem,name:"transformFeedback"};ae.add(ll);var os=class{constructor(e){this.renderer=e}init(e){this.screen=new Ie(0,0,e.width,e.height),this.element=e.view||ne.ADAPTER.createCanvas(),this.resolution=e.resolution||ne.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,r){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(r*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(e){e&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};os.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},os.extension={type:[ee.RendererSystem,ee.CanvasRendererSystem],name:"_view"};ae.add(os);ne.PREFER_ENV=Sr.WEBGL2;ne.STRICT_TEXTURE_CACHE=!1;ne.RENDER_OPTIONS={...is.defaultOptions,...rs.defaultOptions,...os.defaultOptions,...ss.defaultOptions};Object.defineProperties(ne,{WRAP_MODE:{get(){return Pe.defaultOptions.wrapMode},set(t){we("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),Pe.defaultOptions.wrapMode=t}},SCALE_MODE:{get(){return Pe.defaultOptions.scaleMode},set(t){we("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),Pe.defaultOptions.scaleMode=t}},MIPMAP_TEXTURES:{get(){return Pe.defaultOptions.mipmap},set(t){we("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),Pe.defaultOptions.mipmap=t}},ANISOTROPIC_LEVEL:{get(){return Pe.defaultOptions.anisotropicLevel},set(t){we("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),Pe.defaultOptions.anisotropicLevel=t}},FILTER_RESOLUTION:{get(){return we("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Fi.defaultResolution},set(t){Fi.defaultResolution=t}},FILTER_MULTISAMPLE:{get(){return we("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Fi.defaultMultisample},set(t){Fi.defaultMultisample=t}},SPRITE_MAX_TEXTURES:{get(){return ts.defaultMaxTextures},set(t){we("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ts.defaultMaxTextures=t}},SPRITE_BATCH_SIZE:{get(){return ts.defaultBatchSize},set(t){we("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ts.defaultBatchSize=t}},CAN_UPLOAD_SAME_BUFFER:{get(){return ts.canUploadSameBuffer},set(t){we("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ts.canUploadSameBuffer=t}},GC_MODE:{get(){return ki.defaultMode},set(t){we("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),ki.defaultMode=t}},GC_MAX_IDLE:{get(){return ki.defaultMaxIdle},set(t){we("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),ki.defaultMaxIdle=t}},GC_MAX_CHECK_COUNT:{get(){return ki.defaultCheckCountMax},set(t){we("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),ki.defaultCheckCountMax=t}},PRECISION_VERTEX:{get(){return $r.defaultVertexPrecision},set(t){we("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),$r.defaultVertexPrecision=t}},PRECISION_FRAGMENT:{get(){return $r.defaultFragmentPrecision},set(t){we("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),$r.defaultFragmentPrecision=t}}});var tn=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(tn||{});var cl=class{constructor(e,r=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=r,this.priority=i,this.once=s}match(e,r=null){return this.fn===e&&this.context===r}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));let r=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),r}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!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 r=this.next;return this.next=e?null:r,this.previous=null,r}};var UO=class Cr{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 cl(null,null,1/0),this.deltaMS=1/Cr.targetFPMS,this.elapsedMS=1/Cr.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,r,i=tn.NORMAL){return this._addListener(new cl(e,r,i))}addOnce(e,r,i=tn.NORMAL){return this._addListener(new cl(e,r,i,!0))}_addListener(e){let r=this._head.next,i=this._head;if(!r)e.connect(i);else{for(;r;){if(e.priority>r.priority){e.connect(i);break}i=r,r=r.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,r){let i=this._head.next;for(;i;)i.match(e,r)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,r=this._head;for(;r=r.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let r;if(e>this.lastTime){if(r=this.elapsedMS=e-this.lastTime,r>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){let o=e-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=e-o%this._minElapsedMS}this.deltaMS=r,this.deltaTime=this.deltaMS*Cr.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=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){let r=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,r)/1e3,Cr.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{let r=Math.max(this.minFPS,e);this._minElapsedMS=1/(r/1e3)}}static get shared(){if(!Cr._shared){let e=Cr._shared=new Cr;e.autoStart=!0,e._protected=!0}return Cr._shared}static get system(){if(!Cr._system){let e=Cr._system=new Cr;e.autoStart=!0,e._protected=!0}return Cr._system}};UO.targetFPMS=.06;var zr=UO;Object.defineProperties(ne,{TARGET_FPMS:{get(){return zr.targetFPMS},set(t){we("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),zr.targetFPMS=t}}});var fh=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(r){this._ticker&&this._ticker.remove(this.render,this),this._ticker=r,r&&r.add(this.render,this,tn.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?zr.shared:new zr,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};fh.extension=ee.Application;ae.add(fh);var s5=[];ae.handleByList(ee.Renderer,s5);var ph=class{constructor(e){this.renderer=e}contextChange(e){let r;if(this.renderer.context.webGLVersion===1){let i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),r=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{let i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),r=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}r>=We.HIGH?this.multisample=We.HIGH:r>=We.MEDIUM?this.multisample=We.MEDIUM:r>=We.LOW?this.multisample=We.LOW:this.multisample=We.NONE}destroy(){}};ph.extension={type:ee.RendererSystem,name:"_multisample"};ae.add(ph);var Lm=class{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var mh=class{constructor(e){this.renderer=e,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(e){let{gl:r,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);r.bindBuffer(e.type,s.buffer)}unbind(e){let{gl:r}=this;r.bindBuffer(e,null)}bindBufferBase(e,r){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[r]!==e){let o=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[r]=e,i.bindBufferBase(i.UNIFORM_BUFFER,r,o.buffer)}}bindBufferRange(e,r,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=e._glBuffers[o]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,r||0,n.buffer,i*256,256)}update(e){let{gl:r,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,r.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)r.bufferSubData(e.type,0,e.data);else{let o=e.static?r.STATIC_DRAW:r.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,r.bufferData(e.type,e.data,o)}}dispose(e,r){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];let i=e._glBuffers[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this),i&&(r||s.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){let r=Object.keys(this.managedBuffers);for(let i=0;i<r.length;i++)this.dispose(this.managedBuffers[r[i]],e)}createGLBuffer(e){let{CONTEXT_UID:r,gl:i}=this;return e._glBuffers[r]=new Lm(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[r]}};mh.extension={type:ee.RendererSystem,name:"buffer"};ae.add(mh);var gh=class{constructor(e){this.renderer=e}render(e,r){let i=this.renderer,s,o,n,a;if(r&&(s=r.renderTexture,o=r.clear,n=r.transform,a=r.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.isLost){if(s||(this.lastObjectRendered=e),!a){let l=e.enableTempParent();e.updateTransform(),e.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(o??i.background.clearBeforeRender)&&i.renderTexture.clear(),e.render(i),i.batch.currentRenderer.flush(),s&&(r.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}};gh.extension={type:ee.RendererSystem,name:"objectRenderer"};ae.add(gh);var Gm=class f0 extends nl{constructor(e){super(),this.type=rv.WEBGL,e=Object.assign({},ne.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Pr({projectionMatrix:new qe},!0);let r={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:f0.__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(r),"useContextAlpha"in e&&(we("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=f0.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e?.forceCanvas?!1:Dv()}render(e,r){this.objectRenderer.render(e,r)}resize(e,r){this._view.resizeView(e,r)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),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(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}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 we("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return we("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return we("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return we("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){we("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return we("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){we("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return we("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,r){return this.textureGenerator.generateTexture(e,r)}};Gm.extension={type:ee.Renderer,priority:1},Gm.__plugins={},Gm.__systems={};var Dm=Gm;ae.handleByMap(ee.RendererPlugin,Dm.__plugins);ae.handleByMap(ee.RendererSystem,Dm.__systems);ae.add(Dm);var $s=class extends Ar{constructor(e,r){let{width:i,height:s}=r||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<e;o++){let n=new Pe;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=e,this._load=null,this.baseTexture=null}initFromArray(e,r){for(let i=0;i<this.length;i++)e[i]&&(e[i].castToBaseTexture?this.addBaseTextureAt(e[i].castToBaseTexture(),i):e[i]instanceof Ar?this.addResourceAt(e[i],i):this.addResourceAt($a(e[i],r),i))}dispose(){for(let e=0,r=this.length;e<r;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(e,r){if(!this.items[r])throw new Error(`Index ${r} is out of bounds`);return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[r].setResource(e),this}bind(e){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(e);for(let r=0;r<this.length;r++)this.items[r].parentTextureArray=e,this.items[r].on("update",e.update,e)}unbind(e){super.unbind(e);for(let r=0;r<this.length;r++)this.items[r].parentTextureArray=null,this.items[r].off("update",e.update,e)}load(){if(this._load)return this._load;let e=this.items.map(r=>r.resource).filter(r=>r).map(r=>r.load());return this._load=Promise.all(e).then(()=>{let{realWidth:r,realHeight:i}=this.items[0];return this.resize(r,i),this.update(),Promise.resolve(this)}),this._load}};var xh=class extends $s{constructor(e,r){let{width:i,height:s}=r||{},o,n;Array.isArray(e)?(o=e,n=e.length):n=e,super(n,{width:i,height:s}),o&&this.initFromArray(o,r)}addBaseTextureAt(e,r){if(e.resource)this.addResourceAt(e.resource,r);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=Ki.TEXTURE_2D_ARRAY}upload(e,r,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=e;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,r.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,r.format,i.type,c.resource.source))}return!0}};var yh=class extends Pt{constructor(e){super(e)}static test(e){let{OffscreenCanvas:r}=globalThis;return r&&e instanceof r?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}};var OO=class _h extends $s{constructor(e,r){let{width:i,height:s,autoLoad:o,linkBaseTexture:n}=r||{};if(e&&e.length!==_h.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<_h.SIDES;a++)this.items[a].target=Ki.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,e&&this.initFromArray(e,r),o!==!1&&this.load()}bind(e){super.bind(e),e.target=Ki.TEXTURE_CUBE_MAP}addBaseTextureAt(e,r,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[r])throw new Error(`Index ${r} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,r);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=Ki.TEXTURE_CUBE_MAP_POSITIVE_X+r,e.parentTextureArray=this.baseTexture,this.items[r]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[r]=e,this}upload(e,r,i){let s=this.itemDirtyIds;for(let o=0;o<_h.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||i.dirtyId<r.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(e,n,i),s[o]=n.dirtyId):s[o]<-1&&(e.gl.texImage2D(n.target,0,i.internalFormat,r.realWidth,r.realHeight,0,r.format,i.type,null),s[o]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===_h.SIDES}};OO.SIDES=6;var p0=OO;var bh=class t extends Pt{constructor(e,r){r=r||{};let i,s,o;typeof e=="string"?(i=t.EMPTY,s=e,o=!0):(i=e,s=null,o=!1),super(i),this.url=s,this.crossOrigin=r.crossOrigin??!0,this.alphaMode=typeof r.alphaMode=="number"?r.alphaMode:null,this.ownsImageBitmap=r.ownsImageBitmap??o,this._load=null,r.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(e,r)=>{if(this.url===null){e(this);return}try{let i=await ne.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===wr.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),e(this)}catch(i){if(this.destroyed)return;r(i),this.onError.emit(i)}}),this._load)}upload(e,r,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(r.alphaMode=this.alphaMode),super.upload(e,r,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof e=="string"||e instanceof ImageBitmap)}static get EMPTY(){return t._EMPTY=t._EMPTY??ne.ADAPTER.createCanvas(0,0),t._EMPTY}};var m0=class Nm extends Pt{constructor(e,r){r=r||{},super(ne.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=r.scale||1,this._overrideWidth=r.width,this._overrideHeight=r.height,this._resolve=null,this._crossorigin=r.crossorigin,this._load=null,r.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},Nm.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 e=new Image;Pt.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=r=>{this._resolve&&(e.onerror=null,this.onError.emit(r))},e.onload=()=>{if(!this._resolve)return;let r=e.width,i=e.height;if(!r||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=r*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*r,o=this._overrideHeight||this._overrideWidth/r*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${Qi()}`,n.getContext("2d").drawImage(e,0,0,r,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(e){let r=Nm.SVG_SIZE.exec(e),i={};return r&&(i[r[1]]=Math.round(parseFloat(r[3])),i[r[5]]=Math.round(parseFloat(r[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,r){return r==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&Nm.SVG_XML.test(e)}};m0.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,m0.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var g0=m0;var Vm=class extends Pt{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}};var x0=class y0 extends Pt{constructor(e,r){if(r=r||{},!(e instanceof HTMLVideoElement)){let i=document.createElement("video");r.autoLoad!==!1&&i.setAttribute("preload","auto"),r.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),r.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),r.loop===!0&&i.setAttribute("loop",""),r.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);let s=e[0].src||e[0];Pt.crossOrigin(i,s,r.crossorigin);for(let o=0;o<e.length;++o){let n=document.createElement("source"),{src:a,mime:l}=e[o];if(a=a||e[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let c=a.split("?").shift().toLowerCase(),u=c.slice(c.lastIndexOf(".")+1);l=l||y0.MIME_TYPES[u]||`video/${u}`}n.src=a,l&&(n.type=l),i.appendChild(n)}e=i}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=r.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=r.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),r.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){if(this._updateFPS){let r=zr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-r)}(!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 e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise((r,i)=>{this.valid?r(this):(this._resolve=r,this._reject=i,e.load())}),this._load}_onError(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.source;return!e.paused&&!e.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 e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);let r=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!r&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._configureAutoUpdate();let e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(zr.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||(zr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(zr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,r){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||y0.TYPES.includes(r)}};x0.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],x0.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var _0=x0;zu.push(bh,Ko,yh,_0,Vm,g0,Ho,p0,xh);var o5={vec3(t,e,r,i){(r[0]!==i[0]||r[1]!==i[1]||r[2]!==i[2])&&(r[0]=i[0],r[1]=i[1],r[2]=i[2],t.uniform3f(e,i[0],i[1],i[2]))},int(t,e,r,i){t.uniform1i(e,i)},ivec2(t,e,r,i){t.uniform2i(e,i[0],i[1])},ivec3(t,e,r,i){t.uniform3i(e,i[0],i[1],i[2])},ivec4(t,e,r,i){t.uniform4i(e,i[0],i[1],i[2],i[3])},uint(t,e,r,i){t.uniform1ui(e,i)},uvec2(t,e,r,i){t.uniform2ui(e,i[0],i[1])},uvec3(t,e,r,i){t.uniform3ui(e,i[0],i[1],i[2])},uvec4(t,e,r,i){t.uniform4ui(e,i[0],i[1],i[2],i[3])},bvec2(t,e,r,i){t.uniform2i(e,i[0],i[1])},bvec3(t,e,r,i){t.uniform3i(e,i[0],i[1],i[2])},bvec4(t,e,r,i){t.uniform4i(e,i[0],i[1],i[2],i[3])},mat2(t,e,r,i){t.uniformMatrix2fv(e,!1,i)},mat4(t,e,r,i){t.uniformMatrix4fv(e,!1,i)}},n5={float(t,e,r,i){t.uniform1fv(e,i)},vec2(t,e,r,i){t.uniform2fv(e,i)},vec3(t,e,r,i){t.uniform3fv(e,i)},vec4(t,e,r,i){t.uniform4fv(e,i)},int(t,e,r,i){t.uniform1iv(e,i)},ivec2(t,e,r,i){t.uniform2iv(e,i)},ivec3(t,e,r,i){t.uniform3iv(e,i)},ivec4(t,e,r,i){t.uniform4iv(e,i)},uint(t,e,r,i){t.uniform1uiv(e,i)},uvec2(t,e,r,i){t.uniform2uiv(e,i)},uvec3(t,e,r,i){t.uniform3uiv(e,i)},uvec4(t,e,r,i){t.uniform4uiv(e,i)},bool(t,e,r,i){t.uniform1iv(e,i)},bvec2(t,e,r,i){t.uniform2iv(e,i)},bvec3(t,e,r,i){t.uniform3iv(e,i)},bvec4(t,e,r,i){t.uniform4iv(e,i)},sampler2D(t,e,r,i){t.uniform1iv(e,i)},samplerCube(t,e,r,i){t.uniform1iv(e,i)},sampler2DArray(t,e,r,i){t.uniform1iv(e,i)}};function LO(t,e,r,i,s){let o=0,n=null,a=null,l=s.gl;for(let c in t.uniforms){let u=e[c],h=i[c],d=r[c],f=t.uniforms[c];if(!u){f.group===!0&&s.shader.syncUniformGroup(h);continue}u.type==="float"&&u.size===1&&!u.isArray?h!==d.value&&(d.value=h,l.uniform1f(d.location,h)):u.type==="bool"&&u.size===1&&!u.isArray?h!==d.value&&(d.value=h,l.uniform1i(d.location,Number(h))):(u.type==="sampler2D"||u.type==="samplerCube"||u.type==="sampler2DArray")&&u.size===1&&!u.isArray?(s.texture.bind(h,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):u.type==="mat3"&&u.size===1&&!u.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,h.toArray(!0)):l.uniformMatrix3fv(d.location,!1,h):u.type==="vec2"&&u.size===1&&!u.isArray?f.x!==void 0?(a=d.value,n=h,(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=h,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):u.type==="vec4"&&u.size===1&&!u.isArray?f.width!==void 0?(a=d.value,n=h,(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=h,(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]))):(u.size===1&&!u.isArray?o5:n5)[u.type].call(null,l,d.location,d.value,h)}}function a5(){Object.assign(Ws.prototype,{systemCheck(){},syncUniforms(t,e){let{shader:r,renderer:i}=this;LO(t,r.program.uniformData,e.uniformData,t.uniforms,i)}})}a5();var b0="__route_graphics_audio_root__",vh="__route_graphics_audio_direct__",Hm,ni=()=>{if(Hm)return Hm;let t=globalThis.window?.AudioContext??globalThis.window?.webkitAudioContext;if(!t)throw new Error("AudioContext is not available in this environment.");return Hm=new t,Hm},sn=(t,e)=>{t&&e&&typeof t.connect=="function"&&t.connect(e)},rn=t=>{t&&typeof t.disconnect=="function"&&t.disconnect()},Wm=(t,e=0)=>{let r=Number(t);return Number.isFinite(r)?r:e},HO=(t,e=0)=>Wm(t?.value,e),WO=(t=ni())=>{t.state==="suspended"&&typeof t.resume=="function"&&t.resume().catch(()=>{})},zs=(t,e,r=ni())=>{if(!t)return;let i=Wm(e,HO(t));typeof t.cancelScheduledValues=="function"&&t.cancelScheduledValues(r.currentTime),typeof t.setValueAtTime=="function"?t.setValueAtTime(i,r.currentTime):t.value=i},l5=(t,e,r,i=ni())=>{if(!t)return;let s=i.currentTime,o=Math.max(0,Wm(r,0))/1e3,n=HO(t),a=Wm(e,n);typeof t.cancelScheduledValues=="function"&&t.cancelScheduledValues(s),typeof t.setValueAtTime=="function"?t.setValueAtTime(n,s):t.value=n,o>0&&typeof t.linearRampToValueAtTime=="function"?t.linearRampToValueAtTime(a,s+o):typeof t.setValueAtTime=="function"?t.setValueAtTime(a,s+o):t.value=a},$O=(t=1)=>{let e=ni(),r=e.createGain();return zs(r.gain,t,e),r},zO=(t=0)=>{let e=ni();if(typeof e.createStereoPanner!="function")return null;let r=e.createStereoPanner();return zs(r.pan,t,e),r},oi=({volume:t,muted:e})=>e?0:je(t,100),c5=(t,e=1)=>{let r=Number(e),i=Number.isFinite(r)?r:1,s=Number(t??i),o=Number.isFinite(s)?s:i;return je(o*100,i*100)*100},Th=(t=[],e,r,i)=>t.find(o=>(o.type==="audio-transition"||o.type==="audioTransition")&&o.targetId===e)?.properties?.[r]?.[i]??null,ns=({gainNode:t,targetValue:e,transition:r})=>{if(!r)return zs(t.gain,e),0;let i=r.from!==void 0?je(r.from,100):void 0,s=r.to!==void 0?je(r.to,100):e;return i!==void 0&&zs(t.gain,i),l5(t.gain,s,r.duration),r.duration},v0=(t,e)=>{let r=$O(oi(t)),i=zO(t.pan??0);return sn(r,i??e),i&&sn(i,e),{id:t.id,gainNode:r,pannerNode:i,volume:t.volume??100,muted:t.muted??!1,pan:t.pan??0,outputNode:e,cleanupTimeoutId:null}},u5=({sound:t,channelNode:e,internalId:r})=>{let i=$O(oi(t)),s=zO(t.pan??0);return sn(i,s??e),s&&sn(s,e),{internalId:r,id:t.id,src:t.src,url:t.src,loop:t.loop??!1,volume:t.volume??100,muted:t.muted??!1,pan:t.pan??0,startDelayMs:t.startDelayMs??0,playbackRate:t.playbackRate??1,startAt:t.startAt??0,endAt:t.endAt??null,channelId:t.channelId??null,gainNode:i,pannerNode:s,source:null,pendingTimeoutId:null,cleanupTimeoutId:null}},h5=t=>{let e=ni();WO(e);let r=oa.getAsset(t.src);if(!r)return console.warn("AudioStage: asset not found",t.src),null;let i=e.createBufferSource();i.buffer=r,i.loop=t.loop??!1,i.playbackRate&&zs(i.playbackRate,t.playbackRate??1,e),sn(i,t.gainNode);let s=t.startAt??0,o=t.endAt!==null&&t.endAt!==void 0?Math.max(t.endAt-s,0):void 0;return i.loop&&t.endAt!==null&&t.endAt!==void 0?(i.loopStart=s,i.loopEnd=t.endAt,i.start(0,s)):o!==void 0?i.start(0,s,o):i.start(0,s),i},GO=t=>{t.pendingTimeoutId!==null&&(clearTimeout(t.pendingTimeoutId),t.pendingTimeoutId=null),WO(ni());let e=()=>{t.pendingTimeoutId=null,t.source=h5(t)};if(t.startDelayMs>0){t.pendingTimeoutId=setTimeout(e,t.startDelayMs);return}e()},XO=(t,e=0)=>{if(t.pendingTimeoutId!==null&&(clearTimeout(t.pendingTimeoutId),t.pendingTimeoutId=null),!t.source)return;let r=ni();try{t.source.stop(r.currentTime+e/1e3)}catch{}},DO=t=>{t.pendingTimeoutId!==null&&(clearTimeout(t.pendingTimeoutId),t.pendingTimeoutId=null),t.cleanupTimeoutId!==null&&(clearTimeout(t.cleanupTimeoutId),t.cleanupTimeoutId=null),XO(t),rn(t.source),rn(t.gainNode),rn(t.pannerNode)},NO=t=>{t.cleanupTimeoutId!==null&&(clearTimeout(t.cleanupTimeoutId),t.cleanupTimeoutId=null),rn(t.gainNode),rn(t.pannerNode)},VO=(t,e)=>e<=0?(t(),null):setTimeout(t,e);var YO=()=>{let t=new Map,e=new Map,r=new Map,i=new Map,s=0,o=g=>{let b=t.get(g);if(b)return b;let _=v0({id:g,volume:100,muted:!1,pan:0},ni().destination);return t.set(g,_),_},n=(g,b,_)=>{let S=t.get(g.id),E=Th(b,g.id,"volume",_);if(S&&S.cleanupTimeoutId!==null){let C=v0(g,ni().destination);return t.set(g.id,C),ns({gainNode:C.gainNode,targetValue:oi(g),transition:E}),C}if(S){let C=oi(S),M=oi(g),R=C!==M,F=S.pan!==(g.pan??0);return S.volume=g.volume,S.muted=g.muted,S.pan=g.pan,R&&E?ns({gainNode:S.gainNode,targetValue:M,transition:E}):R&&ns({gainNode:S.gainNode,targetValue:M,transition:null}),F&&S.pannerNode?.pan&&zs(S.pannerNode.pan,g.pan??0),S}let P=v0(g,ni().destination);return t.set(g.id,P),ns({gainNode:P.gainNode,targetValue:oi(g),transition:E}),P},a=g=>{let b=g.channelId!==null?t.get(g.channelId):o(b0);if(!b)throw new Error(`Input error: sound "${g.id}" references missing channel.`);return b},l=(g,b)=>{rn(g.gainNode),rn(g.pannerNode),sn(g.gainNode,g.pannerNode??b),g.pannerNode&&sn(g.pannerNode,b)},c=(g,b)=>{if(!g||g.id===b0||g.id===vh)return 0;let _=Th(b,g.id,"volume","exit");return ns({gainNode:g.gainNode,targetValue:oi(g),transition:_})},u=({sound:g,effects:b,phase:_,internalId:S})=>{let E=a(g),P=u5({sound:g,channelNode:E.gainNode,internalId:S});e.set(S,P),r.set(g.id,S);let C=Th(b,g.id,"volume",_);return ns({gainNode:P.gainNode,targetValue:oi(g),transition:C}),GO(P),P},h=(g,b,_=0)=>{if(!g)return 0;let S=Th(b,g.id,"volume","exit"),E=ns({gainNode:g.gainNode,targetValue:oi(g),transition:S}),P=Math.max(E,_);return XO(g,P),g.cleanupTimeoutId=VO(()=>{DO(g),e.delete(g.internalId)},P),P},d=({instance:g,sound:b,effects:_})=>{let S=oi(g),E=oi(b),P=S!==E,C=g.startDelayMs!==b.startDelayMs;if(g.channelId!==b.channelId){let R=a(b);l(g,R.gainNode)}g.loop=b.loop,g.volume=b.volume,g.muted=b.muted,g.pan=b.pan,g.startDelayMs=b.startDelayMs,g.playbackRate=b.playbackRate,g.startAt=b.startAt,g.endAt=b.endAt,g.channelId=b.channelId,g.source&&(g.source.loop=b.loop,g.source.playbackRate&&zs(g.source.playbackRate,b.playbackRate)),g.pannerNode?.pan&&zs(g.pannerNode.pan,b.pan);let M=Th(_,b.id,"volume","update");P&&M?ns({gainNode:g.gainNode,targetValue:E,transition:M}):P&&ns({gainNode:g.gainNode,targetValue:E,transition:null}),C&&g.pendingTimeoutId!==null&&GO(g)};return{add:g=>{let b={id:g.id,type:"sound",src:g.url??g.src,loop:g.loop??!1,volume:c5(g.volume),startDelayMs:g.startDelayMs??0};i.set(g.id,b)},remove:g=>{i.delete(g),r.delete(g);let b=`direct:${g}`,_=e.get(b);_&&h(_,[],0)},getById:g=>i.get(g),tick:()=>{let g=o(vh);for(let b of i.values()){let _=`direct:${b.id}`,S=e.get(_);if(!S){let E={...b,channelId:vh};u({sound:E,effects:[],phase:"enter",internalId:_});continue}if(S.src!==b.src){h(S,[],0);let E={...b,channelId:vh};u({sound:E,effects:[],phase:"enter",internalId:_});continue}d({instance:S,sound:{...b,channelId:vh},effects:[]})}for(let[b,_]of e)b.startsWith("direct:")&&!i.has(_.id)&&(h(_,[],0),r.delete(_.id));return g},renderGraph:({prevAudio:g=[],nextAudio:b=[],prevAudioEffects:_=[],nextAudioEffects:S=[]}={})=>{let E=Gs({audio:g,audioEffects:_}),P=Gs({audio:b,audioEffects:S}),C=new Map(E.channels.map(N=>[N.id,N])),M=new Map(P.channels.map(N=>[N.id,N])),R=new Map(E.sounds.map(N=>[N.id,N])),F=new Map(P.sounds.map(N=>[N.id,N]));o(b0);let U=new Map,W=new Map;for(let[N]of C)if(!M.has(N)){let G=c(t.get(N),_);U.set(N,t.get(N)),W.set(N,G)}for(let[N,G]of M)n(G,S,C.has(N)?"update":"enter");for(let[N,G]of R){let X=F.get(N),$=r.get(N),D=$?e.get($):null,z=G.channelId?W.get(G.channelId)??0:0;if(!X){let le=h(D,_,z);G.channelId&&W.set(G.channelId,Math.max(W.get(G.channelId)??0,le)),r.delete(N);continue}if(G.src!==X.src){let le=h(D,_,z);G.channelId&&W.set(G.channelId,Math.max(W.get(G.channelId)??0,le)),u({sound:X,effects:S,phase:"enter",internalId:`render:${N}:${++s}`})}}for(let[N,G]of F){if(!R.has(N)){u({sound:G,effects:S,phase:"enter",internalId:`render:${N}:${++s}`});continue}if(R.get(N).src!==G.src)continue;let $=r.get(N),D=$?e.get($):null;D&&d({instance:D,sound:G,effects:S})}for(let[N,G]of U){if(!G)continue;let X=W.get(N)??0;G.cleanupTimeoutId=VO(()=>{NO(G),t.get(N)===G&&t.delete(N)},X)}},destroy:()=>{for(let g of e.values())DO(g);for(let g of t.values())NO(g);e.clear(),r.clear(),t.clear(),i.clear()},_inspect:()=>({channels:t,sounds:e,currentSoundKeyById:r,directAudios:i})}};var d5=({JSONObject:t,parserPlugins:e=[]})=>t.map(i=>{let s=e.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:e})});var T0=d5;var jO=({type:t,parse:e})=>({type:t,parse:e});var S0=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function w0(t,e,r,i){t.addEventListener?t.addEventListener(e,r,i):t.attachEvent&&t.attachEvent(`on${e}`,r)}function Sh(t,e,r,i){t&&(t.removeEventListener?t.removeEventListener(e,r,i):t.detachEvent&&t.detachEvent(`on${e}`,r))}function ZO(t,e){let r=e.slice(0,e.length-1),i=[];for(let s=0;s<r.length;s++)i.push(t[r[s].toLowerCase()]);return i}function QO(t){typeof t!="string"&&(t=""),t=t.replace(/\s/g,"");let e=t.split(","),r=e.lastIndexOf("");for(;r>=0;)e[r-1]+=",",e.splice(r,1),r=e.lastIndexOf("");return e}function f5(t,e){let r=t.length>=e.length?t:e,i=t.length>=e.length?e:t,s=!0;for(let o=0;o<r.length;o++)i.indexOf(r[o])===-1&&(s=!1);return s}function JO(t){let e=t.keyCode||t.which||t.charCode;return t.code&&/^Key[A-Z]$/.test(t.code)&&(e=t.code.charCodeAt(3)),e}var Ah={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,"-":S0?173:189,"=":S0?61:187,";":S0?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},ai={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,meta:91,command:91},wh={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Gt={16:!1,18:!1,17:!1,91:!1},at={};for(let t=1;t<20;t++)Ah[`f${t}`]=111+t;var ot=[],Eh=null,eL="all",as=new Map,ul=t=>Ah[t.toLowerCase()]||ai[t.toLowerCase()]||t.toUpperCase().charCodeAt(0),p5=t=>Object.keys(Ah).find(e=>Ah[e]===t),m5=t=>Object.keys(ai).find(e=>ai[e]===t),tL=t=>{eL=t||"all"},Ph=()=>eL||"all",g5=()=>ot.slice(0),x5=()=>ot.map(t=>p5(t)||m5(t)||String.fromCharCode(t)),y5=()=>{let t=[];return Object.keys(at).forEach(e=>{at[e].forEach(({key:r,scope:i,mods:s,shortcut:o})=>{t.push({scope:i,shortcut:o,mods:s,keys:r.split("+").map(n=>ul(n))})})}),t},rL=t=>{let e=t.target||t.srcElement,{tagName:r}=e,i=!0,s=r==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(e.type);return(e.isContentEditable||(s||r==="TEXTAREA"||r==="SELECT")&&!e.readOnly)&&(i=!1),i},_5=t=>(typeof t=="string"&&(t=ul(t)),ot.indexOf(t)!==-1),b5=(t,e)=>{let r,i;t||(t=Ph());for(let s in at)if(Object.prototype.hasOwnProperty.call(at,s))for(r=at[s],i=0;i<r.length;)r[i].scope===t?r.splice(i,1).forEach(({element:o})=>A0(o)):i++;Ph()===t&&tL(e||"all")};function v5(t){let e=JO(t);t.key&&t.key.toLowerCase()==="capslock"&&(e=ul(t.key));let r=ot.indexOf(e);if(r>=0&&ot.splice(r,1),t.key&&t.key.toLowerCase()==="meta"&&ot.splice(0,ot.length),(e===93||e===224)&&(e=91),e in Gt){Gt[e]=!1;for(let i in ai)ai[i]===e&&(bt[i]=!1)}}var iL=(t,...e)=>{if(typeof t>"u")Object.keys(at).forEach(r=>{Array.isArray(at[r])&&at[r].forEach(i=>$m(i)),delete at[r]}),A0(null);else if(Array.isArray(t))t.forEach(r=>{r.key&&$m(r)});else if(typeof t=="object")t.key&&$m(t);else if(typeof t=="string"){let[r,i]=e;typeof r=="function"&&(i=r,r=""),$m({key:t,scope:r,method:i,splitKey:"+"})}},$m=({key:t,scope:e,method:r,splitKey:i="+"})=>{QO(t).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":ul(a);if(!at[l])return;e||(e=Ph());let c=n>1?ZO(ai,o):[],u=[];at[l]=at[l].filter(h=>{let d=(r?h.method===r:!0)&&h.scope===e&&f5(h.mods,c);return d&&u.push(h.element),!d}),u.forEach(h=>A0(h))})};function qO(t,e,r,i){if(e.element!==i)return;let s;if(e.scope===r||e.scope==="all"){s=e.mods.length>0;for(let o in Gt)Object.prototype.hasOwnProperty.call(Gt,o)&&(!Gt[o]&&e.mods.indexOf(+o)>-1||Gt[o]&&e.mods.indexOf(+o)===-1)&&(s=!1);(e.mods.length===0&&!Gt[16]&&!Gt[18]&&!Gt[17]&&!Gt[91]||s||e.shortcut==="*")&&(e.keys=[],e.keys=e.keys.concat(ot),e.method(t,e)===!1&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0)))}}function KO(t,e){let r=at["*"],i=JO(t);if(t.key&&t.key.toLowerCase()==="capslock"||!(bt.filter||rL).call(this,t))return;if((i===93||i===224)&&(i=91),ot.indexOf(i)===-1&&i!==229&&ot.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=wh[a];t[a]&&ot.indexOf(l)===-1?ot.push(l):!t[a]&&ot.indexOf(l)>-1?ot.splice(ot.indexOf(l),1):a==="metaKey"&&t[a]&&(ot=ot.filter(c=>c in wh||c===i))}),i in Gt){Gt[i]=!0;for(let a in ai)if(Object.prototype.hasOwnProperty.call(ai,a)){let l=wh[ai[a]];bt[a]=t[l]}if(!r)return}for(let a in Gt)Object.prototype.hasOwnProperty.call(Gt,a)&&(Gt[a]=t[wh[a]]);t.getModifierState&&!(t.altKey&&!t.ctrlKey)&&t.getModifierState("AltGraph")&&(ot.indexOf(17)===-1&&ot.push(17),ot.indexOf(18)===-1&&ot.push(18),Gt[17]=!0,Gt[18]=!0);let s=Ph();if(r)for(let a=0;a<r.length;a++)r[a].scope===s&&(t.type==="keydown"&&r[a].keydown||t.type==="keyup"&&r[a].keyup)&&qO(t,r[a],s,e);if(!(i in at))return;let o=at[i],n=o.length;for(let a=0;a<n;a++)if((t.type==="keydown"&&o[a].keydown||t.type==="keyup"&&o[a].keyup)&&o[a].key){let l=o[a],{splitKey:c}=l,u=l.key.split(c),h=[];for(let d=0;d<u.length;d++)h.push(ul(u[d]));h.sort().join("")===ot.sort().join("")&&qO(t,l,s,e)}}var bt=function(t,e,r){ot=[];let i=QO(t),s=[],o="all",n=document,a=0,l=!1,c=!0,u="+",h=!1,d=!1;if(r===void 0&&typeof e=="function"&&(r=e),Object.prototype.toString.call(e)==="[object Object]"){let f=e;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&&(h=f.capture),typeof f.splitKey=="string"&&(u=f.splitKey),f.single===!0&&(d=!0)}for(typeof e=="string"&&(o=e),d&&iL(t,o);a<i.length;a++){let f=i[a].split(u);s=[],f.length>1&&(s=ZO(ai,f));let p=f[f.length-1];p=p==="*"?"*":ul(p),p in at||(at[p]=[]),at[p].push({keyup:l,keydown:c,scope:o,mods:s,shortcut:i[a],method:r,key:i[a],splitKey:u,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!as.has(n)){let f=(m=window.event)=>KO(m,n),p=(m=window.event)=>{KO(m,n),v5(m)};as.set(n,{keydownListener:f,keyupListenr:p,capture:h}),w0(n,"keydown",f,h),w0(n,"keyup",p,h)}if(!Eh){let f=()=>{ot=[]};Eh={listener:f,capture:h},w0(window,"focus",f,h)}}};function T5(t,e="all"){Object.keys(at).forEach(r=>{at[r].filter(i=>i.scope===e&&i.shortcut===t).forEach(i=>{i&&i.method&&i.method({},i)})})}function A0(t){let e=Object.values(at).flat();if(e.findIndex(({element:r})=>r===t)<0&&t){let{keydownListener:r,keyupListenr:i,capture:s}=as.get(t)||{};r&&i&&(Sh(t,"keyup",i,s),Sh(t,"keydown",r,s),as.delete(t))}if((e.length<=0||as.size<=0)&&(Array.from(as.keys()).forEach(r=>{let{keydownListener:i,keyupListenr:s,capture:o}=as.get(r)||{};i&&s&&(Sh(r,"keyup",s,o),Sh(r,"keydown",i,o),as.delete(r))}),as.clear(),Object.keys(at).forEach(r=>delete at[r]),Eh)){let{listener:r,capture:i}=Eh;Sh(window,"focus",r,i),Eh=null}}var E0={getPressedKeyString:x5,setScope:tL,getScope:Ph,deleteScope:b5,getPressedKeyCodes:g5,getAllKeyCodes:y5,isPressed:_5,filter:rL,trigger:T5,unbind:iL,keyMap:Ah,modifier:ai,modifierMap:wh};for(let t in E0){let e=t;Object.prototype.hasOwnProperty.call(E0,e)&&(bt[e]=E0[e])}if(typeof window<"u"){let t=window.hotkeys;bt.noConflict=e=>(e&&window.hotkeys===bt&&(window.hotkeys=t),bt),window.hotkeys=bt}var sL=",",S5="+",w5=new Set([93,224]),E5="\0",P0=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),oL=t=>P0(t)?{payload:P0(t.payload)?t.payload:{}}:null,cL=t=>{if(typeof t!="string"||t.length===0)return null;let e=t.toLowerCase();return typeof bt.modifier?.[e]=="number"?bt.modifier[e]:typeof bt.keyMap?.[e]=="number"?bt.keyMap[e]:t.length===1?t.toUpperCase().charCodeAt(0):null},uL=t=>w5.has(t)?91:t,nL=t=>{let e=null;return typeof t?.keyCode=="number"&&t.keyCode>0?e=t.keyCode:typeof t?.which=="number"&&t.which>0?e=t.which:typeof t?.charCode=="number"&&t.charCode>0&&(e=t.charCode),typeof t?.code=="string"&&/^Key[A-Z]$/.test(t.code)&&(e=t.code.charCodeAt(3)),typeof e=="number"?uL(e):cL(t?.key??"")},A5=t=>{if(typeof t!="string"||t.length===0)return[];let e=t.replace(/\s/g,"").split(sL),r=e.lastIndexOf("");for(;r>=0;)r>0&&(e[r-1]+=sL),e.splice(r,1),r=e.lastIndexOf("");return e.filter(Boolean)},P5=t=>typeof bt.modifierMap?.[t]=="string",C5=t=>A5(t).map(e=>{let r=new Set(e.split(S5).map(i=>cL(i)).filter(i=>typeof i=="number").map(i=>uL(i)));return r.size===0?null:{shortcut:e,releaseCodes:r,isModifierOnly:[...r].every(P5)}}).filter(Boolean),R5=(t,e)=>{for(let r of e)if(!t.has(r))return!1;return!0},aL=(t,e)=>`${t}${E5}${e.shortcut}`,lL=t=>{if(!t||typeof t!="object")return!1;let e=typeof t.tagName=="string"?t.tagName.toLowerCase():"";if(["input","textarea","select"].includes(e)||typeof HTMLInputElement<"u"&&t instanceof HTMLInputElement||typeof HTMLTextAreaElement<"u"&&t instanceof HTMLTextAreaElement||typeof HTMLSelectElement<"u"&&t instanceof HTMLSelectElement||t.isContentEditable===!0||t.contentEditable==="true"||t.contentEditable==="plaintext-only")return!0;if(typeof t.getAttribute=="function"){let i=t.getAttribute("contenteditable");if(i!==null&&i.toLowerCase()!=="false"||t.getAttribute("data-route-graphics-input-id")!==null)return!0}let r=typeof t.closest=="function"?t.closest.bind(t):typeof t.parentElement?.closest=="function"?t.parentElement.closest.bind(t.parentElement):null;return r?!!r('[data-route-graphics-input-id], [contenteditable]:not([contenteditable="false"])'):!1},M5=()=>typeof document>"u"?null:document.activeElement??null,C0=t=>lL(t?.target)?!0:lL(M5()),I5=t=>C0(t)?"editable-context":typeof bt.filter=="function"&&!bt.filter(t)?"hotkeys-filter":null,B5=({activeKeyupShortcuts:t,activeModifierShortcuts:e,pressedKeyCodes:r,releasedKeyCode:i})=>{for(let[s,o]of Array.from(t))o.releaseCodes.has(i)&&t.delete(s);for(let[s,o]of Array.from(e))o.releaseCodes.has(i)&&e.delete(s);r.delete(i)},F5=t=>{if(!P0(t))return null;let e={},r=oL(t.keydown),i=oL(t.keyup);return r&&(e.keydown=r),i&&(e.keyup=i),Object.keys(e).length>0?e:null},hL=t=>{let e=new Map,r=new Map,i=new Map,s=new Map,o=new Set,n=(x,v,y)=>{t&&t(x,{_event:{key:v},...y})},a=()=>{i.clear(),s.clear(),o.clear()},l=x=>{for(let[v,y]of Array.from(i))y.binding===x&&i.delete(v);for(let[v,y]of Array.from(s))y.binding===x&&s.delete(v);r.delete(x)},c=(x,v)=>{let y=r.get(x)??[],g=typeof v?.shortcut=="string"?v.shortcut:typeof v?.key=="string"?v.key:null;return y.find(b=>b.shortcut===g)??y[0]??null},u=(x,v)=>{!e.get(x)?.keyup||!v||i.set(aL(x,v),{binding:x,releaseCodes:new Set(v.releaseCodes)})},h=(x,v)=>{let y=aL(x,v),g=s.has(y);return s.set(y,{binding:x,releaseCodes:new Set(v.releaseCodes)}),g},d=x=>{if(I5(x)){a();return}let y=nL(x);if(typeof y=="number"){o.add(y);for(let[g,b]of e)(r.get(g)??[]).filter(S=>S.isModifierOnly).forEach(S=>{if(!R5(o,S.releaseCodes))return;let E=h(g,S);u(g,S),b.keydown&&!E&&n("keydown",g,b.keydown.payload)})}},f=x=>{let v=C0(x),y=nL(x);if(v){typeof y=="number"?B5({activeKeyupShortcuts:i,activeModifierShortcuts:s,pressedKeyCodes:o,releasedKeyCode:y}):a();return}if(typeof y=="number"){for(let[g,b]of Array.from(i)){let _=e.get(b.binding);!b.releaseCodes.has(y)||!_?.keyup||(i.delete(g),n("keyup",b.binding,_.keyup.payload))}for(let[g,b]of Array.from(s))b.releaseCodes.has(y)&&s.delete(g);o.delete(y)}};return typeof document<"u"&&(document.addEventListener("keydown",d),document.addEventListener("keyup",f)),typeof window<"u"&&window.addEventListener("blur",a),{registerHotkeys:(x={})=>{if(typeof x!="object"||x===null)return;let v=new Map,y=[],g=[],b=[];Object.keys(x).forEach(_=>{let S=F5(x[_]);S&&v.set(_,S)}),v.forEach((_,S)=>{let E=e.get(S);E?ye(E,_)||(g.push(S),bt.unbind(S)):y.push(S)}),e.forEach((_,S)=>{v.has(S)||b.push(S)}),b.forEach(_=>{bt.unbind(_),e.delete(_),l(_)}),[...y,...g].forEach(_=>{let S=v.get(_),E=C5(_);l(_),r.set(_,E),e.set(_,S),bt(_,(P,C)=>{if(C0(P)){a();return}let M=c(_,C);if(M?.isModifierOnly){let R=h(_,M);u(_,M),S.keydown&&!R&&n("keydown",_,S.keydown.payload);return}u(_,M),S.keydown&&n("keydown",_,S.keydown.payload)})})},destroy:()=>{typeof document<"u"&&(document.removeEventListener("keydown",d),document.removeEventListener("keyup",f)),typeof window<"u"&&window.removeEventListener("blur",a);for(let x of e.keys())bt.unbind(x);e.clear(),r.clear(),i.clear(),s.clear(),o.clear()}}};var R0=1,k5=(t={})=>Object.keys(t).some(Es),U5=(t,e,r)=>{if(!t||!Object.prototype.hasOwnProperty.call(t,e))throw new Error(`Animation "${r}" cannot auto-resolve property "${e}" from targetState.`);return t[e]},O5=(t,e,r,i,s,o)=>Object.entries(e).map(([n,a])=>{if(!Df[n])throw new Error(`${n} is not a supported property for animation.`);let l=hI({object:t,property:n,propertyPathMap:r,subjectState:o,defaultValue:0});if(a.auto){let h=U5(i,n,s);if(l===h)return null;let d=Io([{value:l},{duration:a.auto.duration,value:h,easing:a.auto.easing}]);return{property:n,timeline:d}}let c=a.initialValue??l,u=Io([{value:c},...a.keyframes]);return{property:n,timeline:u}}).filter(Boolean),dL=()=>{let t=[],e=new Map,r=new Map,i=new Map,s=0,o=null,n=!1,a=(I,A)=>Math.min(Math.max(I,0),Math.max(A??0,0)),l=(I,A)=>{let k=a(A*I.playbackSpeed,I.duration);return I.currentTime=k,I.applyFrame(k),k>=I.duration},c=(I,A)=>{if(I==null)return R0;if(typeof I!="number"||!Number.isFinite(I)||I<=0)throw new Error(`Animation "${A}" playback speed must be a finite number greater than 0.`);return I},u=(I,A)=>{i.get(I)?.forEach(k=>{try{k(A)}catch{}})},h=I=>{if(u("completed",{id:I.id}),I.onComplete)try{I.onComplete()}catch{}},d=(I,A={})=>(I.animationType=A.animationType??I.animationType,I.targetId=A.targetId??I.targetId,I.signature=A.signature??I.signature,I.continuity=A.continuity??I.continuity??"render",I.playbackSpeed=c(A.playbackSpeed??I.playbackSpeed,I.id),I.onContinuationUpdate=A.onContinuationUpdate??I.onContinuationUpdate,I),f=I=>({id:I.id,type:I.animationType??null,targetId:I.targetId??null,signature:I.signature??null,continuity:I.continuity??"render",pending:I.pending===!0}),p=I=>{I.applyFrame(0),r.delete(I.id),e.set(I.id,I);let A=o!==null&&l(I,o);u("started",{id:I.id}),A&&(h(I),e.delete(I.id))},m=I=>{let{id:A,element:k,properties:L,targetState:q,onComplete:H,onCancel:Y,propertyPathMap:pe=Nf,animationBaseState:Le}=I,Be=Le??(k5(L)?As(k):null),ci=()=>(Be||(Be=As(k)),Be),Xr=O5(k,L,pe,q,A,Be);if(Xr.length===0){h({id:A,onComplete:H});return}let Dt={id:A,kind:"property",element:k,timelines:Xr,duration:Aa(Xr),currentTime:0,playbackSpeed:R0,stateVersion:s,targetState:q,onComplete:H,onCancel:Y,applyFrame:pl=>{for(let{property:Rh,timeline:U0}of Xr){let wL=Bo(U0,pl);try{uu({object:k,property:Rh,propertyPathMap:pe,subjectState:Es(Rh)?ci():Be,value:wL})}catch{}}},applyTargetState:()=>{if(!(!k||k.destroyed)){if(q===null){k.destroy();return}if(q)for(let[pl,Rh]of Object.entries(q))try{uu({object:k,property:pl,propertyPathMap:pe,subjectState:Es(pl)?ci():Be,value:Rh})}catch{}}},isValid:()=>!!k&&!k.destroyed};p(d(Dt,I))},x=I=>{let A={id:I.id,kind:"custom",duration:I.duration??0,currentTime:0,playbackSpeed:R0,deferCompletionUntilNextFrame:I.deferCompletionUntilNextFrame===!0,pendingCompletion:!1,stateVersion:s,onComplete:I.onComplete,onCancel:I.onCancel,applyFrame:I.applyFrame??(()=>{}),applyTargetState:I.applyTargetState??(()=>{}),isValid:I.isValid??(()=>!0)};p(d(A,I))},v=I=>{if(I.driver==="custom"){x(I);return}m(I)},y=I=>{try{I.applyTargetState?.()}catch{}if(I.onCancel)try{I.onCancel()}catch{}},g=I=>{let A=r.get(I);A&&(y(A),r.delete(I),u("cancelled",{id:I}))},b=I=>{switch(I.type){case"START":v(I.payload);break;case"CANCEL":E(I.id);break}},_=()=>{let I=t.splice(0);for(let A of I)b(A)},S=()=>{o===null||n||(n=!0,queueMicrotask(()=>{n=!1,o!==null&&_()}))},E=I=>{let A=e.get(I);if(!A){g(I);return}y(A),e.delete(I),u("cancelled",{id:I})},P=I=>{t.push(I),S()},C=()=>{for(let[I,A]of e)y(A),u("cancelled",{id:I});for(let[I,A]of r)y(A),u("cancelled",{id:I});e.clear(),r.clear(),s++},M=(I=new Set)=>{let A=I instanceof Set?I:new Set(I??[]);for(let[k,L]of e)A.has(k)||(y(L),e.delete(k),u("cancelled",{id:k}));for(let[k,L]of r)A.has(k)||(y(L),r.delete(k),u("cancelled",{id:k}))},R=I=>{_();let A=[];for(let[k,L]of e){if(L.stateVersion!==s){A.push(k);continue}if(!L.isValid()){A.push(k);continue}if(L.pendingCompletion){h(L),A.push(k);continue}if(L.currentTime=a(L.currentTime+I*L.playbackSpeed,L.duration),L.currentTime>=L.duration){if(L.applyFrame(L.duration),L.deferCompletionUntilNextFrame===!0&&L.duration>0){L.pendingCompletion=!0;continue}h(L),A.push(k);continue}L.applyFrame(L.currentTime)}for(let k of A)e.delete(k)},F=I=>{o=I,_();let A=[];for(let[k,L]of e){if(L.stateVersion!==s){A.push(k);continue}if(!L.isValid()){A.push(k);continue}l(L,I)&&(h(L),A.push(k))}for(let k of A)e.delete(k)},U=()=>{o=null},W=()=>{_()},N=(I,A)=>(i.has(I)||i.set(I,new Set),i.get(I).add(A),()=>G(I,A)),G=(I,A)=>{i.get(I)?.delete(A)};return{dispatch:P,cancelAll:C,cancelAllExcept:M,flush:W,tick:R,setTime:F,clearTime:U,on:N,off:G,registerPending:I=>{let A=d({id:I.id,kind:"pending",pending:!0,applyTargetState:I.applyTargetState??(()=>{}),onCancel:I.onCancel},I);r.set(A.id,A)},activatePending:(I,A)=>{let k=r.get(I);return k?(r.delete(I),v({...A,id:I,animationType:k.animationType,targetId:k.targetId,signature:k.signature,continuity:k.continuity,playbackSpeed:k.playbackSpeed,onContinuationUpdate:A.onContinuationUpdate??k.onContinuationUpdate}),!0):!1},removePending:I=>{r.delete(I)},getContinuableAnimations:()=>{let I=new Map;for(let[A,k]of r)k.continuity==="persistent"&&I.set(A,f(k));for(let[A,k]of e)k.continuity==="persistent"&&I.set(A,f(k));return I},getState:()=>({stateVersion:s,activeCount:e.size,pendingCount:r.size,animations:Array.from(e.entries()).map(([I,A])=>({id:I,currentTime:A.currentTime,duration:A.duration,playbackSpeed:A.playbackSpeed,progress:A.duration>0?A.currentTime/A.duration:0}))}),isAnimating:I=>e.has(I),hasContext:I=>e.has(I)||r.has(I),updateContinuation:(I,A)=>{let k=e.get(I)??r.get(I);if(k?.onContinuationUpdate)try{k.onContinuationUpdate(A)}catch{}},destroy:()=>{C(),i.clear()}}};var fL=t=>{let e=0,r=0,i=null,s=!1,o=!1,n=d=>{o||(o=!0,t?.("renderComplete",d))};return{reset:d=>{e>0&&i!==null&&!o&&t?.("renderComplete",{id:i,aborted:!0}),r++,e=0,i=d,s=!0,o=!1},track:d=>{d===r&&e++},complete:d=>{d!==r||e===0||(e--,e===0&&!s&&n({id:i,aborted:!1}))},getVersion:()=>r,completeIfEmpty:()=>{s=!1,e===0&&n({id:i,aborted:!1})}}};var pL=new Set(["update","transition"]),mL=new Set(["render","persistent"]),L5="render",G5=1,D5=new Set(["alpha","x","y","translateX","translateY","scaleX","scaleY","rotation","blurX","blurY","uProgress"]),N5=new Set(["x","y","translateX","translateY","alpha","scaleX","scaleY","rotation"]),V5=new Set(["uProgress"]),gL=new Set(["single","sequence"]),xL=new Set(["red","green","blue","alpha"]),yL=new Set(["hold","linear"]),bL=new Set(vp),li=(t,e)=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object.`)},hl=(t,e)=>{if(typeof t!="string"||t.length===0)throw new Error(`${e} must be a non-empty string.`)},dl=(t,e)=>{if(typeof t!="number"||Number.isNaN(t))throw new Error(`${e} must be a number.`)},H5=(t,e)=>{if(typeof t!="number"||!Number.isFinite(t)||t<=0)throw new Error(`${e} must be a finite number greater than 0.`)},W5=(t,e)=>{li(t,e);let r=t.continuity??L5;if(!mL.has(r))throw new Error(`${e}.continuity must be one of: ${Array.from(mL).join(", ")}.`);let i={continuity:r};return t.speed!==void 0&&(H5(t.speed,`${e}.speed`),t.speed!==G5&&(i.speed=t.speed)),i},$5=(t,e)=>{if(li(t,e),dl(t.duration,`${e}.duration`),t.easing!==void 0&&typeof t.easing!="string")throw new Error(`${e}.easing must be a string.`);if(t.easing!==void 0&&!bL.has(t.easing))throw new Error(`${e}.easing must be one of: ${vp.join(", ")}.`);return{duration:t.duration,easing:t.easing??"linear"}},B0=(t,e)=>{li(t,e);let r={};if(t.initialValue!==void 0&&(dl(t.initialValue,`${e}.initialValue`),r.initialValue=t.initialValue),!Array.isArray(t.keyframes)||t.keyframes.length===0)throw new Error(`${e}.keyframes must be a non-empty array.`);return r.keyframes=t.keyframes.map((i,s)=>{let o=`${e}.keyframes[${s}]`;if(li(i,o),dl(i.value,`${o}.value`),dl(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&&!bL.has(i.easing))throw new Error(`${o}.easing must be one of: ${vp.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}:{}}}),r},z5=(t,e)=>{li(t,e);let r=t.keyframes!==void 0,i=t.auto!==void 0;if(r&&i)throw new Error(`${e} cannot define both keyframes and auto.`);if(!r&&!i)throw new Error(`${e} must define keyframes or auto.`);if(i){if(t.initialValue!==void 0)throw new Error(`${e}.initialValue is not valid when auto is defined.`);return{auto:$5(t.auto,`${e}.auto`)}}return B0(t,e)},I0=(t,e,r,i=B0)=>{if(li(t,e),t.x!==void 0&&t.translateX!==void 0)throw new Error(`${e} cannot define both x and translateX.`);if(t.y!==void 0&&t.translateY!==void 0)throw new Error(`${e} cannot define both y and translateY.`);let s=Object.entries(t).map(([o,n])=>{if(!r.has(o))throw new Error(`${e}.${o} is not a supported animation property.`);return[o,i(n,`${e}.${o}`)]});if(s.length===0)throw new Error(`${e} must define at least one property.`);return Object.fromEntries(s)},X5=(t,e)=>{if(li(t,e),hl(t.texture,`${e}.texture`),dl(t.at,`${e}.at`),t.at<0||t.at>1)throw new Error(`${e}.at must be between 0 and 1.`);return{at:t.at,texture:t.texture}},Y5=(t,e)=>{if(!Array.isArray(t)||t.length<2)throw new Error(`${e} must be an array with at least two frames.`);let r=t.map((s,o)=>X5(s,`${e}[${o}]`));if(r[0].at!==0)throw new Error(`${e}[0].at must be 0.`);let i=r.length-1;if(r[i].at!==1)throw new Error(`${e}[${i}].at must be 1.`);for(let s=1;s<r.length;s++)if(r[s].at<=r[s-1].at)throw new Error(`${e} must be sorted by ascending unique at values.`);return r},j5=(t,e)=>{if(li(t,e),!gL.has(t.kind))throw new Error(`${e}.kind must be one of: ${Array.from(gL).join(", ")}.`);let r={kind:t.kind};if(t.channel!==void 0){if(!xL.has(t.channel))throw new Error(`${e}.channel must be one of: ${Array.from(xL).join(", ")}.`);r.channel=t.channel}if(t.softness!==void 0&&(dl(t.softness,`${e}.softness`),r.softness=t.softness),t.invert!==void 0){if(typeof t.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);r.invert=t.invert}if(t.progress!==void 0&&(r.progress=B0(t.progress,`${e}.progress`)),t.kind==="single"){if(t.frames!==void 0)throw new Error(`${e}.frames is only valid for sequence masks.`);if(t.sample!==void 0)throw new Error(`${e}.sample is only valid for sequence masks.`);if(t.items!==void 0)throw new Error(`${e}.items is not supported.`);if(t.combine!==void 0)throw new Error(`${e}.combine is not supported.`);hl(t.texture,`${e}.texture`),r.texture=t.texture}if(t.kind==="sequence"){if(t.texture!==void 0)throw new Error(`${e}.texture is not valid for sequence masks. Use ${e}.frames[].texture instead.`);if(t.items!==void 0)throw new Error(`${e}.items is not supported.`);if(t.combine!==void 0)throw new Error(`${e}.combine is not supported.`);if(t.textures!==void 0)throw new Error(`${e}.textures is no longer supported. Use ${e}.frames with texture and at entries instead.`);if(t.softness!==void 0)throw new Error(`${e}.softness is not valid for sequence masks. Author feathering into ${e}.frames[].texture instead.`);if(r.frames=Y5(t.frames,`${e}.frames`),t.sample!==void 0&&(hl(t.sample,`${e}.sample`),!yL.has(t.sample)))throw new Error(`${e}.sample must be one of: ${Array.from(yL).join(", ")}.`);r.sample=t.sample??"hold"}return r.progress||(r.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),r},_L=(t,e)=>{if(li(t,e),t.mask!==void 0)throw new Error(`${e}.mask is not valid. Define mask on ${e}.`);let r={};if(t.tween!==void 0&&(r.tween=I0(t.tween,`${e}.tween`,N5)),Object.keys(r).length===0)throw new Error(`${e} must define tween.`);return r},q5=(t,e)=>{let r={};if(t.shader!==void 0)throw new Error(`${e}.shader is not supported.`);if(t.prev!==void 0&&(r.prev=_L(t.prev,`${e}.prev`)),t.next!==void 0&&(r.next=_L(t.next,`${e}.next`)),t.mask!==void 0&&(r.mask=j5(t.mask,`${e}.mask`)),t.compositor!==void 0&&(r.compositor=xB(t.compositor,`${e}.compositor`)),r.mask!==void 0&&r.compositor!==void 0)throw new Error(`${e}.compositor cannot be combined with ${e}.mask in v1.`);if(r.prev===void 0&&r.next===void 0&&r.mask===void 0&&r.compositor===void 0)throw new Error(`${e} must define prev, next, mask, or compositor.`);return r},M0=(t,e,r)=>{if(t!==void 0)throw new Error(`${e} ${r}`)},vL=(t=[])=>{if(!Array.isArray(t))throw new Error("Input error: `animations` must be an array.");let e=t.map((s,o)=>{let n=`animations[${o}]`;if(li(s,n),hl(s.id,`${n}.id`),hl(s.targetId,`${n}.targetId`),hl(s.type,`${n}.type`),!pL.has(s.type))throw new Error(`${n}.type must be one of: ${Array.from(pL).join(", ")}.`);let a={id:s.id,targetId:s.targetId,type:s.type};if(s.complete!==void 0&&(li(s.complete,`${n}.complete`),a.complete=s.complete),s.playback!==void 0&&(a.playback=W5(s.playback,`${n}.playback`)),M0(s.operation,`${n}.operation`,"is no longer supported. Use `type: update | transition` instead."),M0(s.properties,`${n}.properties`,"is no longer supported. Use `tween` instead."),M0(s.subjects,`${n}.subjects`,"is no longer supported. Use `prev` / `next` instead."),s.type==="update"){if(a.tween=I0(s.tween,`${n}.tween`,D5,z5),s.replace!==void 0)throw new Error(`${n}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(s.prev!==void 0)throw new Error(`${n}.prev is only valid for transition animations.`);if(s.next!==void 0)throw new Error(`${n}.next is only valid for transition animations.`);if(s.mask!==void 0)throw new Error(`${n}.mask is only valid for transition animations.`);if(s.compositor!==void 0)throw new Error(`${n}.compositor is only valid for transition animations.`);if(s.shader!==void 0)throw new Error(`${n}.shader is not supported.`);return a}if(s.tween!==void 0&&s.compositor===void 0)throw new Error(`${n}.tween is not valid for transition animations.`);if(s.replace!==void 0)throw new Error(`${n}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let l=q5(s,n);if(l.prev!==void 0&&(a.prev=l.prev),l.next!==void 0&&(a.next=l.next),l.mask!==void 0&&(a.mask=l.mask),l.compositor!==void 0){if(a.compositor=l.compositor,s.tween===void 0)throw new Error(`${n}.tween.uProgress is required when compositor is defined.`);a.tween=I0(s.tween,`${n}.tween`,V5)}return a}),r=new Map;for(let s of e){let o=r.get(s.targetId)??new Set;o.add(s.type),r.set(s.targetId,o)}for(let[s,o]of r)if(o.has("transition")&&o.size>1)throw new Error(`Animations targeting "${s}" cannot mix update and transition types in the same state.`);let i=new Set;for(let s of e)if(!(s.type!=="update"||s.tween?.uProgress===void 0)){if(i.has(s.targetId))throw new Error(`Animations targeting "${s.targetId}" cannot define multiple active uProgress update tweens in the same state.`);i.add(s.targetId)}return e};var F0=(t={})=>{if(t===null||typeof t!="object")throw new Error("Input error: render state must be an object.");if(t.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let e={...t,elements:t.elements??[],animations:t.animations??[],audio:t.audio??[],audioEffects:t.audioEffects??[]};if(!Array.isArray(e.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(e.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(e.audio))throw new Error("Input error: `audio` must be an array.");if(!Array.isArray(e.audioEffects))throw new Error("Input error: `audioEffects` must be an array.");return e.animations=vL(e.animations),Gs({audio:e.audio,audioEffects:e.audioEffects}),e};var K5="0",fl=(t,e)=>{let r=t?.[e];return typeof r=="number"?r:0},Rr=t=>({value:t.element.value??"",selectionStart:fl(t.element,"selectionStart"),selectionEnd:fl(t.element,"selectionEnd"),focused:document.activeElement===t.element,composing:t.composing===!0}),Z5=(t,e)=>!t||!e?!1:t.value===e.value&&t.selectionStart===e.selectionStart&&t.selectionEnd===e.selectionEnd&&t.focused===e.focused&&t.composing===e.composing,Q5=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement,Ch=t=>{t.element.style.pointerEvents="none"},k0=(t,e,r)=>{if(typeof t?.setSelectionRange=="function")try{t.setSelectionRange(e,r)}catch{}},J5=({app:t,geometry:e})=>{let r=t.canvas;if(!e||!r||e.visible===!1)return null;let i=r.getBoundingClientRect(),s=t.renderer?.width||i.width||1,o=t.renderer?.height||i.height||1,n=i.width/s,a=i.height/o,l=e.clipInsets??{top:0,right:0,bottom:0,left:0},c=i.left+(e.x+l.left)*n,u=i.top+(e.y+l.top)*a,h=i.left+(e.x+e.width-l.right)*n,d=i.top+(e.y+e.height-l.bottom)*a;return h<=c||d<=u?null:{left:c,top:u,right:h,bottom:d}},e6=({app:t,entry:e,event:r})=>{let i=e.options.getGeometry?.(),s=J5({app:t,geometry:i}),o=r.clientX,n=r.clientY;return!!s&&Number.isFinite(o)&&Number.isFinite(n)&&o>=s.left&&o<=s.right&&n>=s.top&&n<=s.bottom},TL=({app:t})=>{let e=new Map,r,i=null,s=()=>{r||(r=document.createElement("div"),r.dataset.routeGraphicsInputBridge="true",r.style.position="fixed",r.style.left="0",r.style.top="0",r.style.pointerEvents="none",r.style.zIndex="1000",r.style.width="0",r.style.height="0");let g=t.canvas?.parentNode??document.body;r.isConnected||g.appendChild(r)},o=(g,b=g.lastSnapshot)=>{let _=Rr(g);_.focused&&i!==g.id?i=g.id:!_.focused&&i===g.id&&(i=null),Ch(g,i),b?.value!==_.value&&g.callbacks.onValueChange?.(_),(b?.selectionStart!==_.selectionStart||b?.selectionEnd!==_.selectionEnd||b?.focused!==_.focused||b?.composing!==_.composing)&&g.callbacks.onSelectionChange?.(_),g.lastSnapshot=_},n=g=>{let{disabled:b=!1,multiline:_=!1,maxLength:S,textStyle:E,padding:P,placeholder:C="",autocomplete:M="off",autocapitalize:R="off",spellcheck:F=!1}=g.options,{element:U}=g;U instanceof HTMLInputElement&&(U.type="text"),U.disabled=b,U.placeholder=C,U.autocomplete=M,U.autocapitalize=R,U.spellcheck=!!F,U.style.opacity=K5,U.style.color="transparent",U.style.caretColor="transparent",U.style.background="transparent",U.style.paddingTop=`${P.top}px`,U.style.paddingRight=`${P.right}px`,U.style.paddingBottom=`${P.bottom}px`,U.style.paddingLeft=`${P.left}px`,U.style.fontFamily=E?.fontFamily??"Arial",U.style.fontSize=`${E?.fontSize??16}px`,U.style.fontWeight=E?.fontWeight??"400",U.style.textAlign=E?.align??"left",U.style.lineHeight=typeof E?.lineHeight=="number"?`${E.lineHeight}px`:"normal",U.style.whiteSpace=_?"pre":"nowrap",U.style.overflowWrap="normal",U.style.resize="none",U.style.overflow="hidden",typeof S=="number"?U.maxLength=S:U.removeAttribute("maxLength"),U.tabIndex=-1,_&&U instanceof HTMLTextAreaElement&&(U.wrap="off",U.rows=1),Ch(g,i)},a=g=>{s();let b=t.canvas,_=g.options.getGeometry?.();if(!b||!_||_.visible===!1){g.element.style.display="none";return}let S=b.getBoundingClientRect(),E=t.renderer?.width||S.width||1,P=t.renderer?.height||S.height||1,C=S.width/E,M=S.height/P,R=_.clipInsets??{top:0,right:0,bottom:0,left:0},F={top:R.top*M,right:R.right*C,bottom:R.bottom*M,left:R.left*C};g.element.style.display="block",g.element.style.left=`${S.left+_.x*C}px`,g.element.style.top=`${S.top+_.y*M}px`,g.element.style.width=`${_.width*C}px`,g.element.style.height=`${_.height*M}px`;let U=Object.values(F).some(W=>W>0);g.element.style.clipPath=U?`inset(${F.top}px ${F.right}px ${F.bottom}px ${F.left}px)`:"none"},l=g=>{if(!i)return;let b=e.get(i),_=g.target;!b||_===b.element||b.element.contains(_)||Q5(_)&&r?.contains(_)||e6({app:t,entry:b,event:g})||b.element.blur()},c=()=>{for(let g of e.values()){if(a(g),!g.lastSnapshot){g.lastSnapshot=Rr(g);continue}let b=Rr(g);Z5(b,g.lastSnapshot)||o(g,g.lastSnapshot)}},u=({id:g,options:b})=>{let _=b.multiline===!0?document.createElement("textarea"):document.createElement("input");return _.dataset.routeGraphicsInputId=g,_.style.position="fixed",_.style.border="none",_.style.outline="none",_.style.margin="0",_.style.boxSizing="border-box",_.style.borderRadius="0",_.style.transformOrigin="top left",_.style.appearance="none",_.style.boxShadow="none",_.style.userSelect="none",_.style.webkitUserSelect="none",_},h=g=>{let{id:b,element:_}=g,S=()=>{o(g)};_.addEventListener("focus",()=>{g.pendingBlurTimer&&(clearTimeout(g.pendingBlurTimer),g.pendingBlurTimer=null),i=b,Ch(g,i);let E=Rr(g);g.lastSnapshot=E,g.callbacks.onFocus?.(E),g.callbacks.onSelectionChange?.(E)}),_.addEventListener("blur",()=>{i===b&&(i=null),Ch(g,i),g.pendingBlurTimer=setTimeout(()=>{g.pendingBlurTimer=null;let E=Rr(g);if(E.focused){g.lastSnapshot=E;return}g.lastSnapshot=E,g.callbacks.onBlur?.(E),g.callbacks.onSelectionChange?.(E)},0)}),_.addEventListener("input",S),_.addEventListener("select",S),_.addEventListener("click",()=>queueMicrotask(S)),_.addEventListener("keyup",E=>{E.stopPropagation(),E.stopImmediatePropagation?.(),queueMicrotask(S)}),_.addEventListener("keydown",E=>{E.stopPropagation(),E.stopImmediatePropagation?.();let P=g.options.submitOnEnter!==!1,C=g.options.submitOnEnter===!1,M=typeof g.callbacks.onSubmit=="function",R=E.key==="Enter"&&g.options.multiline!==!0&&!E.shiftKey,F=R&&P&&M,U=E.key==="Enter"&&g.options.multiline===!0&&(E.ctrlKey||E.metaKey)&&P&&M;(R||U||E.key==="Enter"&&C)&&E.preventDefault(),(F||U)&&g.callbacks.onSubmit(Rr(g),E),E.key==="Escape"&&_.blur(),queueMicrotask(S)}),_.addEventListener("compositionstart",()=>{g.composing=!0;let E=Rr(g);g.lastSnapshot=E,g.callbacks.onCompositionStart?.(E),g.callbacks.onSelectionChange?.(E)}),_.addEventListener("compositionupdate",()=>{let E=Rr(g);g.lastSnapshot=E,g.callbacks.onCompositionUpdate?.(E),g.callbacks.onSelectionChange?.(E)}),_.addEventListener("compositionend",()=>{g.composing=!1,S(),g.callbacks.onCompositionEnd?.(Rr(g))})};document.addEventListener("pointerdown",l,!0),t.ticker?.add?.(c);let d=(g,b)=>{s();let _=e.get(g);if(_)return _.options=b,_.callbacks=b.callbacks??{},n(_),a(_),typeof b.value=="string"&&_.element.value!==b.value&&(_.element.value=b.value),_.lastSnapshot=Rr(_),_.element;let S={id:g,element:u({id:g,options:b}),options:b,callbacks:b.callbacks??{},composing:!1,pendingBlurTimer:null,lastSnapshot:null};return h(S),typeof b.value=="string"&&(S.element.value=b.value),n(S),r.appendChild(S.element),e.set(g,S),a(S),S.lastSnapshot=Rr(S),S.element};return{mount:d,update:(g,b)=>{let _=e.get(g);if(!_)return d(g,b);let S=b.multiline===!0!=_.element instanceof HTMLTextAreaElement;if(_.options=b,_.callbacks=b.callbacks??{},S){let E=_.element,P=document.activeElement===E,C=fl(E,"selectionStart"),M=fl(E,"selectionEnd");return _.element=u({id:g,options:b}),h(_),E.replaceWith(_.element),_.element.value=typeof b.value=="string"?b.value:E.value,n(_),a(_),_.lastSnapshot=Rr(_),P&&!b.disabled&&queueMicrotask(()=>{_.element.focus(),k0(_.element,C,M)}),_.element}return typeof b.value=="string"&&b.value!==_.element.value&&_.composing!==!0&&(_.element.value=b.value),n(_),a(_),_.lastSnapshot=Rr(_),_.element},focus:(g,{selectAll:b=!1,selectionStart:_,selectionEnd:S}={})=>{let E=e.get(g);if(!E||E.element.disabled)return;let P=document.activeElement===E.element;if(i=g,Ch(E,i),P||E.element.focus(),b){E.element.select?.(),o(E,E.lastSnapshot);return}if(typeof _=="number"||typeof S=="number"){let C=typeof _=="number"?_:fl(E.element,"selectionStart"),M=typeof S=="number"?S:typeof _=="number"?_:fl(E.element,"selectionEnd");k0(E.element,C,M)}o(E,E.lastSnapshot)},setSelection:(g,b,_=b,{focus:S=!1}={})=>{let E=e.get(g);if(!E||E.element.disabled)return;let P=()=>{k0(E.element,b,_),o(E,E.lastSnapshot)};if(S&&document.activeElement!==E.element){E.element.focus(),P();return}P()},blur:g=>{e.get(g)?.element.blur()},unmount:g=>{let b=e.get(g);b&&(i===g&&(i=null),b.pendingBlurTimer&&(clearTimeout(b.pendingBlurTimer),b.pendingBlurTimer=null),b.element.remove(),e.delete(g),e.size===0&&r?.remove())},destroy:()=>{document.removeEventListener("pointerdown",l,!0),t.ticker?.remove?.(c);for(let g of e.values())g.pendingBlurTimer&&(clearTimeout(g.pendingBlurTimer),g.pendingBlurTimer=null),g.element.remove();e.clear(),i=null,r?.remove(),r=void 0}}};var t6=()=>{let t=A=>{if(A!=="auto"&&A!=="manual")throw new Error(`Invalid animation playback mode "${A}". Expected "auto" or "manual".`)},e,r=YO(),i={elements:[],animations:[],audio:[],audioEffects:[]},s,o={animations:[],elements:[],audio:[],parsers:[]},n,a,l,c,u=!1,h,d,f,p="auto",m=null,x=[],v,y=new Map,g,b=(A,k,L,q)=>{A.clear(),A.rect(0,0,k,L),A.fill(q??0)},_=A=>A?A.startsWith("audio/")?"audio":A.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(A)?"font":A.startsWith("video/")?"video":"texture":"texture",S=A=>A?typeof A=="string"?A:A.message||String(A):"Unknown error",E=(A,k=180)=>{if(typeof A=="string")return A.length<=k?A:`${A.slice(0,k-1)}...`},P=A=>A&&typeof A.byteLength=="number"?A.byteLength:0,C=(A,k={})=>A==="texture"?k.type?.startsWith("image/")?"image":"visual asset":A||"asset",M=A=>A.match(/HTTP\s+(\d{3})/)?.[1],R=({category:A,phase:k,error:L})=>{if(L?.rootCauseMessage)return L.rootCauseMessage;let q=S(L),H=M(q);return H==="404"?"File not found.":H==="401"||H==="403"?"Access denied.":H?.startsWith("5")?"File server error.":/URL is missing/i.test(q)?"Missing file URL.":/missing or empty/i.test(q)?"Missing file data.":A==="audio"||/decode/i.test(q)?"Unsupported or damaged audio file.":A==="font"?"Unsupported or damaged font file.":A==="video"?"Unsupported, damaged, or inaccessible video file.":A==="texture"&&k==="image bitmap creation"?"Unsupported or damaged image file.":A==="texture"?"Missing, inaccessible, or unsupported image file.":"File could not be loaded."},F=({key:A,kind:k,category:L,phase:q,asset:H,error:Y})=>{let pe={assetKey:A,assetKind:k,assetCategory:L,phase:q,cause:S(Y)};return H?.type&&(pe.type=H.type),H?.source&&(pe.source=H.source),H?.url&&(pe.url=E(H.url)),H?.buffer&&(pe.bufferBytes=P(H.buffer)),pe},U=({key:A,category:k,phase:L,asset:q,error:H})=>{let Y=C(k,q),pe=R({category:k,phase:L,error:H}),Le=`Could not load ${Y} "${A}". ${pe}`,Be=new Error(Le,{cause:H});return Be.userMessage=Le,Be.rootCauseMessage=pe,Be.details=F({key:A,kind:Y,category:k,phase:L,asset:q,error:H}),Be},W=async({key:A,category:k,phase:L,asset:q},H)=>{try{return await H()}catch(Y){throw U({key:A,category:k,phase:L,asset:q,error:Y})}},N=(A,k)=>{if(P(A?.buffer)===0)throw new Error(`${k} asset data is missing or empty.`)},G=A=>A?`"${String(A).replaceAll('"','\\"')}"`:"unknown",X=A=>{let{assetKind:k,assetKey:L}=A?.details||{};return L?k?`${k} ${G(L)}`:G(L):"unknown asset"},$=A=>{let L=A.slice(0,3).map(X),q=A.length-L.length,H=q>0?`, and ${q} more`:"";return`${L.join(", ")}${H}`},D=A=>{let k=A.filter(Y=>Y.status==="rejected").map(Y=>Y.reason);if(k.length===0)return;if(k.length===1)throw k[0];let L="Check that the files exist and are supported.",q=`Could not load ${k.length} assets: ${$(k)}. ${L}`,H=new AggregateError(k,q);throw H.userMessage=q,H.rootCauseMessage=L,H.details={failures:k.map(Y=>Y?.details||{cause:S(Y)})},H},z=(A,k,{revokable:L=!1}={})=>{y.set(A,{url:k,revokable:L})},le=()=>{for(let A of y.values())A?.revokable===!0&&typeof A?.url=="string"&&URL.revokeObjectURL(A.url);y.clear()},de=(A,k)=>new Promise((L,q)=>{let H=window.HTMLMediaElement?.HAVE_CURRENT_DATA??2;if(A.readyState>=H){L();return}let Y,pe=()=>{window.clearTimeout(Y),A.removeEventListener("loadeddata",Le),A.removeEventListener("canplay",Le),A.removeEventListener("error",Be)},Le=()=>{pe(),L()},Be=()=>{pe();let ci=[A.error?.code?`code=${A.error.code}`:null,A.error?.message?`message=${A.error.message}`:null,`networkState=${A.networkState}`,`readyState=${A.readyState}`,A.currentSrc?`src=${A.currentSrc}`:null].filter(Boolean).join(", ");q(new Error(`Failed to load video asset "${k}"${ci?` (${ci})`:""}.`))};Y=window.setTimeout(()=>{pe(),q(new Error(`Timed out loading video asset "${k}".`))},5e3),A.addEventListener("loadeddata",Le,{once:!0}),A.addEventListener("canplay",Le,{once:!0}),A.addEventListener("error",Be,{once:!0})}),be=async({key:A,sourceUrl:k,mimeType:L})=>{if($t.cache.has(A))return $t.cache.get(A);let q=document.createElement("video");q.crossOrigin="anonymous",q.preload="auto",q.playsInline=!0,q.setAttribute("playsinline",""),typeof L=="string"&&L.length>0&&(q.type=L);let H=de(q,A);q.src=k,q.load(),await H;let Y=B.from(q);return $t.cache.set(A,Y),Y},Se=(A,k,L)=>{n&&n.registerHotkeys(L?.keyboard??{}),A.renderer.events.cursorStyles||(A.renderer.events.cursorStyles={}),A.renderer.events.cursorStyles.default||(A.renderer.events.cursorStyles.default="default"),A.renderer.events.cursorStyles.hover||(A.renderer.events.cursorStyles.hover="pointer");let q=k?.cursorStyles,H=L?.cursorStyles;ye(q,H)||(H?(H.default&&(A.renderer.events.cursorStyles.default=H.default,A.canvas.style.cursor=H.default),H.hover&&(A.renderer.events.cursorStyles.hover=H.hover)):q&&(A.renderer.events.cursorStyles.default="default",A.renderer.events.cursorStyles.hover="pointer"))},et=(A,k,L,q)=>{if(ye(i,L)){typeof A.render=="function"&&A.render();return}let H=HI({prevState:i,nextState:L,activeAnimations:a.getContinuableAnimations()});h&&h.abort(),h=new AbortController;let Y=h.signal;l.reset(L.id),Se(A,i.global,L.global),a.cancelAllExcept(H.continuedAnimationIds),Fo({app:A,parent:k,prevComputedTree:i.elements,nextComputedTree:L.elements,animations:L.animations,elementPlugins:o.elements,animationBus:a,completionTracker:l,eventHandler:q,signal:Y}),a.flush(),p==="manual"&&m!==null&&a.setTime(m),tv({app:A,prevAudioTree:i.audio,nextAudioTree:L.audio,prevAudioEffects:i.audioEffects,nextAudioEffects:L.audioEffects,audioPlugins:o.audio}),i=L,typeof A.render=="function"&&A.render(),l.completeIfEmpty(),u||(u=!0,c&&c())},I={rendererName:"pixi",get canvas(){return e.canvas},findElementByLabel:A=>e.stage.getChildByLabel(A,!0)??null,extractBase64:async A=>{typeof e.render=="function"&&e.render();let k=new te(0,0,e.renderer.width,e.renderer.height);if(!A)return await e.renderer.extract.base64({target:e.stage,frame:k});let L=e.stage.getChildByLabel(A,!0);if(!L)throw new Error(`Element with label '${A}' not found`);return await e.renderer.extract.base64({target:L,frame:k})},assignStageEvent:(A,k)=>{e.stage.eventMode="static",e.stage.on(A,k)},setAnimationPlaybackMode:A=>{t(A),p=A,p!=="manual"&&(m=null,a?.clearTime?.())},setAnimationTime:A=>{let k=Number(A);if(!Number.isFinite(k))throw new Error("Animation time must be a finite number.");p==="manual"&&(m=k),a.flush(),a.setTime(k),p!=="manual"&&(m=null,a.clearTime()),typeof e.render=="function"&&e.render()},init:async A=>{let{eventHandler:k,plugins:L,width:q,height:H,backgroundColor:Y,debug:pe=!1,onFirstRender:Le,animationPlaybackMode:Be="auto"}=A;c=Le,t(Be),p=Be,m=null,x.forEach(Dt=>Dt()),x=[];let ci=[];L?.elements?.forEach(Dt=>{Dt?.parse&&ci.push(jO({type:Dt.type,parse:Dt.parse}))}),o={animations:L?.animations??[],elements:L?.elements??[],audio:L?.audio??[],parsers:ci},s=k,n=hL(k),l=fL(k),e=new nu,e.audioStage=r,await e.init({width:q,height:H,backgroundColor:Y,preference:"webgl",preserveDrawingBuffer:pe===!0}),typeof e.ticker?.remove=="function"&&e.ticker.remove(e.render,e),e.debug=pe,e.inputDomBridge=TL({app:e}),v=Dt=>{Dt.preventDefault()},e.canvas.addEventListener("contextmenu",v),g=new Ze,g.label="__route_graphics_background__",b(g,q,H,Y),e.stage.addChild(g),e.stage.width=q,e.stage.height=H,e.ticker.add(e.audioStage.tick),a=dL();let Xr=()=>{p==="manual"&&typeof e.render=="function"&&e.render()};return x=[a.on("started",Xr),a.on("completed",Xr),a.on("cancelled",Xr)],pe?(d=Dt=>{p==="auto"&&Dt?.detail?.deltaMS&&(a.tick(Number(Dt.detail.deltaMS)),typeof e.render=="function"&&e.render())},window.addEventListener("snapShotKeyFrame",d)):(f=Dt=>{p==="auto"&&(a.tick(Dt.deltaMS),typeof e.render=="function"&&e.render())},e.ticker.add(f)),I},destroy:()=>{h&&(h.abort(),h=void 0),d&&(window.removeEventListener("snapShotKeyFrame",d),d=void 0),f&&typeof e?.ticker?.remove=="function"&&(e.ticker.remove(f),f=void 0),v&&e?.canvas&&(e.canvas.removeEventListener("contextmenu",v),v=void 0),e?.inputDomBridge?.destroy?.(),n?.destroy(),Wb(),x.forEach(k=>k()),x=[],a&&a.destroy(),e?.audioStage&&e.audioStage.destroy();let A=k=>{for(let L of k.children){let q=L.texture?.source?.resource;q instanceof HTMLVideoElement&&q.pause(),L.children&&A(L)}};e?.stage&&(A(e.stage),Yt({app:e,root:e.stage})),e&&e.destroy(),p="auto",m=null,g=void 0,le()},loadAssets:async A=>{if(!A)throw new Error("assetBufferMap is required");let k={audio:{},font:{},video:{},texture:{}};for(let[H,Y]of Object.entries(A)){let pe=_(Y.type);k[pe][H]=Y}let L=[];Object.entries(k.audio).forEach(([H,Y])=>{L.push({includeInReturn:!1,promise:W({key:H,category:"audio",phase:"decode",asset:Y},async()=>(N(Y,"Audio"),oa.load(H,Y.buffer)))})}),Object.entries(k.font).forEach(([H,Y])=>{L.push({includeInReturn:!1,promise:W({key:H,category:"font",phase:"font face load",asset:Y},async()=>{N(Y,"Font");let pe=new Blob([Y.buffer],{type:Y.type}),Le=URL.createObjectURL(pe),Be=new FontFace(H,`url(${Le})`);try{await Be.load(),document.fonts.add(Be)}finally{URL.revokeObjectURL(Le)}})})}),Object.entries(k.texture).forEach(([H,Y])=>L.push({includeInReturn:!0,promise:W({key:H,category:"texture",phase:Y?.source==="url"&&typeof Y?.url=="string"?"Pixi URL load":"image bitmap creation",asset:Y},async()=>{if($t.cache.has(H))return $t.cache.get(H);if(Y?.source==="url"&&typeof Y?.url=="string")return $t.load({alias:H,src:Y.url});N(Y,"Texture");let pe=new Blob([Y.buffer],{type:Y.type}),Le=await createImageBitmap(pe),Be=B.from(Le);return $t.cache.set(H,Be),Be})})),Object.entries(k.video).forEach(([H,Y])=>{L.push({includeInReturn:!0,promise:W({key:H,category:"video",phase:"video texture load",asset:Y},async()=>{if($t.cache.has(H))return $t.cache.get(H);Y?.source!=="url"&&N(Y,"Video");let pe=Y?.source==="url"&&typeof Y?.url=="string"?Y.url:URL.createObjectURL(new Blob([Y.buffer],{type:Y.type})),Le=Y?.source!=="url";z(H,pe,{revokable:Le});try{return await be({key:H,sourceUrl:pe,mimeType:Y?.type})}catch(Be){throw y.delete(H),Le&&URL.revokeObjectURL(pe),Be}})})});let q=await Promise.allSettled(L.map(H=>H.promise));return D(q),q.map((H,Y)=>L[Y].includeInReturn&&H.status==="fulfilled"?H.value:void 0).filter(Boolean)},loadAudioAssets:async A=>Promise.all(A.map(async k=>{let q=await(await fetch(k)).arrayBuffer();return oa.load(k,q)})),updatedBackgroundColor:A=>{e.renderer.background.color=A,g&&b(g,e.renderer.width,e.renderer.height,A),typeof e.render=="function"&&e.render()},render:A=>{let k=F0(A),L=T0({JSONObject:k.elements,parserPlugins:o.parsers}),q={...k,elements:L};et(e,e.stage,q,s)},parse:A=>{let k=F0(A),L=T0({JSONObject:k.elements,parserPlugins:o.parsers});return{...k,elements:L}}};return I},SL=t6;var dDe=SL;export{nu as Application,$t as Assets,oa as AudioAsset,D4 as animatedSpritePlugin,O4 as containerPlugin,M_ as createAnimationPlugin,IL as createAssetBufferManager,I_ as createAudioPlugin,dt as createElementPlugin,dDe as default,qH as inputPlugin,CW as particlesPlugin,hH as rectPlugin,tv as renderAudio,Fo as renderElements,kH as sliderPlugin,H4 as soundPlugin,xH as spritePlugin,QF as spritesheetAnimationPlugin,oH as textPlugin,G4 as textRevealingPlugin,N4 as tweenPlugin,_H as videoPlugin};
|
|
2066
2066
|
/*! Bundled license information:
|
|
2067
2067
|
|
|
2068
2068
|
punycode/punycode.js:
|